move unit tests into 'testing' directories
diff --git a/openstack/compute/v2/images/testing/doc.go b/openstack/compute/v2/images/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/compute/v2/images/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/compute/v2/images/requests_test.go b/openstack/compute/v2/images/testing/requests_test.go
similarity index 89%
rename from openstack/compute/v2/images/requests_test.go
rename to openstack/compute/v2/images/testing/requests_test.go
index 4b94ba1..a13b086 100644
--- a/openstack/compute/v2/images/requests_test.go
+++ b/openstack/compute/v2/images/testing/requests_test.go
@@ -1,4 +1,4 @@
-package images
+package testing
import (
"encoding/json"
@@ -7,6 +7,7 @@
"reflect"
"testing"
+ "github.com/gophercloud/gophercloud/openstack/compute/v2/images"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
@@ -63,17 +64,17 @@
})
pages := 0
- options := &ListOpts{Limit: 2}
- err := ListDetail(fake.ServiceClient(), options).EachPage(func(page pagination.Page) (bool, error) {
+ options := &images.ListOpts{Limit: 2}
+ err := images.ListDetail(fake.ServiceClient(), options).EachPage(func(page pagination.Page) (bool, error) {
pages++
- actual, err := ExtractImages(page)
+ actual, err := images.ExtractImages(page)
if err != nil {
return false, err
}
- expected := []Image{
- Image{
+ expected := []images.Image{
+ {
ID: "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7",
Name: "F17-x86_64-cfntools",
Created: "2014-09-23T12:54:52Z",
@@ -83,7 +84,7 @@
Progress: 100,
Status: "ACTIVE",
},
- Image{
+ {
ID: "f90f6034-2570-4974-8351-6b49732ef2eb",
Name: "cirros-0.3.2-x86_64-disk",
Created: "2014-09-23T12:51:42Z",
@@ -137,12 +138,12 @@
`)
})
- actual, err := Get(fake.ServiceClient(), "12345678").Extract()
+ actual, err := images.Get(fake.ServiceClient(), "12345678").Extract()
if err != nil {
t.Fatalf("Unexpected error from Get: %v", err)
}
- expected := &Image{
+ expected := &images.Image{
Status: "ACTIVE",
Updated: "2014-09-23T12:54:56Z",
ID: "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7",
@@ -159,7 +160,7 @@
}
func TestNextPageURL(t *testing.T) {
- var page ImagePage
+ var page images.ImagePage
var body map[string]interface{}
bodyString := []byte(`{"images":{"links":[{"href":"http://192.154.23.87/12345/images/image3","rel":"bookmark"}]}, "images_links":[{"href":"http://192.154.23.87/12345/images/image4","rel":"next"}]}`)
err := json.Unmarshal(bodyString, &body)
@@ -186,6 +187,6 @@
w.WriteHeader(http.StatusNoContent)
})
- res := Delete(fake.ServiceClient(), "12345678")
+ res := images.Delete(fake.ServiceClient(), "12345678")
th.AssertNoErr(t, res.Err)
}