Shuffle around the acceptance tests a little.
diff --git a/acceptance/openstack/identity/v3/endpoint_test.go b/acceptance/openstack/identity/v3/endpoint_test.go
new file mode 100644
index 0000000..c924ac6
--- /dev/null
+++ b/acceptance/openstack/identity/v3/endpoint_test.go
@@ -0,0 +1,20 @@
+// +build acceptance
+
+package v3
+
+import (
+ "testing"
+
+ endpoints3 "github.com/rackspace/gophercloud/openstack/identity/v3/endpoints"
+)
+
+func TestListEndpoints(t *testing.T) {
+ // Create a service client.
+ serviceClient := createAuthenticatedClient(t)
+
+ // Use the service to list all available endpoints.
+ _, err := endpoints3.List(serviceClient, endpoints3.ListOpts{})
+ if err != nil {
+ t.Errorf("Unexpected error while listing endpoints: %v", err)
+ }
+}
diff --git a/acceptance/openstack/identity/v3/identity_test.go b/acceptance/openstack/identity/v3/identity_test.go
new file mode 100644
index 0000000..eea3737
--- /dev/null
+++ b/acceptance/openstack/identity/v3/identity_test.go
@@ -0,0 +1,29 @@
+package v3
+
+import (
+ "testing"
+
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/openstack"
+ "github.com/rackspace/gophercloud/openstack/utils"
+)
+
+func createAuthenticatedClient(t *testing.T) *gophercloud.ServiceClient {
+ // Obtain credentials from the environment.
+ ao, err := utils.AuthOptions()
+ if err != nil {
+ t.Fatalf("Unable to acquire credentials: %v", err)
+ }
+
+ // Trim out unused fields.
+ ao.Username, ao.TenantID, ao.TenantName = "", "", ""
+
+ // Create an authenticated client.
+ providerClient, err := openstack.AuthenticatedClient(ao)
+ if err != nil {
+ t.Fatalf("Unable to instantiate client: %v", err)
+ }
+
+ // Create a service client.
+ return openstack.NewIdentityV3(providerClient)
+}
diff --git a/acceptance/openstack/identity/v3/service_test.go b/acceptance/openstack/identity/v3/service_test.go
index 6fe8a7a..0dd49d0 100644
--- a/acceptance/openstack/identity/v3/service_test.go
+++ b/acceptance/openstack/identity/v3/service_test.go
@@ -5,29 +5,13 @@
import (
"testing"
- "github.com/rackspace/gophercloud/openstack"
+ "github.com/rackspace/gophercloud"
services3 "github.com/rackspace/gophercloud/openstack/identity/v3/services"
- "github.com/rackspace/gophercloud/openstack/utils"
)
func TestListServices(t *testing.T) {
- // Obtain credentials from the environment.
- ao, err := utils.AuthOptions()
- if err != nil {
- t.Fatalf("Unable to acquire credentials: %v", err)
- }
-
- // Trim out unused fields.
- ao.TenantID, ao.TenantName = "", ""
-
- // Create an authenticated client.
- providerClient, err := openstack.AuthenticatedClient(ao)
- if err != nil {
- t.Fatalf("Unable to instantiate client: %v", err)
- }
-
// Create a service client.
- serviceClient := openstack.NewIdentityV3(providerClient)
+ serviceClient := createAuthenticatedClient(t)
// Use the service to create a token.
results, err := services3.List(serviceClient, services3.ListOpts{})
@@ -35,7 +19,14 @@
t.Fatalf("Unable to get token: %v", err)
}
- for _, service := range results.Services {
- t.Logf("Service: %32s %15s %10s %s", service.ID, service.Type, service.Name, *service.Description)
+ err = gophercloud.EachPage(results, func(page gophercloud.Collection) bool {
+ t.Logf("--- Page ---")
+ for _, service := range services3.AsServices(page) {
+ t.Logf("Service: %32s %15s %10s %s", service.ID, service.Type, service.Name, *service.Description)
+ }
+ return true
+ })
+ if err != nil {
+ t.Errorf("Unexpected error traversing pages: %v", err)
}
}
diff --git a/acceptance/openstack/identity/v3/token_test.go b/acceptance/openstack/identity/v3/token_test.go
index 5d409f3..eb65cea 100644
--- a/acceptance/openstack/identity/v3/token_test.go
+++ b/acceptance/openstack/identity/v3/token_test.go
@@ -18,7 +18,7 @@
}
// Trim out unused fields.
- ao.TenantID, ao.TenantName = "", ""
+ ao.Username, ao.TenantID, ao.TenantName = "", "", ""
// Create an unauthenticated client.
provider, err := openstack.NewClient(ao.IdentityEndpoint)