github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/evs/extensions/services/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack/evs/extensions/services" 7 8 "github.com/opentelekomcloud/gophertelekomcloud/testhelper" 9 "github.com/opentelekomcloud/gophertelekomcloud/testhelper/client" 10 ) 11 12 func TestListServices(t *testing.T) { 13 testhelper.SetupHTTP() 14 defer testhelper.TeardownHTTP() 15 HandleListSuccessfully(t) 16 17 actual, err := services.List(client.ServiceClient(), services.ListOpts{}) 18 testhelper.AssertNoErr(t, err) 19 20 if len(actual) != 3 { 21 t.Fatalf("Expected 3 services, got %d", len(actual)) 22 } 23 testhelper.CheckDeepEquals(t, FirstFakeService, actual[0]) 24 testhelper.CheckDeepEquals(t, SecondFakeService, actual[1]) 25 testhelper.CheckDeepEquals(t, ThirdFakeService, actual[2]) 26 }