Jamie Hannaford | 3c1796b | 2015-02-12 14:21:33 +0100 | [diff] [blame] | 1 | package users |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | db "github.com/rackspace/gophercloud/openstack/db/v1/databases" |
| 7 | os "github.com/rackspace/gophercloud/openstack/db/v1/users" |
Jamie Hannaford | 3c1796b | 2015-02-12 14:21:33 +0100 | [diff] [blame] | 8 | th "github.com/rackspace/gophercloud/testhelper" |
| 9 | fake "github.com/rackspace/gophercloud/testhelper/client" |
| 10 | ) |
| 11 | |
| 12 | const instanceID = "{instanceID}" |
| 13 | |
| 14 | func TestCreate(t *testing.T) { |
| 15 | th.SetupHTTP() |
| 16 | defer th.TeardownHTTP() |
Jamie Hannaford | e635b7d | 2015-02-18 14:11:46 +0100 | [diff] [blame] | 17 | os.HandleCreate(t) |
Jamie Hannaford | 3c1796b | 2015-02-12 14:21:33 +0100 | [diff] [blame] | 18 | |
| 19 | opts := os.BatchCreateOpts{ |
| 20 | os.CreateOpts{ |
| 21 | Databases: db.BatchCreateOpts{ |
| 22 | db.CreateOpts{Name: "databaseA"}, |
| 23 | }, |
| 24 | Name: "dbuser3", |
| 25 | Password: "secretsecret", |
| 26 | }, |
| 27 | os.CreateOpts{ |
| 28 | Databases: db.BatchCreateOpts{ |
| 29 | db.CreateOpts{Name: "databaseB"}, |
| 30 | db.CreateOpts{Name: "databaseC"}, |
| 31 | }, |
| 32 | Name: "dbuser4", |
| 33 | Password: "secretsecret", |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | res := Create(fake.ServiceClient(), instanceID, opts) |
| 38 | th.AssertNoErr(t, res.Err) |
| 39 | } |
| 40 | |
Jamie Hannaford | e635b7d | 2015-02-18 14:11:46 +0100 | [diff] [blame] | 41 | func TestDelete(t *testing.T) { |
Jamie Hannaford | 3c1796b | 2015-02-12 14:21:33 +0100 | [diff] [blame] | 42 | th.SetupHTTP() |
| 43 | defer th.TeardownHTTP() |
Jamie Hannaford | e635b7d | 2015-02-18 14:11:46 +0100 | [diff] [blame] | 44 | os.HandleDelete(t) |
Jamie Hannaford | 3c1796b | 2015-02-12 14:21:33 +0100 | [diff] [blame] | 45 | |
| 46 | res := Delete(fake.ServiceClient(), instanceID, "{userName}") |
| 47 | th.AssertNoErr(t, res.Err) |
| 48 | } |