unit tests for delegated functions; factor out common test http handlers into 'fixtures.go' files
diff --git a/rackspace/objectstorage/v1/accounts/delegate_test.go b/rackspace/objectstorage/v1/accounts/delegate_test.go
index f9c870a..15a21ae 100644
--- a/rackspace/objectstorage/v1/accounts/delegate_test.go
+++ b/rackspace/objectstorage/v1/accounts/delegate_test.go
@@ -2,14 +2,33 @@
import (
"testing"
- //th "github.com/rackspace/gophercloud/testhelper"
- //fake "github.com/rackspace/gophercloud/testhelper/client"
+
+ os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts"
+ th "github.com/rackspace/gophercloud/testhelper"
+ fake "github.com/rackspace/gophercloud/testhelper/client"
)
func TestGetAccounts(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+ os.HandleGetAccountSuccessfully(t)
+ options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}}
+ _, err := Update(fake.ServiceClient(), options).ExtractHeaders()
+ if err != nil {
+ t.Fatalf("Unable to update account: %v", err)
+ }
}
func TestUpdateAccounts(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+ os.HandleUpdateAccountSuccessfully(t)
+ expected := map[string]string{"Foo": "bar"}
+ actual, err := Get(fake.ServiceClient()).ExtractMetadata()
+ if err != nil {
+ t.Fatalf("Unable to get account metadata: %v", err)
+ }
+ th.CheckDeepEquals(t, expected, actual)
}