Jamie Hannaford | af4570f | 2015-02-12 13:33:25 +0100 | [diff] [blame] | 1 | package users |
| 2 | |
Jamie Hannaford | 4a17028 | 2015-02-18 14:16:57 +0100 | [diff] [blame] | 3 | import ( |
| 4 | "fmt" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/rackspace/gophercloud/testhelper/fixture" |
| 8 | ) |
Jamie Hannaford | af4570f | 2015-02-12 13:33:25 +0100 | [diff] [blame] | 9 | |
Jamie Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 10 | const user1 = ` |
| 11 | {"databases": [{"name": "databaseA"}],"name": "dbuser3"%s} |
| 12 | ` |
| 13 | |
| 14 | const user2 = ` |
| 15 | {"databases": [{"name": "databaseB"},{"name": "databaseC"}],"name": "dbuser4"%s} |
| 16 | ` |
| 17 | |
| 18 | var ( |
Jamie Hannaford | 4a17028 | 2015-02-18 14:16:57 +0100 | [diff] [blame] | 19 | instanceID = "{instanceID}" |
| 20 | _rootURL = "/instances/" + instanceID + "/users" |
| 21 | pUser1 = fmt.Sprintf(user1, `,"password":"secretsecret"`) |
| 22 | pUser2 = fmt.Sprintf(user2, `,"password":"secretsecret"`) |
| 23 | createReq = fmt.Sprintf(`{"users":[%s, %s]}`, pUser1, pUser2) |
| 24 | listResp = fmt.Sprintf(`{"users":[%s, %s]}`, fmt.Sprintf(user1, ""), fmt.Sprintf(user2, "")) |
Jamie Hannaford | af4570f | 2015-02-12 13:33:25 +0100 | [diff] [blame] | 25 | ) |
| 26 | |
Jamie Hannaford | 4a17028 | 2015-02-18 14:16:57 +0100 | [diff] [blame] | 27 | func HandleCreate(t *testing.T) { |
| 28 | fixture.SetupHandler(t, _rootURL, "POST", createReq, "", 202) |
| 29 | } |
| 30 | |
| 31 | func HandleList(t *testing.T) { |
| 32 | fixture.SetupHandler(t, _rootURL, "GET", "", listResp, 200) |
| 33 | } |
| 34 | |
| 35 | func HandleDelete(t *testing.T) { |
| 36 | fixture.SetupHandler(t, _rootURL+"/{userName}", "DELETE", "", "", 202) |
| 37 | } |