Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: generated/googleapis/test/sourcerepo/v1_test.dart

Issue 2734843002: Api-roll 46: 2017-03-06 (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library googleapis.sourcerepo.v1.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
12 import 'package:googleapis/sourcerepo/v1.dart' as api;
13
14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback;
16 core.bool _expectJson;
17
18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback;
20 _expectJson = expectJson;
21 }
22
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) {
24 if (_expectJson) {
25 return request.finalize()
26 .transform(convert.UTF8.decoder)
27 .join('')
28 .then((core.String jsonString) {
29 if (jsonString.isEmpty) {
30 return _callback(request, null);
31 } else {
32 return _callback(request, convert.JSON.decode(jsonString));
33 }
34 });
35 } else {
36 var stream = request.finalize();
37 if (stream == null) {
38 return _callback(request, []);
39 } else {
40 return stream.toBytes().then((data) {
41 return _callback(request, data);
42 });
43 }
44 }
45 }
46 }
47
48 http.StreamedResponse stringResponse(
49 core.int status, core.Map headers, core.String body) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers);
52 }
53
54 buildUnnamed429() {
55 var o = new core.List<api.AuditLogConfig>();
56 o.add(buildAuditLogConfig());
57 o.add(buildAuditLogConfig());
58 return o;
59 }
60
61 checkUnnamed429(core.List<api.AuditLogConfig> o) {
62 unittest.expect(o, unittest.hasLength(2));
63 checkAuditLogConfig(o[0]);
64 checkAuditLogConfig(o[1]);
65 }
66
67 buildUnnamed430() {
68 var o = new core.List<core.String>();
69 o.add("foo");
70 o.add("foo");
71 return o;
72 }
73
74 checkUnnamed430(core.List<core.String> o) {
75 unittest.expect(o, unittest.hasLength(2));
76 unittest.expect(o[0], unittest.equals('foo'));
77 unittest.expect(o[1], unittest.equals('foo'));
78 }
79
80 core.int buildCounterAuditConfig = 0;
81 buildAuditConfig() {
82 var o = new api.AuditConfig();
83 buildCounterAuditConfig++;
84 if (buildCounterAuditConfig < 3) {
85 o.auditLogConfigs = buildUnnamed429();
86 o.exemptedMembers = buildUnnamed430();
87 o.service = "foo";
88 }
89 buildCounterAuditConfig--;
90 return o;
91 }
92
93 checkAuditConfig(api.AuditConfig o) {
94 buildCounterAuditConfig++;
95 if (buildCounterAuditConfig < 3) {
96 checkUnnamed429(o.auditLogConfigs);
97 checkUnnamed430(o.exemptedMembers);
98 unittest.expect(o.service, unittest.equals('foo'));
99 }
100 buildCounterAuditConfig--;
101 }
102
103 buildUnnamed431() {
104 var o = new core.List<core.String>();
105 o.add("foo");
106 o.add("foo");
107 return o;
108 }
109
110 checkUnnamed431(core.List<core.String> o) {
111 unittest.expect(o, unittest.hasLength(2));
112 unittest.expect(o[0], unittest.equals('foo'));
113 unittest.expect(o[1], unittest.equals('foo'));
114 }
115
116 core.int buildCounterAuditLogConfig = 0;
117 buildAuditLogConfig() {
118 var o = new api.AuditLogConfig();
119 buildCounterAuditLogConfig++;
120 if (buildCounterAuditLogConfig < 3) {
121 o.exemptedMembers = buildUnnamed431();
122 o.logType = "foo";
123 }
124 buildCounterAuditLogConfig--;
125 return o;
126 }
127
128 checkAuditLogConfig(api.AuditLogConfig o) {
129 buildCounterAuditLogConfig++;
130 if (buildCounterAuditLogConfig < 3) {
131 checkUnnamed431(o.exemptedMembers);
132 unittest.expect(o.logType, unittest.equals('foo'));
133 }
134 buildCounterAuditLogConfig--;
135 }
136
137 buildUnnamed432() {
138 var o = new core.List<core.String>();
139 o.add("foo");
140 o.add("foo");
141 return o;
142 }
143
144 checkUnnamed432(core.List<core.String> o) {
145 unittest.expect(o, unittest.hasLength(2));
146 unittest.expect(o[0], unittest.equals('foo'));
147 unittest.expect(o[1], unittest.equals('foo'));
148 }
149
150 core.int buildCounterBinding = 0;
151 buildBinding() {
152 var o = new api.Binding();
153 buildCounterBinding++;
154 if (buildCounterBinding < 3) {
155 o.members = buildUnnamed432();
156 o.role = "foo";
157 }
158 buildCounterBinding--;
159 return o;
160 }
161
162 checkBinding(api.Binding o) {
163 buildCounterBinding++;
164 if (buildCounterBinding < 3) {
165 checkUnnamed432(o.members);
166 unittest.expect(o.role, unittest.equals('foo'));
167 }
168 buildCounterBinding--;
169 }
170
171 core.int buildCounterCloudAuditOptions = 0;
172 buildCloudAuditOptions() {
173 var o = new api.CloudAuditOptions();
174 buildCounterCloudAuditOptions++;
175 if (buildCounterCloudAuditOptions < 3) {
176 }
177 buildCounterCloudAuditOptions--;
178 return o;
179 }
180
181 checkCloudAuditOptions(api.CloudAuditOptions o) {
182 buildCounterCloudAuditOptions++;
183 if (buildCounterCloudAuditOptions < 3) {
184 }
185 buildCounterCloudAuditOptions--;
186 }
187
188 buildUnnamed433() {
189 var o = new core.List<core.String>();
190 o.add("foo");
191 o.add("foo");
192 return o;
193 }
194
195 checkUnnamed433(core.List<core.String> o) {
196 unittest.expect(o, unittest.hasLength(2));
197 unittest.expect(o[0], unittest.equals('foo'));
198 unittest.expect(o[1], unittest.equals('foo'));
199 }
200
201 core.int buildCounterCondition = 0;
202 buildCondition() {
203 var o = new api.Condition();
204 buildCounterCondition++;
205 if (buildCounterCondition < 3) {
206 o.iam = "foo";
207 o.op = "foo";
208 o.svc = "foo";
209 o.sys = "foo";
210 o.value = "foo";
211 o.values = buildUnnamed433();
212 }
213 buildCounterCondition--;
214 return o;
215 }
216
217 checkCondition(api.Condition o) {
218 buildCounterCondition++;
219 if (buildCounterCondition < 3) {
220 unittest.expect(o.iam, unittest.equals('foo'));
221 unittest.expect(o.op, unittest.equals('foo'));
222 unittest.expect(o.svc, unittest.equals('foo'));
223 unittest.expect(o.sys, unittest.equals('foo'));
224 unittest.expect(o.value, unittest.equals('foo'));
225 checkUnnamed433(o.values);
226 }
227 buildCounterCondition--;
228 }
229
230 core.int buildCounterCounterOptions = 0;
231 buildCounterOptions() {
232 var o = new api.CounterOptions();
233 buildCounterCounterOptions++;
234 if (buildCounterCounterOptions < 3) {
235 o.field = "foo";
236 o.metric = "foo";
237 }
238 buildCounterCounterOptions--;
239 return o;
240 }
241
242 checkCounterOptions(api.CounterOptions o) {
243 buildCounterCounterOptions++;
244 if (buildCounterCounterOptions < 3) {
245 unittest.expect(o.field, unittest.equals('foo'));
246 unittest.expect(o.metric, unittest.equals('foo'));
247 }
248 buildCounterCounterOptions--;
249 }
250
251 core.int buildCounterDataAccessOptions = 0;
252 buildDataAccessOptions() {
253 var o = new api.DataAccessOptions();
254 buildCounterDataAccessOptions++;
255 if (buildCounterDataAccessOptions < 3) {
256 }
257 buildCounterDataAccessOptions--;
258 return o;
259 }
260
261 checkDataAccessOptions(api.DataAccessOptions o) {
262 buildCounterDataAccessOptions++;
263 if (buildCounterDataAccessOptions < 3) {
264 }
265 buildCounterDataAccessOptions--;
266 }
267
268 core.int buildCounterEmpty = 0;
269 buildEmpty() {
270 var o = new api.Empty();
271 buildCounterEmpty++;
272 if (buildCounterEmpty < 3) {
273 }
274 buildCounterEmpty--;
275 return o;
276 }
277
278 checkEmpty(api.Empty o) {
279 buildCounterEmpty++;
280 if (buildCounterEmpty < 3) {
281 }
282 buildCounterEmpty--;
283 }
284
285 buildUnnamed434() {
286 var o = new core.List<api.Repo>();
287 o.add(buildRepo());
288 o.add(buildRepo());
289 return o;
290 }
291
292 checkUnnamed434(core.List<api.Repo> o) {
293 unittest.expect(o, unittest.hasLength(2));
294 checkRepo(o[0]);
295 checkRepo(o[1]);
296 }
297
298 core.int buildCounterListReposResponse = 0;
299 buildListReposResponse() {
300 var o = new api.ListReposResponse();
301 buildCounterListReposResponse++;
302 if (buildCounterListReposResponse < 3) {
303 o.repos = buildUnnamed434();
304 }
305 buildCounterListReposResponse--;
306 return o;
307 }
308
309 checkListReposResponse(api.ListReposResponse o) {
310 buildCounterListReposResponse++;
311 if (buildCounterListReposResponse < 3) {
312 checkUnnamed434(o.repos);
313 }
314 buildCounterListReposResponse--;
315 }
316
317 core.int buildCounterLogConfig = 0;
318 buildLogConfig() {
319 var o = new api.LogConfig();
320 buildCounterLogConfig++;
321 if (buildCounterLogConfig < 3) {
322 o.cloudAudit = buildCloudAuditOptions();
323 o.counter = buildCounterOptions();
324 o.dataAccess = buildDataAccessOptions();
325 }
326 buildCounterLogConfig--;
327 return o;
328 }
329
330 checkLogConfig(api.LogConfig o) {
331 buildCounterLogConfig++;
332 if (buildCounterLogConfig < 3) {
333 checkCloudAuditOptions(o.cloudAudit);
334 checkCounterOptions(o.counter);
335 checkDataAccessOptions(o.dataAccess);
336 }
337 buildCounterLogConfig--;
338 }
339
340 core.int buildCounterMirrorConfig = 0;
341 buildMirrorConfig() {
342 var o = new api.MirrorConfig();
343 buildCounterMirrorConfig++;
344 if (buildCounterMirrorConfig < 3) {
345 o.deployKeyId = "foo";
346 o.url = "foo";
347 o.webhookId = "foo";
348 }
349 buildCounterMirrorConfig--;
350 return o;
351 }
352
353 checkMirrorConfig(api.MirrorConfig o) {
354 buildCounterMirrorConfig++;
355 if (buildCounterMirrorConfig < 3) {
356 unittest.expect(o.deployKeyId, unittest.equals('foo'));
357 unittest.expect(o.url, unittest.equals('foo'));
358 unittest.expect(o.webhookId, unittest.equals('foo'));
359 }
360 buildCounterMirrorConfig--;
361 }
362
363 buildUnnamed435() {
364 var o = new core.List<api.AuditConfig>();
365 o.add(buildAuditConfig());
366 o.add(buildAuditConfig());
367 return o;
368 }
369
370 checkUnnamed435(core.List<api.AuditConfig> o) {
371 unittest.expect(o, unittest.hasLength(2));
372 checkAuditConfig(o[0]);
373 checkAuditConfig(o[1]);
374 }
375
376 buildUnnamed436() {
377 var o = new core.List<api.Binding>();
378 o.add(buildBinding());
379 o.add(buildBinding());
380 return o;
381 }
382
383 checkUnnamed436(core.List<api.Binding> o) {
384 unittest.expect(o, unittest.hasLength(2));
385 checkBinding(o[0]);
386 checkBinding(o[1]);
387 }
388
389 buildUnnamed437() {
390 var o = new core.List<api.Rule>();
391 o.add(buildRule());
392 o.add(buildRule());
393 return o;
394 }
395
396 checkUnnamed437(core.List<api.Rule> o) {
397 unittest.expect(o, unittest.hasLength(2));
398 checkRule(o[0]);
399 checkRule(o[1]);
400 }
401
402 core.int buildCounterPolicy = 0;
403 buildPolicy() {
404 var o = new api.Policy();
405 buildCounterPolicy++;
406 if (buildCounterPolicy < 3) {
407 o.auditConfigs = buildUnnamed435();
408 o.bindings = buildUnnamed436();
409 o.etag = "foo";
410 o.iamOwned = true;
411 o.rules = buildUnnamed437();
412 o.version = 42;
413 }
414 buildCounterPolicy--;
415 return o;
416 }
417
418 checkPolicy(api.Policy o) {
419 buildCounterPolicy++;
420 if (buildCounterPolicy < 3) {
421 checkUnnamed435(o.auditConfigs);
422 checkUnnamed436(o.bindings);
423 unittest.expect(o.etag, unittest.equals('foo'));
424 unittest.expect(o.iamOwned, unittest.isTrue);
425 checkUnnamed437(o.rules);
426 unittest.expect(o.version, unittest.equals(42));
427 }
428 buildCounterPolicy--;
429 }
430
431 core.int buildCounterRepo = 0;
432 buildRepo() {
433 var o = new api.Repo();
434 buildCounterRepo++;
435 if (buildCounterRepo < 3) {
436 o.mirrorConfig = buildMirrorConfig();
437 o.name = "foo";
438 o.size = "foo";
439 o.url = "foo";
440 }
441 buildCounterRepo--;
442 return o;
443 }
444
445 checkRepo(api.Repo o) {
446 buildCounterRepo++;
447 if (buildCounterRepo < 3) {
448 checkMirrorConfig(o.mirrorConfig);
449 unittest.expect(o.name, unittest.equals('foo'));
450 unittest.expect(o.size, unittest.equals('foo'));
451 unittest.expect(o.url, unittest.equals('foo'));
452 }
453 buildCounterRepo--;
454 }
455
456 buildUnnamed438() {
457 var o = new core.List<api.Condition>();
458 o.add(buildCondition());
459 o.add(buildCondition());
460 return o;
461 }
462
463 checkUnnamed438(core.List<api.Condition> o) {
464 unittest.expect(o, unittest.hasLength(2));
465 checkCondition(o[0]);
466 checkCondition(o[1]);
467 }
468
469 buildUnnamed439() {
470 var o = new core.List<core.String>();
471 o.add("foo");
472 o.add("foo");
473 return o;
474 }
475
476 checkUnnamed439(core.List<core.String> o) {
477 unittest.expect(o, unittest.hasLength(2));
478 unittest.expect(o[0], unittest.equals('foo'));
479 unittest.expect(o[1], unittest.equals('foo'));
480 }
481
482 buildUnnamed440() {
483 var o = new core.List<api.LogConfig>();
484 o.add(buildLogConfig());
485 o.add(buildLogConfig());
486 return o;
487 }
488
489 checkUnnamed440(core.List<api.LogConfig> o) {
490 unittest.expect(o, unittest.hasLength(2));
491 checkLogConfig(o[0]);
492 checkLogConfig(o[1]);
493 }
494
495 buildUnnamed441() {
496 var o = new core.List<core.String>();
497 o.add("foo");
498 o.add("foo");
499 return o;
500 }
501
502 checkUnnamed441(core.List<core.String> o) {
503 unittest.expect(o, unittest.hasLength(2));
504 unittest.expect(o[0], unittest.equals('foo'));
505 unittest.expect(o[1], unittest.equals('foo'));
506 }
507
508 buildUnnamed442() {
509 var o = new core.List<core.String>();
510 o.add("foo");
511 o.add("foo");
512 return o;
513 }
514
515 checkUnnamed442(core.List<core.String> o) {
516 unittest.expect(o, unittest.hasLength(2));
517 unittest.expect(o[0], unittest.equals('foo'));
518 unittest.expect(o[1], unittest.equals('foo'));
519 }
520
521 core.int buildCounterRule = 0;
522 buildRule() {
523 var o = new api.Rule();
524 buildCounterRule++;
525 if (buildCounterRule < 3) {
526 o.action = "foo";
527 o.conditions = buildUnnamed438();
528 o.description = "foo";
529 o.in_ = buildUnnamed439();
530 o.logConfig = buildUnnamed440();
531 o.notIn = buildUnnamed441();
532 o.permissions = buildUnnamed442();
533 }
534 buildCounterRule--;
535 return o;
536 }
537
538 checkRule(api.Rule o) {
539 buildCounterRule++;
540 if (buildCounterRule < 3) {
541 unittest.expect(o.action, unittest.equals('foo'));
542 checkUnnamed438(o.conditions);
543 unittest.expect(o.description, unittest.equals('foo'));
544 checkUnnamed439(o.in_);
545 checkUnnamed440(o.logConfig);
546 checkUnnamed441(o.notIn);
547 checkUnnamed442(o.permissions);
548 }
549 buildCounterRule--;
550 }
551
552 core.int buildCounterSetIamPolicyRequest = 0;
553 buildSetIamPolicyRequest() {
554 var o = new api.SetIamPolicyRequest();
555 buildCounterSetIamPolicyRequest++;
556 if (buildCounterSetIamPolicyRequest < 3) {
557 o.policy = buildPolicy();
558 o.updateMask = "foo";
559 }
560 buildCounterSetIamPolicyRequest--;
561 return o;
562 }
563
564 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) {
565 buildCounterSetIamPolicyRequest++;
566 if (buildCounterSetIamPolicyRequest < 3) {
567 checkPolicy(o.policy);
568 unittest.expect(o.updateMask, unittest.equals('foo'));
569 }
570 buildCounterSetIamPolicyRequest--;
571 }
572
573 buildUnnamed443() {
574 var o = new core.List<core.String>();
575 o.add("foo");
576 o.add("foo");
577 return o;
578 }
579
580 checkUnnamed443(core.List<core.String> o) {
581 unittest.expect(o, unittest.hasLength(2));
582 unittest.expect(o[0], unittest.equals('foo'));
583 unittest.expect(o[1], unittest.equals('foo'));
584 }
585
586 core.int buildCounterTestIamPermissionsRequest = 0;
587 buildTestIamPermissionsRequest() {
588 var o = new api.TestIamPermissionsRequest();
589 buildCounterTestIamPermissionsRequest++;
590 if (buildCounterTestIamPermissionsRequest < 3) {
591 o.permissions = buildUnnamed443();
592 }
593 buildCounterTestIamPermissionsRequest--;
594 return o;
595 }
596
597 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) {
598 buildCounterTestIamPermissionsRequest++;
599 if (buildCounterTestIamPermissionsRequest < 3) {
600 checkUnnamed443(o.permissions);
601 }
602 buildCounterTestIamPermissionsRequest--;
603 }
604
605 buildUnnamed444() {
606 var o = new core.List<core.String>();
607 o.add("foo");
608 o.add("foo");
609 return o;
610 }
611
612 checkUnnamed444(core.List<core.String> o) {
613 unittest.expect(o, unittest.hasLength(2));
614 unittest.expect(o[0], unittest.equals('foo'));
615 unittest.expect(o[1], unittest.equals('foo'));
616 }
617
618 core.int buildCounterTestIamPermissionsResponse = 0;
619 buildTestIamPermissionsResponse() {
620 var o = new api.TestIamPermissionsResponse();
621 buildCounterTestIamPermissionsResponse++;
622 if (buildCounterTestIamPermissionsResponse < 3) {
623 o.permissions = buildUnnamed444();
624 }
625 buildCounterTestIamPermissionsResponse--;
626 return o;
627 }
628
629 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) {
630 buildCounterTestIamPermissionsResponse++;
631 if (buildCounterTestIamPermissionsResponse < 3) {
632 checkUnnamed444(o.permissions);
633 }
634 buildCounterTestIamPermissionsResponse--;
635 }
636
637
638 main() {
639 unittest.group("obj-schema-AuditConfig", () {
640 unittest.test("to-json--from-json", () {
641 var o = buildAuditConfig();
642 var od = new api.AuditConfig.fromJson(o.toJson());
643 checkAuditConfig(od);
644 });
645 });
646
647
648 unittest.group("obj-schema-AuditLogConfig", () {
649 unittest.test("to-json--from-json", () {
650 var o = buildAuditLogConfig();
651 var od = new api.AuditLogConfig.fromJson(o.toJson());
652 checkAuditLogConfig(od);
653 });
654 });
655
656
657 unittest.group("obj-schema-Binding", () {
658 unittest.test("to-json--from-json", () {
659 var o = buildBinding();
660 var od = new api.Binding.fromJson(o.toJson());
661 checkBinding(od);
662 });
663 });
664
665
666 unittest.group("obj-schema-CloudAuditOptions", () {
667 unittest.test("to-json--from-json", () {
668 var o = buildCloudAuditOptions();
669 var od = new api.CloudAuditOptions.fromJson(o.toJson());
670 checkCloudAuditOptions(od);
671 });
672 });
673
674
675 unittest.group("obj-schema-Condition", () {
676 unittest.test("to-json--from-json", () {
677 var o = buildCondition();
678 var od = new api.Condition.fromJson(o.toJson());
679 checkCondition(od);
680 });
681 });
682
683
684 unittest.group("obj-schema-CounterOptions", () {
685 unittest.test("to-json--from-json", () {
686 var o = buildCounterOptions();
687 var od = new api.CounterOptions.fromJson(o.toJson());
688 checkCounterOptions(od);
689 });
690 });
691
692
693 unittest.group("obj-schema-DataAccessOptions", () {
694 unittest.test("to-json--from-json", () {
695 var o = buildDataAccessOptions();
696 var od = new api.DataAccessOptions.fromJson(o.toJson());
697 checkDataAccessOptions(od);
698 });
699 });
700
701
702 unittest.group("obj-schema-Empty", () {
703 unittest.test("to-json--from-json", () {
704 var o = buildEmpty();
705 var od = new api.Empty.fromJson(o.toJson());
706 checkEmpty(od);
707 });
708 });
709
710
711 unittest.group("obj-schema-ListReposResponse", () {
712 unittest.test("to-json--from-json", () {
713 var o = buildListReposResponse();
714 var od = new api.ListReposResponse.fromJson(o.toJson());
715 checkListReposResponse(od);
716 });
717 });
718
719
720 unittest.group("obj-schema-LogConfig", () {
721 unittest.test("to-json--from-json", () {
722 var o = buildLogConfig();
723 var od = new api.LogConfig.fromJson(o.toJson());
724 checkLogConfig(od);
725 });
726 });
727
728
729 unittest.group("obj-schema-MirrorConfig", () {
730 unittest.test("to-json--from-json", () {
731 var o = buildMirrorConfig();
732 var od = new api.MirrorConfig.fromJson(o.toJson());
733 checkMirrorConfig(od);
734 });
735 });
736
737
738 unittest.group("obj-schema-Policy", () {
739 unittest.test("to-json--from-json", () {
740 var o = buildPolicy();
741 var od = new api.Policy.fromJson(o.toJson());
742 checkPolicy(od);
743 });
744 });
745
746
747 unittest.group("obj-schema-Repo", () {
748 unittest.test("to-json--from-json", () {
749 var o = buildRepo();
750 var od = new api.Repo.fromJson(o.toJson());
751 checkRepo(od);
752 });
753 });
754
755
756 unittest.group("obj-schema-Rule", () {
757 unittest.test("to-json--from-json", () {
758 var o = buildRule();
759 var od = new api.Rule.fromJson(o.toJson());
760 checkRule(od);
761 });
762 });
763
764
765 unittest.group("obj-schema-SetIamPolicyRequest", () {
766 unittest.test("to-json--from-json", () {
767 var o = buildSetIamPolicyRequest();
768 var od = new api.SetIamPolicyRequest.fromJson(o.toJson());
769 checkSetIamPolicyRequest(od);
770 });
771 });
772
773
774 unittest.group("obj-schema-TestIamPermissionsRequest", () {
775 unittest.test("to-json--from-json", () {
776 var o = buildTestIamPermissionsRequest();
777 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson());
778 checkTestIamPermissionsRequest(od);
779 });
780 });
781
782
783 unittest.group("obj-schema-TestIamPermissionsResponse", () {
784 unittest.test("to-json--from-json", () {
785 var o = buildTestIamPermissionsResponse();
786 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson());
787 checkTestIamPermissionsResponse(od);
788 });
789 });
790
791
792 unittest.group("resource-ProjectsReposResourceApi", () {
793 unittest.test("method--create", () {
794
795 var mock = new HttpServerMock();
796 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
797 var arg_request = buildRepo();
798 var arg_parent = "foo";
799 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
800 var obj = new api.Repo.fromJson(json);
801 checkRepo(obj);
802
803 var path = (req.url).path;
804 var pathOffset = 0;
805 var index;
806 var subPart;
807 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
808 pathOffset += 1;
809 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
810 pathOffset += 3;
811 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
812
813 var query = (req.url).query;
814 var queryOffset = 0;
815 var queryMap = {};
816 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
817 parseBool(n) {
818 if (n == "true") return true;
819 if (n == "false") return false;
820 if (n == null) return null;
821 throw new core.ArgumentError("Invalid boolean: $n");
822 }
823 if (query.length > 0) {
824 for (var part in query.split("&")) {
825 var keyvalue = part.split("=");
826 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
827 }
828 }
829
830
831 var h = {
832 "content-type" : "application/json; charset=utf-8",
833 };
834 var resp = convert.JSON.encode(buildRepo());
835 return new async.Future.value(stringResponse(200, h, resp));
836 }), true);
837 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Repo r esponse) {
838 checkRepo(response);
839 })));
840 });
841
842 unittest.test("method--delete", () {
843
844 var mock = new HttpServerMock();
845 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
846 var arg_name = "foo";
847 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
848 var path = (req.url).path;
849 var pathOffset = 0;
850 var index;
851 var subPart;
852 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
853 pathOffset += 1;
854 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
855 pathOffset += 3;
856 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
857
858 var query = (req.url).query;
859 var queryOffset = 0;
860 var queryMap = {};
861 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
862 parseBool(n) {
863 if (n == "true") return true;
864 if (n == "false") return false;
865 if (n == null) return null;
866 throw new core.ArgumentError("Invalid boolean: $n");
867 }
868 if (query.length > 0) {
869 for (var part in query.split("&")) {
870 var keyvalue = part.split("=");
871 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
872 }
873 }
874
875
876 var h = {
877 "content-type" : "application/json; charset=utf-8",
878 };
879 var resp = convert.JSON.encode(buildEmpty());
880 return new async.Future.value(stringResponse(200, h, resp));
881 }), true);
882 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) {
883 checkEmpty(response);
884 })));
885 });
886
887 unittest.test("method--get", () {
888
889 var mock = new HttpServerMock();
890 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
891 var arg_name = "foo";
892 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
893 var path = (req.url).path;
894 var pathOffset = 0;
895 var index;
896 var subPart;
897 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
898 pathOffset += 1;
899 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
900 pathOffset += 3;
901 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
902
903 var query = (req.url).query;
904 var queryOffset = 0;
905 var queryMap = {};
906 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
907 parseBool(n) {
908 if (n == "true") return true;
909 if (n == "false") return false;
910 if (n == null) return null;
911 throw new core.ArgumentError("Invalid boolean: $n");
912 }
913 if (query.length > 0) {
914 for (var part in query.split("&")) {
915 var keyvalue = part.split("=");
916 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
917 }
918 }
919
920
921 var h = {
922 "content-type" : "application/json; charset=utf-8",
923 };
924 var resp = convert.JSON.encode(buildRepo());
925 return new async.Future.value(stringResponse(200, h, resp));
926 }), true);
927 res.get(arg_name).then(unittest.expectAsync(((api.Repo response) {
928 checkRepo(response);
929 })));
930 });
931
932 unittest.test("method--getIamPolicy", () {
933
934 var mock = new HttpServerMock();
935 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
936 var arg_resource = "foo";
937 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
938 var path = (req.url).path;
939 var pathOffset = 0;
940 var index;
941 var subPart;
942 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
943 pathOffset += 1;
944 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
945 pathOffset += 3;
946 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
947
948 var query = (req.url).query;
949 var queryOffset = 0;
950 var queryMap = {};
951 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
952 parseBool(n) {
953 if (n == "true") return true;
954 if (n == "false") return false;
955 if (n == null) return null;
956 throw new core.ArgumentError("Invalid boolean: $n");
957 }
958 if (query.length > 0) {
959 for (var part in query.split("&")) {
960 var keyvalue = part.split("=");
961 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
962 }
963 }
964
965
966 var h = {
967 "content-type" : "application/json; charset=utf-8",
968 };
969 var resp = convert.JSON.encode(buildPolicy());
970 return new async.Future.value(stringResponse(200, h, resp));
971 }), true);
972 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp onse) {
973 checkPolicy(response);
974 })));
975 });
976
977 unittest.test("method--list", () {
978
979 var mock = new HttpServerMock();
980 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
981 var arg_name = "foo";
982 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
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 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
990 pathOffset += 3;
991 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
992
993 var query = (req.url).query;
994 var queryOffset = 0;
995 var queryMap = {};
996 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
997 parseBool(n) {
998 if (n == "true") return true;
999 if (n == "false") return false;
1000 if (n == null) return null;
1001 throw new core.ArgumentError("Invalid boolean: $n");
1002 }
1003 if (query.length > 0) {
1004 for (var part in query.split("&")) {
1005 var keyvalue = part.split("=");
1006 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1007 }
1008 }
1009
1010
1011 var h = {
1012 "content-type" : "application/json; charset=utf-8",
1013 };
1014 var resp = convert.JSON.encode(buildListReposResponse());
1015 return new async.Future.value(stringResponse(200, h, resp));
1016 }), true);
1017 res.list(arg_name).then(unittest.expectAsync(((api.ListReposResponse respo nse) {
1018 checkListReposResponse(response);
1019 })));
1020 });
1021
1022 unittest.test("method--setIamPolicy", () {
1023
1024 var mock = new HttpServerMock();
1025 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
1026 var arg_request = buildSetIamPolicyRequest();
1027 var arg_resource = "foo";
1028 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1029 var obj = new api.SetIamPolicyRequest.fromJson(json);
1030 checkSetIamPolicyRequest(obj);
1031
1032 var path = (req.url).path;
1033 var pathOffset = 0;
1034 var index;
1035 var subPart;
1036 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1037 pathOffset += 1;
1038 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
1039 pathOffset += 3;
1040 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1041
1042 var query = (req.url).query;
1043 var queryOffset = 0;
1044 var queryMap = {};
1045 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1046 parseBool(n) {
1047 if (n == "true") return true;
1048 if (n == "false") return false;
1049 if (n == null) return null;
1050 throw new core.ArgumentError("Invalid boolean: $n");
1051 }
1052 if (query.length > 0) {
1053 for (var part in query.split("&")) {
1054 var keyvalue = part.split("=");
1055 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1056 }
1057 }
1058
1059
1060 var h = {
1061 "content-type" : "application/json; charset=utf-8",
1062 };
1063 var resp = convert.JSON.encode(buildPolicy());
1064 return new async.Future.value(stringResponse(200, h, resp));
1065 }), true);
1066 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((ap i.Policy response) {
1067 checkPolicy(response);
1068 })));
1069 });
1070
1071 unittest.test("method--testIamPermissions", () {
1072
1073 var mock = new HttpServerMock();
1074 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re pos;
1075 var arg_request = buildTestIamPermissionsRequest();
1076 var arg_resource = "foo";
1077 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1078 var obj = new api.TestIamPermissionsRequest.fromJson(json);
1079 checkTestIamPermissionsRequest(obj);
1080
1081 var path = (req.url).path;
1082 var pathOffset = 0;
1083 var index;
1084 var subPart;
1085 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1086 pathOffset += 1;
1087 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
1088 pathOffset += 3;
1089 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1090
1091 var query = (req.url).query;
1092 var queryOffset = 0;
1093 var queryMap = {};
1094 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1095 parseBool(n) {
1096 if (n == "true") return true;
1097 if (n == "false") return false;
1098 if (n == null) return null;
1099 throw new core.ArgumentError("Invalid boolean: $n");
1100 }
1101 if (query.length > 0) {
1102 for (var part in query.split("&")) {
1103 var keyvalue = part.split("=");
1104 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1105 }
1106 }
1107
1108
1109 var h = {
1110 "content-type" : "application/json; charset=utf-8",
1111 };
1112 var resp = convert.JSON.encode(buildTestIamPermissionsResponse());
1113 return new async.Future.value(stringResponse(200, h, resp));
1114 }), true);
1115 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn c(((api.TestIamPermissionsResponse response) {
1116 checkTestIamPermissionsResponse(response);
1117 })));
1118 });
1119
1120 });
1121
1122
1123 }
1124
OLDNEW
« no previous file with comments | « generated/googleapis/test/slides/v1_test.dart ('k') | generated/googleapis/test/spanner/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698