blob: 31730f9ce7f730fbaaf5fcce2d4ed26e31149d74 [file] [log] [blame]
package testing
import (
"testing"
"github.com/gophercloud/gophercloud/openstack/identity/v3/projects"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
)
func TestListProjects(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleListProjectsSuccessfully(t)
count := 0
err := projects.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := projects.ExtractProjects(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedProjectSlice, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
}