// GetProfileTemplateByName get a template profile func TestGetProfileTemplateByName(t *testing.T) { var ( d *OVTest c *ov.OVClient testname string ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { d, c = getTestDriverA("test_server_profile_template") // determine if we should execute testname = d.Tc.GetTestData(d.Env, "Name").(string) if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } data, err := c.GetProfileTemplateByName(testname) assert.NoError(t, err, "GetProfileTemplateByName threw error -> %s", err) assert.Equal(t, testname, data.Name) data, err = c.GetProfileTemplateByName("foo") assert.NoError(t, err, "GetProfileTemplateByName with fake name -> %+v", err) assert.Equal(t, "", data.Name) } else { d, c = getTestDriverU("test_server_profile_template") // determine if we should execute if c.ProfileTemplatesNotSupported() { return } testname = d.Tc.GetTestData(d.Env, "Name").(string) data, err := c.GetProfileTemplateByName(testname) assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data)) } }