move unit tests into 'testing' directories
diff --git a/openstack/blockstorage/v1/volumes/testing/doc.go b/openstack/blockstorage/v1/volumes/testing/doc.go
index 60fc22a..2f66ba5 100644
--- a/openstack/blockstorage/v1/volumes/testing/doc.go
+++ b/openstack/blockstorage/v1/volumes/testing/doc.go
@@ -2,6 +2,6 @@
This is package created is to hold fixtures (which imports testing),
so that importing volumes package does not inadvertently import testing into production code
More information here:
-https://github.com/gophercloud/gophercloud/issues/473
+https://github.com/rackspace/gophercloud/issues/473
*/
package testing
diff --git a/openstack/blockstorage/v1/volumes/testing/fixtures.go b/openstack/blockstorage/v1/volumes/testing/fixtures.go
index 0d34d5e..421cbf4 100644
--- a/openstack/blockstorage/v1/volumes/testing/fixtures.go
+++ b/openstack/blockstorage/v1/volumes/testing/fixtures.go
@@ -1,5 +1,3 @@
-// +build fixtures
-
package testing
import (
diff --git a/openstack/blockstorage/v1/volumes/requests_test.go b/openstack/blockstorage/v1/volumes/testing/requests_test.go
similarity index 69%
rename from openstack/blockstorage/v1/volumes/requests_test.go
rename to openstack/blockstorage/v1/volumes/testing/requests_test.go
index 436cfdc..85a6cd8 100644
--- a/openstack/blockstorage/v1/volumes/requests_test.go
+++ b/openstack/blockstorage/v1/volumes/testing/requests_test.go
@@ -1,11 +1,11 @@
-package volumes
+package testing
import (
"testing"
"time"
"github.com/gophercloud/gophercloud"
- fixtures "github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes/testing"
+ "github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -15,24 +15,24 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockListResponse(t)
+ MockListResponse(t)
count := 0
- List(client.ServiceClient(), &ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
+ volumes.List(client.ServiceClient(), &volumes.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractVolumes(page)
+ actual, err := volumes.ExtractVolumes(page)
if err != nil {
t.Errorf("Failed to extract volumes: %v", err)
return false, err
}
- expected := []Volume{
- Volume{
+ expected := []volumes.Volume{
+ {
ID: "289da7f8-6440-407c-9fb4-7db01ec49164",
Name: "vol-001",
},
- Volume{
+ {
ID: "96c3bda7-c82a-4f50-be73-ca7621794835",
Name: "vol-002",
},
@@ -52,19 +52,19 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockListResponse(t)
+ MockListResponse(t)
- allPages, err := List(client.ServiceClient(), &ListOpts{}).AllPages()
+ allPages, err := volumes.List(client.ServiceClient(), &volumes.ListOpts{}).AllPages()
th.AssertNoErr(t, err)
- actual, err := ExtractVolumes(allPages)
+ actual, err := volumes.ExtractVolumes(allPages)
th.AssertNoErr(t, err)
- expected := []Volume{
- Volume{
+ expected := []volumes.Volume{
+ {
ID: "289da7f8-6440-407c-9fb4-7db01ec49164",
Name: "vol-001",
},
- Volume{
+ {
ID: "96c3bda7-c82a-4f50-be73-ca7621794835",
Name: "vol-002",
},
@@ -78,12 +78,12 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockGetResponse(t)
+ MockGetResponse(t)
- actual, err := Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
+ actual, err := volumes.Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
th.AssertNoErr(t, err)
- expected := &Volume{
+ expected := &volumes.Volume{
Status: "active",
Name: "vol-001",
Attachments: []map[string]interface{}{
@@ -117,10 +117,10 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockCreateResponse(t)
+ MockCreateResponse(t)
- options := &CreateOpts{Size: 75}
- n, err := Create(client.ServiceClient(), options).Extract()
+ options := &volumes.CreateOpts{Size: 75}
+ n, err := volumes.Create(client.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Size, 4)
@@ -131,9 +131,9 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockDeleteResponse(t)
+ MockDeleteResponse(t)
- res := Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ res := volumes.Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
th.AssertNoErr(t, res.Err)
}
@@ -141,10 +141,10 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- fixtures.MockUpdateResponse(t)
+ MockUpdateResponse(t)
- options := UpdateOpts{Name: "vol-002"}
- v, err := Update(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22", options).Extract()
+ options := volumes.UpdateOpts{Name: "vol-002"}
+ v, err := volumes.Update(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22", options).Extract()
th.AssertNoErr(t, err)
th.CheckEquals(t, "vol-002", v.Name)
}