Keith Byrne | bda4859 | 2016-03-23 11:37:08 +0000 | [diff] [blame^] | 1 | // +build fixtures |
| 2 | |
Jamie Hannaford | 1943b38 | 2015-02-12 11:50:02 +0100 | [diff] [blame] | 3 | package databases |
| 4 | |
Jamie Hannaford | 4a17028 | 2015-02-18 14:16:57 +0100 | [diff] [blame] | 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/rackspace/gophercloud/testhelper/fixture" |
| 9 | ) |
| 10 | |
| 11 | var ( |
| 12 | instanceID = "{instanceID}" |
| 13 | resURL = "/instances/" + instanceID + "/databases" |
| 14 | ) |
| 15 | |
Jamie Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 16 | var createDBsReq = ` |
Jamie Hannaford | 1943b38 | 2015-02-12 11:50:02 +0100 | [diff] [blame] | 17 | { |
Jamie Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 18 | "databases": [ |
| 19 | { |
| 20 | "character_set": "utf8", |
| 21 | "collate": "utf8_general_ci", |
| 22 | "name": "testingdb" |
| 23 | }, |
| 24 | { |
| 25 | "name": "sampledb" |
| 26 | } |
| 27 | ] |
Jamie Hannaford | 1943b38 | 2015-02-12 11:50:02 +0100 | [diff] [blame] | 28 | } |
Jamie Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 29 | ` |
Jamie Hannaford | 1943b38 | 2015-02-12 11:50:02 +0100 | [diff] [blame] | 30 | |
Jamie Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 31 | var listDBsResp = ` |
Jamie Hannaford | 1943b38 | 2015-02-12 11:50:02 +0100 | [diff] [blame] | 32 | { |
| 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 Hannaford | d3a78ef | 2015-02-18 12:17:16 +0100 | [diff] [blame] | 51 | ` |
Jamie Hannaford | 4a17028 | 2015-02-18 14:16:57 +0100 | [diff] [blame] | 52 | |
| 53 | func HandleCreate(t *testing.T) { |
| 54 | fixture.SetupHandler(t, resURL, "POST", createDBsReq, "", 202) |
| 55 | } |
| 56 | |
| 57 | func HandleList(t *testing.T) { |
| 58 | fixture.SetupHandler(t, resURL, "GET", "", listDBsResp, 200) |
| 59 | } |
| 60 | |
| 61 | func HandleDelete(t *testing.T) { |
| 62 | fixture.SetupHandler(t, resURL+"/{dbName}", "DELETE", "", "", 202) |
| 63 | } |