Chromium Code Reviews

Side by Side Diff: generated/googleapis/test/civicinfo/us_v1.dart

Issue 559053002: Generate 0.1.0 version of googleapis/googleapis_beta (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 library googleapis.civicinfo.us_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 import 'package:googleapis/common/common.dart' as common;
12 import 'package:googleapis/src/common_internal.dart' as common_internal;
13 import '../common/common_internal_test.dart' as common_test;
14
15 import 'package:googleapis/civicinfo/us_v1.dart' as api;
16
17
18
19 buildUnnamed781() {
20 var o = new core.List<api.Source>();
21 o.add(buildSource());
22 o.add(buildSource());
23 return o;
24 }
25
26 checkUnnamed781(core.List<api.Source> o) {
27 unittest.expect(o, unittest.hasLength(2));
28 checkSource(o[0]);
29 checkSource(o[1]);
30 }
31
32 core.int buildCounterAdministrationRegion = 0;
33 buildAdministrationRegion() {
34 var o = new api.AdministrationRegion();
35 buildCounterAdministrationRegion++;
36 if (buildCounterAdministrationRegion < 3) {
37 o.electionAdministrationBody = buildAdministrativeBody();
38 o.id = "foo";
39 o.localJurisdiction = buildAdministrationRegion();
40 o.name = "foo";
41 o.sources = buildUnnamed781();
42 }
43 buildCounterAdministrationRegion--;
44 return o;
45 }
46
47 checkAdministrationRegion(api.AdministrationRegion o) {
48 buildCounterAdministrationRegion++;
49 if (buildCounterAdministrationRegion < 3) {
50 checkAdministrativeBody(o.electionAdministrationBody);
51 unittest.expect(o.id, unittest.equals('foo'));
52 checkAdministrationRegion(o.localJurisdiction);
53 unittest.expect(o.name, unittest.equals('foo'));
54 checkUnnamed781(o.sources);
55 }
56 buildCounterAdministrationRegion--;
57 }
58
59 buildUnnamed782() {
60 var o = new core.List<api.ElectionOfficial>();
61 o.add(buildElectionOfficial());
62 o.add(buildElectionOfficial());
63 return o;
64 }
65
66 checkUnnamed782(core.List<api.ElectionOfficial> o) {
67 unittest.expect(o, unittest.hasLength(2));
68 checkElectionOfficial(o[0]);
69 checkElectionOfficial(o[1]);
70 }
71
72 buildUnnamed783() {
73 var o = new core.List<core.String>();
74 o.add("foo");
75 o.add("foo");
76 return o;
77 }
78
79 checkUnnamed783(core.List<core.String> o) {
80 unittest.expect(o, unittest.hasLength(2));
81 unittest.expect(o[0], unittest.equals('foo'));
82 unittest.expect(o[1], unittest.equals('foo'));
83 }
84
85 core.int buildCounterAdministrativeBody = 0;
86 buildAdministrativeBody() {
87 var o = new api.AdministrativeBody();
88 buildCounterAdministrativeBody++;
89 if (buildCounterAdministrativeBody < 3) {
90 o.absenteeVotingInfoUrl = "foo";
91 o.ballotInfoUrl = "foo";
92 o.correspondenceAddress = buildSimpleAddressType();
93 o.electionInfoUrl = "foo";
94 o.electionOfficials = buildUnnamed782();
95 o.electionRegistrationConfirmationUrl = "foo";
96 o.electionRegistrationUrl = "foo";
97 o.electionRulesUrl = "foo";
98 o.hoursOfOperation = "foo";
99 o.name = "foo";
100 o.physicalAddress = buildSimpleAddressType();
101 o.voterServices = buildUnnamed783();
102 o.votingLocationFinderUrl = "foo";
103 }
104 buildCounterAdministrativeBody--;
105 return o;
106 }
107
108 checkAdministrativeBody(api.AdministrativeBody o) {
109 buildCounterAdministrativeBody++;
110 if (buildCounterAdministrativeBody < 3) {
111 unittest.expect(o.absenteeVotingInfoUrl, unittest.equals('foo'));
112 unittest.expect(o.ballotInfoUrl, unittest.equals('foo'));
113 checkSimpleAddressType(o.correspondenceAddress);
114 unittest.expect(o.electionInfoUrl, unittest.equals('foo'));
115 checkUnnamed782(o.electionOfficials);
116 unittest.expect(o.electionRegistrationConfirmationUrl, unittest.equals('foo' ));
117 unittest.expect(o.electionRegistrationUrl, unittest.equals('foo'));
118 unittest.expect(o.electionRulesUrl, unittest.equals('foo'));
119 unittest.expect(o.hoursOfOperation, unittest.equals('foo'));
120 unittest.expect(o.name, unittest.equals('foo'));
121 checkSimpleAddressType(o.physicalAddress);
122 checkUnnamed783(o.voterServices);
123 unittest.expect(o.votingLocationFinderUrl, unittest.equals('foo'));
124 }
125 buildCounterAdministrativeBody--;
126 }
127
128 buildUnnamed784() {
129 var o = new core.List<api.Channel>();
130 o.add(buildChannel());
131 o.add(buildChannel());
132 return o;
133 }
134
135 checkUnnamed784(core.List<api.Channel> o) {
136 unittest.expect(o, unittest.hasLength(2));
137 checkChannel(o[0]);
138 checkChannel(o[1]);
139 }
140
141 core.int buildCounterCandidate = 0;
142 buildCandidate() {
143 var o = new api.Candidate();
144 buildCounterCandidate++;
145 if (buildCounterCandidate < 3) {
146 o.candidateUrl = "foo";
147 o.channels = buildUnnamed784();
148 o.email = "foo";
149 o.name = "foo";
150 o.orderOnBallot = "foo";
151 o.party = "foo";
152 o.phone = "foo";
153 o.photoUrl = "foo";
154 }
155 buildCounterCandidate--;
156 return o;
157 }
158
159 checkCandidate(api.Candidate o) {
160 buildCounterCandidate++;
161 if (buildCounterCandidate < 3) {
162 unittest.expect(o.candidateUrl, unittest.equals('foo'));
163 checkUnnamed784(o.channels);
164 unittest.expect(o.email, unittest.equals('foo'));
165 unittest.expect(o.name, unittest.equals('foo'));
166 unittest.expect(o.orderOnBallot, unittest.equals('foo'));
167 unittest.expect(o.party, unittest.equals('foo'));
168 unittest.expect(o.phone, unittest.equals('foo'));
169 unittest.expect(o.photoUrl, unittest.equals('foo'));
170 }
171 buildCounterCandidate--;
172 }
173
174 core.int buildCounterChannel = 0;
175 buildChannel() {
176 var o = new api.Channel();
177 buildCounterChannel++;
178 if (buildCounterChannel < 3) {
179 o.id = "foo";
180 o.type = "foo";
181 }
182 buildCounterChannel--;
183 return o;
184 }
185
186 checkChannel(api.Channel o) {
187 buildCounterChannel++;
188 if (buildCounterChannel < 3) {
189 unittest.expect(o.id, unittest.equals('foo'));
190 unittest.expect(o.type, unittest.equals('foo'));
191 }
192 buildCounterChannel--;
193 }
194
195 buildUnnamed785() {
196 var o = new core.List<api.Candidate>();
197 o.add(buildCandidate());
198 o.add(buildCandidate());
199 return o;
200 }
201
202 checkUnnamed785(core.List<api.Candidate> o) {
203 unittest.expect(o, unittest.hasLength(2));
204 checkCandidate(o[0]);
205 checkCandidate(o[1]);
206 }
207
208 buildUnnamed786() {
209 var o = new core.List<api.Source>();
210 o.add(buildSource());
211 o.add(buildSource());
212 return o;
213 }
214
215 checkUnnamed786(core.List<api.Source> o) {
216 unittest.expect(o, unittest.hasLength(2));
217 checkSource(o[0]);
218 checkSource(o[1]);
219 }
220
221 core.int buildCounterContest = 0;
222 buildContest() {
223 var o = new api.Contest();
224 buildCounterContest++;
225 if (buildCounterContest < 3) {
226 o.ballotPlacement = "foo";
227 o.candidates = buildUnnamed785();
228 o.district = buildElectoralDistrict();
229 o.electorateSpecifications = "foo";
230 o.id = "foo";
231 o.level = "foo";
232 o.numberElected = "foo";
233 o.numberVotingFor = "foo";
234 o.office = "foo";
235 o.primaryParty = "foo";
236 o.referendumSubtitle = "foo";
237 o.referendumTitle = "foo";
238 o.referendumUrl = "foo";
239 o.sources = buildUnnamed786();
240 o.special = "foo";
241 o.type = "foo";
242 }
243 buildCounterContest--;
244 return o;
245 }
246
247 checkContest(api.Contest o) {
248 buildCounterContest++;
249 if (buildCounterContest < 3) {
250 unittest.expect(o.ballotPlacement, unittest.equals('foo'));
251 checkUnnamed785(o.candidates);
252 checkElectoralDistrict(o.district);
253 unittest.expect(o.electorateSpecifications, unittest.equals('foo'));
254 unittest.expect(o.id, unittest.equals('foo'));
255 unittest.expect(o.level, unittest.equals('foo'));
256 unittest.expect(o.numberElected, unittest.equals('foo'));
257 unittest.expect(o.numberVotingFor, unittest.equals('foo'));
258 unittest.expect(o.office, unittest.equals('foo'));
259 unittest.expect(o.primaryParty, unittest.equals('foo'));
260 unittest.expect(o.referendumSubtitle, unittest.equals('foo'));
261 unittest.expect(o.referendumTitle, unittest.equals('foo'));
262 unittest.expect(o.referendumUrl, unittest.equals('foo'));
263 checkUnnamed786(o.sources);
264 unittest.expect(o.special, unittest.equals('foo'));
265 unittest.expect(o.type, unittest.equals('foo'));
266 }
267 buildCounterContest--;
268 }
269
270 buildUnnamed787() {
271 var o = new core.List<api.DivisionSearchResult>();
272 o.add(buildDivisionSearchResult());
273 o.add(buildDivisionSearchResult());
274 return o;
275 }
276
277 checkUnnamed787(core.List<api.DivisionSearchResult> o) {
278 unittest.expect(o, unittest.hasLength(2));
279 checkDivisionSearchResult(o[0]);
280 checkDivisionSearchResult(o[1]);
281 }
282
283 core.int buildCounterDivisionSearchResponse = 0;
284 buildDivisionSearchResponse() {
285 var o = new api.DivisionSearchResponse();
286 buildCounterDivisionSearchResponse++;
287 if (buildCounterDivisionSearchResponse < 3) {
288 o.kind = "foo";
289 o.results = buildUnnamed787();
290 o.status = "foo";
291 }
292 buildCounterDivisionSearchResponse--;
293 return o;
294 }
295
296 checkDivisionSearchResponse(api.DivisionSearchResponse o) {
297 buildCounterDivisionSearchResponse++;
298 if (buildCounterDivisionSearchResponse < 3) {
299 unittest.expect(o.kind, unittest.equals('foo'));
300 checkUnnamed787(o.results);
301 unittest.expect(o.status, unittest.equals('foo'));
302 }
303 buildCounterDivisionSearchResponse--;
304 }
305
306 buildUnnamed788() {
307 var o = new core.List<core.String>();
308 o.add("foo");
309 o.add("foo");
310 return o;
311 }
312
313 checkUnnamed788(core.List<core.String> o) {
314 unittest.expect(o, unittest.hasLength(2));
315 unittest.expect(o[0], unittest.equals('foo'));
316 unittest.expect(o[1], unittest.equals('foo'));
317 }
318
319 core.int buildCounterDivisionSearchResult = 0;
320 buildDivisionSearchResult() {
321 var o = new api.DivisionSearchResult();
322 buildCounterDivisionSearchResult++;
323 if (buildCounterDivisionSearchResult < 3) {
324 o.aliases = buildUnnamed788();
325 o.name = "foo";
326 o.ocdId = "foo";
327 }
328 buildCounterDivisionSearchResult--;
329 return o;
330 }
331
332 checkDivisionSearchResult(api.DivisionSearchResult o) {
333 buildCounterDivisionSearchResult++;
334 if (buildCounterDivisionSearchResult < 3) {
335 checkUnnamed788(o.aliases);
336 unittest.expect(o.name, unittest.equals('foo'));
337 unittest.expect(o.ocdId, unittest.equals('foo'));
338 }
339 buildCounterDivisionSearchResult--;
340 }
341
342 core.int buildCounterElection = 0;
343 buildElection() {
344 var o = new api.Election();
345 buildCounterElection++;
346 if (buildCounterElection < 3) {
347 o.electionDay = "foo";
348 o.id = "foo";
349 o.name = "foo";
350 }
351 buildCounterElection--;
352 return o;
353 }
354
355 checkElection(api.Election o) {
356 buildCounterElection++;
357 if (buildCounterElection < 3) {
358 unittest.expect(o.electionDay, unittest.equals('foo'));
359 unittest.expect(o.id, unittest.equals('foo'));
360 unittest.expect(o.name, unittest.equals('foo'));
361 }
362 buildCounterElection--;
363 }
364
365 core.int buildCounterElectionOfficial = 0;
366 buildElectionOfficial() {
367 var o = new api.ElectionOfficial();
368 buildCounterElectionOfficial++;
369 if (buildCounterElectionOfficial < 3) {
370 o.emailAddress = "foo";
371 o.faxNumber = "foo";
372 o.name = "foo";
373 o.officePhoneNumber = "foo";
374 o.title = "foo";
375 }
376 buildCounterElectionOfficial--;
377 return o;
378 }
379
380 checkElectionOfficial(api.ElectionOfficial o) {
381 buildCounterElectionOfficial++;
382 if (buildCounterElectionOfficial < 3) {
383 unittest.expect(o.emailAddress, unittest.equals('foo'));
384 unittest.expect(o.faxNumber, unittest.equals('foo'));
385 unittest.expect(o.name, unittest.equals('foo'));
386 unittest.expect(o.officePhoneNumber, unittest.equals('foo'));
387 unittest.expect(o.title, unittest.equals('foo'));
388 }
389 buildCounterElectionOfficial--;
390 }
391
392 buildUnnamed789() {
393 var o = new core.List<api.Election>();
394 o.add(buildElection());
395 o.add(buildElection());
396 return o;
397 }
398
399 checkUnnamed789(core.List<api.Election> o) {
400 unittest.expect(o, unittest.hasLength(2));
401 checkElection(o[0]);
402 checkElection(o[1]);
403 }
404
405 core.int buildCounterElectionsQueryResponse = 0;
406 buildElectionsQueryResponse() {
407 var o = new api.ElectionsQueryResponse();
408 buildCounterElectionsQueryResponse++;
409 if (buildCounterElectionsQueryResponse < 3) {
410 o.elections = buildUnnamed789();
411 o.kind = "foo";
412 }
413 buildCounterElectionsQueryResponse--;
414 return o;
415 }
416
417 checkElectionsQueryResponse(api.ElectionsQueryResponse o) {
418 buildCounterElectionsQueryResponse++;
419 if (buildCounterElectionsQueryResponse < 3) {
420 checkUnnamed789(o.elections);
421 unittest.expect(o.kind, unittest.equals('foo'));
422 }
423 buildCounterElectionsQueryResponse--;
424 }
425
426 core.int buildCounterElectoralDistrict = 0;
427 buildElectoralDistrict() {
428 var o = new api.ElectoralDistrict();
429 buildCounterElectoralDistrict++;
430 if (buildCounterElectoralDistrict < 3) {
431 o.id = "foo";
432 o.name = "foo";
433 o.scope = "foo";
434 }
435 buildCounterElectoralDistrict--;
436 return o;
437 }
438
439 checkElectoralDistrict(api.ElectoralDistrict o) {
440 buildCounterElectoralDistrict++;
441 if (buildCounterElectoralDistrict < 3) {
442 unittest.expect(o.id, unittest.equals('foo'));
443 unittest.expect(o.name, unittest.equals('foo'));
444 unittest.expect(o.scope, unittest.equals('foo'));
445 }
446 buildCounterElectoralDistrict--;
447 }
448
449 buildUnnamed790() {
450 var o = new core.List<core.String>();
451 o.add("foo");
452 o.add("foo");
453 return o;
454 }
455
456 checkUnnamed790(core.List<core.String> o) {
457 unittest.expect(o, unittest.hasLength(2));
458 unittest.expect(o[0], unittest.equals('foo'));
459 unittest.expect(o[1], unittest.equals('foo'));
460 }
461
462 buildUnnamed791() {
463 var o = new core.List<core.String>();
464 o.add("foo");
465 o.add("foo");
466 return o;
467 }
468
469 checkUnnamed791(core.List<core.String> o) {
470 unittest.expect(o, unittest.hasLength(2));
471 unittest.expect(o[0], unittest.equals('foo'));
472 unittest.expect(o[1], unittest.equals('foo'));
473 }
474
475 core.int buildCounterGeographicDivision = 0;
476 buildGeographicDivision() {
477 var o = new api.GeographicDivision();
478 buildCounterGeographicDivision++;
479 if (buildCounterGeographicDivision < 3) {
480 o.alsoKnownAs = buildUnnamed790();
481 o.name = "foo";
482 o.officeIds = buildUnnamed791();
483 o.scope = "foo";
484 }
485 buildCounterGeographicDivision--;
486 return o;
487 }
488
489 checkGeographicDivision(api.GeographicDivision o) {
490 buildCounterGeographicDivision++;
491 if (buildCounterGeographicDivision < 3) {
492 checkUnnamed790(o.alsoKnownAs);
493 unittest.expect(o.name, unittest.equals('foo'));
494 checkUnnamed791(o.officeIds);
495 unittest.expect(o.scope, unittest.equals('foo'));
496 }
497 buildCounterGeographicDivision--;
498 }
499
500 buildUnnamed792() {
501 var o = new core.List<core.String>();
502 o.add("foo");
503 o.add("foo");
504 return o;
505 }
506
507 checkUnnamed792(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 buildUnnamed793() {
514 var o = new core.List<api.Source>();
515 o.add(buildSource());
516 o.add(buildSource());
517 return o;
518 }
519
520 checkUnnamed793(core.List<api.Source> o) {
521 unittest.expect(o, unittest.hasLength(2));
522 checkSource(o[0]);
523 checkSource(o[1]);
524 }
525
526 core.int buildCounterOffice = 0;
527 buildOffice() {
528 var o = new api.Office();
529 buildCounterOffice++;
530 if (buildCounterOffice < 3) {
531 o.divisionId = "foo";
532 o.level = "foo";
533 o.name = "foo";
534 o.officialIds = buildUnnamed792();
535 o.sources = buildUnnamed793();
536 }
537 buildCounterOffice--;
538 return o;
539 }
540
541 checkOffice(api.Office o) {
542 buildCounterOffice++;
543 if (buildCounterOffice < 3) {
544 unittest.expect(o.divisionId, unittest.equals('foo'));
545 unittest.expect(o.level, unittest.equals('foo'));
546 unittest.expect(o.name, unittest.equals('foo'));
547 checkUnnamed792(o.officialIds);
548 checkUnnamed793(o.sources);
549 }
550 buildCounterOffice--;
551 }
552
553 buildUnnamed794() {
554 var o = new core.List<api.SimpleAddressType>();
555 o.add(buildSimpleAddressType());
556 o.add(buildSimpleAddressType());
557 return o;
558 }
559
560 checkUnnamed794(core.List<api.SimpleAddressType> o) {
561 unittest.expect(o, unittest.hasLength(2));
562 checkSimpleAddressType(o[0]);
563 checkSimpleAddressType(o[1]);
564 }
565
566 buildUnnamed795() {
567 var o = new core.List<api.Channel>();
568 o.add(buildChannel());
569 o.add(buildChannel());
570 return o;
571 }
572
573 checkUnnamed795(core.List<api.Channel> o) {
574 unittest.expect(o, unittest.hasLength(2));
575 checkChannel(o[0]);
576 checkChannel(o[1]);
577 }
578
579 buildUnnamed796() {
580 var o = new core.List<core.String>();
581 o.add("foo");
582 o.add("foo");
583 return o;
584 }
585
586 checkUnnamed796(core.List<core.String> o) {
587 unittest.expect(o, unittest.hasLength(2));
588 unittest.expect(o[0], unittest.equals('foo'));
589 unittest.expect(o[1], unittest.equals('foo'));
590 }
591
592 buildUnnamed797() {
593 var o = new core.List<core.String>();
594 o.add("foo");
595 o.add("foo");
596 return o;
597 }
598
599 checkUnnamed797(core.List<core.String> o) {
600 unittest.expect(o, unittest.hasLength(2));
601 unittest.expect(o[0], unittest.equals('foo'));
602 unittest.expect(o[1], unittest.equals('foo'));
603 }
604
605 buildUnnamed798() {
606 var o = new core.List<core.String>();
607 o.add("foo");
608 o.add("foo");
609 return o;
610 }
611
612 checkUnnamed798(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 buildCounterOfficial = 0;
619 buildOfficial() {
620 var o = new api.Official();
621 buildCounterOfficial++;
622 if (buildCounterOfficial < 3) {
623 o.address = buildUnnamed794();
624 o.channels = buildUnnamed795();
625 o.emails = buildUnnamed796();
626 o.name = "foo";
627 o.party = "foo";
628 o.phones = buildUnnamed797();
629 o.photoUrl = "foo";
630 o.urls = buildUnnamed798();
631 }
632 buildCounterOfficial--;
633 return o;
634 }
635
636 checkOfficial(api.Official o) {
637 buildCounterOfficial++;
638 if (buildCounterOfficial < 3) {
639 checkUnnamed794(o.address);
640 checkUnnamed795(o.channels);
641 checkUnnamed796(o.emails);
642 unittest.expect(o.name, unittest.equals('foo'));
643 unittest.expect(o.party, unittest.equals('foo'));
644 checkUnnamed797(o.phones);
645 unittest.expect(o.photoUrl, unittest.equals('foo'));
646 checkUnnamed798(o.urls);
647 }
648 buildCounterOfficial--;
649 }
650
651 buildUnnamed799() {
652 var o = new core.List<api.Source>();
653 o.add(buildSource());
654 o.add(buildSource());
655 return o;
656 }
657
658 checkUnnamed799(core.List<api.Source> o) {
659 unittest.expect(o, unittest.hasLength(2));
660 checkSource(o[0]);
661 checkSource(o[1]);
662 }
663
664 core.int buildCounterPollingLocation = 0;
665 buildPollingLocation() {
666 var o = new api.PollingLocation();
667 buildCounterPollingLocation++;
668 if (buildCounterPollingLocation < 3) {
669 o.address = buildSimpleAddressType();
670 o.endDate = "foo";
671 o.id = "foo";
672 o.name = "foo";
673 o.notes = "foo";
674 o.pollingHours = "foo";
675 o.sources = buildUnnamed799();
676 o.startDate = "foo";
677 o.voterServices = "foo";
678 }
679 buildCounterPollingLocation--;
680 return o;
681 }
682
683 checkPollingLocation(api.PollingLocation o) {
684 buildCounterPollingLocation++;
685 if (buildCounterPollingLocation < 3) {
686 checkSimpleAddressType(o.address);
687 unittest.expect(o.endDate, unittest.equals('foo'));
688 unittest.expect(o.id, unittest.equals('foo'));
689 unittest.expect(o.name, unittest.equals('foo'));
690 unittest.expect(o.notes, unittest.equals('foo'));
691 unittest.expect(o.pollingHours, unittest.equals('foo'));
692 checkUnnamed799(o.sources);
693 unittest.expect(o.startDate, unittest.equals('foo'));
694 unittest.expect(o.voterServices, unittest.equals('foo'));
695 }
696 buildCounterPollingLocation--;
697 }
698
699 core.int buildCounterRepresentativeInfoRequest = 0;
700 buildRepresentativeInfoRequest() {
701 var o = new api.RepresentativeInfoRequest();
702 buildCounterRepresentativeInfoRequest++;
703 if (buildCounterRepresentativeInfoRequest < 3) {
704 o.address = "foo";
705 }
706 buildCounterRepresentativeInfoRequest--;
707 return o;
708 }
709
710 checkRepresentativeInfoRequest(api.RepresentativeInfoRequest o) {
711 buildCounterRepresentativeInfoRequest++;
712 if (buildCounterRepresentativeInfoRequest < 3) {
713 unittest.expect(o.address, unittest.equals('foo'));
714 }
715 buildCounterRepresentativeInfoRequest--;
716 }
717
718 buildUnnamed800() {
719 var o = new core.Map<core.String, api.GeographicDivision>();
720 o["x"] = buildGeographicDivision();
721 o["y"] = buildGeographicDivision();
722 return o;
723 }
724
725 checkUnnamed800(core.Map<core.String, api.GeographicDivision> o) {
726 unittest.expect(o, unittest.hasLength(2));
727 checkGeographicDivision(o["x"]);
728 checkGeographicDivision(o["y"]);
729 }
730
731 buildUnnamed801() {
732 var o = new core.Map<core.String, api.Office>();
733 o["x"] = buildOffice();
734 o["y"] = buildOffice();
735 return o;
736 }
737
738 checkUnnamed801(core.Map<core.String, api.Office> o) {
739 unittest.expect(o, unittest.hasLength(2));
740 checkOffice(o["x"]);
741 checkOffice(o["y"]);
742 }
743
744 buildUnnamed802() {
745 var o = new core.Map<core.String, api.Official>();
746 o["x"] = buildOfficial();
747 o["y"] = buildOfficial();
748 return o;
749 }
750
751 checkUnnamed802(core.Map<core.String, api.Official> o) {
752 unittest.expect(o, unittest.hasLength(2));
753 checkOfficial(o["x"]);
754 checkOfficial(o["y"]);
755 }
756
757 core.int buildCounterRepresentativeInfoResponse = 0;
758 buildRepresentativeInfoResponse() {
759 var o = new api.RepresentativeInfoResponse();
760 buildCounterRepresentativeInfoResponse++;
761 if (buildCounterRepresentativeInfoResponse < 3) {
762 o.divisions = buildUnnamed800();
763 o.kind = "foo";
764 o.normalizedInput = buildSimpleAddressType();
765 o.offices = buildUnnamed801();
766 o.officials = buildUnnamed802();
767 o.status = "foo";
768 }
769 buildCounterRepresentativeInfoResponse--;
770 return o;
771 }
772
773 checkRepresentativeInfoResponse(api.RepresentativeInfoResponse o) {
774 buildCounterRepresentativeInfoResponse++;
775 if (buildCounterRepresentativeInfoResponse < 3) {
776 checkUnnamed800(o.divisions);
777 unittest.expect(o.kind, unittest.equals('foo'));
778 checkSimpleAddressType(o.normalizedInput);
779 checkUnnamed801(o.offices);
780 checkUnnamed802(o.officials);
781 unittest.expect(o.status, unittest.equals('foo'));
782 }
783 buildCounterRepresentativeInfoResponse--;
784 }
785
786 core.int buildCounterSimpleAddressType = 0;
787 buildSimpleAddressType() {
788 var o = new api.SimpleAddressType();
789 buildCounterSimpleAddressType++;
790 if (buildCounterSimpleAddressType < 3) {
791 o.city = "foo";
792 o.line1 = "foo";
793 o.line2 = "foo";
794 o.line3 = "foo";
795 o.locationName = "foo";
796 o.state = "foo";
797 o.zip = "foo";
798 }
799 buildCounterSimpleAddressType--;
800 return o;
801 }
802
803 checkSimpleAddressType(api.SimpleAddressType o) {
804 buildCounterSimpleAddressType++;
805 if (buildCounterSimpleAddressType < 3) {
806 unittest.expect(o.city, unittest.equals('foo'));
807 unittest.expect(o.line1, unittest.equals('foo'));
808 unittest.expect(o.line2, unittest.equals('foo'));
809 unittest.expect(o.line3, unittest.equals('foo'));
810 unittest.expect(o.locationName, unittest.equals('foo'));
811 unittest.expect(o.state, unittest.equals('foo'));
812 unittest.expect(o.zip, unittest.equals('foo'));
813 }
814 buildCounterSimpleAddressType--;
815 }
816
817 core.int buildCounterSource = 0;
818 buildSource() {
819 var o = new api.Source();
820 buildCounterSource++;
821 if (buildCounterSource < 3) {
822 o.name = "foo";
823 o.official = true;
824 }
825 buildCounterSource--;
826 return o;
827 }
828
829 checkSource(api.Source o) {
830 buildCounterSource++;
831 if (buildCounterSource < 3) {
832 unittest.expect(o.name, unittest.equals('foo'));
833 unittest.expect(o.official, unittest.isTrue);
834 }
835 buildCounterSource--;
836 }
837
838 core.int buildCounterVoterInfoRequest = 0;
839 buildVoterInfoRequest() {
840 var o = new api.VoterInfoRequest();
841 buildCounterVoterInfoRequest++;
842 if (buildCounterVoterInfoRequest < 3) {
843 o.address = "foo";
844 }
845 buildCounterVoterInfoRequest--;
846 return o;
847 }
848
849 checkVoterInfoRequest(api.VoterInfoRequest o) {
850 buildCounterVoterInfoRequest++;
851 if (buildCounterVoterInfoRequest < 3) {
852 unittest.expect(o.address, unittest.equals('foo'));
853 }
854 buildCounterVoterInfoRequest--;
855 }
856
857 buildUnnamed803() {
858 var o = new core.List<api.Contest>();
859 o.add(buildContest());
860 o.add(buildContest());
861 return o;
862 }
863
864 checkUnnamed803(core.List<api.Contest> o) {
865 unittest.expect(o, unittest.hasLength(2));
866 checkContest(o[0]);
867 checkContest(o[1]);
868 }
869
870 buildUnnamed804() {
871 var o = new core.List<api.PollingLocation>();
872 o.add(buildPollingLocation());
873 o.add(buildPollingLocation());
874 return o;
875 }
876
877 checkUnnamed804(core.List<api.PollingLocation> o) {
878 unittest.expect(o, unittest.hasLength(2));
879 checkPollingLocation(o[0]);
880 checkPollingLocation(o[1]);
881 }
882
883 buildUnnamed805() {
884 var o = new core.List<api.PollingLocation>();
885 o.add(buildPollingLocation());
886 o.add(buildPollingLocation());
887 return o;
888 }
889
890 checkUnnamed805(core.List<api.PollingLocation> o) {
891 unittest.expect(o, unittest.hasLength(2));
892 checkPollingLocation(o[0]);
893 checkPollingLocation(o[1]);
894 }
895
896 buildUnnamed806() {
897 var o = new core.List<api.AdministrationRegion>();
898 o.add(buildAdministrationRegion());
899 o.add(buildAdministrationRegion());
900 return o;
901 }
902
903 checkUnnamed806(core.List<api.AdministrationRegion> o) {
904 unittest.expect(o, unittest.hasLength(2));
905 checkAdministrationRegion(o[0]);
906 checkAdministrationRegion(o[1]);
907 }
908
909 core.int buildCounterVoterInfoResponse = 0;
910 buildVoterInfoResponse() {
911 var o = new api.VoterInfoResponse();
912 buildCounterVoterInfoResponse++;
913 if (buildCounterVoterInfoResponse < 3) {
914 o.contests = buildUnnamed803();
915 o.earlyVoteSites = buildUnnamed804();
916 o.election = buildElection();
917 o.kind = "foo";
918 o.normalizedInput = buildSimpleAddressType();
919 o.pollingLocations = buildUnnamed805();
920 o.state = buildUnnamed806();
921 o.status = "foo";
922 }
923 buildCounterVoterInfoResponse--;
924 return o;
925 }
926
927 checkVoterInfoResponse(api.VoterInfoResponse o) {
928 buildCounterVoterInfoResponse++;
929 if (buildCounterVoterInfoResponse < 3) {
930 checkUnnamed803(o.contests);
931 checkUnnamed804(o.earlyVoteSites);
932 checkElection(o.election);
933 unittest.expect(o.kind, unittest.equals('foo'));
934 checkSimpleAddressType(o.normalizedInput);
935 checkUnnamed805(o.pollingLocations);
936 checkUnnamed806(o.state);
937 unittest.expect(o.status, unittest.equals('foo'));
938 }
939 buildCounterVoterInfoResponse--;
940 }
941
942
943 main() {
944 unittest.group("obj-schema-AdministrationRegion", () {
945 unittest.test("to-json--from-json", () {
946 var o = buildAdministrationRegion();
947 var od = new api.AdministrationRegion.fromJson(o.toJson());
948 checkAdministrationRegion(od);
949 });
950 });
951
952
953 unittest.group("obj-schema-AdministrativeBody", () {
954 unittest.test("to-json--from-json", () {
955 var o = buildAdministrativeBody();
956 var od = new api.AdministrativeBody.fromJson(o.toJson());
957 checkAdministrativeBody(od);
958 });
959 });
960
961
962 unittest.group("obj-schema-Candidate", () {
963 unittest.test("to-json--from-json", () {
964 var o = buildCandidate();
965 var od = new api.Candidate.fromJson(o.toJson());
966 checkCandidate(od);
967 });
968 });
969
970
971 unittest.group("obj-schema-Channel", () {
972 unittest.test("to-json--from-json", () {
973 var o = buildChannel();
974 var od = new api.Channel.fromJson(o.toJson());
975 checkChannel(od);
976 });
977 });
978
979
980 unittest.group("obj-schema-Contest", () {
981 unittest.test("to-json--from-json", () {
982 var o = buildContest();
983 var od = new api.Contest.fromJson(o.toJson());
984 checkContest(od);
985 });
986 });
987
988
989 unittest.group("obj-schema-DivisionSearchResponse", () {
990 unittest.test("to-json--from-json", () {
991 var o = buildDivisionSearchResponse();
992 var od = new api.DivisionSearchResponse.fromJson(o.toJson());
993 checkDivisionSearchResponse(od);
994 });
995 });
996
997
998 unittest.group("obj-schema-DivisionSearchResult", () {
999 unittest.test("to-json--from-json", () {
1000 var o = buildDivisionSearchResult();
1001 var od = new api.DivisionSearchResult.fromJson(o.toJson());
1002 checkDivisionSearchResult(od);
1003 });
1004 });
1005
1006
1007 unittest.group("obj-schema-Election", () {
1008 unittest.test("to-json--from-json", () {
1009 var o = buildElection();
1010 var od = new api.Election.fromJson(o.toJson());
1011 checkElection(od);
1012 });
1013 });
1014
1015
1016 unittest.group("obj-schema-ElectionOfficial", () {
1017 unittest.test("to-json--from-json", () {
1018 var o = buildElectionOfficial();
1019 var od = new api.ElectionOfficial.fromJson(o.toJson());
1020 checkElectionOfficial(od);
1021 });
1022 });
1023
1024
1025 unittest.group("obj-schema-ElectionsQueryResponse", () {
1026 unittest.test("to-json--from-json", () {
1027 var o = buildElectionsQueryResponse();
1028 var od = new api.ElectionsQueryResponse.fromJson(o.toJson());
1029 checkElectionsQueryResponse(od);
1030 });
1031 });
1032
1033
1034 unittest.group("obj-schema-ElectoralDistrict", () {
1035 unittest.test("to-json--from-json", () {
1036 var o = buildElectoralDistrict();
1037 var od = new api.ElectoralDistrict.fromJson(o.toJson());
1038 checkElectoralDistrict(od);
1039 });
1040 });
1041
1042
1043 unittest.group("obj-schema-GeographicDivision", () {
1044 unittest.test("to-json--from-json", () {
1045 var o = buildGeographicDivision();
1046 var od = new api.GeographicDivision.fromJson(o.toJson());
1047 checkGeographicDivision(od);
1048 });
1049 });
1050
1051
1052 unittest.group("obj-schema-Office", () {
1053 unittest.test("to-json--from-json", () {
1054 var o = buildOffice();
1055 var od = new api.Office.fromJson(o.toJson());
1056 checkOffice(od);
1057 });
1058 });
1059
1060
1061 unittest.group("obj-schema-Official", () {
1062 unittest.test("to-json--from-json", () {
1063 var o = buildOfficial();
1064 var od = new api.Official.fromJson(o.toJson());
1065 checkOfficial(od);
1066 });
1067 });
1068
1069
1070 unittest.group("obj-schema-PollingLocation", () {
1071 unittest.test("to-json--from-json", () {
1072 var o = buildPollingLocation();
1073 var od = new api.PollingLocation.fromJson(o.toJson());
1074 checkPollingLocation(od);
1075 });
1076 });
1077
1078
1079 unittest.group("obj-schema-RepresentativeInfoRequest", () {
1080 unittest.test("to-json--from-json", () {
1081 var o = buildRepresentativeInfoRequest();
1082 var od = new api.RepresentativeInfoRequest.fromJson(o.toJson());
1083 checkRepresentativeInfoRequest(od);
1084 });
1085 });
1086
1087
1088 unittest.group("obj-schema-RepresentativeInfoResponse", () {
1089 unittest.test("to-json--from-json", () {
1090 var o = buildRepresentativeInfoResponse();
1091 var od = new api.RepresentativeInfoResponse.fromJson(o.toJson());
1092 checkRepresentativeInfoResponse(od);
1093 });
1094 });
1095
1096
1097 unittest.group("obj-schema-SimpleAddressType", () {
1098 unittest.test("to-json--from-json", () {
1099 var o = buildSimpleAddressType();
1100 var od = new api.SimpleAddressType.fromJson(o.toJson());
1101 checkSimpleAddressType(od);
1102 });
1103 });
1104
1105
1106 unittest.group("obj-schema-Source", () {
1107 unittest.test("to-json--from-json", () {
1108 var o = buildSource();
1109 var od = new api.Source.fromJson(o.toJson());
1110 checkSource(od);
1111 });
1112 });
1113
1114
1115 unittest.group("obj-schema-VoterInfoRequest", () {
1116 unittest.test("to-json--from-json", () {
1117 var o = buildVoterInfoRequest();
1118 var od = new api.VoterInfoRequest.fromJson(o.toJson());
1119 checkVoterInfoRequest(od);
1120 });
1121 });
1122
1123
1124 unittest.group("obj-schema-VoterInfoResponse", () {
1125 unittest.test("to-json--from-json", () {
1126 var o = buildVoterInfoResponse();
1127 var od = new api.VoterInfoResponse.fromJson(o.toJson());
1128 checkVoterInfoResponse(od);
1129 });
1130 });
1131
1132
1133 unittest.group("resource-DivisionsResourceApi", () {
1134 unittest.test("method--search", () {
1135
1136 var mock = new common_test.HttpServerMock();
1137 api.DivisionsResourceApi res = new api.CivicinfoApi(mock).divisions;
1138 var arg_query = "foo";
1139 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1140 var path = (req.url).path;
1141 var pathOffset = 0;
1142 var index;
1143 var subPart;
1144 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("/civicinfo/us_v1/"));
1145 pathOffset += 17;
1146 unittest.expect(path.substring(pathOffset, pathOffset + 31), unittest.eq uals("representatives/division_search"));
1147 pathOffset += 31;
1148
1149 var query = (req.url).query;
1150 var queryOffset = 0;
1151 var queryMap = {};
1152 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1153 parseBool(n) {
1154 if (n == "true") return true;
1155 if (n == "false") return false;
1156 if (n == null) return null;
1157 throw new core.ArgumentError("Invalid boolean: $n");
1158 }
1159 if (query.length > 0) {
1160 for (var part in query.split("&")) {
1161 var keyvalue = part.split("=");
1162 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1163 }
1164 }
1165 unittest.expect(queryMap["query"].first, unittest.equals(arg_query));
1166
1167
1168 var h = {
1169 "content-type" : "application/json; charset=utf-8",
1170 };
1171 var resp = convert.JSON.encode(buildDivisionSearchResponse());
1172 return new async.Future.value(common_test.stringResponse(200, h, resp));
1173 }), true);
1174 res.search(query: arg_query).then(unittest.expectAsync(((api.DivisionSearc hResponse response) {
1175 checkDivisionSearchResponse(response);
1176 })));
1177 });
1178
1179 });
1180
1181
1182 unittest.group("resource-ElectionsResourceApi", () {
1183 unittest.test("method--electionQuery", () {
1184
1185 var mock = new common_test.HttpServerMock();
1186 api.ElectionsResourceApi res = new api.CivicinfoApi(mock).elections;
1187 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1188 var path = (req.url).path;
1189 var pathOffset = 0;
1190 var index;
1191 var subPart;
1192 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("/civicinfo/us_v1/"));
1193 pathOffset += 17;
1194 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("elections"));
1195 pathOffset += 9;
1196
1197 var query = (req.url).query;
1198 var queryOffset = 0;
1199 var queryMap = {};
1200 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1201 parseBool(n) {
1202 if (n == "true") return true;
1203 if (n == "false") return false;
1204 if (n == null) return null;
1205 throw new core.ArgumentError("Invalid boolean: $n");
1206 }
1207 if (query.length > 0) {
1208 for (var part in query.split("&")) {
1209 var keyvalue = part.split("=");
1210 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1211 }
1212 }
1213
1214
1215 var h = {
1216 "content-type" : "application/json; charset=utf-8",
1217 };
1218 var resp = convert.JSON.encode(buildElectionsQueryResponse());
1219 return new async.Future.value(common_test.stringResponse(200, h, resp));
1220 }), true);
1221 res.electionQuery().then(unittest.expectAsync(((api.ElectionsQueryResponse response) {
1222 checkElectionsQueryResponse(response);
1223 })));
1224 });
1225
1226 unittest.test("method--voterInfoQuery", () {
1227
1228 var mock = new common_test.HttpServerMock();
1229 api.ElectionsResourceApi res = new api.CivicinfoApi(mock).elections;
1230 var arg_request = buildVoterInfoRequest();
1231 var arg_electionId = "foo";
1232 var arg_officialOnly = true;
1233 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1234 var obj = new api.VoterInfoRequest.fromJson(json);
1235 checkVoterInfoRequest(obj);
1236
1237 var path = (req.url).path;
1238 var pathOffset = 0;
1239 var index;
1240 var subPart;
1241 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("/civicinfo/us_v1/"));
1242 pathOffset += 17;
1243 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq uals("voterinfo/"));
1244 pathOffset += 10;
1245 index = path.indexOf("/lookup", pathOffset);
1246 unittest.expect(index >= 0, unittest.isTrue);
1247 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index ));
1248 pathOffset = index;
1249 unittest.expect(subPart, unittest.equals("$arg_electionId"));
1250 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ als("/lookup"));
1251 pathOffset += 7;
1252
1253 var query = (req.url).query;
1254 var queryOffset = 0;
1255 var queryMap = {};
1256 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1257 parseBool(n) {
1258 if (n == "true") return true;
1259 if (n == "false") return false;
1260 if (n == null) return null;
1261 throw new core.ArgumentError("Invalid boolean: $n");
1262 }
1263 if (query.length > 0) {
1264 for (var part in query.split("&")) {
1265 var keyvalue = part.split("=");
1266 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1267 }
1268 }
1269 unittest.expect(queryMap["officialOnly"].first, unittest.equals("$arg_of ficialOnly"));
1270
1271
1272 var h = {
1273 "content-type" : "application/json; charset=utf-8",
1274 };
1275 var resp = convert.JSON.encode(buildVoterInfoResponse());
1276 return new async.Future.value(common_test.stringResponse(200, h, resp));
1277 }), true);
1278 res.voterInfoQuery(arg_request, arg_electionId, officialOnly: arg_official Only).then(unittest.expectAsync(((api.VoterInfoResponse response) {
1279 checkVoterInfoResponse(response);
1280 })));
1281 });
1282
1283 });
1284
1285
1286 unittest.group("resource-RepresentativesResourceApi", () {
1287 unittest.test("method--representativeInfoQuery", () {
1288
1289 var mock = new common_test.HttpServerMock();
1290 api.RepresentativesResourceApi res = new api.CivicinfoApi(mock).representa tives;
1291 var arg_request = buildRepresentativeInfoRequest();
1292 var arg_includeOffices = true;
1293 var arg_ocdId = "foo";
1294 var arg_recursive = true;
1295 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1296 var obj = new api.RepresentativeInfoRequest.fromJson(json);
1297 checkRepresentativeInfoRequest(obj);
1298
1299 var path = (req.url).path;
1300 var pathOffset = 0;
1301 var index;
1302 var subPart;
1303 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("/civicinfo/us_v1/"));
1304 pathOffset += 17;
1305 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq uals("representatives/lookup"));
1306 pathOffset += 22;
1307
1308 var query = (req.url).query;
1309 var queryOffset = 0;
1310 var queryMap = {};
1311 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1312 parseBool(n) {
1313 if (n == "true") return true;
1314 if (n == "false") return false;
1315 if (n == null) return null;
1316 throw new core.ArgumentError("Invalid boolean: $n");
1317 }
1318 if (query.length > 0) {
1319 for (var part in query.split("&")) {
1320 var keyvalue = part.split("=");
1321 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1322 }
1323 }
1324 unittest.expect(queryMap["includeOffices"].first, unittest.equals("$arg_ includeOffices"));
1325 unittest.expect(queryMap["ocdId"].first, unittest.equals(arg_ocdId));
1326 unittest.expect(queryMap["recursive"].first, unittest.equals("$arg_recur sive"));
1327
1328
1329 var h = {
1330 "content-type" : "application/json; charset=utf-8",
1331 };
1332 var resp = convert.JSON.encode(buildRepresentativeInfoResponse());
1333 return new async.Future.value(common_test.stringResponse(200, h, resp));
1334 }), true);
1335 res.representativeInfoQuery(arg_request, includeOffices: arg_includeOffice s, ocdId: arg_ocdId, recursive: arg_recursive).then(unittest.expectAsync(((api.R epresentativeInfoResponse response) {
1336 checkRepresentativeInfoResponse(response);
1337 })));
1338 });
1339
1340 });
1341
1342
1343 }
1344
OLDNEW

Powered by Google App Engine