move unit tests into 'testing' directories
diff --git a/openstack/compute/v2/extensions/servergroups/testing/doc.go b/openstack/compute/v2/extensions/servergroups/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/compute/v2/extensions/servergroups/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/compute/v2/extensions/servergroups/fixtures.go b/openstack/compute/v2/extensions/servergroups/testing/fixtures.go
similarity index 91%
rename from openstack/compute/v2/extensions/servergroups/fixtures.go
rename to openstack/compute/v2/extensions/servergroups/testing/fixtures.go
index 003e9aa..b53757a 100644
--- a/openstack/compute/v2/extensions/servergroups/fixtures.go
+++ b/openstack/compute/v2/extensions/servergroups/testing/fixtures.go
@@ -1,12 +1,11 @@
-// +build fixtures
-
-package servergroups
+package testing
import (
"fmt"
"net/http"
"testing"
+ "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/servergroups"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
)
@@ -68,7 +67,7 @@
`
// FirstServerGroup is the first result in ListOutput.
-var FirstServerGroup = ServerGroup{
+var FirstServerGroup = servergroups.ServerGroup{
ID: "616fb98f-46ca-475e-917e-2563e5a8cd19",
Name: "test",
Policies: []string{
@@ -79,7 +78,7 @@
}
// SecondServerGroup is the second result in ListOutput.
-var SecondServerGroup = ServerGroup{
+var SecondServerGroup = servergroups.ServerGroup{
ID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0",
Name: "test2",
Policies: []string{
@@ -91,10 +90,10 @@
// ExpectedServerGroupSlice is the slice of results that should be parsed
// from ListOutput, in the expected order.
-var ExpectedServerGroupSlice = []ServerGroup{FirstServerGroup, SecondServerGroup}
+var ExpectedServerGroupSlice = []servergroups.ServerGroup{FirstServerGroup, SecondServerGroup}
// CreatedServerGroup is the parsed result from CreateOutput.
-var CreatedServerGroup = ServerGroup{
+var CreatedServerGroup = servergroups.ServerGroup{
ID: "616fb98f-46ca-475e-917e-2563e5a8cd19",
Name: "test",
Policies: []string{
diff --git a/openstack/compute/v2/extensions/servergroups/requests_test.go b/openstack/compute/v2/extensions/servergroups/testing/requests_test.go
similarity index 64%
rename from openstack/compute/v2/extensions/servergroups/requests_test.go
rename to openstack/compute/v2/extensions/servergroups/testing/requests_test.go
index 458526a..d86fa56 100644
--- a/openstack/compute/v2/extensions/servergroups/requests_test.go
+++ b/openstack/compute/v2/extensions/servergroups/testing/requests_test.go
@@ -1,8 +1,9 @@
-package servergroups
+package testing
import (
"testing"
+ "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/servergroups"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -14,9 +15,9 @@
HandleListSuccessfully(t)
count := 0
- err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := servergroups.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractServerGroups(page)
+ actual, err := servergroups.ExtractServerGroups(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedServerGroupSlice, actual)
@@ -31,7 +32,7 @@
defer th.TeardownHTTP()
HandleCreateSuccessfully(t)
- actual, err := Create(client.ServiceClient(), CreateOpts{
+ actual, err := servergroups.Create(client.ServiceClient(), servergroups.CreateOpts{
Name: "test",
Policies: []string{"anti-affinity"},
}).Extract()
@@ -44,7 +45,7 @@
defer th.TeardownHTTP()
HandleGetSuccessfully(t)
- actual, err := Get(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0").Extract()
+ actual, err := servergroups.Get(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0").Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, &FirstServerGroup, actual)
}
@@ -54,6 +55,6 @@
defer th.TeardownHTTP()
HandleDeleteSuccessfully(t)
- err := Delete(client.ServiceClient(), "616fb98f-46ca-475e-917e-2563e5a8cd19").ExtractErr()
+ err := servergroups.Delete(client.ServiceClient(), "616fb98f-46ca-475e-917e-2563e5a8cd19").ExtractErr()
th.AssertNoErr(t, err)
}