@@ -95,7 +95,73 @@ func TestVariableService_handleGetVariables(t *testing.T) {
95
95
wants : wants {
96
96
statusCode : http .StatusOK ,
97
97
contentType : "application/json; charset=utf-8" ,
98
- body : `{"variables":[{"id":"6162207574726f71","orgID":"0000000000000001","name":"variable-a","selected":["b"],"arguments":{"type":"constant","values":["a","b"]},"labels":[{"id":"fc3dc670a4be9b9a","name":"label","properties":{"color":"fff000"}}],"links":{"self":"/api/v2/variables/6162207574726f71","labels":"/api/v2/variables/6162207574726f71/labels","org":"/api/v2/orgs/0000000000000001"}},{"id":"61726920617a696f","orgID":"0000000000000001","name":"variable-b","selected":["c"],"arguments":{"type":"map","values":{"a":"b","c":"d"}},"labels":[{"id":"fc3dc670a4be9b9a","name":"label","properties":{"color":"fff000"}}],"links":{"self":"/api/v2/variables/61726920617a696f","labels":"/api/v2/variables/61726920617a696f/labels","org": "/api/v2/orgs/0000000000000001"}}],"links":{"self":"/api/v2/variables?descending=false&limit=20&offset=0"}}` ,
98
+ body : `{
99
+ "links":{
100
+ "self":"/api/v2/variables?descending=false&limit=20&offset=0"
101
+ },
102
+ "variables":[
103
+ {
104
+ "arguments":{
105
+ "type":"constant",
106
+ "values":[
107
+ "a",
108
+ "b"
109
+ ]
110
+ },
111
+ "description":"",
112
+ "id":"6162207574726f71",
113
+ "labels":[
114
+ {
115
+ "id":"fc3dc670a4be9b9a",
116
+ "name":"label",
117
+ "properties":{
118
+ "color":"fff000"
119
+ }
120
+ }
121
+ ],
122
+ "links":{
123
+ "labels":"/api/v2/variables/6162207574726f71/labels",
124
+ "org":"/api/v2/orgs/0000000000000001",
125
+ "self":"/api/v2/variables/6162207574726f71"
126
+ },
127
+ "name":"variable-a",
128
+ "orgID":"0000000000000001",
129
+ "selected":[
130
+ "b"
131
+ ]
132
+ },
133
+ {
134
+ "arguments":{
135
+ "type":"map",
136
+ "values":{
137
+ "a":"b",
138
+ "c":"d"
139
+ }
140
+ },
141
+ "description":"",
142
+ "id":"61726920617a696f",
143
+ "labels":[
144
+ {
145
+ "id":"fc3dc670a4be9b9a",
146
+ "name":"label",
147
+ "properties":{
148
+ "color":"fff000"
149
+ }
150
+ }
151
+ ],
152
+ "links":{
153
+ "labels":"/api/v2/variables/61726920617a696f/labels",
154
+ "org":"/api/v2/orgs/0000000000000001",
155
+ "self":"/api/v2/variables/61726920617a696f"
156
+ },
157
+ "name":"variable-b",
158
+ "orgID":"0000000000000001",
159
+ "selected":[
160
+ "c"
161
+ ]
162
+ }
163
+ ]
164
+ }` ,
99
165
},
100
166
},
101
167
{
@@ -165,7 +231,43 @@ func TestVariableService_handleGetVariables(t *testing.T) {
165
231
wants : wants {
166
232
statusCode : http .StatusOK ,
167
233
contentType : "application/json; charset=utf-8" ,
168
- body : `{"variables":[{"id":"6162207574726f71","orgID":"0000000000000001","name":"variable-a","selected":["b"],"arguments":{"type":"constant","values":["a","b"]},"labels":[{"id":"fc3dc670a4be9b9a","name":"label","properties":{"color": "fff000"}}],"links":{"self":"/api/v2/variables/6162207574726f71","org":"/api/v2/orgs/0000000000000001","labels":"/api/v2/variables/6162207574726f71/labels"}}],"links":{"self":"/api/v2/variables?descending=false&limit=20&offset=0&orgID=0000000000000001"}}` ,
234
+ body : `{
235
+ "links": {
236
+ "self": "/api/v2/variables?descending=false&limit=20&offset=0&orgID=0000000000000001"
237
+ },
238
+ "variables": [
239
+ {
240
+ "arguments": {
241
+ "type": "constant",
242
+ "values": [
243
+ "a",
244
+ "b"
245
+ ]
246
+ },
247
+ "description": "",
248
+ "id": "6162207574726f71",
249
+ "labels": [
250
+ {
251
+ "id": "fc3dc670a4be9b9a",
252
+ "name": "label",
253
+ "properties": {
254
+ "color": "fff000"
255
+ }
256
+ }
257
+ ],
258
+ "links": {
259
+ "labels": "/api/v2/variables/6162207574726f71/labels",
260
+ "org": "/api/v2/orgs/0000000000000001",
261
+ "self": "/api/v2/variables/6162207574726f71"
262
+ },
263
+ "name": "variable-a",
264
+ "orgID": "0000000000000001",
265
+ "selected": [
266
+ "b"
267
+ ]
268
+ }
269
+ ]
270
+ }` ,
169
271
},
170
272
},
171
273
}
@@ -251,7 +353,7 @@ func TestVariableService_handleGetVariable(t *testing.T) {
251
353
wants : wants {
252
354
statusCode : 200 ,
253
355
contentType : "application/json; charset=utf-8" ,
254
- body : `{"id":"75650d0a636f6d70","orgID":"0000000000000001","name":"variable-a","selected":["b"],"arguments":{"type":"constant","values":["a","b"]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000001"}}
356
+ body : `{"id":"75650d0a636f6d70","orgID":"0000000000000001","name":"variable-a","description":""," selected":["b"],"arguments":{"type":"constant","values":["a","b"]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000001"}}
255
357
` ,
256
358
},
257
359
},
@@ -384,7 +486,7 @@ func TestVariableService_handlePostVariable(t *testing.T) {
384
486
wants : wants {
385
487
statusCode : 201 ,
386
488
contentType : "application/json; charset=utf-8" ,
387
- body : `{"id":"75650d0a636f6d70","orgID":"0000000000000001","name":"my-great-variable","selected":["'foo'"],"arguments":{"type":"constant","values":["bar","foo"]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000001"}}
489
+ body : `{"id":"75650d0a636f6d70","orgID":"0000000000000001","name":"my-great-variable","description":""," selected":["'foo'"],"arguments":{"type":"constant","values":["bar","foo"]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000001"}}
388
490
` ,
389
491
},
390
492
},
@@ -501,7 +603,7 @@ func TestVariableService_handlePatchVariable(t *testing.T) {
501
603
wants : wants {
502
604
statusCode : 200 ,
503
605
contentType : "application/json; charset=utf-8" ,
504
- body : `{"id":"75650d0a636f6d70","orgID":"0000000000000002","name":"new-name","selected":[],"arguments":{"type":"constant","values":[]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000002"}}
606
+ body : `{"id":"75650d0a636f6d70","orgID":"0000000000000002","name":"new-name","description":""," selected":[],"arguments":{"type":"constant","values":[]},"labels":[],"links":{"self":"/api/v2/variables/75650d0a636f6d70","labels":"/api/v2/variables/75650d0a636f6d70/labels","org":"/api/v2/orgs/0000000000000002"}}
505
607
` ,
506
608
},
507
609
},
0 commit comments