blob: f5a4cc19c406e1face75a8a4f6c7381e4ed0f044 [file] [log] [blame]
Keith Byrnebda48592016-03-23 11:37:08 +00001// +build fixtures
2
Jamie Hannafordaf4570f2015-02-12 13:33:25 +01003package users
4
Jamie Hannaford4a170282015-02-18 14:16:57 +01005import (
6 "fmt"
7 "testing"
8
9 "github.com/rackspace/gophercloud/testhelper/fixture"
10)
Jamie Hannafordaf4570f2015-02-12 13:33:25 +010011
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010012const user1 = `
13{"databases": [{"name": "databaseA"}],"name": "dbuser3"%s}
14`
15
16const user2 = `
17{"databases": [{"name": "databaseB"},{"name": "databaseC"}],"name": "dbuser4"%s}
18`
19
20var (
Jamie Hannaford4a170282015-02-18 14:16:57 +010021 instanceID = "{instanceID}"
22 _rootURL = "/instances/" + instanceID + "/users"
23 pUser1 = fmt.Sprintf(user1, `,"password":"secretsecret"`)
24 pUser2 = fmt.Sprintf(user2, `,"password":"secretsecret"`)
25 createReq = fmt.Sprintf(`{"users":[%s, %s]}`, pUser1, pUser2)
26 listResp = fmt.Sprintf(`{"users":[%s, %s]}`, fmt.Sprintf(user1, ""), fmt.Sprintf(user2, ""))
Jamie Hannafordaf4570f2015-02-12 13:33:25 +010027)
28
Jamie Hannaford4a170282015-02-18 14:16:57 +010029func HandleCreate(t *testing.T) {
30 fixture.SetupHandler(t, _rootURL, "POST", createReq, "", 202)
31}
32
33func HandleList(t *testing.T) {
34 fixture.SetupHandler(t, _rootURL, "GET", "", listResp, 200)
35}
36
37func HandleDelete(t *testing.T) {
38 fixture.SetupHandler(t, _rootURL+"/{userName}", "DELETE", "", "", 202)
39}