move unit tests into 'testing' directories
diff --git a/openstack/identity/v2/extensions/admin/roles/testing/doc.go b/openstack/identity/v2/extensions/admin/roles/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/identity/v2/extensions/admin/roles/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/identity/v2/extensions/admin/roles/fixtures.go b/openstack/identity/v2/extensions/admin/roles/testing/fixtures.go
similarity index 97%
rename from openstack/identity/v2/extensions/admin/roles/fixtures.go
rename to openstack/identity/v2/extensions/admin/roles/testing/fixtures.go
index 6b11f5c..498c161 100644
--- a/openstack/identity/v2/extensions/admin/roles/fixtures.go
+++ b/openstack/identity/v2/extensions/admin/roles/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package roles
+package testing
import (
"fmt"
diff --git a/openstack/identity/v2/extensions/admin/roles/requests_test.go b/openstack/identity/v2/extensions/admin/roles/testing/requests_test.go
similarity index 65%
rename from openstack/identity/v2/extensions/admin/roles/requests_test.go
rename to openstack/identity/v2/extensions/admin/roles/testing/requests_test.go
index cf3402d..8cf5395 100644
--- a/openstack/identity/v2/extensions/admin/roles/requests_test.go
+++ b/openstack/identity/v2/extensions/admin/roles/testing/requests_test.go
@@ -1,8 +1,9 @@
-package roles
+package testing
import (
"testing"
+ "github.com/gophercloud/gophercloud/openstack/identity/v2/extensions/admin/roles"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -16,16 +17,16 @@
count := 0
- err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := roles.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractRoles(page)
+ actual, err := roles.ExtractRoles(page)
if err != nil {
t.Errorf("Failed to extract users: %v", err)
return false, err
}
- expected := []Role{
- Role{
+ expected := []roles.Role{
+ {
ID: "123",
Name: "compute:admin",
Description: "Nova Administrator",
@@ -47,7 +48,7 @@
MockAddUserRoleResponse(t)
- err := AddUser(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr()
+ err := roles.AddUser(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr()
th.AssertNoErr(t, err)
}
@@ -58,7 +59,7 @@
MockDeleteUserRoleResponse(t)
- err := DeleteUser(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr()
+ err := roles.DeleteUser(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr()
th.AssertNoErr(t, err)
}
diff --git a/openstack/identity/v2/extensions/delegate_test.go b/openstack/identity/v2/extensions/testing/delegate_test.go
similarity index 69%
rename from openstack/identity/v2/extensions/delegate_test.go
rename to openstack/identity/v2/extensions/testing/delegate_test.go
index b425130..e7869d8 100644
--- a/openstack/identity/v2/extensions/delegate_test.go
+++ b/openstack/identity/v2/extensions/testing/delegate_test.go
@@ -1,9 +1,10 @@
-package extensions
+package testing
import (
"testing"
- common "github.com/gophercloud/gophercloud/openstack/common/extensions"
+ common "github.com/gophercloud/gophercloud/openstack/common/extensions/testing"
+ "github.com/gophercloud/gophercloud/openstack/identity/v2/extensions"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -15,9 +16,9 @@
HandleListExtensionsSuccessfully(t)
count := 0
- err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractExtensions(page)
+ actual, err := extensions.ExtractExtensions(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, common.ExpectedExtensions, actual)
@@ -32,7 +33,7 @@
defer th.TeardownHTTP()
common.HandleGetExtensionSuccessfully(t)
- actual, err := Get(client.ServiceClient(), "agent").Extract()
+ actual, err := extensions.Get(client.ServiceClient(), "agent").Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, common.SingleExtension, actual)
}
diff --git a/openstack/identity/v2/extensions/testing/doc.go b/openstack/identity/v2/extensions/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/identity/v2/extensions/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/identity/v2/extensions/fixtures.go b/openstack/identity/v2/extensions/testing/fixtures.go
similarity index 97%
rename from openstack/identity/v2/extensions/fixtures.go
rename to openstack/identity/v2/extensions/testing/fixtures.go
index 3fd5ad9..60afb74 100644
--- a/openstack/identity/v2/extensions/fixtures.go
+++ b/openstack/identity/v2/extensions/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package extensions
+package testing
import (
"fmt"