move unit tests into 'testing' directories
diff --git a/openstack/orchestration/v1/stackresources/testing/doc.go b/openstack/orchestration/v1/stackresources/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/orchestration/v1/stackresources/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/orchestration/v1/stackresources/fixtures.go b/openstack/orchestration/v1/stackresources/testing/fixtures.go
similarity index 97%
rename from openstack/orchestration/v1/stackresources/fixtures.go
rename to openstack/orchestration/v1/stackresources/testing/fixtures.go
index beec637..adcd4c6 100644
--- a/openstack/orchestration/v1/stackresources/fixtures.go
+++ b/openstack/orchestration/v1/stackresources/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package stackresources
+package testing
import (
"fmt"
@@ -9,20 +7,21 @@
"time"
"github.com/gophercloud/gophercloud"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stackresources"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
)
// FindExpected represents the expected object from a Find request.
-var FindExpected = []Resource{
- Resource{
+var FindExpected = []stackresources.Resource{
+ {
Name: "hello_world",
Links: []gophercloud.Link{
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -85,15 +84,15 @@
}
// ListExpected represents the expected object from a List request.
-var ListExpected = []Resource{
- Resource{
+var ListExpected = []stackresources.Resource{
+ {
Name: "hello_world",
Links: []gophercloud.Link{
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -163,14 +162,14 @@
}
// GetExpected represents the expected object from a Get request.
-var GetExpected = &Resource{
+var GetExpected = &stackresources.Resource{
Name: "wordpress_instance",
Links: []gophercloud.Link{
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e",
Rel: "stack",
},
@@ -257,7 +256,7 @@
}
// ListTypesExpected represents the expected object from a ListTypes request.
-var ListTypesExpected = ResourceTypes{
+var ListTypesExpected = stackresources.ResourceTypes{
"OS::Nova::Server",
"OS::Heat::RandomString",
"OS::Swift::Container",
@@ -269,7 +268,7 @@
}
// same as above, but sorted
-var SortedListTypesExpected = ResourceTypes{
+var SortedListTypesExpected = stackresources.ResourceTypes{
"OS::Cinder::VolumeAttachment",
"OS::Heat::RandomString",
"OS::Nova::FloatingIP",
@@ -310,7 +309,7 @@
}
// GetSchemaExpected represents the expected object from a Schema request.
-var GetSchemaExpected = &TypeSchema{
+var GetSchemaExpected = &stackresources.TypeSchema{
Attributes: map[string]interface{}{
"an_attribute": map[string]interface{}{
"description": "An attribute description .",
diff --git a/openstack/orchestration/v1/stackresources/requests_test.go b/openstack/orchestration/v1/stackresources/testing/requests_test.go
similarity index 66%
rename from openstack/orchestration/v1/stackresources/requests_test.go
rename to openstack/orchestration/v1/stackresources/testing/requests_test.go
index 7932873..c714047 100644
--- a/openstack/orchestration/v1/stackresources/requests_test.go
+++ b/openstack/orchestration/v1/stackresources/testing/requests_test.go
@@ -1,9 +1,10 @@
-package stackresources
+package testing
import (
"sort"
"testing"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stackresources"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
@@ -14,7 +15,7 @@
defer th.TeardownHTTP()
HandleFindSuccessfully(t, FindOutput)
- actual, err := Find(fake.ServiceClient(), "hello_world").Extract()
+ actual, err := stackresources.Find(fake.ServiceClient(), "hello_world").Extract()
th.AssertNoErr(t, err)
expected := FindExpected
@@ -27,9 +28,9 @@
HandleListSuccessfully(t, ListOutput)
count := 0
- err := List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) {
+ err := stackresources.List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractResources(page)
+ actual, err := stackresources.ExtractResources(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ListExpected, actual)
@@ -45,7 +46,7 @@
defer th.TeardownHTTP()
HandleGetSuccessfully(t, GetOutput)
- actual, err := Get(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract()
+ actual, err := stackresources.Get(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract()
th.AssertNoErr(t, err)
expected := GetExpected
@@ -57,7 +58,7 @@
defer th.TeardownHTTP()
HandleMetadataSuccessfully(t, MetadataOutput)
- actual, err := Metadata(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract()
+ actual, err := stackresources.Metadata(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract()
th.AssertNoErr(t, err)
expected := MetadataExpected
@@ -70,9 +71,9 @@
HandleListTypesSuccessfully(t, ListTypesOutput)
count := 0
- err := ListTypes(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := stackresources.ListTypes(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractResourceTypes(page)
+ actual, err := stackresources.ExtractResourceTypes(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ListTypesExpected, actual)
@@ -91,7 +92,7 @@
defer th.TeardownHTTP()
HandleGetSchemaSuccessfully(t, GetSchemaOutput)
- actual, err := Schema(fake.ServiceClient(), "OS::Heat::AResourceName").Extract()
+ actual, err := stackresources.Schema(fake.ServiceClient(), "OS::Heat::AResourceName").Extract()
th.AssertNoErr(t, err)
expected := GetSchemaExpected
@@ -103,7 +104,7 @@
defer th.TeardownHTTP()
HandleGetTemplateSuccessfully(t, GetTemplateOutput)
- actual, err := Template(fake.ServiceClient(), "OS::Heat::AResourceName").Extract()
+ actual, err := stackresources.Template(fake.ServiceClient(), "OS::Heat::AResourceName").Extract()
th.AssertNoErr(t, err)
expected := GetTemplateExpected