func TestGetSwitchTypeByName(t *testing.T) { var ( d *OVTest c *ov.OVClient testName string ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { d, c = getTestDriverA("test_switch_type") if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } testName = d.Tc.GetTestData(d.Env, "Name").(string) testSwitchType, err := c.GetSwitchTypeByName(testName) assert.NoError(t, err, "GetSwitchTypeByName thew an error -> %s", err) assert.Equal(t, testName, testSwitchType.Name) testSwitchType, err = c.GetSwitchTypeByName("bad") assert.NoError(t, err, "GetSwitchTypeByName with fake name -> %s", err) assert.Equal(t, "", testSwitchType.Name) } else { d, c = getTestDriverU("test_switch_type") testName = d.Tc.GetTestData(d.Env, "Name").(string) data, err := c.GetSwitchTypeByName(testName) assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data)) } }