OLD | NEW |
| (Empty) |
1 library googleapis_beta.resourceviews.v1beta1.test; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import 'package:http/http.dart' as http; | |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:unittest/unittest.dart' as unittest; | |
11 import 'package:googleapis_beta/common/common.dart' as common; | |
12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; | |
13 import '../common/common_internal_test.dart' as common_test; | |
14 | |
15 import 'package:googleapis_beta/resourceviews/v1beta1.dart' as api; | |
16 | |
17 | |
18 | |
19 core.int buildCounterLabel = 0; | |
20 buildLabel() { | |
21 var o = new api.Label(); | |
22 buildCounterLabel++; | |
23 if (buildCounterLabel < 3) { | |
24 o.key = "foo"; | |
25 o.value = "foo"; | |
26 } | |
27 buildCounterLabel--; | |
28 return o; | |
29 } | |
30 | |
31 checkLabel(api.Label o) { | |
32 buildCounterLabel++; | |
33 if (buildCounterLabel < 3) { | |
34 unittest.expect(o.key, unittest.equals('foo')); | |
35 unittest.expect(o.value, unittest.equals('foo')); | |
36 } | |
37 buildCounterLabel--; | |
38 } | |
39 | |
40 buildUnnamed1110() { | |
41 var o = new core.List<core.String>(); | |
42 o.add("foo"); | |
43 o.add("foo"); | |
44 return o; | |
45 } | |
46 | |
47 checkUnnamed1110(core.List<core.String> o) { | |
48 unittest.expect(o, unittest.hasLength(2)); | |
49 unittest.expect(o[0], unittest.equals('foo')); | |
50 unittest.expect(o[1], unittest.equals('foo')); | |
51 } | |
52 | |
53 core.int buildCounterRegionViewsAddResourcesRequest = 0; | |
54 buildRegionViewsAddResourcesRequest() { | |
55 var o = new api.RegionViewsAddResourcesRequest(); | |
56 buildCounterRegionViewsAddResourcesRequest++; | |
57 if (buildCounterRegionViewsAddResourcesRequest < 3) { | |
58 o.resources = buildUnnamed1110(); | |
59 } | |
60 buildCounterRegionViewsAddResourcesRequest--; | |
61 return o; | |
62 } | |
63 | |
64 checkRegionViewsAddResourcesRequest(api.RegionViewsAddResourcesRequest o) { | |
65 buildCounterRegionViewsAddResourcesRequest++; | |
66 if (buildCounterRegionViewsAddResourcesRequest < 3) { | |
67 checkUnnamed1110(o.resources); | |
68 } | |
69 buildCounterRegionViewsAddResourcesRequest--; | |
70 } | |
71 | |
72 core.int buildCounterRegionViewsInsertResponse = 0; | |
73 buildRegionViewsInsertResponse() { | |
74 var o = new api.RegionViewsInsertResponse(); | |
75 buildCounterRegionViewsInsertResponse++; | |
76 if (buildCounterRegionViewsInsertResponse < 3) { | |
77 o.resource = buildResourceView(); | |
78 } | |
79 buildCounterRegionViewsInsertResponse--; | |
80 return o; | |
81 } | |
82 | |
83 checkRegionViewsInsertResponse(api.RegionViewsInsertResponse o) { | |
84 buildCounterRegionViewsInsertResponse++; | |
85 if (buildCounterRegionViewsInsertResponse < 3) { | |
86 checkResourceView(o.resource); | |
87 } | |
88 buildCounterRegionViewsInsertResponse--; | |
89 } | |
90 | |
91 buildUnnamed1111() { | |
92 var o = new core.List<core.String>(); | |
93 o.add("foo"); | |
94 o.add("foo"); | |
95 return o; | |
96 } | |
97 | |
98 checkUnnamed1111(core.List<core.String> o) { | |
99 unittest.expect(o, unittest.hasLength(2)); | |
100 unittest.expect(o[0], unittest.equals('foo')); | |
101 unittest.expect(o[1], unittest.equals('foo')); | |
102 } | |
103 | |
104 core.int buildCounterRegionViewsListResourcesResponse = 0; | |
105 buildRegionViewsListResourcesResponse() { | |
106 var o = new api.RegionViewsListResourcesResponse(); | |
107 buildCounterRegionViewsListResourcesResponse++; | |
108 if (buildCounterRegionViewsListResourcesResponse < 3) { | |
109 o.members = buildUnnamed1111(); | |
110 o.nextPageToken = "foo"; | |
111 } | |
112 buildCounterRegionViewsListResourcesResponse--; | |
113 return o; | |
114 } | |
115 | |
116 checkRegionViewsListResourcesResponse(api.RegionViewsListResourcesResponse o) { | |
117 buildCounterRegionViewsListResourcesResponse++; | |
118 if (buildCounterRegionViewsListResourcesResponse < 3) { | |
119 checkUnnamed1111(o.members); | |
120 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
121 } | |
122 buildCounterRegionViewsListResourcesResponse--; | |
123 } | |
124 | |
125 buildUnnamed1112() { | |
126 var o = new core.List<api.ResourceView>(); | |
127 o.add(buildResourceView()); | |
128 o.add(buildResourceView()); | |
129 return o; | |
130 } | |
131 | |
132 checkUnnamed1112(core.List<api.ResourceView> o) { | |
133 unittest.expect(o, unittest.hasLength(2)); | |
134 checkResourceView(o[0]); | |
135 checkResourceView(o[1]); | |
136 } | |
137 | |
138 core.int buildCounterRegionViewsListResponse = 0; | |
139 buildRegionViewsListResponse() { | |
140 var o = new api.RegionViewsListResponse(); | |
141 buildCounterRegionViewsListResponse++; | |
142 if (buildCounterRegionViewsListResponse < 3) { | |
143 o.nextPageToken = "foo"; | |
144 o.resourceViews = buildUnnamed1112(); | |
145 } | |
146 buildCounterRegionViewsListResponse--; | |
147 return o; | |
148 } | |
149 | |
150 checkRegionViewsListResponse(api.RegionViewsListResponse o) { | |
151 buildCounterRegionViewsListResponse++; | |
152 if (buildCounterRegionViewsListResponse < 3) { | |
153 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
154 checkUnnamed1112(o.resourceViews); | |
155 } | |
156 buildCounterRegionViewsListResponse--; | |
157 } | |
158 | |
159 buildUnnamed1113() { | |
160 var o = new core.List<core.String>(); | |
161 o.add("foo"); | |
162 o.add("foo"); | |
163 return o; | |
164 } | |
165 | |
166 checkUnnamed1113(core.List<core.String> o) { | |
167 unittest.expect(o, unittest.hasLength(2)); | |
168 unittest.expect(o[0], unittest.equals('foo')); | |
169 unittest.expect(o[1], unittest.equals('foo')); | |
170 } | |
171 | |
172 core.int buildCounterRegionViewsRemoveResourcesRequest = 0; | |
173 buildRegionViewsRemoveResourcesRequest() { | |
174 var o = new api.RegionViewsRemoveResourcesRequest(); | |
175 buildCounterRegionViewsRemoveResourcesRequest++; | |
176 if (buildCounterRegionViewsRemoveResourcesRequest < 3) { | |
177 o.resources = buildUnnamed1113(); | |
178 } | |
179 buildCounterRegionViewsRemoveResourcesRequest--; | |
180 return o; | |
181 } | |
182 | |
183 checkRegionViewsRemoveResourcesRequest(api.RegionViewsRemoveResourcesRequest o)
{ | |
184 buildCounterRegionViewsRemoveResourcesRequest++; | |
185 if (buildCounterRegionViewsRemoveResourcesRequest < 3) { | |
186 checkUnnamed1113(o.resources); | |
187 } | |
188 buildCounterRegionViewsRemoveResourcesRequest--; | |
189 } | |
190 | |
191 buildUnnamed1114() { | |
192 var o = new core.List<api.Label>(); | |
193 o.add(buildLabel()); | |
194 o.add(buildLabel()); | |
195 return o; | |
196 } | |
197 | |
198 checkUnnamed1114(core.List<api.Label> o) { | |
199 unittest.expect(o, unittest.hasLength(2)); | |
200 checkLabel(o[0]); | |
201 checkLabel(o[1]); | |
202 } | |
203 | |
204 buildUnnamed1115() { | |
205 var o = new core.List<core.String>(); | |
206 o.add("foo"); | |
207 o.add("foo"); | |
208 return o; | |
209 } | |
210 | |
211 checkUnnamed1115(core.List<core.String> o) { | |
212 unittest.expect(o, unittest.hasLength(2)); | |
213 unittest.expect(o[0], unittest.equals('foo')); | |
214 unittest.expect(o[1], unittest.equals('foo')); | |
215 } | |
216 | |
217 core.int buildCounterResourceView = 0; | |
218 buildResourceView() { | |
219 var o = new api.ResourceView(); | |
220 buildCounterResourceView++; | |
221 if (buildCounterResourceView < 3) { | |
222 o.creationTime = "foo"; | |
223 o.description = "foo"; | |
224 o.id = "foo"; | |
225 o.kind = "foo"; | |
226 o.labels = buildUnnamed1114(); | |
227 o.lastModified = "foo"; | |
228 o.members = buildUnnamed1115(); | |
229 o.name = "foo"; | |
230 o.numMembers = 42; | |
231 o.selfLink = "foo"; | |
232 } | |
233 buildCounterResourceView--; | |
234 return o; | |
235 } | |
236 | |
237 checkResourceView(api.ResourceView o) { | |
238 buildCounterResourceView++; | |
239 if (buildCounterResourceView < 3) { | |
240 unittest.expect(o.creationTime, unittest.equals('foo')); | |
241 unittest.expect(o.description, unittest.equals('foo')); | |
242 unittest.expect(o.id, unittest.equals('foo')); | |
243 unittest.expect(o.kind, unittest.equals('foo')); | |
244 checkUnnamed1114(o.labels); | |
245 unittest.expect(o.lastModified, unittest.equals('foo')); | |
246 checkUnnamed1115(o.members); | |
247 unittest.expect(o.name, unittest.equals('foo')); | |
248 unittest.expect(o.numMembers, unittest.equals(42)); | |
249 unittest.expect(o.selfLink, unittest.equals('foo')); | |
250 } | |
251 buildCounterResourceView--; | |
252 } | |
253 | |
254 buildUnnamed1116() { | |
255 var o = new core.List<core.String>(); | |
256 o.add("foo"); | |
257 o.add("foo"); | |
258 return o; | |
259 } | |
260 | |
261 checkUnnamed1116(core.List<core.String> o) { | |
262 unittest.expect(o, unittest.hasLength(2)); | |
263 unittest.expect(o[0], unittest.equals('foo')); | |
264 unittest.expect(o[1], unittest.equals('foo')); | |
265 } | |
266 | |
267 core.int buildCounterZoneViewsAddResourcesRequest = 0; | |
268 buildZoneViewsAddResourcesRequest() { | |
269 var o = new api.ZoneViewsAddResourcesRequest(); | |
270 buildCounterZoneViewsAddResourcesRequest++; | |
271 if (buildCounterZoneViewsAddResourcesRequest < 3) { | |
272 o.resources = buildUnnamed1116(); | |
273 } | |
274 buildCounterZoneViewsAddResourcesRequest--; | |
275 return o; | |
276 } | |
277 | |
278 checkZoneViewsAddResourcesRequest(api.ZoneViewsAddResourcesRequest o) { | |
279 buildCounterZoneViewsAddResourcesRequest++; | |
280 if (buildCounterZoneViewsAddResourcesRequest < 3) { | |
281 checkUnnamed1116(o.resources); | |
282 } | |
283 buildCounterZoneViewsAddResourcesRequest--; | |
284 } | |
285 | |
286 core.int buildCounterZoneViewsInsertResponse = 0; | |
287 buildZoneViewsInsertResponse() { | |
288 var o = new api.ZoneViewsInsertResponse(); | |
289 buildCounterZoneViewsInsertResponse++; | |
290 if (buildCounterZoneViewsInsertResponse < 3) { | |
291 o.resource = buildResourceView(); | |
292 } | |
293 buildCounterZoneViewsInsertResponse--; | |
294 return o; | |
295 } | |
296 | |
297 checkZoneViewsInsertResponse(api.ZoneViewsInsertResponse o) { | |
298 buildCounterZoneViewsInsertResponse++; | |
299 if (buildCounterZoneViewsInsertResponse < 3) { | |
300 checkResourceView(o.resource); | |
301 } | |
302 buildCounterZoneViewsInsertResponse--; | |
303 } | |
304 | |
305 buildUnnamed1117() { | |
306 var o = new core.List<core.String>(); | |
307 o.add("foo"); | |
308 o.add("foo"); | |
309 return o; | |
310 } | |
311 | |
312 checkUnnamed1117(core.List<core.String> o) { | |
313 unittest.expect(o, unittest.hasLength(2)); | |
314 unittest.expect(o[0], unittest.equals('foo')); | |
315 unittest.expect(o[1], unittest.equals('foo')); | |
316 } | |
317 | |
318 core.int buildCounterZoneViewsListResourcesResponse = 0; | |
319 buildZoneViewsListResourcesResponse() { | |
320 var o = new api.ZoneViewsListResourcesResponse(); | |
321 buildCounterZoneViewsListResourcesResponse++; | |
322 if (buildCounterZoneViewsListResourcesResponse < 3) { | |
323 o.members = buildUnnamed1117(); | |
324 o.nextPageToken = "foo"; | |
325 } | |
326 buildCounterZoneViewsListResourcesResponse--; | |
327 return o; | |
328 } | |
329 | |
330 checkZoneViewsListResourcesResponse(api.ZoneViewsListResourcesResponse o) { | |
331 buildCounterZoneViewsListResourcesResponse++; | |
332 if (buildCounterZoneViewsListResourcesResponse < 3) { | |
333 checkUnnamed1117(o.members); | |
334 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
335 } | |
336 buildCounterZoneViewsListResourcesResponse--; | |
337 } | |
338 | |
339 buildUnnamed1118() { | |
340 var o = new core.List<api.ResourceView>(); | |
341 o.add(buildResourceView()); | |
342 o.add(buildResourceView()); | |
343 return o; | |
344 } | |
345 | |
346 checkUnnamed1118(core.List<api.ResourceView> o) { | |
347 unittest.expect(o, unittest.hasLength(2)); | |
348 checkResourceView(o[0]); | |
349 checkResourceView(o[1]); | |
350 } | |
351 | |
352 core.int buildCounterZoneViewsListResponse = 0; | |
353 buildZoneViewsListResponse() { | |
354 var o = new api.ZoneViewsListResponse(); | |
355 buildCounterZoneViewsListResponse++; | |
356 if (buildCounterZoneViewsListResponse < 3) { | |
357 o.nextPageToken = "foo"; | |
358 o.resourceViews = buildUnnamed1118(); | |
359 } | |
360 buildCounterZoneViewsListResponse--; | |
361 return o; | |
362 } | |
363 | |
364 checkZoneViewsListResponse(api.ZoneViewsListResponse o) { | |
365 buildCounterZoneViewsListResponse++; | |
366 if (buildCounterZoneViewsListResponse < 3) { | |
367 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
368 checkUnnamed1118(o.resourceViews); | |
369 } | |
370 buildCounterZoneViewsListResponse--; | |
371 } | |
372 | |
373 buildUnnamed1119() { | |
374 var o = new core.List<core.String>(); | |
375 o.add("foo"); | |
376 o.add("foo"); | |
377 return o; | |
378 } | |
379 | |
380 checkUnnamed1119(core.List<core.String> o) { | |
381 unittest.expect(o, unittest.hasLength(2)); | |
382 unittest.expect(o[0], unittest.equals('foo')); | |
383 unittest.expect(o[1], unittest.equals('foo')); | |
384 } | |
385 | |
386 core.int buildCounterZoneViewsRemoveResourcesRequest = 0; | |
387 buildZoneViewsRemoveResourcesRequest() { | |
388 var o = new api.ZoneViewsRemoveResourcesRequest(); | |
389 buildCounterZoneViewsRemoveResourcesRequest++; | |
390 if (buildCounterZoneViewsRemoveResourcesRequest < 3) { | |
391 o.resources = buildUnnamed1119(); | |
392 } | |
393 buildCounterZoneViewsRemoveResourcesRequest--; | |
394 return o; | |
395 } | |
396 | |
397 checkZoneViewsRemoveResourcesRequest(api.ZoneViewsRemoveResourcesRequest o) { | |
398 buildCounterZoneViewsRemoveResourcesRequest++; | |
399 if (buildCounterZoneViewsRemoveResourcesRequest < 3) { | |
400 checkUnnamed1119(o.resources); | |
401 } | |
402 buildCounterZoneViewsRemoveResourcesRequest--; | |
403 } | |
404 | |
405 | |
406 main() { | |
407 unittest.group("obj-schema-Label", () { | |
408 unittest.test("to-json--from-json", () { | |
409 var o = buildLabel(); | |
410 var od = new api.Label.fromJson(o.toJson()); | |
411 checkLabel(od); | |
412 }); | |
413 }); | |
414 | |
415 | |
416 unittest.group("obj-schema-RegionViewsAddResourcesRequest", () { | |
417 unittest.test("to-json--from-json", () { | |
418 var o = buildRegionViewsAddResourcesRequest(); | |
419 var od = new api.RegionViewsAddResourcesRequest.fromJson(o.toJson()); | |
420 checkRegionViewsAddResourcesRequest(od); | |
421 }); | |
422 }); | |
423 | |
424 | |
425 unittest.group("obj-schema-RegionViewsInsertResponse", () { | |
426 unittest.test("to-json--from-json", () { | |
427 var o = buildRegionViewsInsertResponse(); | |
428 var od = new api.RegionViewsInsertResponse.fromJson(o.toJson()); | |
429 checkRegionViewsInsertResponse(od); | |
430 }); | |
431 }); | |
432 | |
433 | |
434 unittest.group("obj-schema-RegionViewsListResourcesResponse", () { | |
435 unittest.test("to-json--from-json", () { | |
436 var o = buildRegionViewsListResourcesResponse(); | |
437 var od = new api.RegionViewsListResourcesResponse.fromJson(o.toJson()); | |
438 checkRegionViewsListResourcesResponse(od); | |
439 }); | |
440 }); | |
441 | |
442 | |
443 unittest.group("obj-schema-RegionViewsListResponse", () { | |
444 unittest.test("to-json--from-json", () { | |
445 var o = buildRegionViewsListResponse(); | |
446 var od = new api.RegionViewsListResponse.fromJson(o.toJson()); | |
447 checkRegionViewsListResponse(od); | |
448 }); | |
449 }); | |
450 | |
451 | |
452 unittest.group("obj-schema-RegionViewsRemoveResourcesRequest", () { | |
453 unittest.test("to-json--from-json", () { | |
454 var o = buildRegionViewsRemoveResourcesRequest(); | |
455 var od = new api.RegionViewsRemoveResourcesRequest.fromJson(o.toJson()); | |
456 checkRegionViewsRemoveResourcesRequest(od); | |
457 }); | |
458 }); | |
459 | |
460 | |
461 unittest.group("obj-schema-ResourceView", () { | |
462 unittest.test("to-json--from-json", () { | |
463 var o = buildResourceView(); | |
464 var od = new api.ResourceView.fromJson(o.toJson()); | |
465 checkResourceView(od); | |
466 }); | |
467 }); | |
468 | |
469 | |
470 unittest.group("obj-schema-ZoneViewsAddResourcesRequest", () { | |
471 unittest.test("to-json--from-json", () { | |
472 var o = buildZoneViewsAddResourcesRequest(); | |
473 var od = new api.ZoneViewsAddResourcesRequest.fromJson(o.toJson()); | |
474 checkZoneViewsAddResourcesRequest(od); | |
475 }); | |
476 }); | |
477 | |
478 | |
479 unittest.group("obj-schema-ZoneViewsInsertResponse", () { | |
480 unittest.test("to-json--from-json", () { | |
481 var o = buildZoneViewsInsertResponse(); | |
482 var od = new api.ZoneViewsInsertResponse.fromJson(o.toJson()); | |
483 checkZoneViewsInsertResponse(od); | |
484 }); | |
485 }); | |
486 | |
487 | |
488 unittest.group("obj-schema-ZoneViewsListResourcesResponse", () { | |
489 unittest.test("to-json--from-json", () { | |
490 var o = buildZoneViewsListResourcesResponse(); | |
491 var od = new api.ZoneViewsListResourcesResponse.fromJson(o.toJson()); | |
492 checkZoneViewsListResourcesResponse(od); | |
493 }); | |
494 }); | |
495 | |
496 | |
497 unittest.group("obj-schema-ZoneViewsListResponse", () { | |
498 unittest.test("to-json--from-json", () { | |
499 var o = buildZoneViewsListResponse(); | |
500 var od = new api.ZoneViewsListResponse.fromJson(o.toJson()); | |
501 checkZoneViewsListResponse(od); | |
502 }); | |
503 }); | |
504 | |
505 | |
506 unittest.group("obj-schema-ZoneViewsRemoveResourcesRequest", () { | |
507 unittest.test("to-json--from-json", () { | |
508 var o = buildZoneViewsRemoveResourcesRequest(); | |
509 var od = new api.ZoneViewsRemoveResourcesRequest.fromJson(o.toJson()); | |
510 checkZoneViewsRemoveResourcesRequest(od); | |
511 }); | |
512 }); | |
513 | |
514 | |
515 unittest.group("resource-RegionViewsResourceApi", () { | |
516 unittest.test("method--addresources", () { | |
517 | |
518 var mock = new common_test.HttpServerMock(); | |
519 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
520 var arg_request = buildRegionViewsAddResourcesRequest(); | |
521 var arg_projectName = "foo"; | |
522 var arg_region = "foo"; | |
523 var arg_resourceViewName = "foo"; | |
524 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
525 var obj = new api.RegionViewsAddResourcesRequest.fromJson(json); | |
526 checkRegionViewsAddResourcesRequest(obj); | |
527 | |
528 var path = (req.url).path; | |
529 var pathOffset = 0; | |
530 var index; | |
531 var subPart; | |
532 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
533 pathOffset += 1; | |
534 | |
535 var query = (req.url).query; | |
536 var queryOffset = 0; | |
537 var queryMap = {}; | |
538 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
539 parseBool(n) { | |
540 if (n == "true") return true; | |
541 if (n == "false") return false; | |
542 if (n == null) return null; | |
543 throw new core.ArgumentError("Invalid boolean: $n"); | |
544 } | |
545 if (query.length > 0) { | |
546 for (var part in query.split("&")) { | |
547 var keyvalue = part.split("="); | |
548 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
549 } | |
550 } | |
551 | |
552 | |
553 var h = { | |
554 "content-type" : "application/json; charset=utf-8", | |
555 }; | |
556 var resp = ""; | |
557 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
558 }), true); | |
559 res.addresources(arg_request, arg_projectName, arg_region, arg_resourceVie
wName).then(unittest.expectAsync((_) {})); | |
560 }); | |
561 | |
562 unittest.test("method--delete", () { | |
563 | |
564 var mock = new common_test.HttpServerMock(); | |
565 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
566 var arg_projectName = "foo"; | |
567 var arg_region = "foo"; | |
568 var arg_resourceViewName = "foo"; | |
569 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
570 var path = (req.url).path; | |
571 var pathOffset = 0; | |
572 var index; | |
573 var subPart; | |
574 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
575 pathOffset += 1; | |
576 | |
577 var query = (req.url).query; | |
578 var queryOffset = 0; | |
579 var queryMap = {}; | |
580 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
581 parseBool(n) { | |
582 if (n == "true") return true; | |
583 if (n == "false") return false; | |
584 if (n == null) return null; | |
585 throw new core.ArgumentError("Invalid boolean: $n"); | |
586 } | |
587 if (query.length > 0) { | |
588 for (var part in query.split("&")) { | |
589 var keyvalue = part.split("="); | |
590 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
591 } | |
592 } | |
593 | |
594 | |
595 var h = { | |
596 "content-type" : "application/json; charset=utf-8", | |
597 }; | |
598 var resp = ""; | |
599 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
600 }), true); | |
601 res.delete(arg_projectName, arg_region, arg_resourceViewName).then(unittes
t.expectAsync((_) {})); | |
602 }); | |
603 | |
604 unittest.test("method--get", () { | |
605 | |
606 var mock = new common_test.HttpServerMock(); | |
607 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
608 var arg_projectName = "foo"; | |
609 var arg_region = "foo"; | |
610 var arg_resourceViewName = "foo"; | |
611 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
612 var path = (req.url).path; | |
613 var pathOffset = 0; | |
614 var index; | |
615 var subPart; | |
616 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
617 pathOffset += 1; | |
618 | |
619 var query = (req.url).query; | |
620 var queryOffset = 0; | |
621 var queryMap = {}; | |
622 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
623 parseBool(n) { | |
624 if (n == "true") return true; | |
625 if (n == "false") return false; | |
626 if (n == null) return null; | |
627 throw new core.ArgumentError("Invalid boolean: $n"); | |
628 } | |
629 if (query.length > 0) { | |
630 for (var part in query.split("&")) { | |
631 var keyvalue = part.split("="); | |
632 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
633 } | |
634 } | |
635 | |
636 | |
637 var h = { | |
638 "content-type" : "application/json; charset=utf-8", | |
639 }; | |
640 var resp = convert.JSON.encode(buildResourceView()); | |
641 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
642 }), true); | |
643 res.get(arg_projectName, arg_region, arg_resourceViewName).then(unittest.e
xpectAsync(((api.ResourceView response) { | |
644 checkResourceView(response); | |
645 }))); | |
646 }); | |
647 | |
648 unittest.test("method--insert", () { | |
649 | |
650 var mock = new common_test.HttpServerMock(); | |
651 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
652 var arg_request = buildResourceView(); | |
653 var arg_projectName = "foo"; | |
654 var arg_region = "foo"; | |
655 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
656 var obj = new api.ResourceView.fromJson(json); | |
657 checkResourceView(obj); | |
658 | |
659 var path = (req.url).path; | |
660 var pathOffset = 0; | |
661 var index; | |
662 var subPart; | |
663 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
664 pathOffset += 1; | |
665 | |
666 var query = (req.url).query; | |
667 var queryOffset = 0; | |
668 var queryMap = {}; | |
669 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
670 parseBool(n) { | |
671 if (n == "true") return true; | |
672 if (n == "false") return false; | |
673 if (n == null) return null; | |
674 throw new core.ArgumentError("Invalid boolean: $n"); | |
675 } | |
676 if (query.length > 0) { | |
677 for (var part in query.split("&")) { | |
678 var keyvalue = part.split("="); | |
679 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
680 } | |
681 } | |
682 | |
683 | |
684 var h = { | |
685 "content-type" : "application/json; charset=utf-8", | |
686 }; | |
687 var resp = convert.JSON.encode(buildRegionViewsInsertResponse()); | |
688 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
689 }), true); | |
690 res.insert(arg_request, arg_projectName, arg_region).then(unittest.expectA
sync(((api.RegionViewsInsertResponse response) { | |
691 checkRegionViewsInsertResponse(response); | |
692 }))); | |
693 }); | |
694 | |
695 unittest.test("method--list", () { | |
696 | |
697 var mock = new common_test.HttpServerMock(); | |
698 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
699 var arg_projectName = "foo"; | |
700 var arg_region = "foo"; | |
701 var arg_maxResults = 42; | |
702 var arg_pageToken = "foo"; | |
703 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
704 var path = (req.url).path; | |
705 var pathOffset = 0; | |
706 var index; | |
707 var subPart; | |
708 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
709 pathOffset += 1; | |
710 | |
711 var query = (req.url).query; | |
712 var queryOffset = 0; | |
713 var queryMap = {}; | |
714 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
715 parseBool(n) { | |
716 if (n == "true") return true; | |
717 if (n == "false") return false; | |
718 if (n == null) return null; | |
719 throw new core.ArgumentError("Invalid boolean: $n"); | |
720 } | |
721 if (query.length > 0) { | |
722 for (var part in query.split("&")) { | |
723 var keyvalue = part.split("="); | |
724 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
725 } | |
726 } | |
727 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
728 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
729 | |
730 | |
731 var h = { | |
732 "content-type" : "application/json; charset=utf-8", | |
733 }; | |
734 var resp = convert.JSON.encode(buildRegionViewsListResponse()); | |
735 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
736 }), true); | |
737 res.list(arg_projectName, arg_region, maxResults: arg_maxResults, pageToke
n: arg_pageToken).then(unittest.expectAsync(((api.RegionViewsListResponse respon
se) { | |
738 checkRegionViewsListResponse(response); | |
739 }))); | |
740 }); | |
741 | |
742 unittest.test("method--listresources", () { | |
743 | |
744 var mock = new common_test.HttpServerMock(); | |
745 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
746 var arg_projectName = "foo"; | |
747 var arg_region = "foo"; | |
748 var arg_resourceViewName = "foo"; | |
749 var arg_maxResults = 42; | |
750 var arg_pageToken = "foo"; | |
751 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
752 var path = (req.url).path; | |
753 var pathOffset = 0; | |
754 var index; | |
755 var subPart; | |
756 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
757 pathOffset += 1; | |
758 | |
759 var query = (req.url).query; | |
760 var queryOffset = 0; | |
761 var queryMap = {}; | |
762 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
763 parseBool(n) { | |
764 if (n == "true") return true; | |
765 if (n == "false") return false; | |
766 if (n == null) return null; | |
767 throw new core.ArgumentError("Invalid boolean: $n"); | |
768 } | |
769 if (query.length > 0) { | |
770 for (var part in query.split("&")) { | |
771 var keyvalue = part.split("="); | |
772 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
773 } | |
774 } | |
775 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
776 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
777 | |
778 | |
779 var h = { | |
780 "content-type" : "application/json; charset=utf-8", | |
781 }; | |
782 var resp = convert.JSON.encode(buildRegionViewsListResourcesResponse()); | |
783 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
784 }), true); | |
785 res.listresources(arg_projectName, arg_region, arg_resourceViewName, maxRe
sults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api
.RegionViewsListResourcesResponse response) { | |
786 checkRegionViewsListResourcesResponse(response); | |
787 }))); | |
788 }); | |
789 | |
790 unittest.test("method--removeresources", () { | |
791 | |
792 var mock = new common_test.HttpServerMock(); | |
793 api.RegionViewsResourceApi res = new api.ResourceviewsApi(mock).regionView
s; | |
794 var arg_request = buildRegionViewsRemoveResourcesRequest(); | |
795 var arg_projectName = "foo"; | |
796 var arg_region = "foo"; | |
797 var arg_resourceViewName = "foo"; | |
798 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
799 var obj = new api.RegionViewsRemoveResourcesRequest.fromJson(json); | |
800 checkRegionViewsRemoveResourcesRequest(obj); | |
801 | |
802 var path = (req.url).path; | |
803 var pathOffset = 0; | |
804 var index; | |
805 var subPart; | |
806 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
807 pathOffset += 1; | |
808 | |
809 var query = (req.url).query; | |
810 var queryOffset = 0; | |
811 var queryMap = {}; | |
812 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
813 parseBool(n) { | |
814 if (n == "true") return true; | |
815 if (n == "false") return false; | |
816 if (n == null) return null; | |
817 throw new core.ArgumentError("Invalid boolean: $n"); | |
818 } | |
819 if (query.length > 0) { | |
820 for (var part in query.split("&")) { | |
821 var keyvalue = part.split("="); | |
822 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
823 } | |
824 } | |
825 | |
826 | |
827 var h = { | |
828 "content-type" : "application/json; charset=utf-8", | |
829 }; | |
830 var resp = ""; | |
831 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
832 }), true); | |
833 res.removeresources(arg_request, arg_projectName, arg_region, arg_resource
ViewName).then(unittest.expectAsync((_) {})); | |
834 }); | |
835 | |
836 }); | |
837 | |
838 | |
839 unittest.group("resource-ZoneViewsResourceApi", () { | |
840 unittest.test("method--addresources", () { | |
841 | |
842 var mock = new common_test.HttpServerMock(); | |
843 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
844 var arg_request = buildZoneViewsAddResourcesRequest(); | |
845 var arg_projectName = "foo"; | |
846 var arg_zone = "foo"; | |
847 var arg_resourceViewName = "foo"; | |
848 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
849 var obj = new api.ZoneViewsAddResourcesRequest.fromJson(json); | |
850 checkZoneViewsAddResourcesRequest(obj); | |
851 | |
852 var path = (req.url).path; | |
853 var pathOffset = 0; | |
854 var index; | |
855 var subPart; | |
856 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
857 pathOffset += 1; | |
858 | |
859 var query = (req.url).query; | |
860 var queryOffset = 0; | |
861 var queryMap = {}; | |
862 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
863 parseBool(n) { | |
864 if (n == "true") return true; | |
865 if (n == "false") return false; | |
866 if (n == null) return null; | |
867 throw new core.ArgumentError("Invalid boolean: $n"); | |
868 } | |
869 if (query.length > 0) { | |
870 for (var part in query.split("&")) { | |
871 var keyvalue = part.split("="); | |
872 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
873 } | |
874 } | |
875 | |
876 | |
877 var h = { | |
878 "content-type" : "application/json; charset=utf-8", | |
879 }; | |
880 var resp = ""; | |
881 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
882 }), true); | |
883 res.addresources(arg_request, arg_projectName, arg_zone, arg_resourceViewN
ame).then(unittest.expectAsync((_) {})); | |
884 }); | |
885 | |
886 unittest.test("method--delete", () { | |
887 | |
888 var mock = new common_test.HttpServerMock(); | |
889 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
890 var arg_projectName = "foo"; | |
891 var arg_zone = "foo"; | |
892 var arg_resourceViewName = "foo"; | |
893 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
894 var path = (req.url).path; | |
895 var pathOffset = 0; | |
896 var index; | |
897 var subPart; | |
898 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
899 pathOffset += 1; | |
900 | |
901 var query = (req.url).query; | |
902 var queryOffset = 0; | |
903 var queryMap = {}; | |
904 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
905 parseBool(n) { | |
906 if (n == "true") return true; | |
907 if (n == "false") return false; | |
908 if (n == null) return null; | |
909 throw new core.ArgumentError("Invalid boolean: $n"); | |
910 } | |
911 if (query.length > 0) { | |
912 for (var part in query.split("&")) { | |
913 var keyvalue = part.split("="); | |
914 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
915 } | |
916 } | |
917 | |
918 | |
919 var h = { | |
920 "content-type" : "application/json; charset=utf-8", | |
921 }; | |
922 var resp = ""; | |
923 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
924 }), true); | |
925 res.delete(arg_projectName, arg_zone, arg_resourceViewName).then(unittest.
expectAsync((_) {})); | |
926 }); | |
927 | |
928 unittest.test("method--get", () { | |
929 | |
930 var mock = new common_test.HttpServerMock(); | |
931 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
932 var arg_projectName = "foo"; | |
933 var arg_zone = "foo"; | |
934 var arg_resourceViewName = "foo"; | |
935 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
936 var path = (req.url).path; | |
937 var pathOffset = 0; | |
938 var index; | |
939 var subPart; | |
940 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
941 pathOffset += 1; | |
942 | |
943 var query = (req.url).query; | |
944 var queryOffset = 0; | |
945 var queryMap = {}; | |
946 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
947 parseBool(n) { | |
948 if (n == "true") return true; | |
949 if (n == "false") return false; | |
950 if (n == null) return null; | |
951 throw new core.ArgumentError("Invalid boolean: $n"); | |
952 } | |
953 if (query.length > 0) { | |
954 for (var part in query.split("&")) { | |
955 var keyvalue = part.split("="); | |
956 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
957 } | |
958 } | |
959 | |
960 | |
961 var h = { | |
962 "content-type" : "application/json; charset=utf-8", | |
963 }; | |
964 var resp = convert.JSON.encode(buildResourceView()); | |
965 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
966 }), true); | |
967 res.get(arg_projectName, arg_zone, arg_resourceViewName).then(unittest.exp
ectAsync(((api.ResourceView response) { | |
968 checkResourceView(response); | |
969 }))); | |
970 }); | |
971 | |
972 unittest.test("method--insert", () { | |
973 | |
974 var mock = new common_test.HttpServerMock(); | |
975 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
976 var arg_request = buildResourceView(); | |
977 var arg_projectName = "foo"; | |
978 var arg_zone = "foo"; | |
979 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
980 var obj = new api.ResourceView.fromJson(json); | |
981 checkResourceView(obj); | |
982 | |
983 var path = (req.url).path; | |
984 var pathOffset = 0; | |
985 var index; | |
986 var subPart; | |
987 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
988 pathOffset += 1; | |
989 | |
990 var query = (req.url).query; | |
991 var queryOffset = 0; | |
992 var queryMap = {}; | |
993 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
994 parseBool(n) { | |
995 if (n == "true") return true; | |
996 if (n == "false") return false; | |
997 if (n == null) return null; | |
998 throw new core.ArgumentError("Invalid boolean: $n"); | |
999 } | |
1000 if (query.length > 0) { | |
1001 for (var part in query.split("&")) { | |
1002 var keyvalue = part.split("="); | |
1003 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1004 } | |
1005 } | |
1006 | |
1007 | |
1008 var h = { | |
1009 "content-type" : "application/json; charset=utf-8", | |
1010 }; | |
1011 var resp = convert.JSON.encode(buildZoneViewsInsertResponse()); | |
1012 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1013 }), true); | |
1014 res.insert(arg_request, arg_projectName, arg_zone).then(unittest.expectAsy
nc(((api.ZoneViewsInsertResponse response) { | |
1015 checkZoneViewsInsertResponse(response); | |
1016 }))); | |
1017 }); | |
1018 | |
1019 unittest.test("method--list", () { | |
1020 | |
1021 var mock = new common_test.HttpServerMock(); | |
1022 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
1023 var arg_projectName = "foo"; | |
1024 var arg_zone = "foo"; | |
1025 var arg_maxResults = 42; | |
1026 var arg_pageToken = "foo"; | |
1027 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1028 var path = (req.url).path; | |
1029 var pathOffset = 0; | |
1030 var index; | |
1031 var subPart; | |
1032 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1033 pathOffset += 1; | |
1034 | |
1035 var query = (req.url).query; | |
1036 var queryOffset = 0; | |
1037 var queryMap = {}; | |
1038 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1039 parseBool(n) { | |
1040 if (n == "true") return true; | |
1041 if (n == "false") return false; | |
1042 if (n == null) return null; | |
1043 throw new core.ArgumentError("Invalid boolean: $n"); | |
1044 } | |
1045 if (query.length > 0) { | |
1046 for (var part in query.split("&")) { | |
1047 var keyvalue = part.split("="); | |
1048 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1049 } | |
1050 } | |
1051 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1052 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1053 | |
1054 | |
1055 var h = { | |
1056 "content-type" : "application/json; charset=utf-8", | |
1057 }; | |
1058 var resp = convert.JSON.encode(buildZoneViewsListResponse()); | |
1059 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1060 }), true); | |
1061 res.list(arg_projectName, arg_zone, maxResults: arg_maxResults, pageToken:
arg_pageToken).then(unittest.expectAsync(((api.ZoneViewsListResponse response)
{ | |
1062 checkZoneViewsListResponse(response); | |
1063 }))); | |
1064 }); | |
1065 | |
1066 unittest.test("method--listresources", () { | |
1067 | |
1068 var mock = new common_test.HttpServerMock(); | |
1069 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
1070 var arg_projectName = "foo"; | |
1071 var arg_zone = "foo"; | |
1072 var arg_resourceViewName = "foo"; | |
1073 var arg_maxResults = 42; | |
1074 var arg_pageToken = "foo"; | |
1075 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1076 var path = (req.url).path; | |
1077 var pathOffset = 0; | |
1078 var index; | |
1079 var subPart; | |
1080 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1081 pathOffset += 1; | |
1082 | |
1083 var query = (req.url).query; | |
1084 var queryOffset = 0; | |
1085 var queryMap = {}; | |
1086 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1087 parseBool(n) { | |
1088 if (n == "true") return true; | |
1089 if (n == "false") return false; | |
1090 if (n == null) return null; | |
1091 throw new core.ArgumentError("Invalid boolean: $n"); | |
1092 } | |
1093 if (query.length > 0) { | |
1094 for (var part in query.split("&")) { | |
1095 var keyvalue = part.split("="); | |
1096 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1097 } | |
1098 } | |
1099 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1100 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1101 | |
1102 | |
1103 var h = { | |
1104 "content-type" : "application/json; charset=utf-8", | |
1105 }; | |
1106 var resp = convert.JSON.encode(buildZoneViewsListResourcesResponse()); | |
1107 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1108 }), true); | |
1109 res.listresources(arg_projectName, arg_zone, arg_resourceViewName, maxResu
lts: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.Z
oneViewsListResourcesResponse response) { | |
1110 checkZoneViewsListResourcesResponse(response); | |
1111 }))); | |
1112 }); | |
1113 | |
1114 unittest.test("method--removeresources", () { | |
1115 | |
1116 var mock = new common_test.HttpServerMock(); | |
1117 api.ZoneViewsResourceApi res = new api.ResourceviewsApi(mock).zoneViews; | |
1118 var arg_request = buildZoneViewsRemoveResourcesRequest(); | |
1119 var arg_projectName = "foo"; | |
1120 var arg_zone = "foo"; | |
1121 var arg_resourceViewName = "foo"; | |
1122 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1123 var obj = new api.ZoneViewsRemoveResourcesRequest.fromJson(json); | |
1124 checkZoneViewsRemoveResourcesRequest(obj); | |
1125 | |
1126 var path = (req.url).path; | |
1127 var pathOffset = 0; | |
1128 var index; | |
1129 var subPart; | |
1130 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1131 pathOffset += 1; | |
1132 | |
1133 var query = (req.url).query; | |
1134 var queryOffset = 0; | |
1135 var queryMap = {}; | |
1136 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1137 parseBool(n) { | |
1138 if (n == "true") return true; | |
1139 if (n == "false") return false; | |
1140 if (n == null) return null; | |
1141 throw new core.ArgumentError("Invalid boolean: $n"); | |
1142 } | |
1143 if (query.length > 0) { | |
1144 for (var part in query.split("&")) { | |
1145 var keyvalue = part.split("="); | |
1146 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1147 } | |
1148 } | |
1149 | |
1150 | |
1151 var h = { | |
1152 "content-type" : "application/json; charset=utf-8", | |
1153 }; | |
1154 var resp = ""; | |
1155 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1156 }), true); | |
1157 res.removeresources(arg_request, arg_projectName, arg_zone, arg_resourceVi
ewName).then(unittest.expectAsync((_) {})); | |
1158 }); | |
1159 | |
1160 }); | |
1161 | |
1162 | |
1163 } | |
1164 | |
OLD | NEW |