ehdou | c2b8dcd | 2017-01-11 06:01:00 +0200 | [diff] [blame] | 1 | package testing |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | "time" |
| 6 | |
| 7 | "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/availabilityzones" |
| 8 | th "github.com/gophercloud/gophercloud/testhelper" |
| 9 | "github.com/gophercloud/gophercloud/testhelper/client" |
| 10 | ) |
| 11 | |
| 12 | // Verifies that availability zones can be listed correctly |
| 13 | func TestList(t *testing.T) { |
| 14 | th.SetupHTTP() |
| 15 | defer th.TeardownHTTP() |
| 16 | |
| 17 | MockListResponse(t) |
| 18 | |
| 19 | allPages, err := availabilityzones.List(client.ServiceClient()).AllPages() |
| 20 | th.AssertNoErr(t, err) |
| 21 | actual, err := availabilityzones.ExtractAvailabilityZones(allPages) |
| 22 | th.AssertNoErr(t, err) |
| 23 | var nilTime time.Time |
| 24 | expected := []availabilityzones.AvailabilityZone{ |
| 25 | { |
| 26 | Name: "nova", |
| 27 | CreatedAt: time.Date(2015, 9, 18, 9, 50, 55, 0, time.UTC), |
| 28 | UpdatedAt: nilTime, |
| 29 | ID: "388c983d-258e-4a0e-b1ba-10da37d766db", |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | th.CheckDeepEquals(t, expected, actual) |
| 34 | } |