blob: a11d2ada455914fc771c13a45b34ebaffbd7eb06 [file] [log] [blame]
Ash Wilsonad612f62014-10-22 14:04:37 -04001package keypairs
2
3import (
4 "testing"
5
6 "github.com/rackspace/gophercloud/pagination"
7 th "github.com/rackspace/gophercloud/testhelper"
8 "github.com/rackspace/gophercloud/testhelper/client"
9)
10
11func TestList(t *testing.T) {
12 th.SetupHTTP()
13 defer th.TeardownHTTP()
14 HandleListSuccessfully(t)
15
16 count := 0
17 err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
18 count++
19 actual, err := ExtractKeyPairs(page)
20 th.AssertNoErr(t, err)
21 th.CheckDeepEquals(t, ExpectedKeyPairSlice, actual)
22
23 return true, nil
24 })
25 th.AssertNoErr(t, err)
26 th.CheckEquals(t, 1, count)
27}