blob: 8d21e90c09a4338e61cd7249bd3ee85ca1b2e117 [file] [log] [blame]
Keith Byrnebda48592016-03-23 11:37:08 +00001// +build fixtures
2
Jamie Hannaford1943b382015-02-12 11:50:02 +01003package databases
4
Jamie Hannaford4a170282015-02-18 14:16:57 +01005import (
6 "testing"
7
8 "github.com/rackspace/gophercloud/testhelper/fixture"
9)
10
11var (
12 instanceID = "{instanceID}"
13 resURL = "/instances/" + instanceID + "/databases"
14)
15
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010016var createDBsReq = `
Jamie Hannaford1943b382015-02-12 11:50:02 +010017{
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010018 "databases": [
19 {
20 "character_set": "utf8",
21 "collate": "utf8_general_ci",
22 "name": "testingdb"
23 },
24 {
25 "name": "sampledb"
26 }
27 ]
Jamie Hannaford1943b382015-02-12 11:50:02 +010028}
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010029`
Jamie Hannaford1943b382015-02-12 11:50:02 +010030
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010031var listDBsResp = `
Jamie Hannaford1943b382015-02-12 11:50:02 +010032{
33 "databases": [
34 {
35 "name": "anotherexampledb"
36 },
37 {
38 "name": "exampledb"
39 },
40 {
41 "name": "nextround"
42 },
43 {
44 "name": "sampledb"
45 },
46 {
47 "name": "testingdb"
48 }
49 ]
50}
Jamie Hannafordd3a78ef2015-02-18 12:17:16 +010051`
Jamie Hannaford4a170282015-02-18 14:16:57 +010052
53func HandleCreate(t *testing.T) {
54 fixture.SetupHandler(t, resURL, "POST", createDBsReq, "", 202)
55}
56
57func HandleList(t *testing.T) {
58 fixture.SetupHandler(t, resURL, "GET", "", listDBsResp, 200)
59}
60
61func HandleDelete(t *testing.T) {
62 fixture.SetupHandler(t, resURL+"/{dbName}", "DELETE", "", "", 202)
63}