move unit tests into 'testing' directories
diff --git a/openstack/compute/v2/extensions/floatingips/testing/doc.go b/openstack/compute/v2/extensions/floatingips/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/compute/v2/extensions/floatingips/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/compute/v2/extensions/floatingips/fixtures.go b/openstack/compute/v2/extensions/floatingips/testing/fixtures.go
similarity index 93%
rename from openstack/compute/v2/extensions/floatingips/fixtures.go
rename to openstack/compute/v2/extensions/floatingips/testing/fixtures.go
index b369ea2..e372606 100644
--- a/openstack/compute/v2/extensions/floatingips/fixtures.go
+++ b/openstack/compute/v2/extensions/floatingips/testing/fixtures.go
@@ -1,12 +1,11 @@
-// +build fixtures
-
-package floatingips
+package testing
import (
"fmt"
"net/http"
"testing"
+ "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
)
@@ -60,14 +59,14 @@
`
// FirstFloatingIP is the first result in ListOutput.
-var FirstFloatingIP = FloatingIP{
+var FirstFloatingIP = floatingips.FloatingIP{
ID: "1",
IP: "10.10.10.1",
Pool: "nova",
}
// SecondFloatingIP is the first result in ListOutput.
-var SecondFloatingIP = FloatingIP{
+var SecondFloatingIP = floatingips.FloatingIP{
FixedIP: "166.78.185.201",
ID: "2",
InstanceID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0",
@@ -77,10 +76,10 @@
// ExpectedFloatingIPsSlice is the slice of results that should be parsed
// from ListOutput, in the expected order.
-var ExpectedFloatingIPsSlice = []FloatingIP{FirstFloatingIP, SecondFloatingIP}
+var ExpectedFloatingIPsSlice = []floatingips.FloatingIP{FirstFloatingIP, SecondFloatingIP}
// CreatedFloatingIP is the parsed result from CreateOutput.
-var CreatedFloatingIP = FloatingIP{
+var CreatedFloatingIP = floatingips.FloatingIP{
ID: "1",
IP: "10.10.10.1",
Pool: "nova",
diff --git a/openstack/compute/v2/extensions/floatingips/requests_test.go b/openstack/compute/v2/extensions/floatingips/testing/requests_test.go
similarity index 60%
rename from openstack/compute/v2/extensions/floatingips/requests_test.go
rename to openstack/compute/v2/extensions/floatingips/testing/requests_test.go
index f0e9560..e53da91 100644
--- a/openstack/compute/v2/extensions/floatingips/requests_test.go
+++ b/openstack/compute/v2/extensions/floatingips/testing/requests_test.go
@@ -1,8 +1,9 @@
-package floatingips
+package testing
import (
"testing"
+ "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
"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 := floatingips.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractFloatingIPs(page)
+ actual, err := floatingips.ExtractFloatingIPs(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedFloatingIPsSlice, actual)
@@ -31,7 +32,7 @@
defer th.TeardownHTTP()
HandleCreateSuccessfully(t)
- actual, err := Create(client.ServiceClient(), CreateOpts{
+ actual, err := floatingips.Create(client.ServiceClient(), floatingips.CreateOpts{
Pool: "nova",
}).Extract()
th.AssertNoErr(t, err)
@@ -43,7 +44,7 @@
defer th.TeardownHTTP()
HandleGetSuccessfully(t)
- actual, err := Get(client.ServiceClient(), "2").Extract()
+ actual, err := floatingips.Get(client.ServiceClient(), "2").Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, &SecondFloatingIP, actual)
}
@@ -53,7 +54,7 @@
defer th.TeardownHTTP()
HandleDeleteSuccessfully(t)
- err := Delete(client.ServiceClient(), "1").ExtractErr()
+ err := floatingips.Delete(client.ServiceClient(), "1").ExtractErr()
th.AssertNoErr(t, err)
}
@@ -62,11 +63,11 @@
defer th.TeardownHTTP()
HandleAssociateSuccessfully(t)
- associateOpts := AssociateOpts{
+ associateOpts := floatingips.AssociateOpts{
FloatingIP: "10.10.10.2",
}
- err := AssociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", associateOpts).ExtractErr()
+ err := floatingips.AssociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", associateOpts).ExtractErr()
th.AssertNoErr(t, err)
}
@@ -75,12 +76,12 @@
defer th.TeardownHTTP()
HandleAssociateFixedSuccessfully(t)
- associateOpts := AssociateOpts{
+ associateOpts := floatingips.AssociateOpts{
FloatingIP: "10.10.10.2",
FixedIP: "166.78.185.201",
}
- err := AssociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", associateOpts).ExtractErr()
+ err := floatingips.AssociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", associateOpts).ExtractErr()
th.AssertNoErr(t, err)
}
@@ -89,10 +90,10 @@
defer th.TeardownHTTP()
HandleDisassociateSuccessfully(t)
- disassociateOpts := DisassociateOpts{
+ disassociateOpts := floatingips.DisassociateOpts{
FloatingIP: "10.10.10.2",
}
- err := DisassociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", disassociateOpts).ExtractErr()
+ err := floatingips.DisassociateInstance(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0", disassociateOpts).ExtractErr()
th.AssertNoErr(t, err)
}