blob: c568bd6e3b3d467317c3ec4266bfdf282912b7f5 [file] [log] [blame]
Jon Perritt0e28b112014-10-14 20:49:31 -05001package accounts
2
3import (
4 "testing"
Jon Perritt457f8ca2014-10-15 00:28:23 -05005
6 os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts"
7 th "github.com/rackspace/gophercloud/testhelper"
8 fake "github.com/rackspace/gophercloud/testhelper/client"
Jon Perritt0e28b112014-10-14 20:49:31 -05009)
10
11func TestGetAccounts(t *testing.T) {
Jon Perritt457f8ca2014-10-15 00:28:23 -050012 th.SetupHTTP()
13 defer th.TeardownHTTP()
14 os.HandleGetAccountSuccessfully(t)
Jon Perritt0e28b112014-10-14 20:49:31 -050015
Jon Perritt457f8ca2014-10-15 00:28:23 -050016 options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}}
Jon Perritt0ce24ad2014-10-20 21:59:45 -050017 res := Update(fake.ServiceClient(), options)
18 th.CheckNoErr(t, res.Err)
Jon Perritt0e28b112014-10-14 20:49:31 -050019}
20
21func TestUpdateAccounts(t *testing.T) {
Jon Perritt457f8ca2014-10-15 00:28:23 -050022 th.SetupHTTP()
23 defer th.TeardownHTTP()
24 os.HandleUpdateAccountSuccessfully(t)
Jon Perritt0e28b112014-10-14 20:49:31 -050025
Jon Perritt457f8ca2014-10-15 00:28:23 -050026 expected := map[string]string{"Foo": "bar"}
27 actual, err := Get(fake.ServiceClient()).ExtractMetadata()
Jon Perritt0ba5a562014-10-15 23:23:12 -050028 th.CheckNoErr(t, err)
Jon Perritt457f8ca2014-10-15 00:28:23 -050029 th.CheckDeepEquals(t, expected, actual)
Jon Perritt0e28b112014-10-14 20:49:31 -050030}