Jon Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 1 | package accounts |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 5 | |
| 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 Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 9 | ) |
| 10 | |
Jon Perritt | e93d837 | 2015-01-31 20:22:09 -0700 | [diff] [blame] | 11 | func TestUpdateAccounts(t *testing.T) { |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 12 | th.SetupHTTP() |
| 13 | defer th.TeardownHTTP() |
Jon Perritt | e93d837 | 2015-01-31 20:22:09 -0700 | [diff] [blame] | 14 | |
| 15 | os.HandleUpdateAccountSuccessfully(t) |
Jon Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 16 | |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 17 | options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}} |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 18 | res := Update(fake.ServiceClient(), options) |
| 19 | th.CheckNoErr(t, res.Err) |
Jon Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 20 | } |
| 21 | |
Jon Perritt | e93d837 | 2015-01-31 20:22:09 -0700 | [diff] [blame] | 22 | func TestGetAccounts(t *testing.T) { |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 23 | th.SetupHTTP() |
| 24 | defer th.TeardownHTTP() |
Jon Perritt | e93d837 | 2015-01-31 20:22:09 -0700 | [diff] [blame] | 25 | |
| 26 | os.HandleGetAccountSuccessfully(t) |
Jon Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 27 | |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 28 | expected := map[string]string{"Foo": "bar"} |
| 29 | actual, err := Get(fake.ServiceClient()).ExtractMetadata() |
Jon Perritt | 0ba5a56 | 2014-10-15 23:23:12 -0500 | [diff] [blame] | 30 | th.CheckNoErr(t, err) |
Jon Perritt | 457f8ca | 2014-10-15 00:28:23 -0500 | [diff] [blame] | 31 | th.CheckDeepEquals(t, expected, actual) |
Jon Perritt | 0e28b11 | 2014-10-14 20:49:31 -0500 | [diff] [blame] | 32 | } |