move unit tests into 'testing' directories
diff --git a/openstack/orchestration/v1/stackevents/testing/doc.go b/openstack/orchestration/v1/stackevents/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/orchestration/v1/stackevents/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/orchestration/v1/stackevents/fixtures.go b/openstack/orchestration/v1/stackevents/testing/fixtures.go
similarity index 96%
rename from openstack/orchestration/v1/stackevents/fixtures.go
rename to openstack/orchestration/v1/stackevents/testing/fixtures.go
index e4af1bb..a7af025 100644
--- a/openstack/orchestration/v1/stackevents/fixtures.go
+++ b/openstack/orchestration/v1/stackevents/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package stackevents
+package testing
import (
"fmt"
@@ -9,25 +7,26 @@
"time"
"github.com/gophercloud/gophercloud"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stackevents"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
)
// FindExpected represents the expected object from a Find request.
-var FindExpected = []Event{
- Event{
+var FindExpected = []stackevents.Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC)),
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/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -38,19 +37,19 @@
PhysicalResourceID: "",
ID: "06feb26f-9298-4a9b-8749-9d770e5d577a",
},
- Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC)),
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/events/93940999-7d40-44ae-8de4-19624e7b8d18",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -131,20 +130,20 @@
}
// ListExpected represents the expected object from a List request.
-var ListExpected = []Event{
- Event{
+var ListExpected = []stackevents.Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC)),
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/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -155,19 +154,19 @@
PhysicalResourceID: "",
ID: "06feb26f-9298-4a9b-8749-9d770e5d577a",
},
- Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC)),
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/events/93940999-7d40-44ae-8de4-19624e7b8d18",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -256,20 +255,20 @@
}
// ListResourceEventsExpected represents the expected object from a ListResourceEvents request.
-var ListResourceEventsExpected = []Event{
- Event{
+var ListResourceEventsExpected = []stackevents.Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC)),
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/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -280,19 +279,19 @@
PhysicalResourceID: "",
ID: "06feb26f-9298-4a9b-8749-9d770e5d577a",
},
- Event{
+ {
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC)),
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/events/93940999-7d40-44ae-8de4-19624e7b8d18",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
@@ -381,19 +380,19 @@
}
// GetExpected represents the expected object from a Get request.
-var GetExpected = &Event{
+var GetExpected = &stackevents.Event{
ResourceName: "hello_world",
Time: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC)),
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/events/93940999-7d40-44ae-8de4-19624e7b8d18",
Rel: "self",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
Rel: "resource",
},
- gophercloud.Link{
+ {
Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
Rel: "stack",
},
diff --git a/openstack/orchestration/v1/stackevents/requests_test.go b/openstack/orchestration/v1/stackevents/testing/requests_test.go
similarity index 60%
rename from openstack/orchestration/v1/stackevents/requests_test.go
rename to openstack/orchestration/v1/stackevents/testing/requests_test.go
index cead1f3..0ad3fc3 100644
--- a/openstack/orchestration/v1/stackevents/requests_test.go
+++ b/openstack/orchestration/v1/stackevents/testing/requests_test.go
@@ -1,8 +1,9 @@
-package stackevents
+package testing
import (
"testing"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stackevents"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
@@ -13,7 +14,7 @@
defer th.TeardownHTTP()
HandleFindSuccessfully(t, FindOutput)
- actual, err := Find(fake.ServiceClient(), "postman_stack").Extract()
+ actual, err := stackevents.Find(fake.ServiceClient(), "postman_stack").Extract()
th.AssertNoErr(t, err)
expected := FindExpected
@@ -26,9 +27,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 := stackevents.List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractEvents(page)
+ actual, err := stackevents.ExtractEvents(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ListExpected, actual)
@@ -45,9 +46,9 @@
HandleListResourceEventsSuccessfully(t, ListResourceEventsOutput)
count := 0
- err := ListResourceEvents(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", nil).EachPage(func(page pagination.Page) (bool, error) {
+ err := stackevents.ListResourceEvents(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", nil).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractEvents(page)
+ actual, err := stackevents.ExtractEvents(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ListResourceEventsExpected, actual)
@@ -63,7 +64,7 @@
defer th.TeardownHTTP()
HandleGetSuccessfully(t, GetOutput)
- actual, err := Get(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", "93940999-7d40-44ae-8de4-19624e7b8d18").Extract()
+ actual, err := stackevents.Get(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", "93940999-7d40-44ae-8de4-19624e7b8d18").Extract()
th.AssertNoErr(t, err)
expected := GetExpected