Refactor OS fixtures
diff --git a/openstack/db/v1/flavors/fixtures.go b/openstack/db/v1/flavors/fixtures.go
index 42e2dca..f0016bc 100644
--- a/openstack/db/v1/flavors/fixtures.go
+++ b/openstack/db/v1/flavors/fixtures.go
@@ -1,6 +1,11 @@
package flavors
-import "fmt"
+import (
+ "fmt"
+ "testing"
+
+ "github.com/rackspace/gophercloud/testhelper/fixture"
+)
const flavor = `
{
@@ -21,6 +26,12 @@
`
var (
+ flavorID = "{flavorID}"
+ _baseURL = "/flavors"
+ resURL = "/flavors/" + flavorID
+)
+
+var (
flavor1 = fmt.Sprintf(flavor, 1, 1, 1, "m1.tiny", 512)
flavor2 = fmt.Sprintf(flavor, 2, 2, 2, "m1.small", 1024)
flavor3 = fmt.Sprintf(flavor, 3, 3, 3, "m1.medium", 2048)
@@ -29,3 +40,11 @@
listFlavorsResp = fmt.Sprintf(`{"flavors":[%s, %s, %s, %s]}`, flavor1, flavor2, flavor3, flavor4)
getFlavorResp = fmt.Sprintf(`{"flavor": %s}`, flavor1)
)
+
+func HandleList(t *testing.T) {
+ fixture.SetupHandler(t, _baseURL, "GET", "", listFlavorsResp, 200)
+}
+
+func HandleGet(t *testing.T) {
+ fixture.SetupHandler(t, resURL, "GET", "", getFlavorResp, 200)
+}