blob: 31730f9ce7f730fbaaf5fcce2d4ed26e31149d74 [file] [log] [blame]
Joe Topjianf61691c2016-11-05 12:34:59 -06001package testing
2
3import (
4 "testing"
5
6 "github.com/gophercloud/gophercloud/openstack/identity/v3/projects"
7 "github.com/gophercloud/gophercloud/pagination"
8 th "github.com/gophercloud/gophercloud/testhelper"
9 "github.com/gophercloud/gophercloud/testhelper/client"
10)
11
12func TestListProjects(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15 HandleListProjectsSuccessfully(t)
16
17 count := 0
18 err := projects.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
19 count++
20
21 actual, err := projects.ExtractProjects(page)
22 th.AssertNoErr(t, err)
23
24 th.CheckDeepEquals(t, ExpectedProjectSlice, actual)
25
26 return true, nil
27 })
28 th.AssertNoErr(t, err)
29 th.CheckEquals(t, count, 1)
30}