blob: 516b335e0615e1899041c48fdd85445afa864370 [file] [log] [blame]
Jamie Hannafordaf4570f2015-02-12 13:33:25 +01001package users
2
Jamie Hannaford4a170282015-02-18 14:16:57 +01003import (
4 "fmt"
5 "testing"
6
7 "github.com/rackspace/gophercloud/testhelper/fixture"
8)
Jamie Hannafordaf4570f2015-02-12 13:33:25 +01009
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010010const user1 = `
11{"databases": [{"name": "databaseA"}],"name": "dbuser3"%s}
12`
13
14const user2 = `
15{"databases": [{"name": "databaseB"},{"name": "databaseC"}],"name": "dbuser4"%s}
16`
17
18var (
Jamie Hannaford4a170282015-02-18 14:16:57 +010019 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 Hannafordaf4570f2015-02-12 13:33:25 +010025)
26
Jamie Hannaford4a170282015-02-18 14:16:57 +010027func HandleCreate(t *testing.T) {
28 fixture.SetupHandler(t, _rootURL, "POST", createReq, "", 202)
29}
30
31func HandleList(t *testing.T) {
32 fixture.SetupHandler(t, _rootURL, "GET", "", listResp, 200)
33}
34
35func HandleDelete(t *testing.T) {
36 fixture.SetupHandler(t, _rootURL+"/{userName}", "DELETE", "", "", 202)
37}