accounts unit tests
diff --git a/openstack/storage/v1/accounts/accounts_test.go b/openstack/storage/v1/accounts/accounts_test.go
new file mode 100644
index 0000000..75e3362
--- /dev/null
+++ b/openstack/storage/v1/accounts/accounts_test.go
@@ -0,0 +1,20 @@
+package accounts
+
+import (
+ "net/http"
+ "testing"
+)
+
+func TestExtractMetadata(t *testing.T) {
+ getResult := &http.Response{}
+
+ expected := map[string]string{}
+
+ actual := ExtractMetadata(getResult)
+
+ for key, value := range expected {
+ if value != actual[key] {
+ t.Errorf("Expected: %+v\nActual:%+v", expected, actual)
+ }
+ }
+}
diff --git a/openstack/storage/v1/accounts/requests_test.go b/openstack/storage/v1/accounts/requests_test.go
new file mode 100644
index 0000000..e1450d4
--- /dev/null
+++ b/openstack/storage/v1/accounts/requests_test.go
@@ -0,0 +1,55 @@
+package accounts
+
+import (
+ "net/http"
+ "testing"
+
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/testhelper"
+)
+
+const tokenId = "abcabcabcabc"
+
+var metadata = map[string]string{"gophercloud-test": "accounts"}
+
+func serviceClient() *gophercloud.ServiceClient {
+ return &gophercloud.ServiceClient{
+ Provider: &gophercloud.ProviderClient{TokenID: tokenId},
+ Endpoint: testhelper.Endpoint(),
+ }
+}
+
+func TestUpdateAccount(t *testing.T) {
+ testhelper.SetupHTTP()
+ defer testhelper.TeardownHTTP()
+
+ testhelper.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ testhelper.TestMethod(t, r, "POST")
+ testhelper.TestHeader(t, r, "X-Auth-Token", tokenId)
+ testhelper.TestHeader(t, r, "X-Account-Meta-Gophercloud-Test", "accounts")
+ w.WriteHeader(http.StatusNoContent)
+ })
+
+ client := serviceClient()
+ err := Update(client, UpdateOpts{Metadata: metadata})
+ if err != nil {
+ t.Fatalf("Unable to update account: %v", err)
+ }
+}
+
+func TestGetAccount(t *testing.T) {
+ testhelper.SetupHTTP()
+ defer testhelper.TeardownHTTP()
+
+ testhelper.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ testhelper.TestMethod(t, r, "HEAD")
+ testhelper.TestHeader(t, r, "X-Auth-Token", tokenId)
+ w.WriteHeader(http.StatusNoContent)
+ })
+
+ client := serviceClient()
+ _, err := Get(client, GetOpts{})
+ if err != nil {
+ t.Fatalf("Unable to get account metadata: %v", err)
+ }
+}
diff --git a/openstack/storage/v1/accounts/urls_test.go b/openstack/storage/v1/accounts/urls_test.go
new file mode 100644
index 0000000..f127a5e
--- /dev/null
+++ b/openstack/storage/v1/accounts/urls_test.go
@@ -0,0 +1,17 @@
+package accounts
+
+import (
+ "testing"
+
+ "github.com/rackspace/gophercloud"
+)
+
+func TestAccountURL(t *testing.T) {
+ client := gophercloud.ServiceClient{
+ Endpoint: "http://localhost:5000/v3/",
+ }
+ url := accountURL(&client)
+ if url != "http://localhost:5000/v3/" {
+ t.Errorf("Unexpected service URL generated: [%s]", url)
+ }
+}