OLD | NEW |
| (Empty) |
1 library googleapis_beta.manager.v1beta2.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/manager/v1beta2.dart' as api; | |
16 | |
17 | |
18 | |
19 core.int buildCounterAccessConfig = 0; | |
20 buildAccessConfig() { | |
21 var o = new api.AccessConfig(); | |
22 buildCounterAccessConfig++; | |
23 if (buildCounterAccessConfig < 3) { | |
24 o.name = "foo"; | |
25 o.natIp = "foo"; | |
26 o.type = "foo"; | |
27 } | |
28 buildCounterAccessConfig--; | |
29 return o; | |
30 } | |
31 | |
32 checkAccessConfig(api.AccessConfig o) { | |
33 buildCounterAccessConfig++; | |
34 if (buildCounterAccessConfig < 3) { | |
35 unittest.expect(o.name, unittest.equals('foo')); | |
36 unittest.expect(o.natIp, unittest.equals('foo')); | |
37 unittest.expect(o.type, unittest.equals('foo')); | |
38 } | |
39 buildCounterAccessConfig--; | |
40 } | |
41 | |
42 buildUnnamed1092() { | |
43 var o = new core.List<core.String>(); | |
44 o.add("foo"); | |
45 o.add("foo"); | |
46 return o; | |
47 } | |
48 | |
49 checkUnnamed1092(core.List<core.String> o) { | |
50 unittest.expect(o, unittest.hasLength(2)); | |
51 unittest.expect(o[0], unittest.equals('foo')); | |
52 unittest.expect(o[1], unittest.equals('foo')); | |
53 } | |
54 | |
55 core.int buildCounterAction = 0; | |
56 buildAction() { | |
57 var o = new api.Action(); | |
58 buildCounterAction++; | |
59 if (buildCounterAction < 3) { | |
60 o.commands = buildUnnamed1092(); | |
61 o.timeoutMs = 42; | |
62 } | |
63 buildCounterAction--; | |
64 return o; | |
65 } | |
66 | |
67 checkAction(api.Action o) { | |
68 buildCounterAction++; | |
69 if (buildCounterAction < 3) { | |
70 checkUnnamed1092(o.commands); | |
71 unittest.expect(o.timeoutMs, unittest.equals(42)); | |
72 } | |
73 buildCounterAction--; | |
74 } | |
75 | |
76 buildUnnamed1093() { | |
77 var o = new core.List<core.String>(); | |
78 o.add("foo"); | |
79 o.add("foo"); | |
80 return o; | |
81 } | |
82 | |
83 checkUnnamed1093(core.List<core.String> o) { | |
84 unittest.expect(o, unittest.hasLength(2)); | |
85 unittest.expect(o[0], unittest.equals('foo')); | |
86 unittest.expect(o[1], unittest.equals('foo')); | |
87 } | |
88 | |
89 core.int buildCounterAllowedRule = 0; | |
90 buildAllowedRule() { | |
91 var o = new api.AllowedRule(); | |
92 buildCounterAllowedRule++; | |
93 if (buildCounterAllowedRule < 3) { | |
94 o.IPProtocol = "foo"; | |
95 o.ports = buildUnnamed1093(); | |
96 } | |
97 buildCounterAllowedRule--; | |
98 return o; | |
99 } | |
100 | |
101 checkAllowedRule(api.AllowedRule o) { | |
102 buildCounterAllowedRule++; | |
103 if (buildCounterAllowedRule < 3) { | |
104 unittest.expect(o.IPProtocol, unittest.equals('foo')); | |
105 checkUnnamed1093(o.ports); | |
106 } | |
107 buildCounterAllowedRule--; | |
108 } | |
109 | |
110 core.int buildCounterAutoscalingModule = 0; | |
111 buildAutoscalingModule() { | |
112 var o = new api.AutoscalingModule(); | |
113 buildCounterAutoscalingModule++; | |
114 if (buildCounterAutoscalingModule < 3) { | |
115 o.coolDownPeriodSec = 42; | |
116 o.description = "foo"; | |
117 o.maxNumReplicas = 42; | |
118 o.minNumReplicas = 42; | |
119 o.signalType = "foo"; | |
120 o.targetModule = "foo"; | |
121 o.targetUtilization = 42.0; | |
122 } | |
123 buildCounterAutoscalingModule--; | |
124 return o; | |
125 } | |
126 | |
127 checkAutoscalingModule(api.AutoscalingModule o) { | |
128 buildCounterAutoscalingModule++; | |
129 if (buildCounterAutoscalingModule < 3) { | |
130 unittest.expect(o.coolDownPeriodSec, unittest.equals(42)); | |
131 unittest.expect(o.description, unittest.equals('foo')); | |
132 unittest.expect(o.maxNumReplicas, unittest.equals(42)); | |
133 unittest.expect(o.minNumReplicas, unittest.equals(42)); | |
134 unittest.expect(o.signalType, unittest.equals('foo')); | |
135 unittest.expect(o.targetModule, unittest.equals('foo')); | |
136 unittest.expect(o.targetUtilization, unittest.equals(42.0)); | |
137 } | |
138 buildCounterAutoscalingModule--; | |
139 } | |
140 | |
141 core.int buildCounterAutoscalingModuleStatus = 0; | |
142 buildAutoscalingModuleStatus() { | |
143 var o = new api.AutoscalingModuleStatus(); | |
144 buildCounterAutoscalingModuleStatus++; | |
145 if (buildCounterAutoscalingModuleStatus < 3) { | |
146 o.autoscalingConfigUrl = "foo"; | |
147 } | |
148 buildCounterAutoscalingModuleStatus--; | |
149 return o; | |
150 } | |
151 | |
152 checkAutoscalingModuleStatus(api.AutoscalingModuleStatus o) { | |
153 buildCounterAutoscalingModuleStatus++; | |
154 if (buildCounterAutoscalingModuleStatus < 3) { | |
155 unittest.expect(o.autoscalingConfigUrl, unittest.equals('foo')); | |
156 } | |
157 buildCounterAutoscalingModuleStatus--; | |
158 } | |
159 | |
160 core.int buildCounterDeployState = 0; | |
161 buildDeployState() { | |
162 var o = new api.DeployState(); | |
163 buildCounterDeployState++; | |
164 if (buildCounterDeployState < 3) { | |
165 o.details = "foo"; | |
166 o.status = "foo"; | |
167 } | |
168 buildCounterDeployState--; | |
169 return o; | |
170 } | |
171 | |
172 checkDeployState(api.DeployState o) { | |
173 buildCounterDeployState++; | |
174 if (buildCounterDeployState < 3) { | |
175 unittest.expect(o.details, unittest.equals('foo')); | |
176 unittest.expect(o.status, unittest.equals('foo')); | |
177 } | |
178 buildCounterDeployState--; | |
179 } | |
180 | |
181 buildUnnamed1094() { | |
182 var o = new core.Map<core.String, api.ModuleStatus>(); | |
183 o["x"] = buildModuleStatus(); | |
184 o["y"] = buildModuleStatus(); | |
185 return o; | |
186 } | |
187 | |
188 checkUnnamed1094(core.Map<core.String, api.ModuleStatus> o) { | |
189 unittest.expect(o, unittest.hasLength(2)); | |
190 checkModuleStatus(o["x"]); | |
191 checkModuleStatus(o["y"]); | |
192 } | |
193 | |
194 buildUnnamed1095() { | |
195 var o = new core.List<api.ParamOverride>(); | |
196 o.add(buildParamOverride()); | |
197 o.add(buildParamOverride()); | |
198 return o; | |
199 } | |
200 | |
201 checkUnnamed1095(core.List<api.ParamOverride> o) { | |
202 unittest.expect(o, unittest.hasLength(2)); | |
203 checkParamOverride(o[0]); | |
204 checkParamOverride(o[1]); | |
205 } | |
206 | |
207 core.int buildCounterDeployment = 0; | |
208 buildDeployment() { | |
209 var o = new api.Deployment(); | |
210 buildCounterDeployment++; | |
211 if (buildCounterDeployment < 3) { | |
212 o.creationDate = "foo"; | |
213 o.description = "foo"; | |
214 o.modules = buildUnnamed1094(); | |
215 o.name = "foo"; | |
216 o.overrides = buildUnnamed1095(); | |
217 o.state = buildDeployState(); | |
218 o.templateName = "foo"; | |
219 } | |
220 buildCounterDeployment--; | |
221 return o; | |
222 } | |
223 | |
224 checkDeployment(api.Deployment o) { | |
225 buildCounterDeployment++; | |
226 if (buildCounterDeployment < 3) { | |
227 unittest.expect(o.creationDate, unittest.equals('foo')); | |
228 unittest.expect(o.description, unittest.equals('foo')); | |
229 checkUnnamed1094(o.modules); | |
230 unittest.expect(o.name, unittest.equals('foo')); | |
231 checkUnnamed1095(o.overrides); | |
232 checkDeployState(o.state); | |
233 unittest.expect(o.templateName, unittest.equals('foo')); | |
234 } | |
235 buildCounterDeployment--; | |
236 } | |
237 | |
238 buildUnnamed1096() { | |
239 var o = new core.List<api.Deployment>(); | |
240 o.add(buildDeployment()); | |
241 o.add(buildDeployment()); | |
242 return o; | |
243 } | |
244 | |
245 checkUnnamed1096(core.List<api.Deployment> o) { | |
246 unittest.expect(o, unittest.hasLength(2)); | |
247 checkDeployment(o[0]); | |
248 checkDeployment(o[1]); | |
249 } | |
250 | |
251 core.int buildCounterDeploymentsListResponse = 0; | |
252 buildDeploymentsListResponse() { | |
253 var o = new api.DeploymentsListResponse(); | |
254 buildCounterDeploymentsListResponse++; | |
255 if (buildCounterDeploymentsListResponse < 3) { | |
256 o.nextPageToken = "foo"; | |
257 o.resources = buildUnnamed1096(); | |
258 } | |
259 buildCounterDeploymentsListResponse--; | |
260 return o; | |
261 } | |
262 | |
263 checkDeploymentsListResponse(api.DeploymentsListResponse o) { | |
264 buildCounterDeploymentsListResponse++; | |
265 if (buildCounterDeploymentsListResponse < 3) { | |
266 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
267 checkUnnamed1096(o.resources); | |
268 } | |
269 buildCounterDeploymentsListResponse--; | |
270 } | |
271 | |
272 core.int buildCounterDiskAttachment = 0; | |
273 buildDiskAttachment() { | |
274 var o = new api.DiskAttachment(); | |
275 buildCounterDiskAttachment++; | |
276 if (buildCounterDiskAttachment < 3) { | |
277 o.deviceName = "foo"; | |
278 o.index = 42; | |
279 } | |
280 buildCounterDiskAttachment--; | |
281 return o; | |
282 } | |
283 | |
284 checkDiskAttachment(api.DiskAttachment o) { | |
285 buildCounterDiskAttachment++; | |
286 if (buildCounterDiskAttachment < 3) { | |
287 unittest.expect(o.deviceName, unittest.equals('foo')); | |
288 unittest.expect(o.index, unittest.equals(42)); | |
289 } | |
290 buildCounterDiskAttachment--; | |
291 } | |
292 | |
293 core.int buildCounterEnvVariable = 0; | |
294 buildEnvVariable() { | |
295 var o = new api.EnvVariable(); | |
296 buildCounterEnvVariable++; | |
297 if (buildCounterEnvVariable < 3) { | |
298 o.hidden = true; | |
299 o.value = "foo"; | |
300 } | |
301 buildCounterEnvVariable--; | |
302 return o; | |
303 } | |
304 | |
305 checkEnvVariable(api.EnvVariable o) { | |
306 buildCounterEnvVariable++; | |
307 if (buildCounterEnvVariable < 3) { | |
308 unittest.expect(o.hidden, unittest.isTrue); | |
309 unittest.expect(o.value, unittest.equals('foo')); | |
310 } | |
311 buildCounterEnvVariable--; | |
312 } | |
313 | |
314 core.int buildCounterExistingDisk = 0; | |
315 buildExistingDisk() { | |
316 var o = new api.ExistingDisk(); | |
317 buildCounterExistingDisk++; | |
318 if (buildCounterExistingDisk < 3) { | |
319 o.attachment = buildDiskAttachment(); | |
320 o.source = "foo"; | |
321 } | |
322 buildCounterExistingDisk--; | |
323 return o; | |
324 } | |
325 | |
326 checkExistingDisk(api.ExistingDisk o) { | |
327 buildCounterExistingDisk++; | |
328 if (buildCounterExistingDisk < 3) { | |
329 checkDiskAttachment(o.attachment); | |
330 unittest.expect(o.source, unittest.equals('foo')); | |
331 } | |
332 buildCounterExistingDisk--; | |
333 } | |
334 | |
335 buildUnnamed1097() { | |
336 var o = new core.List<api.AllowedRule>(); | |
337 o.add(buildAllowedRule()); | |
338 o.add(buildAllowedRule()); | |
339 return o; | |
340 } | |
341 | |
342 checkUnnamed1097(core.List<api.AllowedRule> o) { | |
343 unittest.expect(o, unittest.hasLength(2)); | |
344 checkAllowedRule(o[0]); | |
345 checkAllowedRule(o[1]); | |
346 } | |
347 | |
348 buildUnnamed1098() { | |
349 var o = new core.List<core.String>(); | |
350 o.add("foo"); | |
351 o.add("foo"); | |
352 return o; | |
353 } | |
354 | |
355 checkUnnamed1098(core.List<core.String> o) { | |
356 unittest.expect(o, unittest.hasLength(2)); | |
357 unittest.expect(o[0], unittest.equals('foo')); | |
358 unittest.expect(o[1], unittest.equals('foo')); | |
359 } | |
360 | |
361 buildUnnamed1099() { | |
362 var o = new core.List<core.String>(); | |
363 o.add("foo"); | |
364 o.add("foo"); | |
365 return o; | |
366 } | |
367 | |
368 checkUnnamed1099(core.List<core.String> o) { | |
369 unittest.expect(o, unittest.hasLength(2)); | |
370 unittest.expect(o[0], unittest.equals('foo')); | |
371 unittest.expect(o[1], unittest.equals('foo')); | |
372 } | |
373 | |
374 buildUnnamed1100() { | |
375 var o = new core.List<core.String>(); | |
376 o.add("foo"); | |
377 o.add("foo"); | |
378 return o; | |
379 } | |
380 | |
381 checkUnnamed1100(core.List<core.String> o) { | |
382 unittest.expect(o, unittest.hasLength(2)); | |
383 unittest.expect(o[0], unittest.equals('foo')); | |
384 unittest.expect(o[1], unittest.equals('foo')); | |
385 } | |
386 | |
387 core.int buildCounterFirewallModule = 0; | |
388 buildFirewallModule() { | |
389 var o = new api.FirewallModule(); | |
390 buildCounterFirewallModule++; | |
391 if (buildCounterFirewallModule < 3) { | |
392 o.allowed = buildUnnamed1097(); | |
393 o.description = "foo"; | |
394 o.network = "foo"; | |
395 o.sourceRanges = buildUnnamed1098(); | |
396 o.sourceTags = buildUnnamed1099(); | |
397 o.targetTags = buildUnnamed1100(); | |
398 } | |
399 buildCounterFirewallModule--; | |
400 return o; | |
401 } | |
402 | |
403 checkFirewallModule(api.FirewallModule o) { | |
404 buildCounterFirewallModule++; | |
405 if (buildCounterFirewallModule < 3) { | |
406 checkUnnamed1097(o.allowed); | |
407 unittest.expect(o.description, unittest.equals('foo')); | |
408 unittest.expect(o.network, unittest.equals('foo')); | |
409 checkUnnamed1098(o.sourceRanges); | |
410 checkUnnamed1099(o.sourceTags); | |
411 checkUnnamed1100(o.targetTags); | |
412 } | |
413 buildCounterFirewallModule--; | |
414 } | |
415 | |
416 core.int buildCounterFirewallModuleStatus = 0; | |
417 buildFirewallModuleStatus() { | |
418 var o = new api.FirewallModuleStatus(); | |
419 buildCounterFirewallModuleStatus++; | |
420 if (buildCounterFirewallModuleStatus < 3) { | |
421 o.firewallUrl = "foo"; | |
422 } | |
423 buildCounterFirewallModuleStatus--; | |
424 return o; | |
425 } | |
426 | |
427 checkFirewallModuleStatus(api.FirewallModuleStatus o) { | |
428 buildCounterFirewallModuleStatus++; | |
429 if (buildCounterFirewallModuleStatus < 3) { | |
430 unittest.expect(o.firewallUrl, unittest.equals('foo')); | |
431 } | |
432 buildCounterFirewallModuleStatus--; | |
433 } | |
434 | |
435 core.int buildCounterHealthCheckModule = 0; | |
436 buildHealthCheckModule() { | |
437 var o = new api.HealthCheckModule(); | |
438 buildCounterHealthCheckModule++; | |
439 if (buildCounterHealthCheckModule < 3) { | |
440 o.checkIntervalSec = 42; | |
441 o.description = "foo"; | |
442 o.healthyThreshold = 42; | |
443 o.host = "foo"; | |
444 o.path = "foo"; | |
445 o.port = 42; | |
446 o.timeoutSec = 42; | |
447 o.unhealthyThreshold = 42; | |
448 } | |
449 buildCounterHealthCheckModule--; | |
450 return o; | |
451 } | |
452 | |
453 checkHealthCheckModule(api.HealthCheckModule o) { | |
454 buildCounterHealthCheckModule++; | |
455 if (buildCounterHealthCheckModule < 3) { | |
456 unittest.expect(o.checkIntervalSec, unittest.equals(42)); | |
457 unittest.expect(o.description, unittest.equals('foo')); | |
458 unittest.expect(o.healthyThreshold, unittest.equals(42)); | |
459 unittest.expect(o.host, unittest.equals('foo')); | |
460 unittest.expect(o.path, unittest.equals('foo')); | |
461 unittest.expect(o.port, unittest.equals(42)); | |
462 unittest.expect(o.timeoutSec, unittest.equals(42)); | |
463 unittest.expect(o.unhealthyThreshold, unittest.equals(42)); | |
464 } | |
465 buildCounterHealthCheckModule--; | |
466 } | |
467 | |
468 core.int buildCounterHealthCheckModuleStatus = 0; | |
469 buildHealthCheckModuleStatus() { | |
470 var o = new api.HealthCheckModuleStatus(); | |
471 buildCounterHealthCheckModuleStatus++; | |
472 if (buildCounterHealthCheckModuleStatus < 3) { | |
473 o.healthCheckUrl = "foo"; | |
474 } | |
475 buildCounterHealthCheckModuleStatus--; | |
476 return o; | |
477 } | |
478 | |
479 checkHealthCheckModuleStatus(api.HealthCheckModuleStatus o) { | |
480 buildCounterHealthCheckModuleStatus++; | |
481 if (buildCounterHealthCheckModuleStatus < 3) { | |
482 unittest.expect(o.healthCheckUrl, unittest.equals('foo')); | |
483 } | |
484 buildCounterHealthCheckModuleStatus--; | |
485 } | |
486 | |
487 buildUnnamed1101() { | |
488 var o = new core.List<core.String>(); | |
489 o.add("foo"); | |
490 o.add("foo"); | |
491 return o; | |
492 } | |
493 | |
494 checkUnnamed1101(core.List<core.String> o) { | |
495 unittest.expect(o, unittest.hasLength(2)); | |
496 unittest.expect(o[0], unittest.equals('foo')); | |
497 unittest.expect(o[1], unittest.equals('foo')); | |
498 } | |
499 | |
500 buildUnnamed1102() { | |
501 var o = new core.List<core.String>(); | |
502 o.add("foo"); | |
503 o.add("foo"); | |
504 return o; | |
505 } | |
506 | |
507 checkUnnamed1102(core.List<core.String> o) { | |
508 unittest.expect(o, unittest.hasLength(2)); | |
509 unittest.expect(o[0], unittest.equals('foo')); | |
510 unittest.expect(o[1], unittest.equals('foo')); | |
511 } | |
512 | |
513 core.int buildCounterLbModule = 0; | |
514 buildLbModule() { | |
515 var o = new api.LbModule(); | |
516 buildCounterLbModule++; | |
517 if (buildCounterLbModule < 3) { | |
518 o.description = "foo"; | |
519 o.healthChecks = buildUnnamed1101(); | |
520 o.ipAddress = "foo"; | |
521 o.ipProtocol = "foo"; | |
522 o.portRange = "foo"; | |
523 o.sessionAffinity = "foo"; | |
524 o.targetModules = buildUnnamed1102(); | |
525 } | |
526 buildCounterLbModule--; | |
527 return o; | |
528 } | |
529 | |
530 checkLbModule(api.LbModule o) { | |
531 buildCounterLbModule++; | |
532 if (buildCounterLbModule < 3) { | |
533 unittest.expect(o.description, unittest.equals('foo')); | |
534 checkUnnamed1101(o.healthChecks); | |
535 unittest.expect(o.ipAddress, unittest.equals('foo')); | |
536 unittest.expect(o.ipProtocol, unittest.equals('foo')); | |
537 unittest.expect(o.portRange, unittest.equals('foo')); | |
538 unittest.expect(o.sessionAffinity, unittest.equals('foo')); | |
539 checkUnnamed1102(o.targetModules); | |
540 } | |
541 buildCounterLbModule--; | |
542 } | |
543 | |
544 core.int buildCounterLbModuleStatus = 0; | |
545 buildLbModuleStatus() { | |
546 var o = new api.LbModuleStatus(); | |
547 buildCounterLbModuleStatus++; | |
548 if (buildCounterLbModuleStatus < 3) { | |
549 o.forwardingRuleUrl = "foo"; | |
550 o.targetPoolUrl = "foo"; | |
551 } | |
552 buildCounterLbModuleStatus--; | |
553 return o; | |
554 } | |
555 | |
556 checkLbModuleStatus(api.LbModuleStatus o) { | |
557 buildCounterLbModuleStatus++; | |
558 if (buildCounterLbModuleStatus < 3) { | |
559 unittest.expect(o.forwardingRuleUrl, unittest.equals('foo')); | |
560 unittest.expect(o.targetPoolUrl, unittest.equals('foo')); | |
561 } | |
562 buildCounterLbModuleStatus--; | |
563 } | |
564 | |
565 buildUnnamed1103() { | |
566 var o = new core.List<api.MetadataItem>(); | |
567 o.add(buildMetadataItem()); | |
568 o.add(buildMetadataItem()); | |
569 return o; | |
570 } | |
571 | |
572 checkUnnamed1103(core.List<api.MetadataItem> o) { | |
573 unittest.expect(o, unittest.hasLength(2)); | |
574 checkMetadataItem(o[0]); | |
575 checkMetadataItem(o[1]); | |
576 } | |
577 | |
578 core.int buildCounterMetadata = 0; | |
579 buildMetadata() { | |
580 var o = new api.Metadata(); | |
581 buildCounterMetadata++; | |
582 if (buildCounterMetadata < 3) { | |
583 o.fingerPrint = "foo"; | |
584 o.items = buildUnnamed1103(); | |
585 } | |
586 buildCounterMetadata--; | |
587 return o; | |
588 } | |
589 | |
590 checkMetadata(api.Metadata o) { | |
591 buildCounterMetadata++; | |
592 if (buildCounterMetadata < 3) { | |
593 unittest.expect(o.fingerPrint, unittest.equals('foo')); | |
594 checkUnnamed1103(o.items); | |
595 } | |
596 buildCounterMetadata--; | |
597 } | |
598 | |
599 core.int buildCounterMetadataItem = 0; | |
600 buildMetadataItem() { | |
601 var o = new api.MetadataItem(); | |
602 buildCounterMetadataItem++; | |
603 if (buildCounterMetadataItem < 3) { | |
604 o.key = "foo"; | |
605 o.value = "foo"; | |
606 } | |
607 buildCounterMetadataItem--; | |
608 return o; | |
609 } | |
610 | |
611 checkMetadataItem(api.MetadataItem o) { | |
612 buildCounterMetadataItem++; | |
613 if (buildCounterMetadataItem < 3) { | |
614 unittest.expect(o.key, unittest.equals('foo')); | |
615 unittest.expect(o.value, unittest.equals('foo')); | |
616 } | |
617 buildCounterMetadataItem--; | |
618 } | |
619 | |
620 core.int buildCounterModule = 0; | |
621 buildModule() { | |
622 var o = new api.Module(); | |
623 buildCounterModule++; | |
624 if (buildCounterModule < 3) { | |
625 o.autoscalingModule = buildAutoscalingModule(); | |
626 o.firewallModule = buildFirewallModule(); | |
627 o.healthCheckModule = buildHealthCheckModule(); | |
628 o.lbModule = buildLbModule(); | |
629 o.networkModule = buildNetworkModule(); | |
630 o.replicaPoolModule = buildReplicaPoolModule(); | |
631 o.type = "foo"; | |
632 } | |
633 buildCounterModule--; | |
634 return o; | |
635 } | |
636 | |
637 checkModule(api.Module o) { | |
638 buildCounterModule++; | |
639 if (buildCounterModule < 3) { | |
640 checkAutoscalingModule(o.autoscalingModule); | |
641 checkFirewallModule(o.firewallModule); | |
642 checkHealthCheckModule(o.healthCheckModule); | |
643 checkLbModule(o.lbModule); | |
644 checkNetworkModule(o.networkModule); | |
645 checkReplicaPoolModule(o.replicaPoolModule); | |
646 unittest.expect(o.type, unittest.equals('foo')); | |
647 } | |
648 buildCounterModule--; | |
649 } | |
650 | |
651 core.int buildCounterModuleStatus = 0; | |
652 buildModuleStatus() { | |
653 var o = new api.ModuleStatus(); | |
654 buildCounterModuleStatus++; | |
655 if (buildCounterModuleStatus < 3) { | |
656 o.autoscalingModuleStatus = buildAutoscalingModuleStatus(); | |
657 o.firewallModuleStatus = buildFirewallModuleStatus(); | |
658 o.healthCheckModuleStatus = buildHealthCheckModuleStatus(); | |
659 o.lbModuleStatus = buildLbModuleStatus(); | |
660 o.networkModuleStatus = buildNetworkModuleStatus(); | |
661 o.replicaPoolModuleStatus = buildReplicaPoolModuleStatus(); | |
662 o.state = buildDeployState(); | |
663 o.type = "foo"; | |
664 } | |
665 buildCounterModuleStatus--; | |
666 return o; | |
667 } | |
668 | |
669 checkModuleStatus(api.ModuleStatus o) { | |
670 buildCounterModuleStatus++; | |
671 if (buildCounterModuleStatus < 3) { | |
672 checkAutoscalingModuleStatus(o.autoscalingModuleStatus); | |
673 checkFirewallModuleStatus(o.firewallModuleStatus); | |
674 checkHealthCheckModuleStatus(o.healthCheckModuleStatus); | |
675 checkLbModuleStatus(o.lbModuleStatus); | |
676 checkNetworkModuleStatus(o.networkModuleStatus); | |
677 checkReplicaPoolModuleStatus(o.replicaPoolModuleStatus); | |
678 checkDeployState(o.state); | |
679 unittest.expect(o.type, unittest.equals('foo')); | |
680 } | |
681 buildCounterModuleStatus--; | |
682 } | |
683 | |
684 buildUnnamed1104() { | |
685 var o = new core.List<api.AccessConfig>(); | |
686 o.add(buildAccessConfig()); | |
687 o.add(buildAccessConfig()); | |
688 return o; | |
689 } | |
690 | |
691 checkUnnamed1104(core.List<api.AccessConfig> o) { | |
692 unittest.expect(o, unittest.hasLength(2)); | |
693 checkAccessConfig(o[0]); | |
694 checkAccessConfig(o[1]); | |
695 } | |
696 | |
697 core.int buildCounterNetworkInterface = 0; | |
698 buildNetworkInterface() { | |
699 var o = new api.NetworkInterface(); | |
700 buildCounterNetworkInterface++; | |
701 if (buildCounterNetworkInterface < 3) { | |
702 o.accessConfigs = buildUnnamed1104(); | |
703 o.name = "foo"; | |
704 o.network = "foo"; | |
705 o.networkIp = "foo"; | |
706 } | |
707 buildCounterNetworkInterface--; | |
708 return o; | |
709 } | |
710 | |
711 checkNetworkInterface(api.NetworkInterface o) { | |
712 buildCounterNetworkInterface++; | |
713 if (buildCounterNetworkInterface < 3) { | |
714 checkUnnamed1104(o.accessConfigs); | |
715 unittest.expect(o.name, unittest.equals('foo')); | |
716 unittest.expect(o.network, unittest.equals('foo')); | |
717 unittest.expect(o.networkIp, unittest.equals('foo')); | |
718 } | |
719 buildCounterNetworkInterface--; | |
720 } | |
721 | |
722 core.int buildCounterNetworkModule = 0; | |
723 buildNetworkModule() { | |
724 var o = new api.NetworkModule(); | |
725 buildCounterNetworkModule++; | |
726 if (buildCounterNetworkModule < 3) { | |
727 o.IPv4Range = "foo"; | |
728 o.description = "foo"; | |
729 o.gatewayIPv4 = "foo"; | |
730 } | |
731 buildCounterNetworkModule--; | |
732 return o; | |
733 } | |
734 | |
735 checkNetworkModule(api.NetworkModule o) { | |
736 buildCounterNetworkModule++; | |
737 if (buildCounterNetworkModule < 3) { | |
738 unittest.expect(o.IPv4Range, unittest.equals('foo')); | |
739 unittest.expect(o.description, unittest.equals('foo')); | |
740 unittest.expect(o.gatewayIPv4, unittest.equals('foo')); | |
741 } | |
742 buildCounterNetworkModule--; | |
743 } | |
744 | |
745 core.int buildCounterNetworkModuleStatus = 0; | |
746 buildNetworkModuleStatus() { | |
747 var o = new api.NetworkModuleStatus(); | |
748 buildCounterNetworkModuleStatus++; | |
749 if (buildCounterNetworkModuleStatus < 3) { | |
750 o.networkUrl = "foo"; | |
751 } | |
752 buildCounterNetworkModuleStatus--; | |
753 return o; | |
754 } | |
755 | |
756 checkNetworkModuleStatus(api.NetworkModuleStatus o) { | |
757 buildCounterNetworkModuleStatus++; | |
758 if (buildCounterNetworkModuleStatus < 3) { | |
759 unittest.expect(o.networkUrl, unittest.equals('foo')); | |
760 } | |
761 buildCounterNetworkModuleStatus--; | |
762 } | |
763 | |
764 core.int buildCounterNewDisk = 0; | |
765 buildNewDisk() { | |
766 var o = new api.NewDisk(); | |
767 buildCounterNewDisk++; | |
768 if (buildCounterNewDisk < 3) { | |
769 o.attachment = buildDiskAttachment(); | |
770 o.autoDelete = true; | |
771 o.boot = true; | |
772 o.initializeParams = buildNewDiskInitializeParams(); | |
773 } | |
774 buildCounterNewDisk--; | |
775 return o; | |
776 } | |
777 | |
778 checkNewDisk(api.NewDisk o) { | |
779 buildCounterNewDisk++; | |
780 if (buildCounterNewDisk < 3) { | |
781 checkDiskAttachment(o.attachment); | |
782 unittest.expect(o.autoDelete, unittest.isTrue); | |
783 unittest.expect(o.boot, unittest.isTrue); | |
784 checkNewDiskInitializeParams(o.initializeParams); | |
785 } | |
786 buildCounterNewDisk--; | |
787 } | |
788 | |
789 core.int buildCounterNewDiskInitializeParams = 0; | |
790 buildNewDiskInitializeParams() { | |
791 var o = new api.NewDiskInitializeParams(); | |
792 buildCounterNewDiskInitializeParams++; | |
793 if (buildCounterNewDiskInitializeParams < 3) { | |
794 o.diskSizeGb = "foo"; | |
795 o.sourceImage = "foo"; | |
796 } | |
797 buildCounterNewDiskInitializeParams--; | |
798 return o; | |
799 } | |
800 | |
801 checkNewDiskInitializeParams(api.NewDiskInitializeParams o) { | |
802 buildCounterNewDiskInitializeParams++; | |
803 if (buildCounterNewDiskInitializeParams < 3) { | |
804 unittest.expect(o.diskSizeGb, unittest.equals('foo')); | |
805 unittest.expect(o.sourceImage, unittest.equals('foo')); | |
806 } | |
807 buildCounterNewDiskInitializeParams--; | |
808 } | |
809 | |
810 core.int buildCounterParamOverride = 0; | |
811 buildParamOverride() { | |
812 var o = new api.ParamOverride(); | |
813 buildCounterParamOverride++; | |
814 if (buildCounterParamOverride < 3) { | |
815 o.path = "foo"; | |
816 o.value = "foo"; | |
817 } | |
818 buildCounterParamOverride--; | |
819 return o; | |
820 } | |
821 | |
822 checkParamOverride(api.ParamOverride o) { | |
823 buildCounterParamOverride++; | |
824 if (buildCounterParamOverride < 3) { | |
825 unittest.expect(o.path, unittest.equals('foo')); | |
826 unittest.expect(o.value, unittest.equals('foo')); | |
827 } | |
828 buildCounterParamOverride--; | |
829 } | |
830 | |
831 buildUnnamed1105() { | |
832 var o = new core.Map<core.String, api.EnvVariable>(); | |
833 o["x"] = buildEnvVariable(); | |
834 o["y"] = buildEnvVariable(); | |
835 return o; | |
836 } | |
837 | |
838 checkUnnamed1105(core.Map<core.String, api.EnvVariable> o) { | |
839 unittest.expect(o, unittest.hasLength(2)); | |
840 checkEnvVariable(o["x"]); | |
841 checkEnvVariable(o["y"]); | |
842 } | |
843 | |
844 buildUnnamed1106() { | |
845 var o = new core.List<core.String>(); | |
846 o.add("foo"); | |
847 o.add("foo"); | |
848 return o; | |
849 } | |
850 | |
851 checkUnnamed1106(core.List<core.String> o) { | |
852 unittest.expect(o, unittest.hasLength(2)); | |
853 unittest.expect(o[0], unittest.equals('foo')); | |
854 unittest.expect(o[1], unittest.equals('foo')); | |
855 } | |
856 | |
857 core.int buildCounterReplicaPoolModule = 0; | |
858 buildReplicaPoolModule() { | |
859 var o = new api.ReplicaPoolModule(); | |
860 buildCounterReplicaPoolModule++; | |
861 if (buildCounterReplicaPoolModule < 3) { | |
862 o.envVariables = buildUnnamed1105(); | |
863 o.healthChecks = buildUnnamed1106(); | |
864 o.numReplicas = 42; | |
865 o.replicaPoolParams = buildReplicaPoolParams(); | |
866 o.resourceView = "foo"; | |
867 } | |
868 buildCounterReplicaPoolModule--; | |
869 return o; | |
870 } | |
871 | |
872 checkReplicaPoolModule(api.ReplicaPoolModule o) { | |
873 buildCounterReplicaPoolModule++; | |
874 if (buildCounterReplicaPoolModule < 3) { | |
875 checkUnnamed1105(o.envVariables); | |
876 checkUnnamed1106(o.healthChecks); | |
877 unittest.expect(o.numReplicas, unittest.equals(42)); | |
878 checkReplicaPoolParams(o.replicaPoolParams); | |
879 unittest.expect(o.resourceView, unittest.equals('foo')); | |
880 } | |
881 buildCounterReplicaPoolModule--; | |
882 } | |
883 | |
884 core.int buildCounterReplicaPoolModuleStatus = 0; | |
885 buildReplicaPoolModuleStatus() { | |
886 var o = new api.ReplicaPoolModuleStatus(); | |
887 buildCounterReplicaPoolModuleStatus++; | |
888 if (buildCounterReplicaPoolModuleStatus < 3) { | |
889 o.replicaPoolUrl = "foo"; | |
890 o.resourceViewUrl = "foo"; | |
891 } | |
892 buildCounterReplicaPoolModuleStatus--; | |
893 return o; | |
894 } | |
895 | |
896 checkReplicaPoolModuleStatus(api.ReplicaPoolModuleStatus o) { | |
897 buildCounterReplicaPoolModuleStatus++; | |
898 if (buildCounterReplicaPoolModuleStatus < 3) { | |
899 unittest.expect(o.replicaPoolUrl, unittest.equals('foo')); | |
900 unittest.expect(o.resourceViewUrl, unittest.equals('foo')); | |
901 } | |
902 buildCounterReplicaPoolModuleStatus--; | |
903 } | |
904 | |
905 core.int buildCounterReplicaPoolParams = 0; | |
906 buildReplicaPoolParams() { | |
907 var o = new api.ReplicaPoolParams(); | |
908 buildCounterReplicaPoolParams++; | |
909 if (buildCounterReplicaPoolParams < 3) { | |
910 o.v1beta1 = buildReplicaPoolParamsV1Beta1(); | |
911 } | |
912 buildCounterReplicaPoolParams--; | |
913 return o; | |
914 } | |
915 | |
916 checkReplicaPoolParams(api.ReplicaPoolParams o) { | |
917 buildCounterReplicaPoolParams++; | |
918 if (buildCounterReplicaPoolParams < 3) { | |
919 checkReplicaPoolParamsV1Beta1(o.v1beta1); | |
920 } | |
921 buildCounterReplicaPoolParams--; | |
922 } | |
923 | |
924 buildUnnamed1107() { | |
925 var o = new core.List<api.ExistingDisk>(); | |
926 o.add(buildExistingDisk()); | |
927 o.add(buildExistingDisk()); | |
928 return o; | |
929 } | |
930 | |
931 checkUnnamed1107(core.List<api.ExistingDisk> o) { | |
932 unittest.expect(o, unittest.hasLength(2)); | |
933 checkExistingDisk(o[0]); | |
934 checkExistingDisk(o[1]); | |
935 } | |
936 | |
937 buildUnnamed1108() { | |
938 var o = new core.List<api.NewDisk>(); | |
939 o.add(buildNewDisk()); | |
940 o.add(buildNewDisk()); | |
941 return o; | |
942 } | |
943 | |
944 checkUnnamed1108(core.List<api.NewDisk> o) { | |
945 unittest.expect(o, unittest.hasLength(2)); | |
946 checkNewDisk(o[0]); | |
947 checkNewDisk(o[1]); | |
948 } | |
949 | |
950 buildUnnamed1109() { | |
951 var o = new core.List<api.NetworkInterface>(); | |
952 o.add(buildNetworkInterface()); | |
953 o.add(buildNetworkInterface()); | |
954 return o; | |
955 } | |
956 | |
957 checkUnnamed1109(core.List<api.NetworkInterface> o) { | |
958 unittest.expect(o, unittest.hasLength(2)); | |
959 checkNetworkInterface(o[0]); | |
960 checkNetworkInterface(o[1]); | |
961 } | |
962 | |
963 buildUnnamed1110() { | |
964 var o = new core.List<api.ServiceAccount>(); | |
965 o.add(buildServiceAccount()); | |
966 o.add(buildServiceAccount()); | |
967 return o; | |
968 } | |
969 | |
970 checkUnnamed1110(core.List<api.ServiceAccount> o) { | |
971 unittest.expect(o, unittest.hasLength(2)); | |
972 checkServiceAccount(o[0]); | |
973 checkServiceAccount(o[1]); | |
974 } | |
975 | |
976 core.int buildCounterReplicaPoolParamsV1Beta1 = 0; | |
977 buildReplicaPoolParamsV1Beta1() { | |
978 var o = new api.ReplicaPoolParamsV1Beta1(); | |
979 buildCounterReplicaPoolParamsV1Beta1++; | |
980 if (buildCounterReplicaPoolParamsV1Beta1 < 3) { | |
981 o.autoRestart = true; | |
982 o.baseInstanceName = "foo"; | |
983 o.canIpForward = true; | |
984 o.description = "foo"; | |
985 o.disksToAttach = buildUnnamed1107(); | |
986 o.disksToCreate = buildUnnamed1108(); | |
987 o.initAction = "foo"; | |
988 o.machineType = "foo"; | |
989 o.metadata = buildMetadata(); | |
990 o.networkInterfaces = buildUnnamed1109(); | |
991 o.onHostMaintenance = "foo"; | |
992 o.serviceAccounts = buildUnnamed1110(); | |
993 o.tags = buildTag(); | |
994 o.zone = "foo"; | |
995 } | |
996 buildCounterReplicaPoolParamsV1Beta1--; | |
997 return o; | |
998 } | |
999 | |
1000 checkReplicaPoolParamsV1Beta1(api.ReplicaPoolParamsV1Beta1 o) { | |
1001 buildCounterReplicaPoolParamsV1Beta1++; | |
1002 if (buildCounterReplicaPoolParamsV1Beta1 < 3) { | |
1003 unittest.expect(o.autoRestart, unittest.isTrue); | |
1004 unittest.expect(o.baseInstanceName, unittest.equals('foo')); | |
1005 unittest.expect(o.canIpForward, unittest.isTrue); | |
1006 unittest.expect(o.description, unittest.equals('foo')); | |
1007 checkUnnamed1107(o.disksToAttach); | |
1008 checkUnnamed1108(o.disksToCreate); | |
1009 unittest.expect(o.initAction, unittest.equals('foo')); | |
1010 unittest.expect(o.machineType, unittest.equals('foo')); | |
1011 checkMetadata(o.metadata); | |
1012 checkUnnamed1109(o.networkInterfaces); | |
1013 unittest.expect(o.onHostMaintenance, unittest.equals('foo')); | |
1014 checkUnnamed1110(o.serviceAccounts); | |
1015 checkTag(o.tags); | |
1016 unittest.expect(o.zone, unittest.equals('foo')); | |
1017 } | |
1018 buildCounterReplicaPoolParamsV1Beta1--; | |
1019 } | |
1020 | |
1021 buildUnnamed1111() { | |
1022 var o = new core.List<core.String>(); | |
1023 o.add("foo"); | |
1024 o.add("foo"); | |
1025 return o; | |
1026 } | |
1027 | |
1028 checkUnnamed1111(core.List<core.String> o) { | |
1029 unittest.expect(o, unittest.hasLength(2)); | |
1030 unittest.expect(o[0], unittest.equals('foo')); | |
1031 unittest.expect(o[1], unittest.equals('foo')); | |
1032 } | |
1033 | |
1034 core.int buildCounterServiceAccount = 0; | |
1035 buildServiceAccount() { | |
1036 var o = new api.ServiceAccount(); | |
1037 buildCounterServiceAccount++; | |
1038 if (buildCounterServiceAccount < 3) { | |
1039 o.email = "foo"; | |
1040 o.scopes = buildUnnamed1111(); | |
1041 } | |
1042 buildCounterServiceAccount--; | |
1043 return o; | |
1044 } | |
1045 | |
1046 checkServiceAccount(api.ServiceAccount o) { | |
1047 buildCounterServiceAccount++; | |
1048 if (buildCounterServiceAccount < 3) { | |
1049 unittest.expect(o.email, unittest.equals('foo')); | |
1050 checkUnnamed1111(o.scopes); | |
1051 } | |
1052 buildCounterServiceAccount--; | |
1053 } | |
1054 | |
1055 buildUnnamed1112() { | |
1056 var o = new core.List<core.String>(); | |
1057 o.add("foo"); | |
1058 o.add("foo"); | |
1059 return o; | |
1060 } | |
1061 | |
1062 checkUnnamed1112(core.List<core.String> o) { | |
1063 unittest.expect(o, unittest.hasLength(2)); | |
1064 unittest.expect(o[0], unittest.equals('foo')); | |
1065 unittest.expect(o[1], unittest.equals('foo')); | |
1066 } | |
1067 | |
1068 core.int buildCounterTag = 0; | |
1069 buildTag() { | |
1070 var o = new api.Tag(); | |
1071 buildCounterTag++; | |
1072 if (buildCounterTag < 3) { | |
1073 o.fingerPrint = "foo"; | |
1074 o.items = buildUnnamed1112(); | |
1075 } | |
1076 buildCounterTag--; | |
1077 return o; | |
1078 } | |
1079 | |
1080 checkTag(api.Tag o) { | |
1081 buildCounterTag++; | |
1082 if (buildCounterTag < 3) { | |
1083 unittest.expect(o.fingerPrint, unittest.equals('foo')); | |
1084 checkUnnamed1112(o.items); | |
1085 } | |
1086 buildCounterTag--; | |
1087 } | |
1088 | |
1089 buildUnnamed1113() { | |
1090 var o = new core.Map<core.String, api.Action>(); | |
1091 o["x"] = buildAction(); | |
1092 o["y"] = buildAction(); | |
1093 return o; | |
1094 } | |
1095 | |
1096 checkUnnamed1113(core.Map<core.String, api.Action> o) { | |
1097 unittest.expect(o, unittest.hasLength(2)); | |
1098 checkAction(o["x"]); | |
1099 checkAction(o["y"]); | |
1100 } | |
1101 | |
1102 buildUnnamed1114() { | |
1103 var o = new core.Map<core.String, api.Module>(); | |
1104 o["x"] = buildModule(); | |
1105 o["y"] = buildModule(); | |
1106 return o; | |
1107 } | |
1108 | |
1109 checkUnnamed1114(core.Map<core.String, api.Module> o) { | |
1110 unittest.expect(o, unittest.hasLength(2)); | |
1111 checkModule(o["x"]); | |
1112 checkModule(o["y"]); | |
1113 } | |
1114 | |
1115 core.int buildCounterTemplate = 0; | |
1116 buildTemplate() { | |
1117 var o = new api.Template(); | |
1118 buildCounterTemplate++; | |
1119 if (buildCounterTemplate < 3) { | |
1120 o.actions = buildUnnamed1113(); | |
1121 o.description = "foo"; | |
1122 o.modules = buildUnnamed1114(); | |
1123 o.name = "foo"; | |
1124 } | |
1125 buildCounterTemplate--; | |
1126 return o; | |
1127 } | |
1128 | |
1129 checkTemplate(api.Template o) { | |
1130 buildCounterTemplate++; | |
1131 if (buildCounterTemplate < 3) { | |
1132 checkUnnamed1113(o.actions); | |
1133 unittest.expect(o.description, unittest.equals('foo')); | |
1134 checkUnnamed1114(o.modules); | |
1135 unittest.expect(o.name, unittest.equals('foo')); | |
1136 } | |
1137 buildCounterTemplate--; | |
1138 } | |
1139 | |
1140 buildUnnamed1115() { | |
1141 var o = new core.List<api.Template>(); | |
1142 o.add(buildTemplate()); | |
1143 o.add(buildTemplate()); | |
1144 return o; | |
1145 } | |
1146 | |
1147 checkUnnamed1115(core.List<api.Template> o) { | |
1148 unittest.expect(o, unittest.hasLength(2)); | |
1149 checkTemplate(o[0]); | |
1150 checkTemplate(o[1]); | |
1151 } | |
1152 | |
1153 core.int buildCounterTemplatesListResponse = 0; | |
1154 buildTemplatesListResponse() { | |
1155 var o = new api.TemplatesListResponse(); | |
1156 buildCounterTemplatesListResponse++; | |
1157 if (buildCounterTemplatesListResponse < 3) { | |
1158 o.nextPageToken = "foo"; | |
1159 o.resources = buildUnnamed1115(); | |
1160 } | |
1161 buildCounterTemplatesListResponse--; | |
1162 return o; | |
1163 } | |
1164 | |
1165 checkTemplatesListResponse(api.TemplatesListResponse o) { | |
1166 buildCounterTemplatesListResponse++; | |
1167 if (buildCounterTemplatesListResponse < 3) { | |
1168 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
1169 checkUnnamed1115(o.resources); | |
1170 } | |
1171 buildCounterTemplatesListResponse--; | |
1172 } | |
1173 | |
1174 | |
1175 main() { | |
1176 unittest.group("obj-schema-AccessConfig", () { | |
1177 unittest.test("to-json--from-json", () { | |
1178 var o = buildAccessConfig(); | |
1179 var od = new api.AccessConfig.fromJson(o.toJson()); | |
1180 checkAccessConfig(od); | |
1181 }); | |
1182 }); | |
1183 | |
1184 | |
1185 unittest.group("obj-schema-Action", () { | |
1186 unittest.test("to-json--from-json", () { | |
1187 var o = buildAction(); | |
1188 var od = new api.Action.fromJson(o.toJson()); | |
1189 checkAction(od); | |
1190 }); | |
1191 }); | |
1192 | |
1193 | |
1194 unittest.group("obj-schema-AllowedRule", () { | |
1195 unittest.test("to-json--from-json", () { | |
1196 var o = buildAllowedRule(); | |
1197 var od = new api.AllowedRule.fromJson(o.toJson()); | |
1198 checkAllowedRule(od); | |
1199 }); | |
1200 }); | |
1201 | |
1202 | |
1203 unittest.group("obj-schema-AutoscalingModule", () { | |
1204 unittest.test("to-json--from-json", () { | |
1205 var o = buildAutoscalingModule(); | |
1206 var od = new api.AutoscalingModule.fromJson(o.toJson()); | |
1207 checkAutoscalingModule(od); | |
1208 }); | |
1209 }); | |
1210 | |
1211 | |
1212 unittest.group("obj-schema-AutoscalingModuleStatus", () { | |
1213 unittest.test("to-json--from-json", () { | |
1214 var o = buildAutoscalingModuleStatus(); | |
1215 var od = new api.AutoscalingModuleStatus.fromJson(o.toJson()); | |
1216 checkAutoscalingModuleStatus(od); | |
1217 }); | |
1218 }); | |
1219 | |
1220 | |
1221 unittest.group("obj-schema-DeployState", () { | |
1222 unittest.test("to-json--from-json", () { | |
1223 var o = buildDeployState(); | |
1224 var od = new api.DeployState.fromJson(o.toJson()); | |
1225 checkDeployState(od); | |
1226 }); | |
1227 }); | |
1228 | |
1229 | |
1230 unittest.group("obj-schema-Deployment", () { | |
1231 unittest.test("to-json--from-json", () { | |
1232 var o = buildDeployment(); | |
1233 var od = new api.Deployment.fromJson(o.toJson()); | |
1234 checkDeployment(od); | |
1235 }); | |
1236 }); | |
1237 | |
1238 | |
1239 unittest.group("obj-schema-DeploymentsListResponse", () { | |
1240 unittest.test("to-json--from-json", () { | |
1241 var o = buildDeploymentsListResponse(); | |
1242 var od = new api.DeploymentsListResponse.fromJson(o.toJson()); | |
1243 checkDeploymentsListResponse(od); | |
1244 }); | |
1245 }); | |
1246 | |
1247 | |
1248 unittest.group("obj-schema-DiskAttachment", () { | |
1249 unittest.test("to-json--from-json", () { | |
1250 var o = buildDiskAttachment(); | |
1251 var od = new api.DiskAttachment.fromJson(o.toJson()); | |
1252 checkDiskAttachment(od); | |
1253 }); | |
1254 }); | |
1255 | |
1256 | |
1257 unittest.group("obj-schema-EnvVariable", () { | |
1258 unittest.test("to-json--from-json", () { | |
1259 var o = buildEnvVariable(); | |
1260 var od = new api.EnvVariable.fromJson(o.toJson()); | |
1261 checkEnvVariable(od); | |
1262 }); | |
1263 }); | |
1264 | |
1265 | |
1266 unittest.group("obj-schema-ExistingDisk", () { | |
1267 unittest.test("to-json--from-json", () { | |
1268 var o = buildExistingDisk(); | |
1269 var od = new api.ExistingDisk.fromJson(o.toJson()); | |
1270 checkExistingDisk(od); | |
1271 }); | |
1272 }); | |
1273 | |
1274 | |
1275 unittest.group("obj-schema-FirewallModule", () { | |
1276 unittest.test("to-json--from-json", () { | |
1277 var o = buildFirewallModule(); | |
1278 var od = new api.FirewallModule.fromJson(o.toJson()); | |
1279 checkFirewallModule(od); | |
1280 }); | |
1281 }); | |
1282 | |
1283 | |
1284 unittest.group("obj-schema-FirewallModuleStatus", () { | |
1285 unittest.test("to-json--from-json", () { | |
1286 var o = buildFirewallModuleStatus(); | |
1287 var od = new api.FirewallModuleStatus.fromJson(o.toJson()); | |
1288 checkFirewallModuleStatus(od); | |
1289 }); | |
1290 }); | |
1291 | |
1292 | |
1293 unittest.group("obj-schema-HealthCheckModule", () { | |
1294 unittest.test("to-json--from-json", () { | |
1295 var o = buildHealthCheckModule(); | |
1296 var od = new api.HealthCheckModule.fromJson(o.toJson()); | |
1297 checkHealthCheckModule(od); | |
1298 }); | |
1299 }); | |
1300 | |
1301 | |
1302 unittest.group("obj-schema-HealthCheckModuleStatus", () { | |
1303 unittest.test("to-json--from-json", () { | |
1304 var o = buildHealthCheckModuleStatus(); | |
1305 var od = new api.HealthCheckModuleStatus.fromJson(o.toJson()); | |
1306 checkHealthCheckModuleStatus(od); | |
1307 }); | |
1308 }); | |
1309 | |
1310 | |
1311 unittest.group("obj-schema-LbModule", () { | |
1312 unittest.test("to-json--from-json", () { | |
1313 var o = buildLbModule(); | |
1314 var od = new api.LbModule.fromJson(o.toJson()); | |
1315 checkLbModule(od); | |
1316 }); | |
1317 }); | |
1318 | |
1319 | |
1320 unittest.group("obj-schema-LbModuleStatus", () { | |
1321 unittest.test("to-json--from-json", () { | |
1322 var o = buildLbModuleStatus(); | |
1323 var od = new api.LbModuleStatus.fromJson(o.toJson()); | |
1324 checkLbModuleStatus(od); | |
1325 }); | |
1326 }); | |
1327 | |
1328 | |
1329 unittest.group("obj-schema-Metadata", () { | |
1330 unittest.test("to-json--from-json", () { | |
1331 var o = buildMetadata(); | |
1332 var od = new api.Metadata.fromJson(o.toJson()); | |
1333 checkMetadata(od); | |
1334 }); | |
1335 }); | |
1336 | |
1337 | |
1338 unittest.group("obj-schema-MetadataItem", () { | |
1339 unittest.test("to-json--from-json", () { | |
1340 var o = buildMetadataItem(); | |
1341 var od = new api.MetadataItem.fromJson(o.toJson()); | |
1342 checkMetadataItem(od); | |
1343 }); | |
1344 }); | |
1345 | |
1346 | |
1347 unittest.group("obj-schema-Module", () { | |
1348 unittest.test("to-json--from-json", () { | |
1349 var o = buildModule(); | |
1350 var od = new api.Module.fromJson(o.toJson()); | |
1351 checkModule(od); | |
1352 }); | |
1353 }); | |
1354 | |
1355 | |
1356 unittest.group("obj-schema-ModuleStatus", () { | |
1357 unittest.test("to-json--from-json", () { | |
1358 var o = buildModuleStatus(); | |
1359 var od = new api.ModuleStatus.fromJson(o.toJson()); | |
1360 checkModuleStatus(od); | |
1361 }); | |
1362 }); | |
1363 | |
1364 | |
1365 unittest.group("obj-schema-NetworkInterface", () { | |
1366 unittest.test("to-json--from-json", () { | |
1367 var o = buildNetworkInterface(); | |
1368 var od = new api.NetworkInterface.fromJson(o.toJson()); | |
1369 checkNetworkInterface(od); | |
1370 }); | |
1371 }); | |
1372 | |
1373 | |
1374 unittest.group("obj-schema-NetworkModule", () { | |
1375 unittest.test("to-json--from-json", () { | |
1376 var o = buildNetworkModule(); | |
1377 var od = new api.NetworkModule.fromJson(o.toJson()); | |
1378 checkNetworkModule(od); | |
1379 }); | |
1380 }); | |
1381 | |
1382 | |
1383 unittest.group("obj-schema-NetworkModuleStatus", () { | |
1384 unittest.test("to-json--from-json", () { | |
1385 var o = buildNetworkModuleStatus(); | |
1386 var od = new api.NetworkModuleStatus.fromJson(o.toJson()); | |
1387 checkNetworkModuleStatus(od); | |
1388 }); | |
1389 }); | |
1390 | |
1391 | |
1392 unittest.group("obj-schema-NewDisk", () { | |
1393 unittest.test("to-json--from-json", () { | |
1394 var o = buildNewDisk(); | |
1395 var od = new api.NewDisk.fromJson(o.toJson()); | |
1396 checkNewDisk(od); | |
1397 }); | |
1398 }); | |
1399 | |
1400 | |
1401 unittest.group("obj-schema-NewDiskInitializeParams", () { | |
1402 unittest.test("to-json--from-json", () { | |
1403 var o = buildNewDiskInitializeParams(); | |
1404 var od = new api.NewDiskInitializeParams.fromJson(o.toJson()); | |
1405 checkNewDiskInitializeParams(od); | |
1406 }); | |
1407 }); | |
1408 | |
1409 | |
1410 unittest.group("obj-schema-ParamOverride", () { | |
1411 unittest.test("to-json--from-json", () { | |
1412 var o = buildParamOverride(); | |
1413 var od = new api.ParamOverride.fromJson(o.toJson()); | |
1414 checkParamOverride(od); | |
1415 }); | |
1416 }); | |
1417 | |
1418 | |
1419 unittest.group("obj-schema-ReplicaPoolModule", () { | |
1420 unittest.test("to-json--from-json", () { | |
1421 var o = buildReplicaPoolModule(); | |
1422 var od = new api.ReplicaPoolModule.fromJson(o.toJson()); | |
1423 checkReplicaPoolModule(od); | |
1424 }); | |
1425 }); | |
1426 | |
1427 | |
1428 unittest.group("obj-schema-ReplicaPoolModuleStatus", () { | |
1429 unittest.test("to-json--from-json", () { | |
1430 var o = buildReplicaPoolModuleStatus(); | |
1431 var od = new api.ReplicaPoolModuleStatus.fromJson(o.toJson()); | |
1432 checkReplicaPoolModuleStatus(od); | |
1433 }); | |
1434 }); | |
1435 | |
1436 | |
1437 unittest.group("obj-schema-ReplicaPoolParams", () { | |
1438 unittest.test("to-json--from-json", () { | |
1439 var o = buildReplicaPoolParams(); | |
1440 var od = new api.ReplicaPoolParams.fromJson(o.toJson()); | |
1441 checkReplicaPoolParams(od); | |
1442 }); | |
1443 }); | |
1444 | |
1445 | |
1446 unittest.group("obj-schema-ReplicaPoolParamsV1Beta1", () { | |
1447 unittest.test("to-json--from-json", () { | |
1448 var o = buildReplicaPoolParamsV1Beta1(); | |
1449 var od = new api.ReplicaPoolParamsV1Beta1.fromJson(o.toJson()); | |
1450 checkReplicaPoolParamsV1Beta1(od); | |
1451 }); | |
1452 }); | |
1453 | |
1454 | |
1455 unittest.group("obj-schema-ServiceAccount", () { | |
1456 unittest.test("to-json--from-json", () { | |
1457 var o = buildServiceAccount(); | |
1458 var od = new api.ServiceAccount.fromJson(o.toJson()); | |
1459 checkServiceAccount(od); | |
1460 }); | |
1461 }); | |
1462 | |
1463 | |
1464 unittest.group("obj-schema-Tag", () { | |
1465 unittest.test("to-json--from-json", () { | |
1466 var o = buildTag(); | |
1467 var od = new api.Tag.fromJson(o.toJson()); | |
1468 checkTag(od); | |
1469 }); | |
1470 }); | |
1471 | |
1472 | |
1473 unittest.group("obj-schema-Template", () { | |
1474 unittest.test("to-json--from-json", () { | |
1475 var o = buildTemplate(); | |
1476 var od = new api.Template.fromJson(o.toJson()); | |
1477 checkTemplate(od); | |
1478 }); | |
1479 }); | |
1480 | |
1481 | |
1482 unittest.group("obj-schema-TemplatesListResponse", () { | |
1483 unittest.test("to-json--from-json", () { | |
1484 var o = buildTemplatesListResponse(); | |
1485 var od = new api.TemplatesListResponse.fromJson(o.toJson()); | |
1486 checkTemplatesListResponse(od); | |
1487 }); | |
1488 }); | |
1489 | |
1490 | |
1491 unittest.group("resource-DeploymentsResourceApi", () { | |
1492 unittest.test("method--delete", () { | |
1493 | |
1494 var mock = new common_test.HttpServerMock(); | |
1495 api.DeploymentsResourceApi res = new api.ManagerApi(mock).deployments; | |
1496 var arg_projectId = "foo"; | |
1497 var arg_region = "foo"; | |
1498 var arg_deploymentName = "foo"; | |
1499 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1500 var path = (req.url).path; | |
1501 var pathOffset = 0; | |
1502 var index; | |
1503 var subPart; | |
1504 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1505 pathOffset += 26; | |
1506 index = path.indexOf("/regions/", pathOffset); | |
1507 unittest.expect(index >= 0, unittest.isTrue); | |
1508 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1509 pathOffset = index; | |
1510 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1511 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/regions/")); | |
1512 pathOffset += 9; | |
1513 index = path.indexOf("/deployments/", pathOffset); | |
1514 unittest.expect(index >= 0, unittest.isTrue); | |
1515 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1516 pathOffset = index; | |
1517 unittest.expect(subPart, unittest.equals("$arg_region")); | |
1518 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/deployments/")); | |
1519 pathOffset += 13; | |
1520 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1521 pathOffset = path.length; | |
1522 unittest.expect(subPart, unittest.equals("$arg_deploymentName")); | |
1523 | |
1524 var query = (req.url).query; | |
1525 var queryOffset = 0; | |
1526 var queryMap = {}; | |
1527 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1528 parseBool(n) { | |
1529 if (n == "true") return true; | |
1530 if (n == "false") return false; | |
1531 if (n == null) return null; | |
1532 throw new core.ArgumentError("Invalid boolean: $n"); | |
1533 } | |
1534 if (query.length > 0) { | |
1535 for (var part in query.split("&")) { | |
1536 var keyvalue = part.split("="); | |
1537 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1538 } | |
1539 } | |
1540 | |
1541 | |
1542 var h = { | |
1543 "content-type" : "application/json; charset=utf-8", | |
1544 }; | |
1545 var resp = ""; | |
1546 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1547 }), true); | |
1548 res.delete(arg_projectId, arg_region, arg_deploymentName).then(unittest.ex
pectAsync((_) {})); | |
1549 }); | |
1550 | |
1551 unittest.test("method--get", () { | |
1552 | |
1553 var mock = new common_test.HttpServerMock(); | |
1554 api.DeploymentsResourceApi res = new api.ManagerApi(mock).deployments; | |
1555 var arg_projectId = "foo"; | |
1556 var arg_region = "foo"; | |
1557 var arg_deploymentName = "foo"; | |
1558 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1559 var path = (req.url).path; | |
1560 var pathOffset = 0; | |
1561 var index; | |
1562 var subPart; | |
1563 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1564 pathOffset += 26; | |
1565 index = path.indexOf("/regions/", pathOffset); | |
1566 unittest.expect(index >= 0, unittest.isTrue); | |
1567 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1568 pathOffset = index; | |
1569 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1570 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/regions/")); | |
1571 pathOffset += 9; | |
1572 index = path.indexOf("/deployments/", pathOffset); | |
1573 unittest.expect(index >= 0, unittest.isTrue); | |
1574 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1575 pathOffset = index; | |
1576 unittest.expect(subPart, unittest.equals("$arg_region")); | |
1577 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/deployments/")); | |
1578 pathOffset += 13; | |
1579 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1580 pathOffset = path.length; | |
1581 unittest.expect(subPart, unittest.equals("$arg_deploymentName")); | |
1582 | |
1583 var query = (req.url).query; | |
1584 var queryOffset = 0; | |
1585 var queryMap = {}; | |
1586 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1587 parseBool(n) { | |
1588 if (n == "true") return true; | |
1589 if (n == "false") return false; | |
1590 if (n == null) return null; | |
1591 throw new core.ArgumentError("Invalid boolean: $n"); | |
1592 } | |
1593 if (query.length > 0) { | |
1594 for (var part in query.split("&")) { | |
1595 var keyvalue = part.split("="); | |
1596 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1597 } | |
1598 } | |
1599 | |
1600 | |
1601 var h = { | |
1602 "content-type" : "application/json; charset=utf-8", | |
1603 }; | |
1604 var resp = convert.JSON.encode(buildDeployment()); | |
1605 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1606 }), true); | |
1607 res.get(arg_projectId, arg_region, arg_deploymentName).then(unittest.expec
tAsync(((api.Deployment response) { | |
1608 checkDeployment(response); | |
1609 }))); | |
1610 }); | |
1611 | |
1612 unittest.test("method--insert", () { | |
1613 | |
1614 var mock = new common_test.HttpServerMock(); | |
1615 api.DeploymentsResourceApi res = new api.ManagerApi(mock).deployments; | |
1616 var arg_request = buildDeployment(); | |
1617 var arg_projectId = "foo"; | |
1618 var arg_region = "foo"; | |
1619 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1620 var obj = new api.Deployment.fromJson(json); | |
1621 checkDeployment(obj); | |
1622 | |
1623 var path = (req.url).path; | |
1624 var pathOffset = 0; | |
1625 var index; | |
1626 var subPart; | |
1627 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1628 pathOffset += 26; | |
1629 index = path.indexOf("/regions/", pathOffset); | |
1630 unittest.expect(index >= 0, unittest.isTrue); | |
1631 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1632 pathOffset = index; | |
1633 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1634 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/regions/")); | |
1635 pathOffset += 9; | |
1636 index = path.indexOf("/deployments", pathOffset); | |
1637 unittest.expect(index >= 0, unittest.isTrue); | |
1638 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1639 pathOffset = index; | |
1640 unittest.expect(subPart, unittest.equals("$arg_region")); | |
1641 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/deployments")); | |
1642 pathOffset += 12; | |
1643 | |
1644 var query = (req.url).query; | |
1645 var queryOffset = 0; | |
1646 var queryMap = {}; | |
1647 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1648 parseBool(n) { | |
1649 if (n == "true") return true; | |
1650 if (n == "false") return false; | |
1651 if (n == null) return null; | |
1652 throw new core.ArgumentError("Invalid boolean: $n"); | |
1653 } | |
1654 if (query.length > 0) { | |
1655 for (var part in query.split("&")) { | |
1656 var keyvalue = part.split("="); | |
1657 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1658 } | |
1659 } | |
1660 | |
1661 | |
1662 var h = { | |
1663 "content-type" : "application/json; charset=utf-8", | |
1664 }; | |
1665 var resp = convert.JSON.encode(buildDeployment()); | |
1666 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1667 }), true); | |
1668 res.insert(arg_request, arg_projectId, arg_region).then(unittest.expectAsy
nc(((api.Deployment response) { | |
1669 checkDeployment(response); | |
1670 }))); | |
1671 }); | |
1672 | |
1673 unittest.test("method--list", () { | |
1674 | |
1675 var mock = new common_test.HttpServerMock(); | |
1676 api.DeploymentsResourceApi res = new api.ManagerApi(mock).deployments; | |
1677 var arg_projectId = "foo"; | |
1678 var arg_region = "foo"; | |
1679 var arg_maxResults = 42; | |
1680 var arg_pageToken = "foo"; | |
1681 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1682 var path = (req.url).path; | |
1683 var pathOffset = 0; | |
1684 var index; | |
1685 var subPart; | |
1686 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1687 pathOffset += 26; | |
1688 index = path.indexOf("/regions/", pathOffset); | |
1689 unittest.expect(index >= 0, unittest.isTrue); | |
1690 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1691 pathOffset = index; | |
1692 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1693 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/regions/")); | |
1694 pathOffset += 9; | |
1695 index = path.indexOf("/deployments", pathOffset); | |
1696 unittest.expect(index >= 0, unittest.isTrue); | |
1697 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1698 pathOffset = index; | |
1699 unittest.expect(subPart, unittest.equals("$arg_region")); | |
1700 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/deployments")); | |
1701 pathOffset += 12; | |
1702 | |
1703 var query = (req.url).query; | |
1704 var queryOffset = 0; | |
1705 var queryMap = {}; | |
1706 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1707 parseBool(n) { | |
1708 if (n == "true") return true; | |
1709 if (n == "false") return false; | |
1710 if (n == null) return null; | |
1711 throw new core.ArgumentError("Invalid boolean: $n"); | |
1712 } | |
1713 if (query.length > 0) { | |
1714 for (var part in query.split("&")) { | |
1715 var keyvalue = part.split("="); | |
1716 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1717 } | |
1718 } | |
1719 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1720 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1721 | |
1722 | |
1723 var h = { | |
1724 "content-type" : "application/json; charset=utf-8", | |
1725 }; | |
1726 var resp = convert.JSON.encode(buildDeploymentsListResponse()); | |
1727 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1728 }), true); | |
1729 res.list(arg_projectId, arg_region, maxResults: arg_maxResults, pageToken:
arg_pageToken).then(unittest.expectAsync(((api.DeploymentsListResponse response
) { | |
1730 checkDeploymentsListResponse(response); | |
1731 }))); | |
1732 }); | |
1733 | |
1734 }); | |
1735 | |
1736 | |
1737 unittest.group("resource-TemplatesResourceApi", () { | |
1738 unittest.test("method--delete", () { | |
1739 | |
1740 var mock = new common_test.HttpServerMock(); | |
1741 api.TemplatesResourceApi res = new api.ManagerApi(mock).templates; | |
1742 var arg_projectId = "foo"; | |
1743 var arg_templateName = "foo"; | |
1744 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1745 var path = (req.url).path; | |
1746 var pathOffset = 0; | |
1747 var index; | |
1748 var subPart; | |
1749 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1750 pathOffset += 26; | |
1751 index = path.indexOf("/templates/", pathOffset); | |
1752 unittest.expect(index >= 0, unittest.isTrue); | |
1753 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1754 pathOffset = index; | |
1755 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1756 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/templates/")); | |
1757 pathOffset += 11; | |
1758 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1759 pathOffset = path.length; | |
1760 unittest.expect(subPart, unittest.equals("$arg_templateName")); | |
1761 | |
1762 var query = (req.url).query; | |
1763 var queryOffset = 0; | |
1764 var queryMap = {}; | |
1765 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1766 parseBool(n) { | |
1767 if (n == "true") return true; | |
1768 if (n == "false") return false; | |
1769 if (n == null) return null; | |
1770 throw new core.ArgumentError("Invalid boolean: $n"); | |
1771 } | |
1772 if (query.length > 0) { | |
1773 for (var part in query.split("&")) { | |
1774 var keyvalue = part.split("="); | |
1775 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1776 } | |
1777 } | |
1778 | |
1779 | |
1780 var h = { | |
1781 "content-type" : "application/json; charset=utf-8", | |
1782 }; | |
1783 var resp = ""; | |
1784 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1785 }), true); | |
1786 res.delete(arg_projectId, arg_templateName).then(unittest.expectAsync((_)
{})); | |
1787 }); | |
1788 | |
1789 unittest.test("method--get", () { | |
1790 | |
1791 var mock = new common_test.HttpServerMock(); | |
1792 api.TemplatesResourceApi res = new api.ManagerApi(mock).templates; | |
1793 var arg_projectId = "foo"; | |
1794 var arg_templateName = "foo"; | |
1795 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1796 var path = (req.url).path; | |
1797 var pathOffset = 0; | |
1798 var index; | |
1799 var subPart; | |
1800 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1801 pathOffset += 26; | |
1802 index = path.indexOf("/templates/", pathOffset); | |
1803 unittest.expect(index >= 0, unittest.isTrue); | |
1804 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1805 pathOffset = index; | |
1806 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1807 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/templates/")); | |
1808 pathOffset += 11; | |
1809 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1810 pathOffset = path.length; | |
1811 unittest.expect(subPart, unittest.equals("$arg_templateName")); | |
1812 | |
1813 var query = (req.url).query; | |
1814 var queryOffset = 0; | |
1815 var queryMap = {}; | |
1816 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1817 parseBool(n) { | |
1818 if (n == "true") return true; | |
1819 if (n == "false") return false; | |
1820 if (n == null) return null; | |
1821 throw new core.ArgumentError("Invalid boolean: $n"); | |
1822 } | |
1823 if (query.length > 0) { | |
1824 for (var part in query.split("&")) { | |
1825 var keyvalue = part.split("="); | |
1826 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1827 } | |
1828 } | |
1829 | |
1830 | |
1831 var h = { | |
1832 "content-type" : "application/json; charset=utf-8", | |
1833 }; | |
1834 var resp = convert.JSON.encode(buildTemplate()); | |
1835 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1836 }), true); | |
1837 res.get(arg_projectId, arg_templateName).then(unittest.expectAsync(((api.T
emplate response) { | |
1838 checkTemplate(response); | |
1839 }))); | |
1840 }); | |
1841 | |
1842 unittest.test("method--insert", () { | |
1843 | |
1844 var mock = new common_test.HttpServerMock(); | |
1845 api.TemplatesResourceApi res = new api.ManagerApi(mock).templates; | |
1846 var arg_request = buildTemplate(); | |
1847 var arg_projectId = "foo"; | |
1848 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1849 var obj = new api.Template.fromJson(json); | |
1850 checkTemplate(obj); | |
1851 | |
1852 var path = (req.url).path; | |
1853 var pathOffset = 0; | |
1854 var index; | |
1855 var subPart; | |
1856 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1857 pathOffset += 26; | |
1858 index = path.indexOf("/templates", pathOffset); | |
1859 unittest.expect(index >= 0, unittest.isTrue); | |
1860 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1861 pathOffset = index; | |
1862 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1863 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/templates")); | |
1864 pathOffset += 10; | |
1865 | |
1866 var query = (req.url).query; | |
1867 var queryOffset = 0; | |
1868 var queryMap = {}; | |
1869 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1870 parseBool(n) { | |
1871 if (n == "true") return true; | |
1872 if (n == "false") return false; | |
1873 if (n == null) return null; | |
1874 throw new core.ArgumentError("Invalid boolean: $n"); | |
1875 } | |
1876 if (query.length > 0) { | |
1877 for (var part in query.split("&")) { | |
1878 var keyvalue = part.split("="); | |
1879 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1880 } | |
1881 } | |
1882 | |
1883 | |
1884 var h = { | |
1885 "content-type" : "application/json; charset=utf-8", | |
1886 }; | |
1887 var resp = convert.JSON.encode(buildTemplate()); | |
1888 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1889 }), true); | |
1890 res.insert(arg_request, arg_projectId).then(unittest.expectAsync(((api.Tem
plate response) { | |
1891 checkTemplate(response); | |
1892 }))); | |
1893 }); | |
1894 | |
1895 unittest.test("method--list", () { | |
1896 | |
1897 var mock = new common_test.HttpServerMock(); | |
1898 api.TemplatesResourceApi res = new api.ManagerApi(mock).templates; | |
1899 var arg_projectId = "foo"; | |
1900 var arg_maxResults = 42; | |
1901 var arg_pageToken = "foo"; | |
1902 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1903 var path = (req.url).path; | |
1904 var pathOffset = 0; | |
1905 var index; | |
1906 var subPart; | |
1907 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/manager/v1beta2/projects/")); | |
1908 pathOffset += 26; | |
1909 index = path.indexOf("/templates", pathOffset); | |
1910 unittest.expect(index >= 0, unittest.isTrue); | |
1911 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1912 pathOffset = index; | |
1913 unittest.expect(subPart, unittest.equals("$arg_projectId")); | |
1914 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/templates")); | |
1915 pathOffset += 10; | |
1916 | |
1917 var query = (req.url).query; | |
1918 var queryOffset = 0; | |
1919 var queryMap = {}; | |
1920 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1921 parseBool(n) { | |
1922 if (n == "true") return true; | |
1923 if (n == "false") return false; | |
1924 if (n == null) return null; | |
1925 throw new core.ArgumentError("Invalid boolean: $n"); | |
1926 } | |
1927 if (query.length > 0) { | |
1928 for (var part in query.split("&")) { | |
1929 var keyvalue = part.split("="); | |
1930 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1931 } | |
1932 } | |
1933 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1934 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1935 | |
1936 | |
1937 var h = { | |
1938 "content-type" : "application/json; charset=utf-8", | |
1939 }; | |
1940 var resp = convert.JSON.encode(buildTemplatesListResponse()); | |
1941 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1942 }), true); | |
1943 res.list(arg_projectId, maxResults: arg_maxResults, pageToken: arg_pageTok
en).then(unittest.expectAsync(((api.TemplatesListResponse response) { | |
1944 checkTemplatesListResponse(response); | |
1945 }))); | |
1946 }); | |
1947 | |
1948 }); | |
1949 | |
1950 | |
1951 } | |
1952 | |
OLD | NEW |