github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/evs/v1/apiversions/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack/evs/v1/apiversions" 7 th "github.com/opentelekomcloud/gophertelekomcloud/testhelper" 8 "github.com/opentelekomcloud/gophertelekomcloud/testhelper/client" 9 ) 10 11 func TestListVersions(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 15 MockListResponse(t) 16 17 actual, err := apiversions.List(client.ServiceClient()) 18 th.AssertNoErr(t, err) 19 20 expected := []apiversions.APIVersion{ 21 { 22 ID: "v1.0", 23 Status: "CURRENT", 24 Updated: "2012-01-04T11:33:21Z", 25 }, 26 { 27 ID: "v2.0", 28 Status: "CURRENT", 29 Updated: "2012-11-21T11:33:21Z", 30 }, 31 } 32 33 th.AssertDeepEquals(t, expected, actual) 34 } 35 36 func TestAPIInfo(t *testing.T) { 37 th.SetupHTTP() 38 defer th.TeardownHTTP() 39 40 MockGetResponse(t) 41 42 actual, err := apiversions.Get(client.ServiceClient(), "v1") 43 th.AssertNoErr(t, err) 44 45 expected := apiversions.APIVersion{ 46 ID: "v1.0", 47 Status: "CURRENT", 48 Updated: "2012-01-04T11:33:21Z", 49 } 50 51 th.AssertEquals(t, actual.ID, expected.ID) 52 th.AssertEquals(t, actual.Status, expected.Status) 53 th.AssertEquals(t, actual.Updated, expected.Updated) 54 }