github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/db/v1/databases/testing/fixtures.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/testhelper/fixture" 7 ) 8 9 var ( 10 instanceID = "{instanceID}" 11 resURL = "/instances/" + instanceID + "/databases" 12 ) 13 14 var createDBsReq = ` 15 { 16 "databases": [ 17 { 18 "character_set": "utf8", 19 "collate": "utf8_general_ci", 20 "name": "testingdb" 21 }, 22 { 23 "name": "sampledb" 24 } 25 ] 26 } 27 ` 28 29 var listDBsResp = ` 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 } 49 ` 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 }