Identity Acceptance Test Cleanup (#49)
diff --git a/acceptance/openstack/identity/v3/service_test.go b/acceptance/openstack/identity/v3/service_test.go
index b39ba7f..364f69b 100644
--- a/acceptance/openstack/identity/v3/service_test.go
+++ b/acceptance/openstack/identity/v3/service_test.go
@@ -5,32 +5,28 @@
import (
"testing"
- services3 "github.com/gophercloud/gophercloud/openstack/identity/v3/services"
- "github.com/gophercloud/gophercloud/pagination"
+ "github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/openstack/identity/v3/services"
)
-func TestListServices(t *testing.T) {
- // Create a service client.
- serviceClient := createAuthenticatedClient(t)
- if serviceClient == nil {
- return
- }
-
- // Use the client to list all available services.
- pager := services3.List(serviceClient, services3.ListOpts{})
- err := pager.EachPage(func(page pagination.Page) (bool, error) {
- parts, err := services3.ExtractServices(page)
- if err != nil {
- return false, err
- }
-
- t.Logf("--- Page ---")
- for _, service := range parts {
- t.Logf("Service: %32s %15s %10s %s", service.ID, service.Type, service.Name, *service.Description)
- }
- return true, nil
- })
+func TestServicesList(t *testing.T) {
+ client, err := clients.NewIdentityV3Client()
if err != nil {
- t.Errorf("Unexpected error traversing pages: %v", err)
+ t.Fatalf("Unable to obtain an identity client: %v")
}
+
+ allPages, err := services.List(client, nil).AllPages()
+ if err != nil {
+ t.Fatalf("Unable to list services: %v", err)
+ }
+
+ allServices, err := services.ExtractServices(allPages)
+ if err != nil {
+ t.Fatalf("Unable to extract services: %v", err)
+ }
+
+ for _, service := range allServices {
+ PrintService(t, &service)
+ }
+
}