Refactor fixtures
diff --git a/rackspace/db/v1/databases/delegate_test.go b/rackspace/db/v1/databases/delegate_test.go
index f557a15..b9e50a5 100644
--- a/rackspace/db/v1/databases/delegate_test.go
+++ b/rackspace/db/v1/databases/delegate_test.go
@@ -9,13 +9,18 @@
fake "github.com/rackspace/gophercloud/testhelper/client"
)
-const instanceID = "{instanceID}"
+var (
+ instanceID = "{instanceID}"
+ rootURL = "/instances"
+ resURL = rootURL + "/" + instanceID
+ uRootURL = resURL + "/root"
+ aURL = resURL + "/action"
+)
func TestCreate(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
-
- os.HandleCreateDBSuccessfully(t, instanceID)
+ os.HandleCreate(t)
opts := os.BatchCreateOpts{
os.CreateOpts{Name: "testingdb", CharSet: "utf8", Collate: "utf8_general_ci"},
@@ -29,8 +34,7 @@
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
-
- os.HandleListDBsSuccessfully(t, instanceID)
+ os.HandleList(t)
expectedDBs := []os.Database{
os.Database{Name: "anotherexampledb"},
@@ -50,22 +54,17 @@
}
th.CheckDeepEquals(t, expectedDBs, actual)
-
return true, nil
})
th.AssertNoErr(t, err)
-
- if pages != 1 {
- t.Errorf("Expected 1 page, saw %d", pages)
- }
+ th.AssertEquals(t, 1, pages)
}
func TestDelete(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
-
- os.HandleDeleteDBSuccessfully(t, instanceID, "{dbName}")
+ os.HandleDelete(t)
err := os.Delete(fake.ServiceClient(), instanceID, "{dbName}").ExtractErr()
th.AssertNoErr(t, err)