| Index: generated/googleapis/test/civicinfo/us_v1.dart
|
| diff --git a/generated/googleapis/test/civicinfo/us_v1.dart b/generated/googleapis/test/civicinfo/us_v1.dart
|
| deleted file mode 100644
|
| index e852db4882b2ba1a33f83365c2309ca1320d3bd6..0000000000000000000000000000000000000000
|
| --- a/generated/googleapis/test/civicinfo/us_v1.dart
|
| +++ /dev/null
|
| @@ -1,1344 +0,0 @@
|
| -library googleapis.civicinfo.us_v1.test;
|
| -
|
| -import "dart:core" as core;
|
| -import "dart:collection" as collection;
|
| -import "dart:async" as async;
|
| -import "dart:convert" as convert;
|
| -
|
| -import 'package:http/http.dart' as http;
|
| -import 'package:http/testing.dart' as http_testing;
|
| -import 'package:unittest/unittest.dart' as unittest;
|
| -import 'package:googleapis/common/common.dart' as common;
|
| -import 'package:googleapis/src/common_internal.dart' as common_internal;
|
| -import '../common/common_internal_test.dart' as common_test;
|
| -
|
| -import 'package:googleapis/civicinfo/us_v1.dart' as api;
|
| -
|
| -
|
| -
|
| -buildUnnamed781() {
|
| - var o = new core.List<api.Source>();
|
| - o.add(buildSource());
|
| - o.add(buildSource());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed781(core.List<api.Source> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkSource(o[0]);
|
| - checkSource(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterAdministrationRegion = 0;
|
| -buildAdministrationRegion() {
|
| - var o = new api.AdministrationRegion();
|
| - buildCounterAdministrationRegion++;
|
| - if (buildCounterAdministrationRegion < 3) {
|
| - o.electionAdministrationBody = buildAdministrativeBody();
|
| - o.id = "foo";
|
| - o.localJurisdiction = buildAdministrationRegion();
|
| - o.name = "foo";
|
| - o.sources = buildUnnamed781();
|
| - }
|
| - buildCounterAdministrationRegion--;
|
| - return o;
|
| -}
|
| -
|
| -checkAdministrationRegion(api.AdministrationRegion o) {
|
| - buildCounterAdministrationRegion++;
|
| - if (buildCounterAdministrationRegion < 3) {
|
| - checkAdministrativeBody(o.electionAdministrationBody);
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - checkAdministrationRegion(o.localJurisdiction);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - checkUnnamed781(o.sources);
|
| - }
|
| - buildCounterAdministrationRegion--;
|
| -}
|
| -
|
| -buildUnnamed782() {
|
| - var o = new core.List<api.ElectionOfficial>();
|
| - o.add(buildElectionOfficial());
|
| - o.add(buildElectionOfficial());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed782(core.List<api.ElectionOfficial> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkElectionOfficial(o[0]);
|
| - checkElectionOfficial(o[1]);
|
| -}
|
| -
|
| -buildUnnamed783() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed783(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -core.int buildCounterAdministrativeBody = 0;
|
| -buildAdministrativeBody() {
|
| - var o = new api.AdministrativeBody();
|
| - buildCounterAdministrativeBody++;
|
| - if (buildCounterAdministrativeBody < 3) {
|
| - o.absenteeVotingInfoUrl = "foo";
|
| - o.ballotInfoUrl = "foo";
|
| - o.correspondenceAddress = buildSimpleAddressType();
|
| - o.electionInfoUrl = "foo";
|
| - o.electionOfficials = buildUnnamed782();
|
| - o.electionRegistrationConfirmationUrl = "foo";
|
| - o.electionRegistrationUrl = "foo";
|
| - o.electionRulesUrl = "foo";
|
| - o.hoursOfOperation = "foo";
|
| - o.name = "foo";
|
| - o.physicalAddress = buildSimpleAddressType();
|
| - o.voterServices = buildUnnamed783();
|
| - o.votingLocationFinderUrl = "foo";
|
| - }
|
| - buildCounterAdministrativeBody--;
|
| - return o;
|
| -}
|
| -
|
| -checkAdministrativeBody(api.AdministrativeBody o) {
|
| - buildCounterAdministrativeBody++;
|
| - if (buildCounterAdministrativeBody < 3) {
|
| - unittest.expect(o.absenteeVotingInfoUrl, unittest.equals('foo'));
|
| - unittest.expect(o.ballotInfoUrl, unittest.equals('foo'));
|
| - checkSimpleAddressType(o.correspondenceAddress);
|
| - unittest.expect(o.electionInfoUrl, unittest.equals('foo'));
|
| - checkUnnamed782(o.electionOfficials);
|
| - unittest.expect(o.electionRegistrationConfirmationUrl, unittest.equals('foo'));
|
| - unittest.expect(o.electionRegistrationUrl, unittest.equals('foo'));
|
| - unittest.expect(o.electionRulesUrl, unittest.equals('foo'));
|
| - unittest.expect(o.hoursOfOperation, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - checkSimpleAddressType(o.physicalAddress);
|
| - checkUnnamed783(o.voterServices);
|
| - unittest.expect(o.votingLocationFinderUrl, unittest.equals('foo'));
|
| - }
|
| - buildCounterAdministrativeBody--;
|
| -}
|
| -
|
| -buildUnnamed784() {
|
| - var o = new core.List<api.Channel>();
|
| - o.add(buildChannel());
|
| - o.add(buildChannel());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed784(core.List<api.Channel> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkChannel(o[0]);
|
| - checkChannel(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterCandidate = 0;
|
| -buildCandidate() {
|
| - var o = new api.Candidate();
|
| - buildCounterCandidate++;
|
| - if (buildCounterCandidate < 3) {
|
| - o.candidateUrl = "foo";
|
| - o.channels = buildUnnamed784();
|
| - o.email = "foo";
|
| - o.name = "foo";
|
| - o.orderOnBallot = "foo";
|
| - o.party = "foo";
|
| - o.phone = "foo";
|
| - o.photoUrl = "foo";
|
| - }
|
| - buildCounterCandidate--;
|
| - return o;
|
| -}
|
| -
|
| -checkCandidate(api.Candidate o) {
|
| - buildCounterCandidate++;
|
| - if (buildCounterCandidate < 3) {
|
| - unittest.expect(o.candidateUrl, unittest.equals('foo'));
|
| - checkUnnamed784(o.channels);
|
| - unittest.expect(o.email, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.orderOnBallot, unittest.equals('foo'));
|
| - unittest.expect(o.party, unittest.equals('foo'));
|
| - unittest.expect(o.phone, unittest.equals('foo'));
|
| - unittest.expect(o.photoUrl, unittest.equals('foo'));
|
| - }
|
| - buildCounterCandidate--;
|
| -}
|
| -
|
| -core.int buildCounterChannel = 0;
|
| -buildChannel() {
|
| - var o = new api.Channel();
|
| - buildCounterChannel++;
|
| - if (buildCounterChannel < 3) {
|
| - o.id = "foo";
|
| - o.type = "foo";
|
| - }
|
| - buildCounterChannel--;
|
| - return o;
|
| -}
|
| -
|
| -checkChannel(api.Channel o) {
|
| - buildCounterChannel++;
|
| - if (buildCounterChannel < 3) {
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - unittest.expect(o.type, unittest.equals('foo'));
|
| - }
|
| - buildCounterChannel--;
|
| -}
|
| -
|
| -buildUnnamed785() {
|
| - var o = new core.List<api.Candidate>();
|
| - o.add(buildCandidate());
|
| - o.add(buildCandidate());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed785(core.List<api.Candidate> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkCandidate(o[0]);
|
| - checkCandidate(o[1]);
|
| -}
|
| -
|
| -buildUnnamed786() {
|
| - var o = new core.List<api.Source>();
|
| - o.add(buildSource());
|
| - o.add(buildSource());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed786(core.List<api.Source> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkSource(o[0]);
|
| - checkSource(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterContest = 0;
|
| -buildContest() {
|
| - var o = new api.Contest();
|
| - buildCounterContest++;
|
| - if (buildCounterContest < 3) {
|
| - o.ballotPlacement = "foo";
|
| - o.candidates = buildUnnamed785();
|
| - o.district = buildElectoralDistrict();
|
| - o.electorateSpecifications = "foo";
|
| - o.id = "foo";
|
| - o.level = "foo";
|
| - o.numberElected = "foo";
|
| - o.numberVotingFor = "foo";
|
| - o.office = "foo";
|
| - o.primaryParty = "foo";
|
| - o.referendumSubtitle = "foo";
|
| - o.referendumTitle = "foo";
|
| - o.referendumUrl = "foo";
|
| - o.sources = buildUnnamed786();
|
| - o.special = "foo";
|
| - o.type = "foo";
|
| - }
|
| - buildCounterContest--;
|
| - return o;
|
| -}
|
| -
|
| -checkContest(api.Contest o) {
|
| - buildCounterContest++;
|
| - if (buildCounterContest < 3) {
|
| - unittest.expect(o.ballotPlacement, unittest.equals('foo'));
|
| - checkUnnamed785(o.candidates);
|
| - checkElectoralDistrict(o.district);
|
| - unittest.expect(o.electorateSpecifications, unittest.equals('foo'));
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - unittest.expect(o.level, unittest.equals('foo'));
|
| - unittest.expect(o.numberElected, unittest.equals('foo'));
|
| - unittest.expect(o.numberVotingFor, unittest.equals('foo'));
|
| - unittest.expect(o.office, unittest.equals('foo'));
|
| - unittest.expect(o.primaryParty, unittest.equals('foo'));
|
| - unittest.expect(o.referendumSubtitle, unittest.equals('foo'));
|
| - unittest.expect(o.referendumTitle, unittest.equals('foo'));
|
| - unittest.expect(o.referendumUrl, unittest.equals('foo'));
|
| - checkUnnamed786(o.sources);
|
| - unittest.expect(o.special, unittest.equals('foo'));
|
| - unittest.expect(o.type, unittest.equals('foo'));
|
| - }
|
| - buildCounterContest--;
|
| -}
|
| -
|
| -buildUnnamed787() {
|
| - var o = new core.List<api.DivisionSearchResult>();
|
| - o.add(buildDivisionSearchResult());
|
| - o.add(buildDivisionSearchResult());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed787(core.List<api.DivisionSearchResult> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkDivisionSearchResult(o[0]);
|
| - checkDivisionSearchResult(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterDivisionSearchResponse = 0;
|
| -buildDivisionSearchResponse() {
|
| - var o = new api.DivisionSearchResponse();
|
| - buildCounterDivisionSearchResponse++;
|
| - if (buildCounterDivisionSearchResponse < 3) {
|
| - o.kind = "foo";
|
| - o.results = buildUnnamed787();
|
| - o.status = "foo";
|
| - }
|
| - buildCounterDivisionSearchResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkDivisionSearchResponse(api.DivisionSearchResponse o) {
|
| - buildCounterDivisionSearchResponse++;
|
| - if (buildCounterDivisionSearchResponse < 3) {
|
| - unittest.expect(o.kind, unittest.equals('foo'));
|
| - checkUnnamed787(o.results);
|
| - unittest.expect(o.status, unittest.equals('foo'));
|
| - }
|
| - buildCounterDivisionSearchResponse--;
|
| -}
|
| -
|
| -buildUnnamed788() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed788(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -core.int buildCounterDivisionSearchResult = 0;
|
| -buildDivisionSearchResult() {
|
| - var o = new api.DivisionSearchResult();
|
| - buildCounterDivisionSearchResult++;
|
| - if (buildCounterDivisionSearchResult < 3) {
|
| - o.aliases = buildUnnamed788();
|
| - o.name = "foo";
|
| - o.ocdId = "foo";
|
| - }
|
| - buildCounterDivisionSearchResult--;
|
| - return o;
|
| -}
|
| -
|
| -checkDivisionSearchResult(api.DivisionSearchResult o) {
|
| - buildCounterDivisionSearchResult++;
|
| - if (buildCounterDivisionSearchResult < 3) {
|
| - checkUnnamed788(o.aliases);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.ocdId, unittest.equals('foo'));
|
| - }
|
| - buildCounterDivisionSearchResult--;
|
| -}
|
| -
|
| -core.int buildCounterElection = 0;
|
| -buildElection() {
|
| - var o = new api.Election();
|
| - buildCounterElection++;
|
| - if (buildCounterElection < 3) {
|
| - o.electionDay = "foo";
|
| - o.id = "foo";
|
| - o.name = "foo";
|
| - }
|
| - buildCounterElection--;
|
| - return o;
|
| -}
|
| -
|
| -checkElection(api.Election o) {
|
| - buildCounterElection++;
|
| - if (buildCounterElection < 3) {
|
| - unittest.expect(o.electionDay, unittest.equals('foo'));
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - }
|
| - buildCounterElection--;
|
| -}
|
| -
|
| -core.int buildCounterElectionOfficial = 0;
|
| -buildElectionOfficial() {
|
| - var o = new api.ElectionOfficial();
|
| - buildCounterElectionOfficial++;
|
| - if (buildCounterElectionOfficial < 3) {
|
| - o.emailAddress = "foo";
|
| - o.faxNumber = "foo";
|
| - o.name = "foo";
|
| - o.officePhoneNumber = "foo";
|
| - o.title = "foo";
|
| - }
|
| - buildCounterElectionOfficial--;
|
| - return o;
|
| -}
|
| -
|
| -checkElectionOfficial(api.ElectionOfficial o) {
|
| - buildCounterElectionOfficial++;
|
| - if (buildCounterElectionOfficial < 3) {
|
| - unittest.expect(o.emailAddress, unittest.equals('foo'));
|
| - unittest.expect(o.faxNumber, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.officePhoneNumber, unittest.equals('foo'));
|
| - unittest.expect(o.title, unittest.equals('foo'));
|
| - }
|
| - buildCounterElectionOfficial--;
|
| -}
|
| -
|
| -buildUnnamed789() {
|
| - var o = new core.List<api.Election>();
|
| - o.add(buildElection());
|
| - o.add(buildElection());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed789(core.List<api.Election> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkElection(o[0]);
|
| - checkElection(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterElectionsQueryResponse = 0;
|
| -buildElectionsQueryResponse() {
|
| - var o = new api.ElectionsQueryResponse();
|
| - buildCounterElectionsQueryResponse++;
|
| - if (buildCounterElectionsQueryResponse < 3) {
|
| - o.elections = buildUnnamed789();
|
| - o.kind = "foo";
|
| - }
|
| - buildCounterElectionsQueryResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkElectionsQueryResponse(api.ElectionsQueryResponse o) {
|
| - buildCounterElectionsQueryResponse++;
|
| - if (buildCounterElectionsQueryResponse < 3) {
|
| - checkUnnamed789(o.elections);
|
| - unittest.expect(o.kind, unittest.equals('foo'));
|
| - }
|
| - buildCounterElectionsQueryResponse--;
|
| -}
|
| -
|
| -core.int buildCounterElectoralDistrict = 0;
|
| -buildElectoralDistrict() {
|
| - var o = new api.ElectoralDistrict();
|
| - buildCounterElectoralDistrict++;
|
| - if (buildCounterElectoralDistrict < 3) {
|
| - o.id = "foo";
|
| - o.name = "foo";
|
| - o.scope = "foo";
|
| - }
|
| - buildCounterElectoralDistrict--;
|
| - return o;
|
| -}
|
| -
|
| -checkElectoralDistrict(api.ElectoralDistrict o) {
|
| - buildCounterElectoralDistrict++;
|
| - if (buildCounterElectoralDistrict < 3) {
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.scope, unittest.equals('foo'));
|
| - }
|
| - buildCounterElectoralDistrict--;
|
| -}
|
| -
|
| -buildUnnamed790() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed790(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed791() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed791(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -core.int buildCounterGeographicDivision = 0;
|
| -buildGeographicDivision() {
|
| - var o = new api.GeographicDivision();
|
| - buildCounterGeographicDivision++;
|
| - if (buildCounterGeographicDivision < 3) {
|
| - o.alsoKnownAs = buildUnnamed790();
|
| - o.name = "foo";
|
| - o.officeIds = buildUnnamed791();
|
| - o.scope = "foo";
|
| - }
|
| - buildCounterGeographicDivision--;
|
| - return o;
|
| -}
|
| -
|
| -checkGeographicDivision(api.GeographicDivision o) {
|
| - buildCounterGeographicDivision++;
|
| - if (buildCounterGeographicDivision < 3) {
|
| - checkUnnamed790(o.alsoKnownAs);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - checkUnnamed791(o.officeIds);
|
| - unittest.expect(o.scope, unittest.equals('foo'));
|
| - }
|
| - buildCounterGeographicDivision--;
|
| -}
|
| -
|
| -buildUnnamed792() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed792(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed793() {
|
| - var o = new core.List<api.Source>();
|
| - o.add(buildSource());
|
| - o.add(buildSource());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed793(core.List<api.Source> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkSource(o[0]);
|
| - checkSource(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterOffice = 0;
|
| -buildOffice() {
|
| - var o = new api.Office();
|
| - buildCounterOffice++;
|
| - if (buildCounterOffice < 3) {
|
| - o.divisionId = "foo";
|
| - o.level = "foo";
|
| - o.name = "foo";
|
| - o.officialIds = buildUnnamed792();
|
| - o.sources = buildUnnamed793();
|
| - }
|
| - buildCounterOffice--;
|
| - return o;
|
| -}
|
| -
|
| -checkOffice(api.Office o) {
|
| - buildCounterOffice++;
|
| - if (buildCounterOffice < 3) {
|
| - unittest.expect(o.divisionId, unittest.equals('foo'));
|
| - unittest.expect(o.level, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - checkUnnamed792(o.officialIds);
|
| - checkUnnamed793(o.sources);
|
| - }
|
| - buildCounterOffice--;
|
| -}
|
| -
|
| -buildUnnamed794() {
|
| - var o = new core.List<api.SimpleAddressType>();
|
| - o.add(buildSimpleAddressType());
|
| - o.add(buildSimpleAddressType());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed794(core.List<api.SimpleAddressType> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkSimpleAddressType(o[0]);
|
| - checkSimpleAddressType(o[1]);
|
| -}
|
| -
|
| -buildUnnamed795() {
|
| - var o = new core.List<api.Channel>();
|
| - o.add(buildChannel());
|
| - o.add(buildChannel());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed795(core.List<api.Channel> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkChannel(o[0]);
|
| - checkChannel(o[1]);
|
| -}
|
| -
|
| -buildUnnamed796() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed796(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed797() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed797(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed798() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed798(core.List<core.String> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - unittest.expect(o[0], unittest.equals('foo'));
|
| - unittest.expect(o[1], unittest.equals('foo'));
|
| -}
|
| -
|
| -core.int buildCounterOfficial = 0;
|
| -buildOfficial() {
|
| - var o = new api.Official();
|
| - buildCounterOfficial++;
|
| - if (buildCounterOfficial < 3) {
|
| - o.address = buildUnnamed794();
|
| - o.channels = buildUnnamed795();
|
| - o.emails = buildUnnamed796();
|
| - o.name = "foo";
|
| - o.party = "foo";
|
| - o.phones = buildUnnamed797();
|
| - o.photoUrl = "foo";
|
| - o.urls = buildUnnamed798();
|
| - }
|
| - buildCounterOfficial--;
|
| - return o;
|
| -}
|
| -
|
| -checkOfficial(api.Official o) {
|
| - buildCounterOfficial++;
|
| - if (buildCounterOfficial < 3) {
|
| - checkUnnamed794(o.address);
|
| - checkUnnamed795(o.channels);
|
| - checkUnnamed796(o.emails);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.party, unittest.equals('foo'));
|
| - checkUnnamed797(o.phones);
|
| - unittest.expect(o.photoUrl, unittest.equals('foo'));
|
| - checkUnnamed798(o.urls);
|
| - }
|
| - buildCounterOfficial--;
|
| -}
|
| -
|
| -buildUnnamed799() {
|
| - var o = new core.List<api.Source>();
|
| - o.add(buildSource());
|
| - o.add(buildSource());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed799(core.List<api.Source> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkSource(o[0]);
|
| - checkSource(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterPollingLocation = 0;
|
| -buildPollingLocation() {
|
| - var o = new api.PollingLocation();
|
| - buildCounterPollingLocation++;
|
| - if (buildCounterPollingLocation < 3) {
|
| - o.address = buildSimpleAddressType();
|
| - o.endDate = "foo";
|
| - o.id = "foo";
|
| - o.name = "foo";
|
| - o.notes = "foo";
|
| - o.pollingHours = "foo";
|
| - o.sources = buildUnnamed799();
|
| - o.startDate = "foo";
|
| - o.voterServices = "foo";
|
| - }
|
| - buildCounterPollingLocation--;
|
| - return o;
|
| -}
|
| -
|
| -checkPollingLocation(api.PollingLocation o) {
|
| - buildCounterPollingLocation++;
|
| - if (buildCounterPollingLocation < 3) {
|
| - checkSimpleAddressType(o.address);
|
| - unittest.expect(o.endDate, unittest.equals('foo'));
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.notes, unittest.equals('foo'));
|
| - unittest.expect(o.pollingHours, unittest.equals('foo'));
|
| - checkUnnamed799(o.sources);
|
| - unittest.expect(o.startDate, unittest.equals('foo'));
|
| - unittest.expect(o.voterServices, unittest.equals('foo'));
|
| - }
|
| - buildCounterPollingLocation--;
|
| -}
|
| -
|
| -core.int buildCounterRepresentativeInfoRequest = 0;
|
| -buildRepresentativeInfoRequest() {
|
| - var o = new api.RepresentativeInfoRequest();
|
| - buildCounterRepresentativeInfoRequest++;
|
| - if (buildCounterRepresentativeInfoRequest < 3) {
|
| - o.address = "foo";
|
| - }
|
| - buildCounterRepresentativeInfoRequest--;
|
| - return o;
|
| -}
|
| -
|
| -checkRepresentativeInfoRequest(api.RepresentativeInfoRequest o) {
|
| - buildCounterRepresentativeInfoRequest++;
|
| - if (buildCounterRepresentativeInfoRequest < 3) {
|
| - unittest.expect(o.address, unittest.equals('foo'));
|
| - }
|
| - buildCounterRepresentativeInfoRequest--;
|
| -}
|
| -
|
| -buildUnnamed800() {
|
| - var o = new core.Map<core.String, api.GeographicDivision>();
|
| - o["x"] = buildGeographicDivision();
|
| - o["y"] = buildGeographicDivision();
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed800(core.Map<core.String, api.GeographicDivision> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkGeographicDivision(o["x"]);
|
| - checkGeographicDivision(o["y"]);
|
| -}
|
| -
|
| -buildUnnamed801() {
|
| - var o = new core.Map<core.String, api.Office>();
|
| - o["x"] = buildOffice();
|
| - o["y"] = buildOffice();
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed801(core.Map<core.String, api.Office> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkOffice(o["x"]);
|
| - checkOffice(o["y"]);
|
| -}
|
| -
|
| -buildUnnamed802() {
|
| - var o = new core.Map<core.String, api.Official>();
|
| - o["x"] = buildOfficial();
|
| - o["y"] = buildOfficial();
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed802(core.Map<core.String, api.Official> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkOfficial(o["x"]);
|
| - checkOfficial(o["y"]);
|
| -}
|
| -
|
| -core.int buildCounterRepresentativeInfoResponse = 0;
|
| -buildRepresentativeInfoResponse() {
|
| - var o = new api.RepresentativeInfoResponse();
|
| - buildCounterRepresentativeInfoResponse++;
|
| - if (buildCounterRepresentativeInfoResponse < 3) {
|
| - o.divisions = buildUnnamed800();
|
| - o.kind = "foo";
|
| - o.normalizedInput = buildSimpleAddressType();
|
| - o.offices = buildUnnamed801();
|
| - o.officials = buildUnnamed802();
|
| - o.status = "foo";
|
| - }
|
| - buildCounterRepresentativeInfoResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkRepresentativeInfoResponse(api.RepresentativeInfoResponse o) {
|
| - buildCounterRepresentativeInfoResponse++;
|
| - if (buildCounterRepresentativeInfoResponse < 3) {
|
| - checkUnnamed800(o.divisions);
|
| - unittest.expect(o.kind, unittest.equals('foo'));
|
| - checkSimpleAddressType(o.normalizedInput);
|
| - checkUnnamed801(o.offices);
|
| - checkUnnamed802(o.officials);
|
| - unittest.expect(o.status, unittest.equals('foo'));
|
| - }
|
| - buildCounterRepresentativeInfoResponse--;
|
| -}
|
| -
|
| -core.int buildCounterSimpleAddressType = 0;
|
| -buildSimpleAddressType() {
|
| - var o = new api.SimpleAddressType();
|
| - buildCounterSimpleAddressType++;
|
| - if (buildCounterSimpleAddressType < 3) {
|
| - o.city = "foo";
|
| - o.line1 = "foo";
|
| - o.line2 = "foo";
|
| - o.line3 = "foo";
|
| - o.locationName = "foo";
|
| - o.state = "foo";
|
| - o.zip = "foo";
|
| - }
|
| - buildCounterSimpleAddressType--;
|
| - return o;
|
| -}
|
| -
|
| -checkSimpleAddressType(api.SimpleAddressType o) {
|
| - buildCounterSimpleAddressType++;
|
| - if (buildCounterSimpleAddressType < 3) {
|
| - unittest.expect(o.city, unittest.equals('foo'));
|
| - unittest.expect(o.line1, unittest.equals('foo'));
|
| - unittest.expect(o.line2, unittest.equals('foo'));
|
| - unittest.expect(o.line3, unittest.equals('foo'));
|
| - unittest.expect(o.locationName, unittest.equals('foo'));
|
| - unittest.expect(o.state, unittest.equals('foo'));
|
| - unittest.expect(o.zip, unittest.equals('foo'));
|
| - }
|
| - buildCounterSimpleAddressType--;
|
| -}
|
| -
|
| -core.int buildCounterSource = 0;
|
| -buildSource() {
|
| - var o = new api.Source();
|
| - buildCounterSource++;
|
| - if (buildCounterSource < 3) {
|
| - o.name = "foo";
|
| - o.official = true;
|
| - }
|
| - buildCounterSource--;
|
| - return o;
|
| -}
|
| -
|
| -checkSource(api.Source o) {
|
| - buildCounterSource++;
|
| - if (buildCounterSource < 3) {
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - unittest.expect(o.official, unittest.isTrue);
|
| - }
|
| - buildCounterSource--;
|
| -}
|
| -
|
| -core.int buildCounterVoterInfoRequest = 0;
|
| -buildVoterInfoRequest() {
|
| - var o = new api.VoterInfoRequest();
|
| - buildCounterVoterInfoRequest++;
|
| - if (buildCounterVoterInfoRequest < 3) {
|
| - o.address = "foo";
|
| - }
|
| - buildCounterVoterInfoRequest--;
|
| - return o;
|
| -}
|
| -
|
| -checkVoterInfoRequest(api.VoterInfoRequest o) {
|
| - buildCounterVoterInfoRequest++;
|
| - if (buildCounterVoterInfoRequest < 3) {
|
| - unittest.expect(o.address, unittest.equals('foo'));
|
| - }
|
| - buildCounterVoterInfoRequest--;
|
| -}
|
| -
|
| -buildUnnamed803() {
|
| - var o = new core.List<api.Contest>();
|
| - o.add(buildContest());
|
| - o.add(buildContest());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed803(core.List<api.Contest> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkContest(o[0]);
|
| - checkContest(o[1]);
|
| -}
|
| -
|
| -buildUnnamed804() {
|
| - var o = new core.List<api.PollingLocation>();
|
| - o.add(buildPollingLocation());
|
| - o.add(buildPollingLocation());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed804(core.List<api.PollingLocation> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkPollingLocation(o[0]);
|
| - checkPollingLocation(o[1]);
|
| -}
|
| -
|
| -buildUnnamed805() {
|
| - var o = new core.List<api.PollingLocation>();
|
| - o.add(buildPollingLocation());
|
| - o.add(buildPollingLocation());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed805(core.List<api.PollingLocation> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkPollingLocation(o[0]);
|
| - checkPollingLocation(o[1]);
|
| -}
|
| -
|
| -buildUnnamed806() {
|
| - var o = new core.List<api.AdministrationRegion>();
|
| - o.add(buildAdministrationRegion());
|
| - o.add(buildAdministrationRegion());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed806(core.List<api.AdministrationRegion> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkAdministrationRegion(o[0]);
|
| - checkAdministrationRegion(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterVoterInfoResponse = 0;
|
| -buildVoterInfoResponse() {
|
| - var o = new api.VoterInfoResponse();
|
| - buildCounterVoterInfoResponse++;
|
| - if (buildCounterVoterInfoResponse < 3) {
|
| - o.contests = buildUnnamed803();
|
| - o.earlyVoteSites = buildUnnamed804();
|
| - o.election = buildElection();
|
| - o.kind = "foo";
|
| - o.normalizedInput = buildSimpleAddressType();
|
| - o.pollingLocations = buildUnnamed805();
|
| - o.state = buildUnnamed806();
|
| - o.status = "foo";
|
| - }
|
| - buildCounterVoterInfoResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkVoterInfoResponse(api.VoterInfoResponse o) {
|
| - buildCounterVoterInfoResponse++;
|
| - if (buildCounterVoterInfoResponse < 3) {
|
| - checkUnnamed803(o.contests);
|
| - checkUnnamed804(o.earlyVoteSites);
|
| - checkElection(o.election);
|
| - unittest.expect(o.kind, unittest.equals('foo'));
|
| - checkSimpleAddressType(o.normalizedInput);
|
| - checkUnnamed805(o.pollingLocations);
|
| - checkUnnamed806(o.state);
|
| - unittest.expect(o.status, unittest.equals('foo'));
|
| - }
|
| - buildCounterVoterInfoResponse--;
|
| -}
|
| -
|
| -
|
| -main() {
|
| - unittest.group("obj-schema-AdministrationRegion", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildAdministrationRegion();
|
| - var od = new api.AdministrationRegion.fromJson(o.toJson());
|
| - checkAdministrationRegion(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-AdministrativeBody", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildAdministrativeBody();
|
| - var od = new api.AdministrativeBody.fromJson(o.toJson());
|
| - checkAdministrativeBody(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Candidate", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildCandidate();
|
| - var od = new api.Candidate.fromJson(o.toJson());
|
| - checkCandidate(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Channel", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildChannel();
|
| - var od = new api.Channel.fromJson(o.toJson());
|
| - checkChannel(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Contest", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildContest();
|
| - var od = new api.Contest.fromJson(o.toJson());
|
| - checkContest(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-DivisionSearchResponse", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildDivisionSearchResponse();
|
| - var od = new api.DivisionSearchResponse.fromJson(o.toJson());
|
| - checkDivisionSearchResponse(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-DivisionSearchResult", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildDivisionSearchResult();
|
| - var od = new api.DivisionSearchResult.fromJson(o.toJson());
|
| - checkDivisionSearchResult(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Election", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildElection();
|
| - var od = new api.Election.fromJson(o.toJson());
|
| - checkElection(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-ElectionOfficial", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildElectionOfficial();
|
| - var od = new api.ElectionOfficial.fromJson(o.toJson());
|
| - checkElectionOfficial(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-ElectionsQueryResponse", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildElectionsQueryResponse();
|
| - var od = new api.ElectionsQueryResponse.fromJson(o.toJson());
|
| - checkElectionsQueryResponse(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-ElectoralDistrict", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildElectoralDistrict();
|
| - var od = new api.ElectoralDistrict.fromJson(o.toJson());
|
| - checkElectoralDistrict(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-GeographicDivision", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildGeographicDivision();
|
| - var od = new api.GeographicDivision.fromJson(o.toJson());
|
| - checkGeographicDivision(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Office", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildOffice();
|
| - var od = new api.Office.fromJson(o.toJson());
|
| - checkOffice(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Official", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildOfficial();
|
| - var od = new api.Official.fromJson(o.toJson());
|
| - checkOfficial(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-PollingLocation", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildPollingLocation();
|
| - var od = new api.PollingLocation.fromJson(o.toJson());
|
| - checkPollingLocation(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-RepresentativeInfoRequest", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildRepresentativeInfoRequest();
|
| - var od = new api.RepresentativeInfoRequest.fromJson(o.toJson());
|
| - checkRepresentativeInfoRequest(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-RepresentativeInfoResponse", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildRepresentativeInfoResponse();
|
| - var od = new api.RepresentativeInfoResponse.fromJson(o.toJson());
|
| - checkRepresentativeInfoResponse(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-SimpleAddressType", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildSimpleAddressType();
|
| - var od = new api.SimpleAddressType.fromJson(o.toJson());
|
| - checkSimpleAddressType(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Source", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildSource();
|
| - var od = new api.Source.fromJson(o.toJson());
|
| - checkSource(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-VoterInfoRequest", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildVoterInfoRequest();
|
| - var od = new api.VoterInfoRequest.fromJson(o.toJson());
|
| - checkVoterInfoRequest(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-VoterInfoResponse", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildVoterInfoResponse();
|
| - var od = new api.VoterInfoResponse.fromJson(o.toJson());
|
| - checkVoterInfoResponse(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("resource-DivisionsResourceApi", () {
|
| - unittest.test("method--search", () {
|
| -
|
| - var mock = new common_test.HttpServerMock();
|
| - api.DivisionsResourceApi res = new api.CivicinfoApi(mock).divisions;
|
| - var arg_query = "foo";
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var path = (req.url).path;
|
| - var pathOffset = 0;
|
| - var index;
|
| - var subPart;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("/civicinfo/us_v1/"));
|
| - pathOffset += 17;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 31), unittest.equals("representatives/division_search"));
|
| - pathOffset += 31;
|
| -
|
| - var query = (req.url).query;
|
| - var queryOffset = 0;
|
| - var queryMap = {};
|
| - addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
|
| - parseBool(n) {
|
| - if (n == "true") return true;
|
| - if (n == "false") return false;
|
| - if (n == null) return null;
|
| - throw new core.ArgumentError("Invalid boolean: $n");
|
| - }
|
| - if (query.length > 0) {
|
| - for (var part in query.split("&")) {
|
| - var keyvalue = part.split("=");
|
| - addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
|
| - }
|
| - }
|
| - unittest.expect(queryMap["query"].first, unittest.equals(arg_query));
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildDivisionSearchResponse());
|
| - return new async.Future.value(common_test.stringResponse(200, h, resp));
|
| - }), true);
|
| - res.search(query: arg_query).then(unittest.expectAsync(((api.DivisionSearchResponse response) {
|
| - checkDivisionSearchResponse(response);
|
| - })));
|
| - });
|
| -
|
| - });
|
| -
|
| -
|
| - unittest.group("resource-ElectionsResourceApi", () {
|
| - unittest.test("method--electionQuery", () {
|
| -
|
| - var mock = new common_test.HttpServerMock();
|
| - api.ElectionsResourceApi res = new api.CivicinfoApi(mock).elections;
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var path = (req.url).path;
|
| - var pathOffset = 0;
|
| - var index;
|
| - var subPart;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("/civicinfo/us_v1/"));
|
| - pathOffset += 17;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals("elections"));
|
| - pathOffset += 9;
|
| -
|
| - var query = (req.url).query;
|
| - var queryOffset = 0;
|
| - var queryMap = {};
|
| - addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
|
| - parseBool(n) {
|
| - if (n == "true") return true;
|
| - if (n == "false") return false;
|
| - if (n == null) return null;
|
| - throw new core.ArgumentError("Invalid boolean: $n");
|
| - }
|
| - if (query.length > 0) {
|
| - for (var part in query.split("&")) {
|
| - var keyvalue = part.split("=");
|
| - addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
|
| - }
|
| - }
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildElectionsQueryResponse());
|
| - return new async.Future.value(common_test.stringResponse(200, h, resp));
|
| - }), true);
|
| - res.electionQuery().then(unittest.expectAsync(((api.ElectionsQueryResponse response) {
|
| - checkElectionsQueryResponse(response);
|
| - })));
|
| - });
|
| -
|
| - unittest.test("method--voterInfoQuery", () {
|
| -
|
| - var mock = new common_test.HttpServerMock();
|
| - api.ElectionsResourceApi res = new api.CivicinfoApi(mock).elections;
|
| - var arg_request = buildVoterInfoRequest();
|
| - var arg_electionId = "foo";
|
| - var arg_officialOnly = true;
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var obj = new api.VoterInfoRequest.fromJson(json);
|
| - checkVoterInfoRequest(obj);
|
| -
|
| - var path = (req.url).path;
|
| - var pathOffset = 0;
|
| - var index;
|
| - var subPart;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("/civicinfo/us_v1/"));
|
| - pathOffset += 17;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.equals("voterinfo/"));
|
| - pathOffset += 10;
|
| - index = path.indexOf("/lookup", pathOffset);
|
| - unittest.expect(index >= 0, unittest.isTrue);
|
| - subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
|
| - pathOffset = index;
|
| - unittest.expect(subPart, unittest.equals("$arg_electionId"));
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equals("/lookup"));
|
| - pathOffset += 7;
|
| -
|
| - var query = (req.url).query;
|
| - var queryOffset = 0;
|
| - var queryMap = {};
|
| - addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
|
| - parseBool(n) {
|
| - if (n == "true") return true;
|
| - if (n == "false") return false;
|
| - if (n == null) return null;
|
| - throw new core.ArgumentError("Invalid boolean: $n");
|
| - }
|
| - if (query.length > 0) {
|
| - for (var part in query.split("&")) {
|
| - var keyvalue = part.split("=");
|
| - addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
|
| - }
|
| - }
|
| - unittest.expect(queryMap["officialOnly"].first, unittest.equals("$arg_officialOnly"));
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildVoterInfoResponse());
|
| - return new async.Future.value(common_test.stringResponse(200, h, resp));
|
| - }), true);
|
| - res.voterInfoQuery(arg_request, arg_electionId, officialOnly: arg_officialOnly).then(unittest.expectAsync(((api.VoterInfoResponse response) {
|
| - checkVoterInfoResponse(response);
|
| - })));
|
| - });
|
| -
|
| - });
|
| -
|
| -
|
| - unittest.group("resource-RepresentativesResourceApi", () {
|
| - unittest.test("method--representativeInfoQuery", () {
|
| -
|
| - var mock = new common_test.HttpServerMock();
|
| - api.RepresentativesResourceApi res = new api.CivicinfoApi(mock).representatives;
|
| - var arg_request = buildRepresentativeInfoRequest();
|
| - var arg_includeOffices = true;
|
| - var arg_ocdId = "foo";
|
| - var arg_recursive = true;
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var obj = new api.RepresentativeInfoRequest.fromJson(json);
|
| - checkRepresentativeInfoRequest(obj);
|
| -
|
| - var path = (req.url).path;
|
| - var pathOffset = 0;
|
| - var index;
|
| - var subPart;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("/civicinfo/us_v1/"));
|
| - pathOffset += 17;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.equals("representatives/lookup"));
|
| - pathOffset += 22;
|
| -
|
| - var query = (req.url).query;
|
| - var queryOffset = 0;
|
| - var queryMap = {};
|
| - addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
|
| - parseBool(n) {
|
| - if (n == "true") return true;
|
| - if (n == "false") return false;
|
| - if (n == null) return null;
|
| - throw new core.ArgumentError("Invalid boolean: $n");
|
| - }
|
| - if (query.length > 0) {
|
| - for (var part in query.split("&")) {
|
| - var keyvalue = part.split("=");
|
| - addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
|
| - }
|
| - }
|
| - unittest.expect(queryMap["includeOffices"].first, unittest.equals("$arg_includeOffices"));
|
| - unittest.expect(queryMap["ocdId"].first, unittest.equals(arg_ocdId));
|
| - unittest.expect(queryMap["recursive"].first, unittest.equals("$arg_recursive"));
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildRepresentativeInfoResponse());
|
| - return new async.Future.value(common_test.stringResponse(200, h, resp));
|
| - }), true);
|
| - res.representativeInfoQuery(arg_request, includeOffices: arg_includeOffices, ocdId: arg_ocdId, recursive: arg_recursive).then(unittest.expectAsync(((api.RepresentativeInfoResponse response) {
|
| - checkRepresentativeInfoResponse(response);
|
| - })));
|
| - });
|
| -
|
| - });
|
| -
|
| -
|
| -}
|
| -
|
|
|