blob: a1ea98bb70010a42ad4b9fb77b37bf9389114547 [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
Jon Perritte93d8372015-01-31 20:22:09 -070011func TestUpdateAccounts(t *testing.T) {
Jon Perritt457f8ca2014-10-15 00:28:23 -050012 th.SetupHTTP()
13 defer th.TeardownHTTP()
Jon Perritte93d8372015-01-31 20:22:09 -070014
15 os.HandleUpdateAccountSuccessfully(t)
Jon Perritt0e28b112014-10-14 20:49:31 -050016
Jon Perritt457f8ca2014-10-15 00:28:23 -050017 options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}}
Jon Perritt0ce24ad2014-10-20 21:59:45 -050018 res := Update(fake.ServiceClient(), options)
19 th.CheckNoErr(t, res.Err)
Jon Perritt0e28b112014-10-14 20:49:31 -050020}
21
Jon Perritte93d8372015-01-31 20:22:09 -070022func TestGetAccounts(t *testing.T) {
Jon Perritt457f8ca2014-10-15 00:28:23 -050023 th.SetupHTTP()
24 defer th.TeardownHTTP()
Jon Perritte93d8372015-01-31 20:22:09 -070025
26 os.HandleGetAccountSuccessfully(t)
Jon Perritt0e28b112014-10-14 20:49:31 -050027
Jon Perritt457f8ca2014-10-15 00:28:23 -050028 expected := map[string]string{"Foo": "bar"}
29 actual, err := Get(fake.ServiceClient()).ExtractMetadata()
Jon Perritt0ba5a562014-10-15 23:23:12 -050030 th.CheckNoErr(t, err)
Jon Perritt457f8ca2014-10-15 00:28:23 -050031 th.CheckDeepEquals(t, expected, actual)
Jon Perritt0e28b112014-10-14 20:49:31 -050032}