Ash Wilson | fd794d5 | 2014-09-03 14:30:43 -0400 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v3 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
Joe Topjian | 918f573 | 2016-08-15 08:47:08 -0600 | [diff] [blame^] | 8 | "github.com/gophercloud/gophercloud/acceptance/clients" |
| 9 | "github.com/gophercloud/gophercloud/openstack/identity/v3/services" |
Ash Wilson | fd794d5 | 2014-09-03 14:30:43 -0400 | [diff] [blame] | 10 | ) |
| 11 | |
Joe Topjian | 918f573 | 2016-08-15 08:47:08 -0600 | [diff] [blame^] | 12 | func TestServicesList(t *testing.T) { |
| 13 | client, err := clients.NewIdentityV3Client() |
Ash Wilson | dd7188d | 2014-09-05 14:02:42 -0400 | [diff] [blame] | 14 | if err != nil { |
Joe Topjian | 918f573 | 2016-08-15 08:47:08 -0600 | [diff] [blame^] | 15 | t.Fatalf("Unable to obtain an identity client: %v") |
Ash Wilson | fd794d5 | 2014-09-03 14:30:43 -0400 | [diff] [blame] | 16 | } |
Joe Topjian | 918f573 | 2016-08-15 08:47:08 -0600 | [diff] [blame^] | 17 | |
| 18 | allPages, err := services.List(client, nil).AllPages() |
| 19 | if err != nil { |
| 20 | t.Fatalf("Unable to list services: %v", err) |
| 21 | } |
| 22 | |
| 23 | allServices, err := services.ExtractServices(allPages) |
| 24 | if err != nil { |
| 25 | t.Fatalf("Unable to extract services: %v", err) |
| 26 | } |
| 27 | |
| 28 | for _, service := range allServices { |
| 29 | PrintService(t, &service) |
| 30 | } |
| 31 | |
Ash Wilson | fd794d5 | 2014-09-03 14:30:43 -0400 | [diff] [blame] | 32 | } |