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

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

Issue 3003493002: Api-Roll 53: 2017-08-21 (Closed)
Patch Set: Created 3 years, 4 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
1 library googleapis.youtubereporting.v1.test; 1 library googleapis.youtubereporting.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 unittest.expect(o.createTime, unittest.equals('foo')); 90 unittest.expect(o.createTime, unittest.equals('foo'));
91 unittest.expect(o.expireTime, unittest.equals('foo')); 91 unittest.expect(o.expireTime, unittest.equals('foo'));
92 unittest.expect(o.id, unittest.equals('foo')); 92 unittest.expect(o.id, unittest.equals('foo'));
93 unittest.expect(o.name, unittest.equals('foo')); 93 unittest.expect(o.name, unittest.equals('foo'));
94 unittest.expect(o.reportTypeId, unittest.equals('foo')); 94 unittest.expect(o.reportTypeId, unittest.equals('foo'));
95 unittest.expect(o.systemManaged, unittest.isTrue); 95 unittest.expect(o.systemManaged, unittest.isTrue);
96 } 96 }
97 buildCounterJob--; 97 buildCounterJob--;
98 } 98 }
99 99
100 buildUnnamed1061() { 100 buildUnnamed1078() {
101 var o = new core.List<api.Job>(); 101 var o = new core.List<api.Job>();
102 o.add(buildJob()); 102 o.add(buildJob());
103 o.add(buildJob()); 103 o.add(buildJob());
104 return o; 104 return o;
105 } 105 }
106 106
107 checkUnnamed1061(core.List<api.Job> o) { 107 checkUnnamed1078(core.List<api.Job> o) {
108 unittest.expect(o, unittest.hasLength(2)); 108 unittest.expect(o, unittest.hasLength(2));
109 checkJob(o[0]); 109 checkJob(o[0]);
110 checkJob(o[1]); 110 checkJob(o[1]);
111 } 111 }
112 112
113 core.int buildCounterListJobsResponse = 0; 113 core.int buildCounterListJobsResponse = 0;
114 buildListJobsResponse() { 114 buildListJobsResponse() {
115 var o = new api.ListJobsResponse(); 115 var o = new api.ListJobsResponse();
116 buildCounterListJobsResponse++; 116 buildCounterListJobsResponse++;
117 if (buildCounterListJobsResponse < 3) { 117 if (buildCounterListJobsResponse < 3) {
118 o.jobs = buildUnnamed1061(); 118 o.jobs = buildUnnamed1078();
119 o.nextPageToken = "foo"; 119 o.nextPageToken = "foo";
120 } 120 }
121 buildCounterListJobsResponse--; 121 buildCounterListJobsResponse--;
122 return o; 122 return o;
123 } 123 }
124 124
125 checkListJobsResponse(api.ListJobsResponse o) { 125 checkListJobsResponse(api.ListJobsResponse o) {
126 buildCounterListJobsResponse++; 126 buildCounterListJobsResponse++;
127 if (buildCounterListJobsResponse < 3) { 127 if (buildCounterListJobsResponse < 3) {
128 checkUnnamed1061(o.jobs); 128 checkUnnamed1078(o.jobs);
129 unittest.expect(o.nextPageToken, unittest.equals('foo')); 129 unittest.expect(o.nextPageToken, unittest.equals('foo'));
130 } 130 }
131 buildCounterListJobsResponse--; 131 buildCounterListJobsResponse--;
132 } 132 }
133 133
134 buildUnnamed1062() { 134 buildUnnamed1079() {
135 var o = new core.List<api.ReportType>(); 135 var o = new core.List<api.ReportType>();
136 o.add(buildReportType()); 136 o.add(buildReportType());
137 o.add(buildReportType()); 137 o.add(buildReportType());
138 return o; 138 return o;
139 } 139 }
140 140
141 checkUnnamed1062(core.List<api.ReportType> o) { 141 checkUnnamed1079(core.List<api.ReportType> o) {
142 unittest.expect(o, unittest.hasLength(2)); 142 unittest.expect(o, unittest.hasLength(2));
143 checkReportType(o[0]); 143 checkReportType(o[0]);
144 checkReportType(o[1]); 144 checkReportType(o[1]);
145 } 145 }
146 146
147 core.int buildCounterListReportTypesResponse = 0; 147 core.int buildCounterListReportTypesResponse = 0;
148 buildListReportTypesResponse() { 148 buildListReportTypesResponse() {
149 var o = new api.ListReportTypesResponse(); 149 var o = new api.ListReportTypesResponse();
150 buildCounterListReportTypesResponse++; 150 buildCounterListReportTypesResponse++;
151 if (buildCounterListReportTypesResponse < 3) { 151 if (buildCounterListReportTypesResponse < 3) {
152 o.nextPageToken = "foo"; 152 o.nextPageToken = "foo";
153 o.reportTypes = buildUnnamed1062(); 153 o.reportTypes = buildUnnamed1079();
154 } 154 }
155 buildCounterListReportTypesResponse--; 155 buildCounterListReportTypesResponse--;
156 return o; 156 return o;
157 } 157 }
158 158
159 checkListReportTypesResponse(api.ListReportTypesResponse o) { 159 checkListReportTypesResponse(api.ListReportTypesResponse o) {
160 buildCounterListReportTypesResponse++; 160 buildCounterListReportTypesResponse++;
161 if (buildCounterListReportTypesResponse < 3) { 161 if (buildCounterListReportTypesResponse < 3) {
162 unittest.expect(o.nextPageToken, unittest.equals('foo')); 162 unittest.expect(o.nextPageToken, unittest.equals('foo'));
163 checkUnnamed1062(o.reportTypes); 163 checkUnnamed1079(o.reportTypes);
164 } 164 }
165 buildCounterListReportTypesResponse--; 165 buildCounterListReportTypesResponse--;
166 } 166 }
167 167
168 buildUnnamed1063() { 168 buildUnnamed1080() {
169 var o = new core.List<api.Report>(); 169 var o = new core.List<api.Report>();
170 o.add(buildReport()); 170 o.add(buildReport());
171 o.add(buildReport()); 171 o.add(buildReport());
172 return o; 172 return o;
173 } 173 }
174 174
175 checkUnnamed1063(core.List<api.Report> o) { 175 checkUnnamed1080(core.List<api.Report> o) {
176 unittest.expect(o, unittest.hasLength(2)); 176 unittest.expect(o, unittest.hasLength(2));
177 checkReport(o[0]); 177 checkReport(o[0]);
178 checkReport(o[1]); 178 checkReport(o[1]);
179 } 179 }
180 180
181 core.int buildCounterListReportsResponse = 0; 181 core.int buildCounterListReportsResponse = 0;
182 buildListReportsResponse() { 182 buildListReportsResponse() {
183 var o = new api.ListReportsResponse(); 183 var o = new api.ListReportsResponse();
184 buildCounterListReportsResponse++; 184 buildCounterListReportsResponse++;
185 if (buildCounterListReportsResponse < 3) { 185 if (buildCounterListReportsResponse < 3) {
186 o.nextPageToken = "foo"; 186 o.nextPageToken = "foo";
187 o.reports = buildUnnamed1063(); 187 o.reports = buildUnnamed1080();
188 } 188 }
189 buildCounterListReportsResponse--; 189 buildCounterListReportsResponse--;
190 return o; 190 return o;
191 } 191 }
192 192
193 checkListReportsResponse(api.ListReportsResponse o) { 193 checkListReportsResponse(api.ListReportsResponse o) {
194 buildCounterListReportsResponse++; 194 buildCounterListReportsResponse++;
195 if (buildCounterListReportsResponse < 3) { 195 if (buildCounterListReportsResponse < 3) {
196 unittest.expect(o.nextPageToken, unittest.equals('foo')); 196 unittest.expect(o.nextPageToken, unittest.equals('foo'));
197 checkUnnamed1063(o.reports); 197 checkUnnamed1080(o.reports);
198 } 198 }
199 buildCounterListReportsResponse--; 199 buildCounterListReportsResponse--;
200 } 200 }
201 201
202 core.int buildCounterMedia = 0; 202 core.int buildCounterMedia = 0;
203 buildMedia() { 203 buildMedia() {
204 var o = new api.Media(); 204 var o = new api.Media();
205 buildCounterMedia++; 205 buildCounterMedia++;
206 if (buildCounterMedia < 3) { 206 if (buildCounterMedia < 3) {
207 o.resourceName = "foo"; 207 o.resourceName = "foo";
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 }), true); 493 }), true);
494 res.get(arg_jobId, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the n(unittest.expectAsync1(((api.Job response) { 494 res.get(arg_jobId, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the n(unittest.expectAsync1(((api.Job response) {
495 checkJob(response); 495 checkJob(response);
496 }))); 496 })));
497 }); 497 });
498 498
499 unittest.test("method--list", () { 499 unittest.test("method--list", () {
500 500
501 var mock = new HttpServerMock(); 501 var mock = new HttpServerMock();
502 api.JobsResourceApi res = new api.YoutubereportingApi(mock).jobs; 502 api.JobsResourceApi res = new api.YoutubereportingApi(mock).jobs;
503 var arg_onBehalfOfContentOwner = "foo";
504 var arg_includeSystemManaged = true; 503 var arg_includeSystemManaged = true;
505 var arg_pageToken = "foo"; 504 var arg_pageToken = "foo";
506 var arg_pageSize = 42; 505 var arg_pageSize = 42;
506 var arg_onBehalfOfContentOwner = "foo";
507 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 507 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
508 var path = (req.url).path; 508 var path = (req.url).path;
509 var pathOffset = 0; 509 var pathOffset = 0;
510 var index; 510 var index;
511 var subPart; 511 var subPart;
512 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 512 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
513 pathOffset += 1; 513 pathOffset += 1;
514 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ als("v1/jobs")); 514 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ als("v1/jobs"));
515 pathOffset += 7; 515 pathOffset += 7;
516 516
517 var query = (req.url).query; 517 var query = (req.url).query;
518 var queryOffset = 0; 518 var queryOffset = 0;
519 var queryMap = {}; 519 var queryMap = {};
520 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 520 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
521 parseBool(n) { 521 parseBool(n) {
522 if (n == "true") return true; 522 if (n == "true") return true;
523 if (n == "false") return false; 523 if (n == "false") return false;
524 if (n == null) return null; 524 if (n == null) return null;
525 throw new core.ArgumentError("Invalid boolean: $n"); 525 throw new core.ArgumentError("Invalid boolean: $n");
526 } 526 }
527 if (query.length > 0) { 527 if (query.length > 0) {
528 for (var part in query.split("&")) { 528 for (var part in query.split("&")) {
529 var keyvalue = part.split("="); 529 var keyvalue = part.split("=");
530 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 530 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
531 } 531 }
532 } 532 }
533 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal s(arg_onBehalfOfContentOwner));
534 unittest.expect(queryMap["includeSystemManaged"].first, unittest.equals( "$arg_includeSystemManaged")); 533 unittest.expect(queryMap["includeSystemManaged"].first, unittest.equals( "$arg_includeSystemManaged"));
535 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 534 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
536 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 535 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize));
536 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal s(arg_onBehalfOfContentOwner));
537 537
538 538
539 var h = { 539 var h = {
540 "content-type" : "application/json; charset=utf-8", 540 "content-type" : "application/json; charset=utf-8",
541 }; 541 };
542 var resp = convert.JSON.encode(buildListJobsResponse()); 542 var resp = convert.JSON.encode(buildListJobsResponse());
543 return new async.Future.value(stringResponse(200, h, resp)); 543 return new async.Future.value(stringResponse(200, h, resp));
544 }), true); 544 }), true);
545 res.list(onBehalfOfContentOwner: arg_onBehalfOfContentOwner, includeSystem Managed: arg_includeSystemManaged, pageToken: arg_pageToken, pageSize: arg_pageS ize).then(unittest.expectAsync1(((api.ListJobsResponse response) { 545 res.list(includeSystemManaged: arg_includeSystemManaged, pageToken: arg_pa geToken, pageSize: arg_pageSize, onBehalfOfContentOwner: arg_onBehalfOfContentOw ner).then(unittest.expectAsync1(((api.ListJobsResponse response) {
546 checkListJobsResponse(response); 546 checkListJobsResponse(response);
547 }))); 547 })));
548 }); 548 });
549 549
550 }); 550 });
551 551
552 552
553 unittest.group("resource-JobsReportsResourceApi", () { 553 unittest.group("resource-JobsReportsResourceApi", () {
554 unittest.test("method--get", () { 554 unittest.test("method--get", () {
555 555
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 res.list(onBehalfOfContentOwner: arg_onBehalfOfContentOwner, includeSystem Managed: arg_includeSystemManaged, pageToken: arg_pageToken, pageSize: arg_pageS ize).then(unittest.expectAsync1(((api.ListReportTypesResponse response) { 775 res.list(onBehalfOfContentOwner: arg_onBehalfOfContentOwner, includeSystem Managed: arg_includeSystemManaged, pageToken: arg_pageToken, pageSize: arg_pageS ize).then(unittest.expectAsync1(((api.ListReportTypesResponse response) {
776 checkListReportTypesResponse(response); 776 checkListReportTypesResponse(response);
777 }))); 777 })));
778 }); 778 });
779 779
780 }); 780 });
781 781
782 782
783 } 783 }
784 784
OLDNEW
« no previous file with comments | « generated/googleapis/test/youtubeanalytics/v1_test.dart ('k') | generated/googleapis_beta/CHANGELOG.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698