Acceptance Test Updates (#218)

* compute: don't pass choices

* blockstorage: don't pass choices

* DumpResource Function

This function prints a resource in JSON format but retains the actual
field name rather than using the name specified in the JSON tag.

* New DumpResource

This version just converts the resource into JSON. The original is
being left in git history for posterity.

* Renaming DumpResource to PrintResource

* Removing all print functions in favor of PrintResource

* Rebase reconcilliation
diff --git a/acceptance/openstack/identity/v2/extension_test.go b/acceptance/openstack/identity/v2/extension_test.go
index 3e526f1..c6a2bde 100644
--- a/acceptance/openstack/identity/v2/extension_test.go
+++ b/acceptance/openstack/identity/v2/extension_test.go
@@ -6,7 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
-	"github.com/gophercloud/gophercloud/acceptance/openstack"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/extensions"
 )
 
@@ -27,7 +27,7 @@
 	}
 
 	for _, extension := range allExtensions {
-		openstack.PrintExtension(t, &extension)
+		tools.PrintResource(t, extension)
 	}
 }
 
@@ -42,5 +42,5 @@
 		t.Fatalf("Unable to get extension OS-KSCRUD: %v", err)
 	}
 
-	openstack.PrintExtension(t, extension)
+	tools.PrintResource(t, extension)
 }
diff --git a/acceptance/openstack/identity/v2/identity.go b/acceptance/openstack/identity/v2/identity.go
index f1c6624..2d3bd09 100644
--- a/acceptance/openstack/identity/v2/identity.go
+++ b/acceptance/openstack/identity/v2/identity.go
@@ -9,7 +9,6 @@
 	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/extensions/admin/roles"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/tenants"
-	"github.com/gophercloud/gophercloud/openstack/identity/v2/tokens"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/users"
 )
 
@@ -145,72 +144,3 @@
 
 	return newUser, nil
 }
-
-// PrintCatalogEntry will print a catalog entry and all of its attributes.
-func PrintCatalogEntry(t *testing.T, catalogEntry *tokens.CatalogEntry) {
-	t.Logf("Name: %s", catalogEntry.Name)
-	t.Logf("Type: %s", catalogEntry.Type)
-
-	t.Log("Endpoints:")
-	for _, endpoint := range catalogEntry.Endpoints {
-		t.Logf("\tTenantID: %s", endpoint.TenantID)
-		t.Logf("\tPublicURL: %s", endpoint.PublicURL)
-		t.Logf("\tInternalURL: %s", endpoint.InternalURL)
-		t.Logf("\tAdminURL: %s", endpoint.AdminURL)
-		t.Logf("\tRegion: %s", endpoint.Region)
-		t.Logf("\tVersionID: %s", endpoint.VersionID)
-		t.Logf("\tVersionInfo: %s", endpoint.VersionInfo)
-		t.Logf("\tVersionList: %s", endpoint.VersionList)
-	}
-}
-
-// PrintRole will print a role and all of its attributes.
-func PrintRole(t *testing.T, role *roles.Role) {
-	t.Logf("ID: %s", role.ID)
-	t.Logf("Name: %v", role.Name)
-	t.Logf("Description: %s", role.Description)
-	t.Logf("ServiceID: %s", role.ServiceID)
-}
-
-// PrintTenant will print a tenant and all of its attributes.
-func PrintTenant(t *testing.T, tenant *tenants.Tenant) {
-	t.Logf("ID: %s", tenant.ID)
-	t.Logf("Name: %s", tenant.Name)
-	t.Logf("Description: %s", tenant.Description)
-	t.Logf("Enabled: %t", tenant.Enabled)
-}
-
-// PrintToken will print a token and all of its attributes.
-func PrintToken(t *testing.T, token *tokens.Token) {
-	t.Logf("ID: %s", token.ID)
-	t.Logf("ExpiresAt: %v", token.ExpiresAt)
-	t.Logf("TenantID: %s", token.Tenant.ID)
-}
-
-// PrintTokenUser will print the user information of a token and all attributes.
-func PrintTokenUser(t *testing.T, user *tokens.User) {
-	t.Logf("ID: %s", user.ID)
-	t.Logf("Name: %s", user.Name)
-	t.Logf("Username: %s", user.UserName)
-
-	t.Log("Roles")
-	for _, role := range user.Roles {
-		t.Logf("\t%s", role)
-	}
-}
-
-// PrintUser will print a user and all of its attributes.
-func PrintUser(t *testing.T, user *users.User) {
-	t.Logf("ID: %s", user.ID)
-	t.Logf("Name: %s", user.Name)
-	t.Logf("Username: %s", user.Username)
-	t.Logf("Enabled: %t", user.Enabled)
-	t.Logf("Email: %s", user.Email)
-	t.Logf("TenantID: %s", user.TenantID)
-}
-
-// PrintUserRole will print the roles that a user has been granted.
-func PrintUserRole(t *testing.T, role *users.Role) {
-	t.Logf("ID: %s", role.ID)
-	t.Logf("Name: %s", role.Name)
-}
diff --git a/acceptance/openstack/identity/v2/role_test.go b/acceptance/openstack/identity/v2/role_test.go
index 5589b1b..83fbd31 100644
--- a/acceptance/openstack/identity/v2/role_test.go
+++ b/acceptance/openstack/identity/v2/role_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/extensions/admin/roles"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/users"
 )
@@ -50,7 +51,7 @@
 
 	t.Logf("Roles of user %s:", user.Name)
 	for _, role := range allRoles {
-		PrintUserRole(t, &role)
+		tools.PrintResource(t, role)
 	}
 }
 
@@ -71,6 +72,6 @@
 	}
 
 	for _, r := range allRoles {
-		PrintRole(t, &r)
+		tools.PrintResource(t, r)
 	}
 }
diff --git a/acceptance/openstack/identity/v2/tenant_test.go b/acceptance/openstack/identity/v2/tenant_test.go
index ed457d4..2053614 100644
--- a/acceptance/openstack/identity/v2/tenant_test.go
+++ b/acceptance/openstack/identity/v2/tenant_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/tenants"
 )
 
@@ -26,6 +27,6 @@
 	}
 
 	for _, tenant := range allTenants {
-		PrintTenant(t, &tenant)
+		tools.PrintResource(t, tenant)
 	}
 }
diff --git a/acceptance/openstack/identity/v2/token_test.go b/acceptance/openstack/identity/v2/token_test.go
index 4cd8301..82a317a 100644
--- a/acceptance/openstack/identity/v2/token_test.go
+++ b/acceptance/openstack/identity/v2/token_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/tokens"
 )
@@ -27,7 +28,7 @@
 		t.Fatalf("Unable to extract token: %v", err)
 	}
 
-	PrintToken(t, token)
+	tools.PrintResource(t, token)
 
 	catalog, err := result.ExtractServiceCatalog()
 	if err != nil {
@@ -35,7 +36,7 @@
 	}
 
 	for _, entry := range catalog.Entries {
-		PrintCatalogEntry(t, &entry)
+		tools.PrintResource(t, entry)
 	}
 }
 
@@ -56,7 +57,7 @@
 		t.Fatalf("Unable to extract token: %v", err)
 	}
 
-	PrintToken(t, token)
+	tools.PrintResource(t, token)
 
 	getResult := tokens.Get(client, token.ID)
 	user, err := getResult.ExtractUser()
@@ -64,5 +65,5 @@
 		t.Fatalf("Unable to extract user: %v", err)
 	}
 
-	PrintTokenUser(t, user)
+	tools.PrintResource(t, user)
 }
diff --git a/acceptance/openstack/identity/v2/user_test.go b/acceptance/openstack/identity/v2/user_test.go
index 5c6bfd9..faa5bba 100644
--- a/acceptance/openstack/identity/v2/user_test.go
+++ b/acceptance/openstack/identity/v2/user_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v2/users"
 )
 
@@ -26,7 +27,7 @@
 	}
 
 	for _, user := range allUsers {
-		PrintUser(t, &user)
+		tools.PrintResource(t, user)
 	}
 }
 
@@ -47,12 +48,12 @@
 	}
 	defer DeleteUser(t, client, user)
 
-	PrintUser(t, user)
+	tools.PrintResource(t, user)
 
 	newUser, err := UpdateUser(t, client, user)
 	if err != nil {
 		t.Fatalf("Unable to update user: %v", err)
 	}
 
-	PrintUser(t, newUser)
+	tools.PrintResource(t, newUser)
 }
diff --git a/acceptance/openstack/identity/v3/endpoint_test.go b/acceptance/openstack/identity/v3/endpoint_test.go
index 6a52f26..a589970 100644
--- a/acceptance/openstack/identity/v3/endpoint_test.go
+++ b/acceptance/openstack/identity/v3/endpoint_test.go
@@ -7,6 +7,7 @@
 
 	"github.com/gophercloud/gophercloud"
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/endpoints"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/services"
 )
@@ -28,7 +29,7 @@
 	}
 
 	for _, endpoint := range allEndpoints {
-		PrintEndpoint(t, &endpoint)
+		tools.PrintResource(t, endpoint)
 	}
 }
 
@@ -58,7 +59,7 @@
 	}
 
 	computeService := allServices[0]
-	PrintService(t, &computeService)
+	tools.PrintResource(t, computeService)
 
 	// Enumerate the endpoints available for this service.
 	endpointListOpts := endpoints.ListOpts{
@@ -80,6 +81,6 @@
 		t.Fatalf("Expected one endpoint, got %d", len(allEndpoints))
 	}
 
-	PrintEndpoint(t, &allEndpoints[0])
+	tools.PrintResource(t, allEndpoints[0])
 
 }
diff --git a/acceptance/openstack/identity/v3/identity.go b/acceptance/openstack/identity/v3/identity.go
index f7ea48f..3276efc 100644
--- a/acceptance/openstack/identity/v3/identity.go
+++ b/acceptance/openstack/identity/v3/identity.go
@@ -5,10 +5,7 @@
 
 	"github.com/gophercloud/gophercloud"
 	"github.com/gophercloud/gophercloud/acceptance/tools"
-	"github.com/gophercloud/gophercloud/openstack/identity/v3/endpoints"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/projects"
-	"github.com/gophercloud/gophercloud/openstack/identity/v3/services"
-	"github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
 )
 
 // CreateProject will create a project with a random name.
@@ -49,38 +46,3 @@
 
 	t.Logf("Deleted project: %s", projectID)
 }
-
-// PrintEndpoint will print an endpoint and all of its attributes.
-func PrintEndpoint(t *testing.T, endpoint *endpoints.Endpoint) {
-	t.Logf("ID: %s", endpoint.ID)
-	t.Logf("Availability: %s", endpoint.Availability)
-	t.Logf("Name: %s", endpoint.Name)
-	t.Logf("Region: %s", endpoint.Region)
-	t.Logf("ServiceID: %s", endpoint.ServiceID)
-	t.Logf("URL: %s", endpoint.URL)
-}
-
-// PrintProject will print a project and all of its attributes.
-func PrintProject(t *testing.T, project *projects.Project) {
-	t.Logf("ID: %s", project.ID)
-	t.Logf("IsDomain: %t", project.IsDomain)
-	t.Logf("Description: %s", project.Description)
-	t.Logf("DomainID: %s", project.DomainID)
-	t.Logf("Enabled: %t", project.Enabled)
-	t.Logf("Name: %s", project.Name)
-	t.Logf("ParentID: %s", project.ParentID)
-}
-
-// PrintService will print a service and all of its attributes.
-func PrintService(t *testing.T, service *services.Service) {
-	t.Logf("ID: %s", service.ID)
-	t.Logf("Description: %s", service.Description)
-	t.Logf("Name: %s", service.Name)
-	t.Logf("Type: %s", service.Type)
-}
-
-// PrintToken will print a token and all of its attributes.
-func PrintToken(t *testing.T, token *tokens.Token) {
-	t.Logf("ID: %s", token.ID)
-	t.Logf("ExpiresAt: %v", token.ExpiresAt)
-}
diff --git a/acceptance/openstack/identity/v3/projects_test.go b/acceptance/openstack/identity/v3/projects_test.go
index ebb5543..8325bee 100644
--- a/acceptance/openstack/identity/v3/projects_test.go
+++ b/acceptance/openstack/identity/v3/projects_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/projects"
 )
 
@@ -31,7 +32,7 @@
 	}
 
 	for _, project := range allProjects {
-		PrintProject(t, &project)
+		tools.PrintResource(t, project)
 	}
 }
 
@@ -57,7 +58,7 @@
 		t.Fatalf("Unable to get project: %v", err)
 	}
 
-	PrintProject(t, p)
+	tools.PrintResource(t, p)
 }
 
 func TestProjectsCRUD(t *testing.T) {
@@ -72,7 +73,7 @@
 	}
 	defer DeleteProject(t, client, project.ID)
 
-	PrintProject(t, project)
+	tools.PrintResource(t, project)
 
 	var iFalse bool = false
 	updateOpts := projects.UpdateOpts{
@@ -84,7 +85,7 @@
 		t.Fatalf("Unable to update project: %v", err)
 	}
 
-	PrintProject(t, updatedProject)
+	tools.PrintResource(t, updatedProject)
 }
 
 func TestProjectsDomain(t *testing.T) {
@@ -104,7 +105,7 @@
 	}
 	defer DeleteProject(t, client, projectDomain.ID)
 
-	PrintProject(t, projectDomain)
+	tools.PrintResource(t, projectDomain)
 
 	createOpts = projects.CreateOpts{
 		DomainID: projectDomain.ID,
@@ -116,7 +117,7 @@
 	}
 	defer DeleteProject(t, client, project.ID)
 
-	PrintProject(t, project)
+	tools.PrintResource(t, project)
 
 	var iFalse = false
 	updateOpts := projects.UpdateOpts{
@@ -141,7 +142,7 @@
 	}
 	defer DeleteProject(t, client, projectMain.ID)
 
-	PrintProject(t, projectMain)
+	tools.PrintResource(t, projectMain)
 
 	createOpts := projects.CreateOpts{
 		ParentID: projectMain.ID,
@@ -153,5 +154,5 @@
 	}
 	defer DeleteProject(t, client, project.ID)
 
-	PrintProject(t, project)
+	tools.PrintResource(t, project)
 }
diff --git a/acceptance/openstack/identity/v3/service_test.go b/acceptance/openstack/identity/v3/service_test.go
index 364f69b..7a0c71f 100644
--- a/acceptance/openstack/identity/v3/service_test.go
+++ b/acceptance/openstack/identity/v3/service_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/services"
 )
 
@@ -26,7 +27,7 @@
 	}
 
 	for _, service := range allServices {
-		PrintService(t, &service)
+		tools.PrintResource(t, service)
 	}
 
 }
diff --git a/acceptance/openstack/identity/v3/token_test.go b/acceptance/openstack/identity/v3/token_test.go
index 13b38f8..e0f90d9 100644
--- a/acceptance/openstack/identity/v3/token_test.go
+++ b/acceptance/openstack/identity/v3/token_test.go
@@ -6,6 +6,7 @@
 	"testing"
 
 	"github.com/gophercloud/gophercloud/acceptance/clients"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
 	"github.com/gophercloud/gophercloud/openstack"
 	"github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
 )
@@ -32,5 +33,5 @@
 		t.Fatalf("Unable to get token: %v", err)
 	}
 
-	PrintToken(t, token)
+	tools.PrintResource(t, token)
 }