Joe Topjian | f61691c | 2016-11-05 12:34:59 -0600 | [diff] [blame^] | 1 | // +build acceptance |
| 2 | |
| 3 | package v3 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/gophercloud/gophercloud/acceptance/clients" |
| 9 | "github.com/gophercloud/gophercloud/openstack/identity/v3/projects" |
| 10 | ) |
| 11 | |
| 12 | func TestProjectsList(t *testing.T) { |
| 13 | client, err := clients.NewIdentityV3Client() |
| 14 | if err != nil { |
| 15 | t.Fatalf("Unable to obtain an identity client: %v") |
| 16 | } |
| 17 | |
| 18 | var iTrue bool = true |
| 19 | listOpts := projects.ListOpts{ |
| 20 | Enabled: &iTrue, |
| 21 | } |
| 22 | |
| 23 | allPages, err := projects.List(client, listOpts).AllPages() |
| 24 | if err != nil { |
| 25 | t.Fatalf("Unable to list projects: %v", err) |
| 26 | } |
| 27 | |
| 28 | allProjects, err := projects.ExtractProjects(allPages) |
| 29 | if err != nil { |
| 30 | t.Fatalf("Unable to extract projects: %v", err) |
| 31 | } |
| 32 | |
| 33 | for _, project := range allProjects { |
| 34 | PrintProject(t, &project) |
| 35 | } |
| 36 | } |