Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 1 | package accounts |
| 2 | |
| 3 | import ( |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 4 | "testing" |
| 5 | |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame^] | 6 | th "github.com/gophercloud/gophercloud/testhelper" |
| 7 | fake "github.com/gophercloud/gophercloud/testhelper/client" |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 8 | ) |
| 9 | |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 10 | func TestUpdateAccount(t *testing.T) { |
Jon Perritt | 4a59d23 | 2014-10-09 20:21:31 -0500 | [diff] [blame] | 11 | th.SetupHTTP() |
| 12 | defer th.TeardownHTTP() |
Jon Perritt | ae06ab7 | 2014-11-06 18:18:55 -0600 | [diff] [blame] | 13 | HandleUpdateAccountSuccessfully(t) |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 14 | |
Jon Perritt | 4a59d23 | 2014-10-09 20:21:31 -0500 | [diff] [blame] | 15 | options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}} |
Jon Perritt | 7e70c40 | 2014-10-24 16:15:09 -0500 | [diff] [blame] | 16 | res := Update(fake.ServiceClient(), options) |
| 17 | th.AssertNoErr(t, res.Err) |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | func TestGetAccount(t *testing.T) { |
Jon Perritt | 4a59d23 | 2014-10-09 20:21:31 -0500 | [diff] [blame] | 21 | th.SetupHTTP() |
| 22 | defer th.TeardownHTTP() |
Jon Perritt | ae06ab7 | 2014-11-06 18:18:55 -0600 | [diff] [blame] | 23 | HandleGetAccountSuccessfully(t) |
Jon Perritt | 70bba63 | 2014-09-13 00:32:32 -0500 | [diff] [blame] | 24 | |
Jon Perritt | ae06ab7 | 2014-11-06 18:18:55 -0600 | [diff] [blame] | 25 | expectedMetadata := map[string]string{"Subject": "books"} |
| 26 | res := Get(fake.ServiceClient(), &GetOpts{}) |
| 27 | th.AssertNoErr(t, res.Err) |
| 28 | actualMetadata, _ := res.ExtractMetadata() |
| 29 | th.CheckDeepEquals(t, expectedMetadata, actualMetadata) |
| 30 | //headers, err := res.Extract() |
| 31 | //th.AssertNoErr(t, err) |
Jamie Hannaford | 93209fe | 2014-10-10 11:54:19 +0200 | [diff] [blame] | 32 | } |