move unit tests into 'testing' directories
diff --git a/openstack/blockstorage/v1/snapshots/testing/doc.go b/openstack/blockstorage/v1/snapshots/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/blockstorage/v1/snapshots/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/blockstorage/v1/snapshots/fixtures.go b/openstack/blockstorage/v1/snapshots/testing/fixtures.go
similarity index 98%
rename from openstack/blockstorage/v1/snapshots/fixtures.go
rename to openstack/blockstorage/v1/snapshots/testing/fixtures.go
index 1dcdfca..7bdc782 100644
--- a/openstack/blockstorage/v1/snapshots/fixtures.go
+++ b/openstack/blockstorage/v1/snapshots/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package snapshots
+package testing
import (
"fmt"
diff --git a/openstack/blockstorage/v1/snapshots/requests_test.go b/openstack/blockstorage/v1/snapshots/testing/requests_test.go
similarity index 67%
rename from openstack/blockstorage/v1/snapshots/requests_test.go
rename to openstack/blockstorage/v1/snapshots/testing/requests_test.go
index 410b753..cfb206b 100644
--- a/openstack/blockstorage/v1/snapshots/requests_test.go
+++ b/openstack/blockstorage/v1/snapshots/testing/requests_test.go
@@ -1,8 +1,9 @@
-package snapshots
+package testing
import (
"testing"
+ "github.com/gophercloud/gophercloud/openstack/blockstorage/v1/snapshots"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -16,20 +17,20 @@
count := 0
- List(client.ServiceClient(), &ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
+ snapshots.List(client.ServiceClient(), &snapshots.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractSnapshots(page)
+ actual, err := snapshots.ExtractSnapshots(page)
if err != nil {
t.Errorf("Failed to extract snapshots: %v", err)
return false, err
}
- expected := []Snapshot{
- Snapshot{
+ expected := []snapshots.Snapshot{
+ {
ID: "289da7f8-6440-407c-9fb4-7db01ec49164",
Name: "snapshot-001",
},
- Snapshot{
+ {
ID: "96c3bda7-c82a-4f50-be73-ca7621794835",
Name: "snapshot-002",
},
@@ -51,7 +52,7 @@
MockGetResponse(t)
- v, err := Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
+ v, err := snapshots.Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, v.Name, "snapshot-001")
@@ -64,8 +65,8 @@
MockCreateResponse(t)
- options := CreateOpts{VolumeID: "1234", Name: "snapshot-001"}
- n, err := Create(client.ServiceClient(), options).Extract()
+ options := snapshots.CreateOpts{VolumeID: "1234", Name: "snapshot-001"}
+ n, err := snapshots.Create(client.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, n.VolumeID, "1234")
@@ -81,13 +82,13 @@
expected := map[string]interface{}{"key": "v1"}
- options := &UpdateMetadataOpts{
+ options := &snapshots.UpdateMetadataOpts{
Metadata: map[string]interface{}{
"key": "v1",
},
}
- actual, err := UpdateMetadata(client.ServiceClient(), "123", options).ExtractMetadata()
+ actual, err := snapshots.UpdateMetadata(client.ServiceClient(), "123", options).ExtractMetadata()
th.AssertNoErr(t, err)
th.AssertDeepEquals(t, actual, expected)
@@ -99,6 +100,6 @@
MockDeleteResponse(t)
- res := Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ res := snapshots.Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
th.AssertNoErr(t, res.Err)
}