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