OLD | NEW |
1 library googleapis.youtubeAnalytics.v1.test; | 1 library googleapis.youtubeAnalytics.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:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 52 } |
53 | 53 |
54 core.int buildCounterBatchReportOutputs = 0; | |
55 buildBatchReportOutputs() { | |
56 var o = new api.BatchReportOutputs(); | |
57 buildCounterBatchReportOutputs++; | |
58 if (buildCounterBatchReportOutputs < 3) { | |
59 o.downloadUrl = "foo"; | |
60 o.format = "foo"; | |
61 o.type = "foo"; | |
62 } | |
63 buildCounterBatchReportOutputs--; | |
64 return o; | |
65 } | |
66 | |
67 checkBatchReportOutputs(api.BatchReportOutputs o) { | |
68 buildCounterBatchReportOutputs++; | |
69 if (buildCounterBatchReportOutputs < 3) { | |
70 unittest.expect(o.downloadUrl, unittest.equals('foo')); | |
71 unittest.expect(o.format, unittest.equals('foo')); | |
72 unittest.expect(o.type, unittest.equals('foo')); | |
73 } | |
74 buildCounterBatchReportOutputs--; | |
75 } | |
76 | |
77 buildUnnamed189() { | |
78 var o = new core.List<api.BatchReportOutputs>(); | |
79 o.add(buildBatchReportOutputs()); | |
80 o.add(buildBatchReportOutputs()); | |
81 return o; | |
82 } | |
83 | |
84 checkUnnamed189(core.List<api.BatchReportOutputs> o) { | |
85 unittest.expect(o, unittest.hasLength(2)); | |
86 checkBatchReportOutputs(o[0]); | |
87 checkBatchReportOutputs(o[1]); | |
88 } | |
89 | |
90 core.int buildCounterBatchReportTimeSpan = 0; | |
91 buildBatchReportTimeSpan() { | |
92 var o = new api.BatchReportTimeSpan(); | |
93 buildCounterBatchReportTimeSpan++; | |
94 if (buildCounterBatchReportTimeSpan < 3) { | |
95 o.endTime = core.DateTime.parse("2002-02-27T14:01:02"); | |
96 o.startTime = core.DateTime.parse("2002-02-27T14:01:02"); | |
97 } | |
98 buildCounterBatchReportTimeSpan--; | |
99 return o; | |
100 } | |
101 | |
102 checkBatchReportTimeSpan(api.BatchReportTimeSpan o) { | |
103 buildCounterBatchReportTimeSpan++; | |
104 if (buildCounterBatchReportTimeSpan < 3) { | |
105 unittest.expect(o.endTime, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); | |
106 unittest.expect(o.startTime, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); | |
107 } | |
108 buildCounterBatchReportTimeSpan--; | |
109 } | |
110 | |
111 core.int buildCounterBatchReport = 0; | |
112 buildBatchReport() { | |
113 var o = new api.BatchReport(); | |
114 buildCounterBatchReport++; | |
115 if (buildCounterBatchReport < 3) { | |
116 o.id = "foo"; | |
117 o.kind = "foo"; | |
118 o.outputs = buildUnnamed189(); | |
119 o.reportId = "foo"; | |
120 o.timeSpan = buildBatchReportTimeSpan(); | |
121 o.timeUpdated = core.DateTime.parse("2002-02-27T14:01:02"); | |
122 } | |
123 buildCounterBatchReport--; | |
124 return o; | |
125 } | |
126 | |
127 checkBatchReport(api.BatchReport o) { | |
128 buildCounterBatchReport++; | |
129 if (buildCounterBatchReport < 3) { | |
130 unittest.expect(o.id, unittest.equals('foo')); | |
131 unittest.expect(o.kind, unittest.equals('foo')); | |
132 checkUnnamed189(o.outputs); | |
133 unittest.expect(o.reportId, unittest.equals('foo')); | |
134 checkBatchReportTimeSpan(o.timeSpan); | |
135 unittest.expect(o.timeUpdated, unittest.equals(core.DateTime.parse("2002-02-
27T14:01:02"))); | |
136 } | |
137 buildCounterBatchReport--; | |
138 } | |
139 | |
140 core.int buildCounterBatchReportDefinition = 0; | |
141 buildBatchReportDefinition() { | |
142 var o = new api.BatchReportDefinition(); | |
143 buildCounterBatchReportDefinition++; | |
144 if (buildCounterBatchReportDefinition < 3) { | |
145 o.id = "foo"; | |
146 o.kind = "foo"; | |
147 o.name = "foo"; | |
148 o.status = "foo"; | |
149 o.type = "foo"; | |
150 } | |
151 buildCounterBatchReportDefinition--; | |
152 return o; | |
153 } | |
154 | |
155 checkBatchReportDefinition(api.BatchReportDefinition o) { | |
156 buildCounterBatchReportDefinition++; | |
157 if (buildCounterBatchReportDefinition < 3) { | |
158 unittest.expect(o.id, unittest.equals('foo')); | |
159 unittest.expect(o.kind, unittest.equals('foo')); | |
160 unittest.expect(o.name, unittest.equals('foo')); | |
161 unittest.expect(o.status, unittest.equals('foo')); | |
162 unittest.expect(o.type, unittest.equals('foo')); | |
163 } | |
164 buildCounterBatchReportDefinition--; | |
165 } | |
166 | |
167 buildUnnamed190() { | |
168 var o = new core.List<api.BatchReportDefinition>(); | |
169 o.add(buildBatchReportDefinition()); | |
170 o.add(buildBatchReportDefinition()); | |
171 return o; | |
172 } | |
173 | |
174 checkUnnamed190(core.List<api.BatchReportDefinition> o) { | |
175 unittest.expect(o, unittest.hasLength(2)); | |
176 checkBatchReportDefinition(o[0]); | |
177 checkBatchReportDefinition(o[1]); | |
178 } | |
179 | |
180 core.int buildCounterBatchReportDefinitionList = 0; | |
181 buildBatchReportDefinitionList() { | |
182 var o = new api.BatchReportDefinitionList(); | |
183 buildCounterBatchReportDefinitionList++; | |
184 if (buildCounterBatchReportDefinitionList < 3) { | |
185 o.items = buildUnnamed190(); | |
186 o.kind = "foo"; | |
187 } | |
188 buildCounterBatchReportDefinitionList--; | |
189 return o; | |
190 } | |
191 | |
192 checkBatchReportDefinitionList(api.BatchReportDefinitionList o) { | |
193 buildCounterBatchReportDefinitionList++; | |
194 if (buildCounterBatchReportDefinitionList < 3) { | |
195 checkUnnamed190(o.items); | |
196 unittest.expect(o.kind, unittest.equals('foo')); | |
197 } | |
198 buildCounterBatchReportDefinitionList--; | |
199 } | |
200 | |
201 buildUnnamed191() { | |
202 var o = new core.List<api.BatchReport>(); | |
203 o.add(buildBatchReport()); | |
204 o.add(buildBatchReport()); | |
205 return o; | |
206 } | |
207 | |
208 checkUnnamed191(core.List<api.BatchReport> o) { | |
209 unittest.expect(o, unittest.hasLength(2)); | |
210 checkBatchReport(o[0]); | |
211 checkBatchReport(o[1]); | |
212 } | |
213 | |
214 core.int buildCounterBatchReportList = 0; | |
215 buildBatchReportList() { | |
216 var o = new api.BatchReportList(); | |
217 buildCounterBatchReportList++; | |
218 if (buildCounterBatchReportList < 3) { | |
219 o.items = buildUnnamed191(); | |
220 o.kind = "foo"; | |
221 } | |
222 buildCounterBatchReportList--; | |
223 return o; | |
224 } | |
225 | |
226 checkBatchReportList(api.BatchReportList o) { | |
227 buildCounterBatchReportList++; | |
228 if (buildCounterBatchReportList < 3) { | |
229 checkUnnamed191(o.items); | |
230 unittest.expect(o.kind, unittest.equals('foo')); | |
231 } | |
232 buildCounterBatchReportList--; | |
233 } | |
234 | |
235 core.int buildCounterGroupContentDetails = 0; | 54 core.int buildCounterGroupContentDetails = 0; |
236 buildGroupContentDetails() { | 55 buildGroupContentDetails() { |
237 var o = new api.GroupContentDetails(); | 56 var o = new api.GroupContentDetails(); |
238 buildCounterGroupContentDetails++; | 57 buildCounterGroupContentDetails++; |
239 if (buildCounterGroupContentDetails < 3) { | 58 if (buildCounterGroupContentDetails < 3) { |
240 o.itemCount = "foo"; | 59 o.itemCount = "foo"; |
241 o.itemType = "foo"; | 60 o.itemType = "foo"; |
242 } | 61 } |
243 buildCounterGroupContentDetails--; | 62 buildCounterGroupContentDetails--; |
244 return o; | 63 return o; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (buildCounterGroupItem < 3) { | 161 if (buildCounterGroupItem < 3) { |
343 unittest.expect(o.etag, unittest.equals('foo')); | 162 unittest.expect(o.etag, unittest.equals('foo')); |
344 unittest.expect(o.groupId, unittest.equals('foo')); | 163 unittest.expect(o.groupId, unittest.equals('foo')); |
345 unittest.expect(o.id, unittest.equals('foo')); | 164 unittest.expect(o.id, unittest.equals('foo')); |
346 unittest.expect(o.kind, unittest.equals('foo')); | 165 unittest.expect(o.kind, unittest.equals('foo')); |
347 checkGroupItemResource(o.resource); | 166 checkGroupItemResource(o.resource); |
348 } | 167 } |
349 buildCounterGroupItem--; | 168 buildCounterGroupItem--; |
350 } | 169 } |
351 | 170 |
352 buildUnnamed192() { | 171 buildUnnamed193() { |
353 var o = new core.List<api.GroupItem>(); | 172 var o = new core.List<api.GroupItem>(); |
354 o.add(buildGroupItem()); | 173 o.add(buildGroupItem()); |
355 o.add(buildGroupItem()); | 174 o.add(buildGroupItem()); |
356 return o; | 175 return o; |
357 } | 176 } |
358 | 177 |
359 checkUnnamed192(core.List<api.GroupItem> o) { | 178 checkUnnamed193(core.List<api.GroupItem> o) { |
360 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
361 checkGroupItem(o[0]); | 180 checkGroupItem(o[0]); |
362 checkGroupItem(o[1]); | 181 checkGroupItem(o[1]); |
363 } | 182 } |
364 | 183 |
365 core.int buildCounterGroupItemListResponse = 0; | 184 core.int buildCounterGroupItemListResponse = 0; |
366 buildGroupItemListResponse() { | 185 buildGroupItemListResponse() { |
367 var o = new api.GroupItemListResponse(); | 186 var o = new api.GroupItemListResponse(); |
368 buildCounterGroupItemListResponse++; | 187 buildCounterGroupItemListResponse++; |
369 if (buildCounterGroupItemListResponse < 3) { | 188 if (buildCounterGroupItemListResponse < 3) { |
370 o.etag = "foo"; | 189 o.etag = "foo"; |
371 o.items = buildUnnamed192(); | 190 o.items = buildUnnamed193(); |
372 o.kind = "foo"; | 191 o.kind = "foo"; |
373 } | 192 } |
374 buildCounterGroupItemListResponse--; | 193 buildCounterGroupItemListResponse--; |
375 return o; | 194 return o; |
376 } | 195 } |
377 | 196 |
378 checkGroupItemListResponse(api.GroupItemListResponse o) { | 197 checkGroupItemListResponse(api.GroupItemListResponse o) { |
379 buildCounterGroupItemListResponse++; | 198 buildCounterGroupItemListResponse++; |
380 if (buildCounterGroupItemListResponse < 3) { | 199 if (buildCounterGroupItemListResponse < 3) { |
381 unittest.expect(o.etag, unittest.equals('foo')); | 200 unittest.expect(o.etag, unittest.equals('foo')); |
382 checkUnnamed192(o.items); | 201 checkUnnamed193(o.items); |
383 unittest.expect(o.kind, unittest.equals('foo')); | 202 unittest.expect(o.kind, unittest.equals('foo')); |
384 } | 203 } |
385 buildCounterGroupItemListResponse--; | 204 buildCounterGroupItemListResponse--; |
386 } | 205 } |
387 | 206 |
388 buildUnnamed193() { | 207 buildUnnamed194() { |
389 var o = new core.List<api.Group>(); | 208 var o = new core.List<api.Group>(); |
390 o.add(buildGroup()); | 209 o.add(buildGroup()); |
391 o.add(buildGroup()); | 210 o.add(buildGroup()); |
392 return o; | 211 return o; |
393 } | 212 } |
394 | 213 |
395 checkUnnamed193(core.List<api.Group> o) { | 214 checkUnnamed194(core.List<api.Group> o) { |
396 unittest.expect(o, unittest.hasLength(2)); | 215 unittest.expect(o, unittest.hasLength(2)); |
397 checkGroup(o[0]); | 216 checkGroup(o[0]); |
398 checkGroup(o[1]); | 217 checkGroup(o[1]); |
399 } | 218 } |
400 | 219 |
401 core.int buildCounterGroupListResponse = 0; | 220 core.int buildCounterGroupListResponse = 0; |
402 buildGroupListResponse() { | 221 buildGroupListResponse() { |
403 var o = new api.GroupListResponse(); | 222 var o = new api.GroupListResponse(); |
404 buildCounterGroupListResponse++; | 223 buildCounterGroupListResponse++; |
405 if (buildCounterGroupListResponse < 3) { | 224 if (buildCounterGroupListResponse < 3) { |
406 o.etag = "foo"; | 225 o.etag = "foo"; |
407 o.items = buildUnnamed193(); | 226 o.items = buildUnnamed194(); |
408 o.kind = "foo"; | 227 o.kind = "foo"; |
409 o.nextPageToken = "foo"; | 228 o.nextPageToken = "foo"; |
410 } | 229 } |
411 buildCounterGroupListResponse--; | 230 buildCounterGroupListResponse--; |
412 return o; | 231 return o; |
413 } | 232 } |
414 | 233 |
415 checkGroupListResponse(api.GroupListResponse o) { | 234 checkGroupListResponse(api.GroupListResponse o) { |
416 buildCounterGroupListResponse++; | 235 buildCounterGroupListResponse++; |
417 if (buildCounterGroupListResponse < 3) { | 236 if (buildCounterGroupListResponse < 3) { |
418 unittest.expect(o.etag, unittest.equals('foo')); | 237 unittest.expect(o.etag, unittest.equals('foo')); |
419 checkUnnamed193(o.items); | 238 checkUnnamed194(o.items); |
420 unittest.expect(o.kind, unittest.equals('foo')); | 239 unittest.expect(o.kind, unittest.equals('foo')); |
421 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 240 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
422 } | 241 } |
423 buildCounterGroupListResponse--; | 242 buildCounterGroupListResponse--; |
424 } | 243 } |
425 | 244 |
426 core.int buildCounterResultTableColumnHeaders = 0; | 245 core.int buildCounterResultTableColumnHeaders = 0; |
427 buildResultTableColumnHeaders() { | 246 buildResultTableColumnHeaders() { |
428 var o = new api.ResultTableColumnHeaders(); | 247 var o = new api.ResultTableColumnHeaders(); |
429 buildCounterResultTableColumnHeaders++; | 248 buildCounterResultTableColumnHeaders++; |
430 if (buildCounterResultTableColumnHeaders < 3) { | 249 if (buildCounterResultTableColumnHeaders < 3) { |
431 o.columnType = "foo"; | 250 o.columnType = "foo"; |
432 o.dataType = "foo"; | 251 o.dataType = "foo"; |
433 o.name = "foo"; | 252 o.name = "foo"; |
434 } | 253 } |
435 buildCounterResultTableColumnHeaders--; | 254 buildCounterResultTableColumnHeaders--; |
436 return o; | 255 return o; |
437 } | 256 } |
438 | 257 |
439 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { | 258 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { |
440 buildCounterResultTableColumnHeaders++; | 259 buildCounterResultTableColumnHeaders++; |
441 if (buildCounterResultTableColumnHeaders < 3) { | 260 if (buildCounterResultTableColumnHeaders < 3) { |
442 unittest.expect(o.columnType, unittest.equals('foo')); | 261 unittest.expect(o.columnType, unittest.equals('foo')); |
443 unittest.expect(o.dataType, unittest.equals('foo')); | 262 unittest.expect(o.dataType, unittest.equals('foo')); |
444 unittest.expect(o.name, unittest.equals('foo')); | 263 unittest.expect(o.name, unittest.equals('foo')); |
445 } | 264 } |
446 buildCounterResultTableColumnHeaders--; | 265 buildCounterResultTableColumnHeaders--; |
447 } | 266 } |
448 | 267 |
449 buildUnnamed194() { | 268 buildUnnamed195() { |
450 var o = new core.List<api.ResultTableColumnHeaders>(); | 269 var o = new core.List<api.ResultTableColumnHeaders>(); |
451 o.add(buildResultTableColumnHeaders()); | 270 o.add(buildResultTableColumnHeaders()); |
452 o.add(buildResultTableColumnHeaders()); | 271 o.add(buildResultTableColumnHeaders()); |
453 return o; | 272 return o; |
454 } | 273 } |
455 | 274 |
456 checkUnnamed194(core.List<api.ResultTableColumnHeaders> o) { | 275 checkUnnamed195(core.List<api.ResultTableColumnHeaders> o) { |
457 unittest.expect(o, unittest.hasLength(2)); | 276 unittest.expect(o, unittest.hasLength(2)); |
458 checkResultTableColumnHeaders(o[0]); | 277 checkResultTableColumnHeaders(o[0]); |
459 checkResultTableColumnHeaders(o[1]); | 278 checkResultTableColumnHeaders(o[1]); |
460 } | 279 } |
461 | 280 |
462 buildUnnamed195() { | 281 buildUnnamed196() { |
463 var o = new core.List<core.Object>(); | 282 var o = new core.List<core.Object>(); |
464 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 283 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
465 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 284 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
466 return o; | 285 return o; |
467 } | 286 } |
468 | 287 |
469 checkUnnamed195(core.List<core.Object> o) { | 288 checkUnnamed196(core.List<core.Object> o) { |
470 unittest.expect(o, unittest.hasLength(2)); | 289 unittest.expect(o, unittest.hasLength(2)); |
471 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); | 290 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); |
472 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); | 291 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); |
473 } | 292 } |
474 | 293 |
475 buildUnnamed196() { | 294 buildUnnamed197() { |
476 var o = new core.List<core.List<core.Object>>(); | 295 var o = new core.List<core.List<core.Object>>(); |
477 o.add(buildUnnamed195()); | 296 o.add(buildUnnamed196()); |
478 o.add(buildUnnamed195()); | 297 o.add(buildUnnamed196()); |
479 return o; | 298 return o; |
480 } | 299 } |
481 | 300 |
482 checkUnnamed196(core.List<core.List<core.Object>> o) { | 301 checkUnnamed197(core.List<core.List<core.Object>> o) { |
483 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
484 checkUnnamed195(o[0]); | 303 checkUnnamed196(o[0]); |
485 checkUnnamed195(o[1]); | 304 checkUnnamed196(o[1]); |
486 } | 305 } |
487 | 306 |
488 core.int buildCounterResultTable = 0; | 307 core.int buildCounterResultTable = 0; |
489 buildResultTable() { | 308 buildResultTable() { |
490 var o = new api.ResultTable(); | 309 var o = new api.ResultTable(); |
491 buildCounterResultTable++; | 310 buildCounterResultTable++; |
492 if (buildCounterResultTable < 3) { | 311 if (buildCounterResultTable < 3) { |
493 o.columnHeaders = buildUnnamed194(); | 312 o.columnHeaders = buildUnnamed195(); |
494 o.kind = "foo"; | 313 o.kind = "foo"; |
495 o.rows = buildUnnamed196(); | 314 o.rows = buildUnnamed197(); |
496 } | 315 } |
497 buildCounterResultTable--; | 316 buildCounterResultTable--; |
498 return o; | 317 return o; |
499 } | 318 } |
500 | 319 |
501 checkResultTable(api.ResultTable o) { | 320 checkResultTable(api.ResultTable o) { |
502 buildCounterResultTable++; | 321 buildCounterResultTable++; |
503 if (buildCounterResultTable < 3) { | 322 if (buildCounterResultTable < 3) { |
504 checkUnnamed194(o.columnHeaders); | 323 checkUnnamed195(o.columnHeaders); |
505 unittest.expect(o.kind, unittest.equals('foo')); | 324 unittest.expect(o.kind, unittest.equals('foo')); |
506 checkUnnamed196(o.rows); | 325 checkUnnamed197(o.rows); |
507 } | 326 } |
508 buildCounterResultTable--; | 327 buildCounterResultTable--; |
509 } | 328 } |
510 | 329 |
511 | 330 |
512 main() { | 331 main() { |
513 unittest.group("obj-schema-BatchReportOutputs", () { | |
514 unittest.test("to-json--from-json", () { | |
515 var o = buildBatchReportOutputs(); | |
516 var od = new api.BatchReportOutputs.fromJson(o.toJson()); | |
517 checkBatchReportOutputs(od); | |
518 }); | |
519 }); | |
520 | |
521 | |
522 unittest.group("obj-schema-BatchReportTimeSpan", () { | |
523 unittest.test("to-json--from-json", () { | |
524 var o = buildBatchReportTimeSpan(); | |
525 var od = new api.BatchReportTimeSpan.fromJson(o.toJson()); | |
526 checkBatchReportTimeSpan(od); | |
527 }); | |
528 }); | |
529 | |
530 | |
531 unittest.group("obj-schema-BatchReport", () { | |
532 unittest.test("to-json--from-json", () { | |
533 var o = buildBatchReport(); | |
534 var od = new api.BatchReport.fromJson(o.toJson()); | |
535 checkBatchReport(od); | |
536 }); | |
537 }); | |
538 | |
539 | |
540 unittest.group("obj-schema-BatchReportDefinition", () { | |
541 unittest.test("to-json--from-json", () { | |
542 var o = buildBatchReportDefinition(); | |
543 var od = new api.BatchReportDefinition.fromJson(o.toJson()); | |
544 checkBatchReportDefinition(od); | |
545 }); | |
546 }); | |
547 | |
548 | |
549 unittest.group("obj-schema-BatchReportDefinitionList", () { | |
550 unittest.test("to-json--from-json", () { | |
551 var o = buildBatchReportDefinitionList(); | |
552 var od = new api.BatchReportDefinitionList.fromJson(o.toJson()); | |
553 checkBatchReportDefinitionList(od); | |
554 }); | |
555 }); | |
556 | |
557 | |
558 unittest.group("obj-schema-BatchReportList", () { | |
559 unittest.test("to-json--from-json", () { | |
560 var o = buildBatchReportList(); | |
561 var od = new api.BatchReportList.fromJson(o.toJson()); | |
562 checkBatchReportList(od); | |
563 }); | |
564 }); | |
565 | |
566 | |
567 unittest.group("obj-schema-GroupContentDetails", () { | 332 unittest.group("obj-schema-GroupContentDetails", () { |
568 unittest.test("to-json--from-json", () { | 333 unittest.test("to-json--from-json", () { |
569 var o = buildGroupContentDetails(); | 334 var o = buildGroupContentDetails(); |
570 var od = new api.GroupContentDetails.fromJson(o.toJson()); | 335 var od = new api.GroupContentDetails.fromJson(o.toJson()); |
571 checkGroupContentDetails(od); | 336 checkGroupContentDetails(od); |
572 }); | 337 }); |
573 }); | 338 }); |
574 | 339 |
575 | 340 |
576 unittest.group("obj-schema-GroupSnippet", () { | 341 unittest.group("obj-schema-GroupSnippet", () { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 403 |
639 unittest.group("obj-schema-ResultTable", () { | 404 unittest.group("obj-schema-ResultTable", () { |
640 unittest.test("to-json--from-json", () { | 405 unittest.test("to-json--from-json", () { |
641 var o = buildResultTable(); | 406 var o = buildResultTable(); |
642 var od = new api.ResultTable.fromJson(o.toJson()); | 407 var od = new api.ResultTable.fromJson(o.toJson()); |
643 checkResultTable(od); | 408 checkResultTable(od); |
644 }); | 409 }); |
645 }); | 410 }); |
646 | 411 |
647 | 412 |
648 unittest.group("resource-BatchReportDefinitionsResourceApi", () { | |
649 unittest.test("method--list", () { | |
650 | |
651 var mock = new HttpServerMock(); | |
652 api.BatchReportDefinitionsResourceApi res = new api.YoutubeAnalyticsApi(mo
ck).batchReportDefinitions; | |
653 var arg_onBehalfOfContentOwner = "foo"; | |
654 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
655 var path = (req.url).path; | |
656 var pathOffset = 0; | |
657 var index; | |
658 var subPart; | |
659 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
660 pathOffset += 1; | |
661 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | |
662 pathOffset += 21; | |
663 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("batchReportDefinitions")); | |
664 pathOffset += 22; | |
665 | |
666 var query = (req.url).query; | |
667 var queryOffset = 0; | |
668 var queryMap = {}; | |
669 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
670 parseBool(n) { | |
671 if (n == "true") return true; | |
672 if (n == "false") return false; | |
673 if (n == null) return null; | |
674 throw new core.ArgumentError("Invalid boolean: $n"); | |
675 } | |
676 if (query.length > 0) { | |
677 for (var part in query.split("&")) { | |
678 var keyvalue = part.split("="); | |
679 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
680 } | |
681 } | |
682 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | |
683 | |
684 | |
685 var h = { | |
686 "content-type" : "application/json; charset=utf-8", | |
687 }; | |
688 var resp = convert.JSON.encode(buildBatchReportDefinitionList()); | |
689 return new async.Future.value(stringResponse(200, h, resp)); | |
690 }), true); | |
691 res.list(arg_onBehalfOfContentOwner).then(unittest.expectAsync(((api.Batch
ReportDefinitionList response) { | |
692 checkBatchReportDefinitionList(response); | |
693 }))); | |
694 }); | |
695 | |
696 }); | |
697 | |
698 | |
699 unittest.group("resource-BatchReportsResourceApi", () { | |
700 unittest.test("method--list", () { | |
701 | |
702 var mock = new HttpServerMock(); | |
703 api.BatchReportsResourceApi res = new api.YoutubeAnalyticsApi(mock).batchR
eports; | |
704 var arg_batchReportDefinitionId = "foo"; | |
705 var arg_onBehalfOfContentOwner = "foo"; | |
706 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
707 var path = (req.url).path; | |
708 var pathOffset = 0; | |
709 var index; | |
710 var subPart; | |
711 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
712 pathOffset += 1; | |
713 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | |
714 pathOffset += 21; | |
715 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("batchReports")); | |
716 pathOffset += 12; | |
717 | |
718 var query = (req.url).query; | |
719 var queryOffset = 0; | |
720 var queryMap = {}; | |
721 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
722 parseBool(n) { | |
723 if (n == "true") return true; | |
724 if (n == "false") return false; | |
725 if (n == null) return null; | |
726 throw new core.ArgumentError("Invalid boolean: $n"); | |
727 } | |
728 if (query.length > 0) { | |
729 for (var part in query.split("&")) { | |
730 var keyvalue = part.split("="); | |
731 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
732 } | |
733 } | |
734 unittest.expect(queryMap["batchReportDefinitionId"].first, unittest.equa
ls(arg_batchReportDefinitionId)); | |
735 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | |
736 | |
737 | |
738 var h = { | |
739 "content-type" : "application/json; charset=utf-8", | |
740 }; | |
741 var resp = convert.JSON.encode(buildBatchReportList()); | |
742 return new async.Future.value(stringResponse(200, h, resp)); | |
743 }), true); | |
744 res.list(arg_batchReportDefinitionId, arg_onBehalfOfContentOwner).then(uni
ttest.expectAsync(((api.BatchReportList response) { | |
745 checkBatchReportList(response); | |
746 }))); | |
747 }); | |
748 | |
749 }); | |
750 | |
751 | |
752 unittest.group("resource-GroupItemsResourceApi", () { | 413 unittest.group("resource-GroupItemsResourceApi", () { |
753 unittest.test("method--delete", () { | 414 unittest.test("method--delete", () { |
754 | 415 |
755 var mock = new HttpServerMock(); | 416 var mock = new HttpServerMock(); |
756 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; | 417 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; |
757 var arg_id = "foo"; | 418 var arg_id = "foo"; |
758 var arg_onBehalfOfContentOwner = "foo"; | 419 var arg_onBehalfOfContentOwner = "foo"; |
759 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 420 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
760 var path = (req.url).path; | 421 var path = (req.url).path; |
761 var pathOffset = 0; | 422 var pathOffset = 0; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, max_results: arg_m
ax_results, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAs
ync(((api.ResultTable response) { | 831 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, max_results: arg_m
ax_results, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAs
ync(((api.ResultTable response) { |
1171 checkResultTable(response); | 832 checkResultTable(response); |
1172 }))); | 833 }))); |
1173 }); | 834 }); |
1174 | 835 |
1175 }); | 836 }); |
1176 | 837 |
1177 | 838 |
1178 } | 839 } |
1179 | 840 |
OLD | NEW |