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