blob: eccbfe23eb6e67f439e4b7c018c1025a7298d92e [file] [log] [blame]
Ash Wilson94af38d2014-10-10 14:07:02 -04001package tenants
2
3import (
4 "testing"
5
6 os "github.com/rackspace/gophercloud/openstack/identity/v2/tenants"
7 "github.com/rackspace/gophercloud/pagination"
8 th "github.com/rackspace/gophercloud/testhelper"
9 fake "github.com/rackspace/gophercloud/testhelper/client"
10)
11
12func TestListTenants(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15 os.HandleListTenantsSuccessfully(t)
16
17 count := 0
18 err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
19 actual, err := ExtractTenants(page)
20 th.AssertNoErr(t, err)
21 th.CheckDeepEquals(t, os.ExpectedTenantSlice, actual)
22
23 count++
24 return true, nil
25 })
26 th.AssertNoErr(t, err)
27 th.CheckEquals(t, 1, count)
28}