blob: 3e677211b52dc6b2a306fe85828510c80e8e6604 [file] [log] [blame]
Jamie Hannaford1943b382015-02-12 11:50:02 +01001package databases
2
Jamie Hannaford4a170282015-02-18 14:16:57 +01003import (
4 "testing"
5
6 "github.com/rackspace/gophercloud/testhelper/fixture"
7)
8
9var (
10 instanceID = "{instanceID}"
11 resURL = "/instances/" + instanceID + "/databases"
12)
13
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010014var createDBsReq = `
Jamie Hannaford1943b382015-02-12 11:50:02 +010015{
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010016 "databases": [
17 {
18 "character_set": "utf8",
19 "collate": "utf8_general_ci",
20 "name": "testingdb"
21 },
22 {
23 "name": "sampledb"
24 }
25 ]
Jamie Hannaford1943b382015-02-12 11:50:02 +010026}
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010027`
Jamie Hannaford1943b382015-02-12 11:50:02 +010028
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010029var listDBsResp = `
Jamie Hannaford1943b382015-02-12 11:50:02 +010030{
31 "databases": [
32 {
33 "name": "anotherexampledb"
34 },
35 {
36 "name": "exampledb"
37 },
38 {
39 "name": "nextround"
40 },
41 {
42 "name": "sampledb"
43 },
44 {
45 "name": "testingdb"
46 }
47 ]
48}
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010049`
Jamie Hannaford4a170282015-02-18 14:16:57 +010050
51func HandleCreate(t *testing.T) {
52 fixture.SetupHandler(t, resURL, "POST", createDBsReq, "", 202)
53}
54
55func HandleList(t *testing.T) {
56 fixture.SetupHandler(t, resURL, "GET", "", listDBsResp, 200)
57}
58
59func HandleDelete(t *testing.T) {
60 fixture.SetupHandler(t, resURL+"/{dbName}", "DELETE", "", "", 202)
61}