blob: 7a0c71f4fa8b5deaaccecf8e1b55391319053a1c [file] [log] [blame]
Ash Wilsonfd794d52014-09-03 14:30:43 -04001// +build acceptance
2
3package v3
4
5import (
6 "testing"
7
Joe Topjian918f5732016-08-15 08:47:08 -06008 "github.com/gophercloud/gophercloud/acceptance/clients"
Joe Topjian66a046c2017-01-19 22:07:26 -07009 "github.com/gophercloud/gophercloud/acceptance/tools"
Joe Topjian918f5732016-08-15 08:47:08 -060010 "github.com/gophercloud/gophercloud/openstack/identity/v3/services"
Ash Wilsonfd794d52014-09-03 14:30:43 -040011)
12
Joe Topjian918f5732016-08-15 08:47:08 -060013func TestServicesList(t *testing.T) {
14 client, err := clients.NewIdentityV3Client()
Ash Wilsondd7188d2014-09-05 14:02:42 -040015 if err != nil {
Joe Topjian918f5732016-08-15 08:47:08 -060016 t.Fatalf("Unable to obtain an identity client: %v")
Ash Wilsonfd794d52014-09-03 14:30:43 -040017 }
Joe Topjian918f5732016-08-15 08:47:08 -060018
19 allPages, err := services.List(client, nil).AllPages()
20 if err != nil {
21 t.Fatalf("Unable to list services: %v", err)
22 }
23
24 allServices, err := services.ExtractServices(allPages)
25 if err != nil {
26 t.Fatalf("Unable to extract services: %v", err)
27 }
28
29 for _, service := range allServices {
Joe Topjian66a046c2017-01-19 22:07:26 -070030 tools.PrintResource(t, service)
Joe Topjian918f5732016-08-15 08:47:08 -060031 }
32
Ash Wilsonfd794d52014-09-03 14:30:43 -040033}