Compute Acceptance Test Changes (#33)

This commit makes more changes to the compute acceptance tests:

* Makes all reusable functions exportable so other APIs can use them.
* Centralizes client initialization and environment variable checks.
diff --git a/acceptance/openstack/compute/v2/tenantnetworks_test.go b/acceptance/openstack/compute/v2/tenantnetworks_test.go
index 3092077..7d9c167 100644
--- a/acceptance/openstack/compute/v2/tenantnetworks_test.go
+++ b/acceptance/openstack/compute/v2/tenantnetworks_test.go
@@ -3,15 +3,14 @@
 package v2
 
 import (
-	"fmt"
 	"testing"
 
-	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/tenantnetworks"
 )
 
 func TestTenantNetworksList(t *testing.T) {
-	client, err := newClient()
+	client, err := clients.NewComputeV2Client()
 	if err != nil {
 		t.Fatalf("Unable to create a compute client: %v", err)
 	}
@@ -27,22 +26,22 @@
 	}
 
 	for _, network := range allTenantNetworks {
-		printTenantNetwork(t, &network)
+		PrintTenantNetwork(t, &network)
 	}
 }
 
 func TestTenantNetworksGet(t *testing.T) {
-	choices, err := ComputeChoicesFromEnv()
+	choices, err := clients.AcceptanceTestChoicesFromEnv()
 	if err != nil {
 		t.Fatal(err)
 	}
 
-	client, err := newClient()
+	client, err := clients.NewComputeV2Client()
 	if err != nil {
 		t.Fatalf("Unable to create a compute client: %v", err)
 	}
 
-	networkID, err := getNetworkIDFromTenantNetworks(t, client, choices.NetworkName)
+	networkID, err := GetNetworkIDFromTenantNetworks(t, client, choices.NetworkName)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -52,31 +51,5 @@
 		t.Fatalf("Unable to get network %s: %v", networkID, err)
 	}
 
-	printTenantNetwork(t, network)
-}
-
-func getNetworkIDFromTenantNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error) {
-	allPages, err := tenantnetworks.List(client).AllPages()
-	if err != nil {
-		t.Fatalf("Unable to list networks: %v", err)
-	}
-
-	allTenantNetworks, err := tenantnetworks.ExtractNetworks(allPages)
-	if err != nil {
-		t.Fatalf("Unable to list networks: %v", err)
-	}
-
-	for _, network := range allTenantNetworks {
-		if network.Name == networkName {
-			return network.ID, nil
-		}
-	}
-
-	return "", fmt.Errorf("Failed to obtain network ID for network %s", networkName)
-}
-
-func printTenantNetwork(t *testing.T, network *tenantnetworks.Network) {
-	t.Logf("ID: %s", network.ID)
-	t.Logf("Name: %s", network.Name)
-	t.Logf("CIDR: %s", network.CIDR)
+	PrintTenantNetwork(t, network)
 }