blob: 31ebccce084e823d7e45dd9df873502a8b48dded [file] [log] [blame]
Jon Perritt70bba632014-09-13 00:32:32 -05001package accounts
2
3import (
Jon Perritt70bba632014-09-13 00:32:32 -05004 "testing"
5
Jon Perritt27249f42016-02-18 10:35:59 -06006 th "github.com/gophercloud/gophercloud/testhelper"
7 fake "github.com/gophercloud/gophercloud/testhelper/client"
Jon Perritt70bba632014-09-13 00:32:32 -05008)
9
Jon Perritt70bba632014-09-13 00:32:32 -050010func TestUpdateAccount(t *testing.T) {
Jon Perritt4a59d232014-10-09 20:21:31 -050011 th.SetupHTTP()
12 defer th.TeardownHTTP()
Jon Perrittae06ab72014-11-06 18:18:55 -060013 HandleUpdateAccountSuccessfully(t)
Jon Perritt70bba632014-09-13 00:32:32 -050014
Jon Perritt4a59d232014-10-09 20:21:31 -050015 options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}}
Jon Perritt7e70c402014-10-24 16:15:09 -050016 res := Update(fake.ServiceClient(), options)
17 th.AssertNoErr(t, res.Err)
Jon Perritt70bba632014-09-13 00:32:32 -050018}
19
20func TestGetAccount(t *testing.T) {
Jon Perritt4a59d232014-10-09 20:21:31 -050021 th.SetupHTTP()
22 defer th.TeardownHTTP()
Jon Perrittae06ab72014-11-06 18:18:55 -060023 HandleGetAccountSuccessfully(t)
Jon Perritt70bba632014-09-13 00:32:32 -050024
Jon Perrittae06ab72014-11-06 18:18:55 -060025 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 Hannaford93209fe2014-10-10 11:54:19 +020032}