move unit tests into 'testing' directories
diff --git a/openstack/identity/v2/users/testing/doc.go b/openstack/identity/v2/users/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/identity/v2/users/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/identity/v2/users/fixtures.go b/openstack/identity/v2/users/testing/fixtures.go
similarity index 98%
rename from openstack/identity/v2/users/fixtures.go
rename to openstack/identity/v2/users/testing/fixtures.go
index 7b0bc4c..c1c3b89 100644
--- a/openstack/identity/v2/users/fixtures.go
+++ b/openstack/identity/v2/users/testing/fixtures.go
@@ -1,6 +1,4 @@
-// +build fixtures
-
-package users
+package testing
import (
"fmt"
diff --git a/openstack/identity/v2/users/requests_test.go b/openstack/identity/v2/users/testing/requests_test.go
similarity index 71%
rename from openstack/identity/v2/users/requests_test.go
rename to openstack/identity/v2/users/testing/requests_test.go
index 0e6da37..3cb047e 100644
--- a/openstack/identity/v2/users/requests_test.go
+++ b/openstack/identity/v2/users/testing/requests_test.go
@@ -1,9 +1,10 @@
-package users
+package testing
import (
"testing"
"github.com/gophercloud/gophercloud"
+ "github.com/gophercloud/gophercloud/openstack/identity/v2/users"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
@@ -17,13 +18,13 @@
count := 0
- err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := users.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractUsers(page)
+ actual, err := users.ExtractUsers(page)
th.AssertNoErr(t, err)
- expected := []User{
- User{
+ expected := []users.User{
+ {
ID: "u1000",
Name: "John Smith",
Username: "jqsmith",
@@ -31,7 +32,7 @@
Enabled: true,
TenantID: "12345",
},
- User{
+ {
ID: "u1001",
Name: "Jane Smith",
Username: "jqsmith",
@@ -53,18 +54,18 @@
mockCreateUserResponse(t)
- opts := CreateOpts{
+ opts := users.CreateOpts{
Name: "new_user",
TenantID: "12345",
Enabled: gophercloud.Disabled,
Email: "new_user@foo.com",
}
- user, err := Create(client.ServiceClient(), opts).Extract()
+ user, err := users.Create(client.ServiceClient(), opts).Extract()
th.AssertNoErr(t, err)
- expected := &User{
+ expected := &users.User{
Name: "new_user",
ID: "c39e3de9be2d4c779f1dfd6abacc176d",
Email: "new_user@foo.com",
@@ -81,10 +82,10 @@
mockGetUserResponse(t)
- user, err := Get(client.ServiceClient(), "new_user").Extract()
+ user, err := users.Get(client.ServiceClient(), "new_user").Extract()
th.AssertNoErr(t, err)
- expected := &User{
+ expected := &users.User{
Name: "new_user",
ID: "c39e3de9be2d4c779f1dfd6abacc176d",
Email: "new_user@foo.com",
@@ -102,17 +103,17 @@
mockUpdateUserResponse(t)
id := "c39e3de9be2d4c779f1dfd6abacc176d"
- opts := UpdateOpts{
+ opts := users.UpdateOpts{
Name: "new_name",
Enabled: gophercloud.Enabled,
Email: "new_email@foo.com",
}
- user, err := Update(client.ServiceClient(), id, opts).Extract()
+ user, err := users.Update(client.ServiceClient(), id, opts).Extract()
th.AssertNoErr(t, err)
- expected := &User{
+ expected := &users.User{
Name: "new_name",
ID: id,
Email: "new_email@foo.com",
@@ -129,7 +130,7 @@
mockDeleteUserResponse(t)
- res := Delete(client.ServiceClient(), "c39e3de9be2d4c779f1dfd6abacc176d")
+ res := users.Delete(client.ServiceClient(), "c39e3de9be2d4c779f1dfd6abacc176d")
th.AssertNoErr(t, res.Err)
}
@@ -142,13 +143,13 @@
tenantID := "1d8b6120dcc640fda4fc9194ffc80273"
userID := "c39e3de9be2d4c779f1dfd6abacc176d"
- err := ListRoles(client.ServiceClient(), tenantID, userID).EachPage(func(page pagination.Page) (bool, error) {
- actual, err := ExtractRoles(page)
+ err := users.ListRoles(client.ServiceClient(), tenantID, userID).EachPage(func(page pagination.Page) (bool, error) {
+ actual, err := users.ExtractRoles(page)
th.AssertNoErr(t, err)
- expected := []Role{
- Role{ID: "9fe2ff9ee4384b1894a90878d3e92bab", Name: "foo_role"},
- Role{ID: "1ea3d56793574b668e85960fbf651e13", Name: "admin"},
+ expected := []users.Role{
+ {ID: "9fe2ff9ee4384b1894a90878d3e92bab", Name: "foo_role"},
+ {ID: "1ea3d56793574b668e85960fbf651e13", Name: "admin"},
}
th.CheckDeepEquals(t, expected, actual)