OLD | NEW |
| (Empty) |
1 library googleapis.doubleclickbidmanager.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/doubleclickbidmanager/v1.dart' as api; | |
16 | |
17 | |
18 | |
19 buildUnnamed691() { | |
20 var o = new core.List<core.String>(); | |
21 o.add("foo"); | |
22 o.add("foo"); | |
23 return o; | |
24 } | |
25 | |
26 checkUnnamed691(core.List<core.String> o) { | |
27 unittest.expect(o, unittest.hasLength(2)); | |
28 unittest.expect(o[0], unittest.equals('foo')); | |
29 unittest.expect(o[1], unittest.equals('foo')); | |
30 } | |
31 | |
32 core.int buildCounterDownloadLineItemsRequest = 0; | |
33 buildDownloadLineItemsRequest() { | |
34 var o = new api.DownloadLineItemsRequest(); | |
35 buildCounterDownloadLineItemsRequest++; | |
36 if (buildCounterDownloadLineItemsRequest < 3) { | |
37 o.filterIds = buildUnnamed691(); | |
38 o.filterType = "foo"; | |
39 o.format = "foo"; | |
40 } | |
41 buildCounterDownloadLineItemsRequest--; | |
42 return o; | |
43 } | |
44 | |
45 checkDownloadLineItemsRequest(api.DownloadLineItemsRequest o) { | |
46 buildCounterDownloadLineItemsRequest++; | |
47 if (buildCounterDownloadLineItemsRequest < 3) { | |
48 checkUnnamed691(o.filterIds); | |
49 unittest.expect(o.filterType, unittest.equals('foo')); | |
50 unittest.expect(o.format, unittest.equals('foo')); | |
51 } | |
52 buildCounterDownloadLineItemsRequest--; | |
53 } | |
54 | |
55 core.int buildCounterDownloadLineItemsResponse = 0; | |
56 buildDownloadLineItemsResponse() { | |
57 var o = new api.DownloadLineItemsResponse(); | |
58 buildCounterDownloadLineItemsResponse++; | |
59 if (buildCounterDownloadLineItemsResponse < 3) { | |
60 o.lineItems = "foo"; | |
61 } | |
62 buildCounterDownloadLineItemsResponse--; | |
63 return o; | |
64 } | |
65 | |
66 checkDownloadLineItemsResponse(api.DownloadLineItemsResponse o) { | |
67 buildCounterDownloadLineItemsResponse++; | |
68 if (buildCounterDownloadLineItemsResponse < 3) { | |
69 unittest.expect(o.lineItems, unittest.equals('foo')); | |
70 } | |
71 buildCounterDownloadLineItemsResponse--; | |
72 } | |
73 | |
74 core.int buildCounterFilterPair = 0; | |
75 buildFilterPair() { | |
76 var o = new api.FilterPair(); | |
77 buildCounterFilterPair++; | |
78 if (buildCounterFilterPair < 3) { | |
79 o.type = "foo"; | |
80 o.value = "foo"; | |
81 } | |
82 buildCounterFilterPair--; | |
83 return o; | |
84 } | |
85 | |
86 checkFilterPair(api.FilterPair o) { | |
87 buildCounterFilterPair++; | |
88 if (buildCounterFilterPair < 3) { | |
89 unittest.expect(o.type, unittest.equals('foo')); | |
90 unittest.expect(o.value, unittest.equals('foo')); | |
91 } | |
92 buildCounterFilterPair--; | |
93 } | |
94 | |
95 buildUnnamed692() { | |
96 var o = new core.List<api.Query>(); | |
97 o.add(buildQuery()); | |
98 o.add(buildQuery()); | |
99 return o; | |
100 } | |
101 | |
102 checkUnnamed692(core.List<api.Query> o) { | |
103 unittest.expect(o, unittest.hasLength(2)); | |
104 checkQuery(o[0]); | |
105 checkQuery(o[1]); | |
106 } | |
107 | |
108 core.int buildCounterListQueriesResponse = 0; | |
109 buildListQueriesResponse() { | |
110 var o = new api.ListQueriesResponse(); | |
111 buildCounterListQueriesResponse++; | |
112 if (buildCounterListQueriesResponse < 3) { | |
113 o.kind = "foo"; | |
114 o.queries = buildUnnamed692(); | |
115 } | |
116 buildCounterListQueriesResponse--; | |
117 return o; | |
118 } | |
119 | |
120 checkListQueriesResponse(api.ListQueriesResponse o) { | |
121 buildCounterListQueriesResponse++; | |
122 if (buildCounterListQueriesResponse < 3) { | |
123 unittest.expect(o.kind, unittest.equals('foo')); | |
124 checkUnnamed692(o.queries); | |
125 } | |
126 buildCounterListQueriesResponse--; | |
127 } | |
128 | |
129 buildUnnamed693() { | |
130 var o = new core.List<api.Report>(); | |
131 o.add(buildReport()); | |
132 o.add(buildReport()); | |
133 return o; | |
134 } | |
135 | |
136 checkUnnamed693(core.List<api.Report> o) { | |
137 unittest.expect(o, unittest.hasLength(2)); | |
138 checkReport(o[0]); | |
139 checkReport(o[1]); | |
140 } | |
141 | |
142 core.int buildCounterListReportsResponse = 0; | |
143 buildListReportsResponse() { | |
144 var o = new api.ListReportsResponse(); | |
145 buildCounterListReportsResponse++; | |
146 if (buildCounterListReportsResponse < 3) { | |
147 o.kind = "foo"; | |
148 o.reports = buildUnnamed693(); | |
149 } | |
150 buildCounterListReportsResponse--; | |
151 return o; | |
152 } | |
153 | |
154 checkListReportsResponse(api.ListReportsResponse o) { | |
155 buildCounterListReportsResponse++; | |
156 if (buildCounterListReportsResponse < 3) { | |
157 unittest.expect(o.kind, unittest.equals('foo')); | |
158 checkUnnamed693(o.reports); | |
159 } | |
160 buildCounterListReportsResponse--; | |
161 } | |
162 | |
163 buildUnnamed694() { | |
164 var o = new core.List<api.FilterPair>(); | |
165 o.add(buildFilterPair()); | |
166 o.add(buildFilterPair()); | |
167 return o; | |
168 } | |
169 | |
170 checkUnnamed694(core.List<api.FilterPair> o) { | |
171 unittest.expect(o, unittest.hasLength(2)); | |
172 checkFilterPair(o[0]); | |
173 checkFilterPair(o[1]); | |
174 } | |
175 | |
176 buildUnnamed695() { | |
177 var o = new core.List<core.String>(); | |
178 o.add("foo"); | |
179 o.add("foo"); | |
180 return o; | |
181 } | |
182 | |
183 checkUnnamed695(core.List<core.String> o) { | |
184 unittest.expect(o, unittest.hasLength(2)); | |
185 unittest.expect(o[0], unittest.equals('foo')); | |
186 unittest.expect(o[1], unittest.equals('foo')); | |
187 } | |
188 | |
189 buildUnnamed696() { | |
190 var o = new core.List<core.String>(); | |
191 o.add("foo"); | |
192 o.add("foo"); | |
193 return o; | |
194 } | |
195 | |
196 checkUnnamed696(core.List<core.String> o) { | |
197 unittest.expect(o, unittest.hasLength(2)); | |
198 unittest.expect(o[0], unittest.equals('foo')); | |
199 unittest.expect(o[1], unittest.equals('foo')); | |
200 } | |
201 | |
202 core.int buildCounterParameters = 0; | |
203 buildParameters() { | |
204 var o = new api.Parameters(); | |
205 buildCounterParameters++; | |
206 if (buildCounterParameters < 3) { | |
207 o.filters = buildUnnamed694(); | |
208 o.groupBys = buildUnnamed695(); | |
209 o.includeInviteData = true; | |
210 o.metrics = buildUnnamed696(); | |
211 o.type = "foo"; | |
212 } | |
213 buildCounterParameters--; | |
214 return o; | |
215 } | |
216 | |
217 checkParameters(api.Parameters o) { | |
218 buildCounterParameters++; | |
219 if (buildCounterParameters < 3) { | |
220 checkUnnamed694(o.filters); | |
221 checkUnnamed695(o.groupBys); | |
222 unittest.expect(o.includeInviteData, unittest.isTrue); | |
223 checkUnnamed696(o.metrics); | |
224 unittest.expect(o.type, unittest.equals('foo')); | |
225 } | |
226 buildCounterParameters--; | |
227 } | |
228 | |
229 core.int buildCounterQuery = 0; | |
230 buildQuery() { | |
231 var o = new api.Query(); | |
232 buildCounterQuery++; | |
233 if (buildCounterQuery < 3) { | |
234 o.kind = "foo"; | |
235 o.metadata = buildQueryMetadata(); | |
236 o.params = buildParameters(); | |
237 o.queryId = "foo"; | |
238 o.reportDataEndTimeMs = "foo"; | |
239 o.reportDataStartTimeMs = "foo"; | |
240 o.schedule = buildQuerySchedule(); | |
241 o.timezoneCode = "foo"; | |
242 } | |
243 buildCounterQuery--; | |
244 return o; | |
245 } | |
246 | |
247 checkQuery(api.Query o) { | |
248 buildCounterQuery++; | |
249 if (buildCounterQuery < 3) { | |
250 unittest.expect(o.kind, unittest.equals('foo')); | |
251 checkQueryMetadata(o.metadata); | |
252 checkParameters(o.params); | |
253 unittest.expect(o.queryId, unittest.equals('foo')); | |
254 unittest.expect(o.reportDataEndTimeMs, unittest.equals('foo')); | |
255 unittest.expect(o.reportDataStartTimeMs, unittest.equals('foo')); | |
256 checkQuerySchedule(o.schedule); | |
257 unittest.expect(o.timezoneCode, unittest.equals('foo')); | |
258 } | |
259 buildCounterQuery--; | |
260 } | |
261 | |
262 buildUnnamed697() { | |
263 var o = new core.List<core.String>(); | |
264 o.add("foo"); | |
265 o.add("foo"); | |
266 return o; | |
267 } | |
268 | |
269 checkUnnamed697(core.List<core.String> o) { | |
270 unittest.expect(o, unittest.hasLength(2)); | |
271 unittest.expect(o[0], unittest.equals('foo')); | |
272 unittest.expect(o[1], unittest.equals('foo')); | |
273 } | |
274 | |
275 core.int buildCounterQueryMetadata = 0; | |
276 buildQueryMetadata() { | |
277 var o = new api.QueryMetadata(); | |
278 buildCounterQueryMetadata++; | |
279 if (buildCounterQueryMetadata < 3) { | |
280 o.dataRange = "foo"; | |
281 o.format = "foo"; | |
282 o.googleCloudStoragePathForLatestReport = "foo"; | |
283 o.googleDrivePathForLatestReport = "foo"; | |
284 o.latestReportRunTimeMs = "foo"; | |
285 o.reportCount = 42; | |
286 o.running = true; | |
287 o.sendNotification = true; | |
288 o.shareEmailAddress = buildUnnamed697(); | |
289 o.title = "foo"; | |
290 } | |
291 buildCounterQueryMetadata--; | |
292 return o; | |
293 } | |
294 | |
295 checkQueryMetadata(api.QueryMetadata o) { | |
296 buildCounterQueryMetadata++; | |
297 if (buildCounterQueryMetadata < 3) { | |
298 unittest.expect(o.dataRange, unittest.equals('foo')); | |
299 unittest.expect(o.format, unittest.equals('foo')); | |
300 unittest.expect(o.googleCloudStoragePathForLatestReport, unittest.equals('fo
o')); | |
301 unittest.expect(o.googleDrivePathForLatestReport, unittest.equals('foo')); | |
302 unittest.expect(o.latestReportRunTimeMs, unittest.equals('foo')); | |
303 unittest.expect(o.reportCount, unittest.equals(42)); | |
304 unittest.expect(o.running, unittest.isTrue); | |
305 unittest.expect(o.sendNotification, unittest.isTrue); | |
306 checkUnnamed697(o.shareEmailAddress); | |
307 unittest.expect(o.title, unittest.equals('foo')); | |
308 } | |
309 buildCounterQueryMetadata--; | |
310 } | |
311 | |
312 core.int buildCounterQuerySchedule = 0; | |
313 buildQuerySchedule() { | |
314 var o = new api.QuerySchedule(); | |
315 buildCounterQuerySchedule++; | |
316 if (buildCounterQuerySchedule < 3) { | |
317 o.endTimeMs = "foo"; | |
318 o.frequency = "foo"; | |
319 o.nextRunMinuteOfDay = 42; | |
320 o.nextRunTimezoneCode = "foo"; | |
321 } | |
322 buildCounterQuerySchedule--; | |
323 return o; | |
324 } | |
325 | |
326 checkQuerySchedule(api.QuerySchedule o) { | |
327 buildCounterQuerySchedule++; | |
328 if (buildCounterQuerySchedule < 3) { | |
329 unittest.expect(o.endTimeMs, unittest.equals('foo')); | |
330 unittest.expect(o.frequency, unittest.equals('foo')); | |
331 unittest.expect(o.nextRunMinuteOfDay, unittest.equals(42)); | |
332 unittest.expect(o.nextRunTimezoneCode, unittest.equals('foo')); | |
333 } | |
334 buildCounterQuerySchedule--; | |
335 } | |
336 | |
337 core.int buildCounterReport = 0; | |
338 buildReport() { | |
339 var o = new api.Report(); | |
340 buildCounterReport++; | |
341 if (buildCounterReport < 3) { | |
342 o.key = buildReportKey(); | |
343 o.metadata = buildReportMetadata(); | |
344 o.params = buildParameters(); | |
345 } | |
346 buildCounterReport--; | |
347 return o; | |
348 } | |
349 | |
350 checkReport(api.Report o) { | |
351 buildCounterReport++; | |
352 if (buildCounterReport < 3) { | |
353 checkReportKey(o.key); | |
354 checkReportMetadata(o.metadata); | |
355 checkParameters(o.params); | |
356 } | |
357 buildCounterReport--; | |
358 } | |
359 | |
360 core.int buildCounterReportFailure = 0; | |
361 buildReportFailure() { | |
362 var o = new api.ReportFailure(); | |
363 buildCounterReportFailure++; | |
364 if (buildCounterReportFailure < 3) { | |
365 o.errorCode = "foo"; | |
366 } | |
367 buildCounterReportFailure--; | |
368 return o; | |
369 } | |
370 | |
371 checkReportFailure(api.ReportFailure o) { | |
372 buildCounterReportFailure++; | |
373 if (buildCounterReportFailure < 3) { | |
374 unittest.expect(o.errorCode, unittest.equals('foo')); | |
375 } | |
376 buildCounterReportFailure--; | |
377 } | |
378 | |
379 core.int buildCounterReportKey = 0; | |
380 buildReportKey() { | |
381 var o = new api.ReportKey(); | |
382 buildCounterReportKey++; | |
383 if (buildCounterReportKey < 3) { | |
384 o.queryId = "foo"; | |
385 o.reportId = "foo"; | |
386 } | |
387 buildCounterReportKey--; | |
388 return o; | |
389 } | |
390 | |
391 checkReportKey(api.ReportKey o) { | |
392 buildCounterReportKey++; | |
393 if (buildCounterReportKey < 3) { | |
394 unittest.expect(o.queryId, unittest.equals('foo')); | |
395 unittest.expect(o.reportId, unittest.equals('foo')); | |
396 } | |
397 buildCounterReportKey--; | |
398 } | |
399 | |
400 core.int buildCounterReportMetadata = 0; | |
401 buildReportMetadata() { | |
402 var o = new api.ReportMetadata(); | |
403 buildCounterReportMetadata++; | |
404 if (buildCounterReportMetadata < 3) { | |
405 o.googleCloudStoragePath = "foo"; | |
406 o.reportDataEndTimeMs = "foo"; | |
407 o.reportDataStartTimeMs = "foo"; | |
408 o.status = buildReportStatus(); | |
409 } | |
410 buildCounterReportMetadata--; | |
411 return o; | |
412 } | |
413 | |
414 checkReportMetadata(api.ReportMetadata o) { | |
415 buildCounterReportMetadata++; | |
416 if (buildCounterReportMetadata < 3) { | |
417 unittest.expect(o.googleCloudStoragePath, unittest.equals('foo')); | |
418 unittest.expect(o.reportDataEndTimeMs, unittest.equals('foo')); | |
419 unittest.expect(o.reportDataStartTimeMs, unittest.equals('foo')); | |
420 checkReportStatus(o.status); | |
421 } | |
422 buildCounterReportMetadata--; | |
423 } | |
424 | |
425 core.int buildCounterReportStatus = 0; | |
426 buildReportStatus() { | |
427 var o = new api.ReportStatus(); | |
428 buildCounterReportStatus++; | |
429 if (buildCounterReportStatus < 3) { | |
430 o.failure = buildReportFailure(); | |
431 o.finishTimeMs = "foo"; | |
432 o.format = "foo"; | |
433 o.state = "foo"; | |
434 } | |
435 buildCounterReportStatus--; | |
436 return o; | |
437 } | |
438 | |
439 checkReportStatus(api.ReportStatus o) { | |
440 buildCounterReportStatus++; | |
441 if (buildCounterReportStatus < 3) { | |
442 checkReportFailure(o.failure); | |
443 unittest.expect(o.finishTimeMs, unittest.equals('foo')); | |
444 unittest.expect(o.format, unittest.equals('foo')); | |
445 unittest.expect(o.state, unittest.equals('foo')); | |
446 } | |
447 buildCounterReportStatus--; | |
448 } | |
449 | |
450 buildUnnamed698() { | |
451 var o = new core.List<core.String>(); | |
452 o.add("foo"); | |
453 o.add("foo"); | |
454 return o; | |
455 } | |
456 | |
457 checkUnnamed698(core.List<core.String> o) { | |
458 unittest.expect(o, unittest.hasLength(2)); | |
459 unittest.expect(o[0], unittest.equals('foo')); | |
460 unittest.expect(o[1], unittest.equals('foo')); | |
461 } | |
462 | |
463 core.int buildCounterRowStatus = 0; | |
464 buildRowStatus() { | |
465 var o = new api.RowStatus(); | |
466 buildCounterRowStatus++; | |
467 if (buildCounterRowStatus < 3) { | |
468 o.changed = true; | |
469 o.entityId = "foo"; | |
470 o.entityName = "foo"; | |
471 o.errors = buildUnnamed698(); | |
472 o.persisted = true; | |
473 o.rowNumber = 42; | |
474 } | |
475 buildCounterRowStatus--; | |
476 return o; | |
477 } | |
478 | |
479 checkRowStatus(api.RowStatus o) { | |
480 buildCounterRowStatus++; | |
481 if (buildCounterRowStatus < 3) { | |
482 unittest.expect(o.changed, unittest.isTrue); | |
483 unittest.expect(o.entityId, unittest.equals('foo')); | |
484 unittest.expect(o.entityName, unittest.equals('foo')); | |
485 checkUnnamed698(o.errors); | |
486 unittest.expect(o.persisted, unittest.isTrue); | |
487 unittest.expect(o.rowNumber, unittest.equals(42)); | |
488 } | |
489 buildCounterRowStatus--; | |
490 } | |
491 | |
492 core.int buildCounterRunQueryRequest = 0; | |
493 buildRunQueryRequest() { | |
494 var o = new api.RunQueryRequest(); | |
495 buildCounterRunQueryRequest++; | |
496 if (buildCounterRunQueryRequest < 3) { | |
497 o.dataRange = "foo"; | |
498 o.reportDataEndTimeMs = "foo"; | |
499 o.reportDataStartTimeMs = "foo"; | |
500 o.timezoneCode = "foo"; | |
501 } | |
502 buildCounterRunQueryRequest--; | |
503 return o; | |
504 } | |
505 | |
506 checkRunQueryRequest(api.RunQueryRequest o) { | |
507 buildCounterRunQueryRequest++; | |
508 if (buildCounterRunQueryRequest < 3) { | |
509 unittest.expect(o.dataRange, unittest.equals('foo')); | |
510 unittest.expect(o.reportDataEndTimeMs, unittest.equals('foo')); | |
511 unittest.expect(o.reportDataStartTimeMs, unittest.equals('foo')); | |
512 unittest.expect(o.timezoneCode, unittest.equals('foo')); | |
513 } | |
514 buildCounterRunQueryRequest--; | |
515 } | |
516 | |
517 core.int buildCounterUploadLineItemsRequest = 0; | |
518 buildUploadLineItemsRequest() { | |
519 var o = new api.UploadLineItemsRequest(); | |
520 buildCounterUploadLineItemsRequest++; | |
521 if (buildCounterUploadLineItemsRequest < 3) { | |
522 o.dryRun = true; | |
523 o.format = "foo"; | |
524 o.lineItems = "foo"; | |
525 } | |
526 buildCounterUploadLineItemsRequest--; | |
527 return o; | |
528 } | |
529 | |
530 checkUploadLineItemsRequest(api.UploadLineItemsRequest o) { | |
531 buildCounterUploadLineItemsRequest++; | |
532 if (buildCounterUploadLineItemsRequest < 3) { | |
533 unittest.expect(o.dryRun, unittest.isTrue); | |
534 unittest.expect(o.format, unittest.equals('foo')); | |
535 unittest.expect(o.lineItems, unittest.equals('foo')); | |
536 } | |
537 buildCounterUploadLineItemsRequest--; | |
538 } | |
539 | |
540 core.int buildCounterUploadLineItemsResponse = 0; | |
541 buildUploadLineItemsResponse() { | |
542 var o = new api.UploadLineItemsResponse(); | |
543 buildCounterUploadLineItemsResponse++; | |
544 if (buildCounterUploadLineItemsResponse < 3) { | |
545 o.uploadStatus = buildUploadStatus(); | |
546 } | |
547 buildCounterUploadLineItemsResponse--; | |
548 return o; | |
549 } | |
550 | |
551 checkUploadLineItemsResponse(api.UploadLineItemsResponse o) { | |
552 buildCounterUploadLineItemsResponse++; | |
553 if (buildCounterUploadLineItemsResponse < 3) { | |
554 checkUploadStatus(o.uploadStatus); | |
555 } | |
556 buildCounterUploadLineItemsResponse--; | |
557 } | |
558 | |
559 buildUnnamed699() { | |
560 var o = new core.List<core.String>(); | |
561 o.add("foo"); | |
562 o.add("foo"); | |
563 return o; | |
564 } | |
565 | |
566 checkUnnamed699(core.List<core.String> o) { | |
567 unittest.expect(o, unittest.hasLength(2)); | |
568 unittest.expect(o[0], unittest.equals('foo')); | |
569 unittest.expect(o[1], unittest.equals('foo')); | |
570 } | |
571 | |
572 buildUnnamed700() { | |
573 var o = new core.List<api.RowStatus>(); | |
574 o.add(buildRowStatus()); | |
575 o.add(buildRowStatus()); | |
576 return o; | |
577 } | |
578 | |
579 checkUnnamed700(core.List<api.RowStatus> o) { | |
580 unittest.expect(o, unittest.hasLength(2)); | |
581 checkRowStatus(o[0]); | |
582 checkRowStatus(o[1]); | |
583 } | |
584 | |
585 core.int buildCounterUploadStatus = 0; | |
586 buildUploadStatus() { | |
587 var o = new api.UploadStatus(); | |
588 buildCounterUploadStatus++; | |
589 if (buildCounterUploadStatus < 3) { | |
590 o.errors = buildUnnamed699(); | |
591 o.rowStatus = buildUnnamed700(); | |
592 } | |
593 buildCounterUploadStatus--; | |
594 return o; | |
595 } | |
596 | |
597 checkUploadStatus(api.UploadStatus o) { | |
598 buildCounterUploadStatus++; | |
599 if (buildCounterUploadStatus < 3) { | |
600 checkUnnamed699(o.errors); | |
601 checkUnnamed700(o.rowStatus); | |
602 } | |
603 buildCounterUploadStatus--; | |
604 } | |
605 | |
606 | |
607 main() { | |
608 unittest.group("obj-schema-DownloadLineItemsRequest", () { | |
609 unittest.test("to-json--from-json", () { | |
610 var o = buildDownloadLineItemsRequest(); | |
611 var od = new api.DownloadLineItemsRequest.fromJson(o.toJson()); | |
612 checkDownloadLineItemsRequest(od); | |
613 }); | |
614 }); | |
615 | |
616 | |
617 unittest.group("obj-schema-DownloadLineItemsResponse", () { | |
618 unittest.test("to-json--from-json", () { | |
619 var o = buildDownloadLineItemsResponse(); | |
620 var od = new api.DownloadLineItemsResponse.fromJson(o.toJson()); | |
621 checkDownloadLineItemsResponse(od); | |
622 }); | |
623 }); | |
624 | |
625 | |
626 unittest.group("obj-schema-FilterPair", () { | |
627 unittest.test("to-json--from-json", () { | |
628 var o = buildFilterPair(); | |
629 var od = new api.FilterPair.fromJson(o.toJson()); | |
630 checkFilterPair(od); | |
631 }); | |
632 }); | |
633 | |
634 | |
635 unittest.group("obj-schema-ListQueriesResponse", () { | |
636 unittest.test("to-json--from-json", () { | |
637 var o = buildListQueriesResponse(); | |
638 var od = new api.ListQueriesResponse.fromJson(o.toJson()); | |
639 checkListQueriesResponse(od); | |
640 }); | |
641 }); | |
642 | |
643 | |
644 unittest.group("obj-schema-ListReportsResponse", () { | |
645 unittest.test("to-json--from-json", () { | |
646 var o = buildListReportsResponse(); | |
647 var od = new api.ListReportsResponse.fromJson(o.toJson()); | |
648 checkListReportsResponse(od); | |
649 }); | |
650 }); | |
651 | |
652 | |
653 unittest.group("obj-schema-Parameters", () { | |
654 unittest.test("to-json--from-json", () { | |
655 var o = buildParameters(); | |
656 var od = new api.Parameters.fromJson(o.toJson()); | |
657 checkParameters(od); | |
658 }); | |
659 }); | |
660 | |
661 | |
662 unittest.group("obj-schema-Query", () { | |
663 unittest.test("to-json--from-json", () { | |
664 var o = buildQuery(); | |
665 var od = new api.Query.fromJson(o.toJson()); | |
666 checkQuery(od); | |
667 }); | |
668 }); | |
669 | |
670 | |
671 unittest.group("obj-schema-QueryMetadata", () { | |
672 unittest.test("to-json--from-json", () { | |
673 var o = buildQueryMetadata(); | |
674 var od = new api.QueryMetadata.fromJson(o.toJson()); | |
675 checkQueryMetadata(od); | |
676 }); | |
677 }); | |
678 | |
679 | |
680 unittest.group("obj-schema-QuerySchedule", () { | |
681 unittest.test("to-json--from-json", () { | |
682 var o = buildQuerySchedule(); | |
683 var od = new api.QuerySchedule.fromJson(o.toJson()); | |
684 checkQuerySchedule(od); | |
685 }); | |
686 }); | |
687 | |
688 | |
689 unittest.group("obj-schema-Report", () { | |
690 unittest.test("to-json--from-json", () { | |
691 var o = buildReport(); | |
692 var od = new api.Report.fromJson(o.toJson()); | |
693 checkReport(od); | |
694 }); | |
695 }); | |
696 | |
697 | |
698 unittest.group("obj-schema-ReportFailure", () { | |
699 unittest.test("to-json--from-json", () { | |
700 var o = buildReportFailure(); | |
701 var od = new api.ReportFailure.fromJson(o.toJson()); | |
702 checkReportFailure(od); | |
703 }); | |
704 }); | |
705 | |
706 | |
707 unittest.group("obj-schema-ReportKey", () { | |
708 unittest.test("to-json--from-json", () { | |
709 var o = buildReportKey(); | |
710 var od = new api.ReportKey.fromJson(o.toJson()); | |
711 checkReportKey(od); | |
712 }); | |
713 }); | |
714 | |
715 | |
716 unittest.group("obj-schema-ReportMetadata", () { | |
717 unittest.test("to-json--from-json", () { | |
718 var o = buildReportMetadata(); | |
719 var od = new api.ReportMetadata.fromJson(o.toJson()); | |
720 checkReportMetadata(od); | |
721 }); | |
722 }); | |
723 | |
724 | |
725 unittest.group("obj-schema-ReportStatus", () { | |
726 unittest.test("to-json--from-json", () { | |
727 var o = buildReportStatus(); | |
728 var od = new api.ReportStatus.fromJson(o.toJson()); | |
729 checkReportStatus(od); | |
730 }); | |
731 }); | |
732 | |
733 | |
734 unittest.group("obj-schema-RowStatus", () { | |
735 unittest.test("to-json--from-json", () { | |
736 var o = buildRowStatus(); | |
737 var od = new api.RowStatus.fromJson(o.toJson()); | |
738 checkRowStatus(od); | |
739 }); | |
740 }); | |
741 | |
742 | |
743 unittest.group("obj-schema-RunQueryRequest", () { | |
744 unittest.test("to-json--from-json", () { | |
745 var o = buildRunQueryRequest(); | |
746 var od = new api.RunQueryRequest.fromJson(o.toJson()); | |
747 checkRunQueryRequest(od); | |
748 }); | |
749 }); | |
750 | |
751 | |
752 unittest.group("obj-schema-UploadLineItemsRequest", () { | |
753 unittest.test("to-json--from-json", () { | |
754 var o = buildUploadLineItemsRequest(); | |
755 var od = new api.UploadLineItemsRequest.fromJson(o.toJson()); | |
756 checkUploadLineItemsRequest(od); | |
757 }); | |
758 }); | |
759 | |
760 | |
761 unittest.group("obj-schema-UploadLineItemsResponse", () { | |
762 unittest.test("to-json--from-json", () { | |
763 var o = buildUploadLineItemsResponse(); | |
764 var od = new api.UploadLineItemsResponse.fromJson(o.toJson()); | |
765 checkUploadLineItemsResponse(od); | |
766 }); | |
767 }); | |
768 | |
769 | |
770 unittest.group("obj-schema-UploadStatus", () { | |
771 unittest.test("to-json--from-json", () { | |
772 var o = buildUploadStatus(); | |
773 var od = new api.UploadStatus.fromJson(o.toJson()); | |
774 checkUploadStatus(od); | |
775 }); | |
776 }); | |
777 | |
778 | |
779 unittest.group("resource-LineitemsResourceApi", () { | |
780 unittest.test("method--downloadlineitems", () { | |
781 | |
782 var mock = new common_test.HttpServerMock(); | |
783 api.LineitemsResourceApi res = new api.DoubleclickbidmanagerApi(mock).line
items; | |
784 var arg_request = buildDownloadLineItemsRequest(); | |
785 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
786 var obj = new api.DownloadLineItemsRequest.fromJson(json); | |
787 checkDownloadLineItemsRequest(obj); | |
788 | |
789 var path = (req.url).path; | |
790 var pathOffset = 0; | |
791 var index; | |
792 var subPart; | |
793 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
794 pathOffset += 26; | |
795 unittest.expect(path.substring(pathOffset, pathOffset + 27), unittest.eq
uals("lineitems/downloadlineitems")); | |
796 pathOffset += 27; | |
797 | |
798 var query = (req.url).query; | |
799 var queryOffset = 0; | |
800 var queryMap = {}; | |
801 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
802 parseBool(n) { | |
803 if (n == "true") return true; | |
804 if (n == "false") return false; | |
805 if (n == null) return null; | |
806 throw new core.ArgumentError("Invalid boolean: $n"); | |
807 } | |
808 if (query.length > 0) { | |
809 for (var part in query.split("&")) { | |
810 var keyvalue = part.split("="); | |
811 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
812 } | |
813 } | |
814 | |
815 | |
816 var h = { | |
817 "content-type" : "application/json; charset=utf-8", | |
818 }; | |
819 var resp = convert.JSON.encode(buildDownloadLineItemsResponse()); | |
820 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
821 }), true); | |
822 res.downloadlineitems(arg_request).then(unittest.expectAsync(((api.Downloa
dLineItemsResponse response) { | |
823 checkDownloadLineItemsResponse(response); | |
824 }))); | |
825 }); | |
826 | |
827 unittest.test("method--uploadlineitems", () { | |
828 | |
829 var mock = new common_test.HttpServerMock(); | |
830 api.LineitemsResourceApi res = new api.DoubleclickbidmanagerApi(mock).line
items; | |
831 var arg_request = buildUploadLineItemsRequest(); | |
832 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
833 var obj = new api.UploadLineItemsRequest.fromJson(json); | |
834 checkUploadLineItemsRequest(obj); | |
835 | |
836 var path = (req.url).path; | |
837 var pathOffset = 0; | |
838 var index; | |
839 var subPart; | |
840 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
841 pathOffset += 26; | |
842 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("lineitems/uploadlineitems")); | |
843 pathOffset += 25; | |
844 | |
845 var query = (req.url).query; | |
846 var queryOffset = 0; | |
847 var queryMap = {}; | |
848 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
849 parseBool(n) { | |
850 if (n == "true") return true; | |
851 if (n == "false") return false; | |
852 if (n == null) return null; | |
853 throw new core.ArgumentError("Invalid boolean: $n"); | |
854 } | |
855 if (query.length > 0) { | |
856 for (var part in query.split("&")) { | |
857 var keyvalue = part.split("="); | |
858 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
859 } | |
860 } | |
861 | |
862 | |
863 var h = { | |
864 "content-type" : "application/json; charset=utf-8", | |
865 }; | |
866 var resp = convert.JSON.encode(buildUploadLineItemsResponse()); | |
867 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
868 }), true); | |
869 res.uploadlineitems(arg_request).then(unittest.expectAsync(((api.UploadLin
eItemsResponse response) { | |
870 checkUploadLineItemsResponse(response); | |
871 }))); | |
872 }); | |
873 | |
874 }); | |
875 | |
876 | |
877 unittest.group("resource-QueriesResourceApi", () { | |
878 unittest.test("method--createquery", () { | |
879 | |
880 var mock = new common_test.HttpServerMock(); | |
881 api.QueriesResourceApi res = new api.DoubleclickbidmanagerApi(mock).querie
s; | |
882 var arg_request = buildQuery(); | |
883 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
884 var obj = new api.Query.fromJson(json); | |
885 checkQuery(obj); | |
886 | |
887 var path = (req.url).path; | |
888 var pathOffset = 0; | |
889 var index; | |
890 var subPart; | |
891 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
892 pathOffset += 26; | |
893 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("query")); | |
894 pathOffset += 5; | |
895 | |
896 var query = (req.url).query; | |
897 var queryOffset = 0; | |
898 var queryMap = {}; | |
899 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
900 parseBool(n) { | |
901 if (n == "true") return true; | |
902 if (n == "false") return false; | |
903 if (n == null) return null; | |
904 throw new core.ArgumentError("Invalid boolean: $n"); | |
905 } | |
906 if (query.length > 0) { | |
907 for (var part in query.split("&")) { | |
908 var keyvalue = part.split("="); | |
909 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
910 } | |
911 } | |
912 | |
913 | |
914 var h = { | |
915 "content-type" : "application/json; charset=utf-8", | |
916 }; | |
917 var resp = convert.JSON.encode(buildQuery()); | |
918 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
919 }), true); | |
920 res.createquery(arg_request).then(unittest.expectAsync(((api.Query respons
e) { | |
921 checkQuery(response); | |
922 }))); | |
923 }); | |
924 | |
925 unittest.test("method--deletequery", () { | |
926 | |
927 var mock = new common_test.HttpServerMock(); | |
928 api.QueriesResourceApi res = new api.DoubleclickbidmanagerApi(mock).querie
s; | |
929 var arg_queryId = "foo"; | |
930 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
931 var path = (req.url).path; | |
932 var pathOffset = 0; | |
933 var index; | |
934 var subPart; | |
935 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
936 pathOffset += 26; | |
937 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("query/")); | |
938 pathOffset += 6; | |
939 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
940 pathOffset = path.length; | |
941 unittest.expect(subPart, unittest.equals("$arg_queryId")); | |
942 | |
943 var query = (req.url).query; | |
944 var queryOffset = 0; | |
945 var queryMap = {}; | |
946 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
947 parseBool(n) { | |
948 if (n == "true") return true; | |
949 if (n == "false") return false; | |
950 if (n == null) return null; | |
951 throw new core.ArgumentError("Invalid boolean: $n"); | |
952 } | |
953 if (query.length > 0) { | |
954 for (var part in query.split("&")) { | |
955 var keyvalue = part.split("="); | |
956 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
957 } | |
958 } | |
959 | |
960 | |
961 var h = { | |
962 "content-type" : "application/json; charset=utf-8", | |
963 }; | |
964 var resp = ""; | |
965 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
966 }), true); | |
967 res.deletequery(arg_queryId).then(unittest.expectAsync((_) {})); | |
968 }); | |
969 | |
970 unittest.test("method--getquery", () { | |
971 | |
972 var mock = new common_test.HttpServerMock(); | |
973 api.QueriesResourceApi res = new api.DoubleclickbidmanagerApi(mock).querie
s; | |
974 var arg_queryId = "foo"; | |
975 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
976 var path = (req.url).path; | |
977 var pathOffset = 0; | |
978 var index; | |
979 var subPart; | |
980 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
981 pathOffset += 26; | |
982 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("query/")); | |
983 pathOffset += 6; | |
984 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
985 pathOffset = path.length; | |
986 unittest.expect(subPart, unittest.equals("$arg_queryId")); | |
987 | |
988 var query = (req.url).query; | |
989 var queryOffset = 0; | |
990 var queryMap = {}; | |
991 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
992 parseBool(n) { | |
993 if (n == "true") return true; | |
994 if (n == "false") return false; | |
995 if (n == null) return null; | |
996 throw new core.ArgumentError("Invalid boolean: $n"); | |
997 } | |
998 if (query.length > 0) { | |
999 for (var part in query.split("&")) { | |
1000 var keyvalue = part.split("="); | |
1001 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1002 } | |
1003 } | |
1004 | |
1005 | |
1006 var h = { | |
1007 "content-type" : "application/json; charset=utf-8", | |
1008 }; | |
1009 var resp = convert.JSON.encode(buildQuery()); | |
1010 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1011 }), true); | |
1012 res.getquery(arg_queryId).then(unittest.expectAsync(((api.Query response)
{ | |
1013 checkQuery(response); | |
1014 }))); | |
1015 }); | |
1016 | |
1017 unittest.test("method--listqueries", () { | |
1018 | |
1019 var mock = new common_test.HttpServerMock(); | |
1020 api.QueriesResourceApi res = new api.DoubleclickbidmanagerApi(mock).querie
s; | |
1021 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1022 var path = (req.url).path; | |
1023 var pathOffset = 0; | |
1024 var index; | |
1025 var subPart; | |
1026 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
1027 pathOffset += 26; | |
1028 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("queries")); | |
1029 pathOffset += 7; | |
1030 | |
1031 var query = (req.url).query; | |
1032 var queryOffset = 0; | |
1033 var queryMap = {}; | |
1034 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1035 parseBool(n) { | |
1036 if (n == "true") return true; | |
1037 if (n == "false") return false; | |
1038 if (n == null) return null; | |
1039 throw new core.ArgumentError("Invalid boolean: $n"); | |
1040 } | |
1041 if (query.length > 0) { | |
1042 for (var part in query.split("&")) { | |
1043 var keyvalue = part.split("="); | |
1044 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1045 } | |
1046 } | |
1047 | |
1048 | |
1049 var h = { | |
1050 "content-type" : "application/json; charset=utf-8", | |
1051 }; | |
1052 var resp = convert.JSON.encode(buildListQueriesResponse()); | |
1053 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1054 }), true); | |
1055 res.listqueries().then(unittest.expectAsync(((api.ListQueriesResponse resp
onse) { | |
1056 checkListQueriesResponse(response); | |
1057 }))); | |
1058 }); | |
1059 | |
1060 unittest.test("method--runquery", () { | |
1061 | |
1062 var mock = new common_test.HttpServerMock(); | |
1063 api.QueriesResourceApi res = new api.DoubleclickbidmanagerApi(mock).querie
s; | |
1064 var arg_request = buildRunQueryRequest(); | |
1065 var arg_queryId = "foo"; | |
1066 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1067 var obj = new api.RunQueryRequest.fromJson(json); | |
1068 checkRunQueryRequest(obj); | |
1069 | |
1070 var path = (req.url).path; | |
1071 var pathOffset = 0; | |
1072 var index; | |
1073 var subPart; | |
1074 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
1075 pathOffset += 26; | |
1076 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("query/")); | |
1077 pathOffset += 6; | |
1078 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1079 pathOffset = path.length; | |
1080 unittest.expect(subPart, unittest.equals("$arg_queryId")); | |
1081 | |
1082 var query = (req.url).query; | |
1083 var queryOffset = 0; | |
1084 var queryMap = {}; | |
1085 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1086 parseBool(n) { | |
1087 if (n == "true") return true; | |
1088 if (n == "false") return false; | |
1089 if (n == null) return null; | |
1090 throw new core.ArgumentError("Invalid boolean: $n"); | |
1091 } | |
1092 if (query.length > 0) { | |
1093 for (var part in query.split("&")) { | |
1094 var keyvalue = part.split("="); | |
1095 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1096 } | |
1097 } | |
1098 | |
1099 | |
1100 var h = { | |
1101 "content-type" : "application/json; charset=utf-8", | |
1102 }; | |
1103 var resp = ""; | |
1104 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1105 }), true); | |
1106 res.runquery(arg_request, arg_queryId).then(unittest.expectAsync((_) {})); | |
1107 }); | |
1108 | |
1109 }); | |
1110 | |
1111 | |
1112 unittest.group("resource-ReportsResourceApi", () { | |
1113 unittest.test("method--listreports", () { | |
1114 | |
1115 var mock = new common_test.HttpServerMock(); | |
1116 api.ReportsResourceApi res = new api.DoubleclickbidmanagerApi(mock).report
s; | |
1117 var arg_queryId = "foo"; | |
1118 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1119 var path = (req.url).path; | |
1120 var pathOffset = 0; | |
1121 var index; | |
1122 var subPart; | |
1123 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/doubleclickbidmanager/v1/")); | |
1124 pathOffset += 26; | |
1125 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("queries/")); | |
1126 pathOffset += 8; | |
1127 index = path.indexOf("/reports", pathOffset); | |
1128 unittest.expect(index >= 0, unittest.isTrue); | |
1129 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1130 pathOffset = index; | |
1131 unittest.expect(subPart, unittest.equals("$arg_queryId")); | |
1132 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/reports")); | |
1133 pathOffset += 8; | |
1134 | |
1135 var query = (req.url).query; | |
1136 var queryOffset = 0; | |
1137 var queryMap = {}; | |
1138 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1139 parseBool(n) { | |
1140 if (n == "true") return true; | |
1141 if (n == "false") return false; | |
1142 if (n == null) return null; | |
1143 throw new core.ArgumentError("Invalid boolean: $n"); | |
1144 } | |
1145 if (query.length > 0) { | |
1146 for (var part in query.split("&")) { | |
1147 var keyvalue = part.split("="); | |
1148 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1149 } | |
1150 } | |
1151 | |
1152 | |
1153 var h = { | |
1154 "content-type" : "application/json; charset=utf-8", | |
1155 }; | |
1156 var resp = convert.JSON.encode(buildListReportsResponse()); | |
1157 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1158 }), true); | |
1159 res.listreports(arg_queryId).then(unittest.expectAsync(((api.ListReportsRe
sponse response) { | |
1160 checkListReportsResponse(response); | |
1161 }))); | |
1162 }); | |
1163 | |
1164 }); | |
1165 | |
1166 | |
1167 } | |
1168 | |
OLD | NEW |