blob: eccbfe23eb6e67f439e4b7c018c1025a7298d92e [file] [log] [blame]
package tenants
import (
"testing"
os "github.com/rackspace/gophercloud/openstack/identity/v2/tenants"
"github.com/rackspace/gophercloud/pagination"
th "github.com/rackspace/gophercloud/testhelper"
fake "github.com/rackspace/gophercloud/testhelper/client"
)
func TestListTenants(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
os.HandleListTenantsSuccessfully(t)
count := 0
err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
actual, err := ExtractTenants(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, os.ExpectedTenantSlice, actual)
count++
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, 1, count)
}