@@ -9,66 +9,6 @@ import (
99 fake "github.com/gophercloud/gophercloud/testhelper/client"
1010)
1111
12- func MockListResponse (t * testing.T ) {
13- th .Mux .HandleFunc ("/types" , func (w http.ResponseWriter , r * http.Request ) {
14- th .TestMethod (t , r , "GET" )
15- th .TestHeader (t , r , "X-Auth-Token" , fake .TokenID )
16-
17- w .Header ().Add ("Content-Type" , "application/json" )
18- w .WriteHeader (http .StatusOK )
19-
20- fmt .Fprintf (w , `
21- {
22- "volume_types": [
23- {
24- "name": "SSD",
25- "qos_specs_id": null,
26- "extra_specs": {
27- "volume_backend_name": "lvmdriver-1"
28- },
29- "is_public": true,
30- "id": "6685584b-1eac-4da6-b5c3-555430cf68ff",
31- "description": null
32- },
33- {
34- "name": "SATA",
35- "qos_specs_id": null,
36- "extra_specs": {
37- "volume_backend_name": "lvmdriver-1"
38- },
39- "is_public": true,
40- "id": "8eb69a46-df97-4e41-9586-9a40a7533803",
41- "description": null
42- }
43- ]
44- }
45- ` )
46- })
47- }
48-
49- func MockGetResponse (t * testing.T ) {
50- th .Mux .HandleFunc ("/types/d32019d3-bc6e-4319-9c1d-6722fc136a22" , func (w http.ResponseWriter , r * http.Request ) {
51- th .TestMethod (t , r , "GET" )
52- th .TestHeader (t , r , "X-Auth-Token" , fake .TokenID )
53-
54- w .Header ().Add ("Content-Type" , "application/json" )
55- w .WriteHeader (http .StatusOK )
56- fmt .Fprintf (w , `
57- {
58- "volume_type": {
59- "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
60- "name": "vol-type-001",
61- "description": "volume type 001",
62- "is_public": true,
63- "extra_specs": {
64- "capabilities": "gpu"
65- }
66- }
67- }
68- ` )
69- })
70- }
71-
7212func MockCreateResponse (t * testing.T ) {
7313 th .Mux .HandleFunc ("/types" , func (w http.ResponseWriter , r * http.Request ) {
7414 th .TestMethod (t , r , "POST" )
@@ -101,28 +41,3 @@ func MockCreateResponse(t *testing.T) {
10141 ` )
10242 })
10343}
104-
105- func MockDeleteResponse (t * testing.T ) {
106- th .Mux .HandleFunc ("/types/d32019d3-bc6e-4319-9c1d-6722fc136a22" , func (w http.ResponseWriter , r * http.Request ) {
107- th .TestMethod (t , r , "DELETE" )
108- th .TestHeader (t , r , "X-Auth-Token" , fake .TokenID )
109- w .WriteHeader (http .StatusAccepted )
110- })
111- }
112-
113- func MockUpdateResponse (t * testing.T ) {
114- th .Mux .HandleFunc ("/types/d32019d3-bc6e-4319-9c1d-6722fc136a22" , func (w http.ResponseWriter , r * http.Request ) {
115- th .TestMethod (t , r , "PUT" )
116- th .TestHeader (t , r , "X-Auth-Token" , fake .TokenID )
117- w .WriteHeader (http .StatusOK )
118- fmt .Fprintf (w , `
119- {
120- "volume_type": {
121- "name": "vol-type-002",
122- "description": "volume type 0001",
123- "is_public": true,
124- "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22"
125- }
126- }` )
127- })
128- }
0 commit comments