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:test/test.dart' as unittest; |
11 | 11 |
12 import 'package:googleapis/youtubeanalytics/v1.dart' as api; | 12 import 'package:googleapis/youtubeanalytics/v1.dart' as api; |
13 | 13 |
14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 15 core.Function _callback; |
16 core.bool _expectJson; | 16 core.bool _expectJson; |
17 | 17 |
18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 19 _callback = callback; |
20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
(...skipping 18 matching lines...) Expand all Loading... |
39 } else { | 39 } else { |
40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 41 return _callback(request, data); |
42 }); | 42 }); |
43 } | 43 } |
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<core.String, core.String> headers, core.String bod
y) { |
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 buildCounterGroupContentDetails = 0; | 54 core.int buildCounterGroupContentDetails = 0; |
55 buildGroupContentDetails() { | 55 buildGroupContentDetails() { |
56 var o = new api.GroupContentDetails(); | 56 var o = new api.GroupContentDetails(); |
57 buildCounterGroupContentDetails++; | 57 buildCounterGroupContentDetails++; |
58 if (buildCounterGroupContentDetails < 3) { | 58 if (buildCounterGroupContentDetails < 3) { |
59 o.itemCount = "foo"; | 59 o.itemCount = "foo"; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (buildCounterGroupItem < 3) { | 161 if (buildCounterGroupItem < 3) { |
162 unittest.expect(o.etag, unittest.equals('foo')); | 162 unittest.expect(o.etag, unittest.equals('foo')); |
163 unittest.expect(o.groupId, unittest.equals('foo')); | 163 unittest.expect(o.groupId, unittest.equals('foo')); |
164 unittest.expect(o.id, unittest.equals('foo')); | 164 unittest.expect(o.id, unittest.equals('foo')); |
165 unittest.expect(o.kind, unittest.equals('foo')); | 165 unittest.expect(o.kind, unittest.equals('foo')); |
166 checkGroupItemResource(o.resource); | 166 checkGroupItemResource(o.resource); |
167 } | 167 } |
168 buildCounterGroupItem--; | 168 buildCounterGroupItem--; |
169 } | 169 } |
170 | 170 |
171 buildUnnamed214() { | 171 buildUnnamed216() { |
172 var o = new core.List<api.GroupItem>(); | 172 var o = new core.List<api.GroupItem>(); |
173 o.add(buildGroupItem()); | 173 o.add(buildGroupItem()); |
174 o.add(buildGroupItem()); | 174 o.add(buildGroupItem()); |
175 return o; | 175 return o; |
176 } | 176 } |
177 | 177 |
178 checkUnnamed214(core.List<api.GroupItem> o) { | 178 checkUnnamed216(core.List<api.GroupItem> o) { |
179 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
180 checkGroupItem(o[0]); | 180 checkGroupItem(o[0]); |
181 checkGroupItem(o[1]); | 181 checkGroupItem(o[1]); |
182 } | 182 } |
183 | 183 |
184 core.int buildCounterGroupItemListResponse = 0; | 184 core.int buildCounterGroupItemListResponse = 0; |
185 buildGroupItemListResponse() { | 185 buildGroupItemListResponse() { |
186 var o = new api.GroupItemListResponse(); | 186 var o = new api.GroupItemListResponse(); |
187 buildCounterGroupItemListResponse++; | 187 buildCounterGroupItemListResponse++; |
188 if (buildCounterGroupItemListResponse < 3) { | 188 if (buildCounterGroupItemListResponse < 3) { |
189 o.etag = "foo"; | 189 o.etag = "foo"; |
190 o.items = buildUnnamed214(); | 190 o.items = buildUnnamed216(); |
191 o.kind = "foo"; | 191 o.kind = "foo"; |
192 } | 192 } |
193 buildCounterGroupItemListResponse--; | 193 buildCounterGroupItemListResponse--; |
194 return o; | 194 return o; |
195 } | 195 } |
196 | 196 |
197 checkGroupItemListResponse(api.GroupItemListResponse o) { | 197 checkGroupItemListResponse(api.GroupItemListResponse o) { |
198 buildCounterGroupItemListResponse++; | 198 buildCounterGroupItemListResponse++; |
199 if (buildCounterGroupItemListResponse < 3) { | 199 if (buildCounterGroupItemListResponse < 3) { |
200 unittest.expect(o.etag, unittest.equals('foo')); | 200 unittest.expect(o.etag, unittest.equals('foo')); |
201 checkUnnamed214(o.items); | 201 checkUnnamed216(o.items); |
202 unittest.expect(o.kind, unittest.equals('foo')); | 202 unittest.expect(o.kind, unittest.equals('foo')); |
203 } | 203 } |
204 buildCounterGroupItemListResponse--; | 204 buildCounterGroupItemListResponse--; |
205 } | 205 } |
206 | 206 |
207 buildUnnamed215() { | 207 buildUnnamed217() { |
208 var o = new core.List<api.Group>(); | 208 var o = new core.List<api.Group>(); |
209 o.add(buildGroup()); | 209 o.add(buildGroup()); |
210 o.add(buildGroup()); | 210 o.add(buildGroup()); |
211 return o; | 211 return o; |
212 } | 212 } |
213 | 213 |
214 checkUnnamed215(core.List<api.Group> o) { | 214 checkUnnamed217(core.List<api.Group> o) { |
215 unittest.expect(o, unittest.hasLength(2)); | 215 unittest.expect(o, unittest.hasLength(2)); |
216 checkGroup(o[0]); | 216 checkGroup(o[0]); |
217 checkGroup(o[1]); | 217 checkGroup(o[1]); |
218 } | 218 } |
219 | 219 |
220 core.int buildCounterGroupListResponse = 0; | 220 core.int buildCounterGroupListResponse = 0; |
221 buildGroupListResponse() { | 221 buildGroupListResponse() { |
222 var o = new api.GroupListResponse(); | 222 var o = new api.GroupListResponse(); |
223 buildCounterGroupListResponse++; | 223 buildCounterGroupListResponse++; |
224 if (buildCounterGroupListResponse < 3) { | 224 if (buildCounterGroupListResponse < 3) { |
225 o.etag = "foo"; | 225 o.etag = "foo"; |
226 o.items = buildUnnamed215(); | 226 o.items = buildUnnamed217(); |
227 o.kind = "foo"; | 227 o.kind = "foo"; |
228 o.nextPageToken = "foo"; | 228 o.nextPageToken = "foo"; |
229 } | 229 } |
230 buildCounterGroupListResponse--; | 230 buildCounterGroupListResponse--; |
231 return o; | 231 return o; |
232 } | 232 } |
233 | 233 |
234 checkGroupListResponse(api.GroupListResponse o) { | 234 checkGroupListResponse(api.GroupListResponse o) { |
235 buildCounterGroupListResponse++; | 235 buildCounterGroupListResponse++; |
236 if (buildCounterGroupListResponse < 3) { | 236 if (buildCounterGroupListResponse < 3) { |
237 unittest.expect(o.etag, unittest.equals('foo')); | 237 unittest.expect(o.etag, unittest.equals('foo')); |
238 checkUnnamed215(o.items); | 238 checkUnnamed217(o.items); |
239 unittest.expect(o.kind, unittest.equals('foo')); | 239 unittest.expect(o.kind, unittest.equals('foo')); |
240 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 240 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
241 } | 241 } |
242 buildCounterGroupListResponse--; | 242 buildCounterGroupListResponse--; |
243 } | 243 } |
244 | 244 |
245 core.int buildCounterResultTableColumnHeaders = 0; | 245 core.int buildCounterResultTableColumnHeaders = 0; |
246 buildResultTableColumnHeaders() { | 246 buildResultTableColumnHeaders() { |
247 var o = new api.ResultTableColumnHeaders(); | 247 var o = new api.ResultTableColumnHeaders(); |
248 buildCounterResultTableColumnHeaders++; | 248 buildCounterResultTableColumnHeaders++; |
249 if (buildCounterResultTableColumnHeaders < 3) { | 249 if (buildCounterResultTableColumnHeaders < 3) { |
250 o.columnType = "foo"; | 250 o.columnType = "foo"; |
251 o.dataType = "foo"; | 251 o.dataType = "foo"; |
252 o.name = "foo"; | 252 o.name = "foo"; |
253 } | 253 } |
254 buildCounterResultTableColumnHeaders--; | 254 buildCounterResultTableColumnHeaders--; |
255 return o; | 255 return o; |
256 } | 256 } |
257 | 257 |
258 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { | 258 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { |
259 buildCounterResultTableColumnHeaders++; | 259 buildCounterResultTableColumnHeaders++; |
260 if (buildCounterResultTableColumnHeaders < 3) { | 260 if (buildCounterResultTableColumnHeaders < 3) { |
261 unittest.expect(o.columnType, unittest.equals('foo')); | 261 unittest.expect(o.columnType, unittest.equals('foo')); |
262 unittest.expect(o.dataType, unittest.equals('foo')); | 262 unittest.expect(o.dataType, unittest.equals('foo')); |
263 unittest.expect(o.name, unittest.equals('foo')); | 263 unittest.expect(o.name, unittest.equals('foo')); |
264 } | 264 } |
265 buildCounterResultTableColumnHeaders--; | 265 buildCounterResultTableColumnHeaders--; |
266 } | 266 } |
267 | 267 |
268 buildUnnamed216() { | 268 buildUnnamed218() { |
269 var o = new core.List<api.ResultTableColumnHeaders>(); | 269 var o = new core.List<api.ResultTableColumnHeaders>(); |
270 o.add(buildResultTableColumnHeaders()); | 270 o.add(buildResultTableColumnHeaders()); |
271 o.add(buildResultTableColumnHeaders()); | 271 o.add(buildResultTableColumnHeaders()); |
272 return o; | 272 return o; |
273 } | 273 } |
274 | 274 |
275 checkUnnamed216(core.List<api.ResultTableColumnHeaders> o) { | 275 checkUnnamed218(core.List<api.ResultTableColumnHeaders> o) { |
276 unittest.expect(o, unittest.hasLength(2)); | 276 unittest.expect(o, unittest.hasLength(2)); |
277 checkResultTableColumnHeaders(o[0]); | 277 checkResultTableColumnHeaders(o[0]); |
278 checkResultTableColumnHeaders(o[1]); | 278 checkResultTableColumnHeaders(o[1]); |
279 } | 279 } |
280 | 280 |
281 buildUnnamed217() { | 281 buildUnnamed219() { |
282 var o = new core.List<core.Object>(); | 282 var o = new core.List<core.Object>(); |
283 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 283 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
284 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 284 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
285 return o; | 285 return o; |
286 } | 286 } |
287 | 287 |
288 checkUnnamed217(core.List<core.Object> o) { | 288 checkUnnamed219(core.List<core.Object> o) { |
289 unittest.expect(o, unittest.hasLength(2)); | 289 unittest.expect(o, unittest.hasLength(2)); |
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')); | 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')); |
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')); | 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')); |
292 } | 292 } |
293 | 293 |
294 buildUnnamed218() { | 294 buildUnnamed220() { |
295 var o = new core.List<core.List<core.Object>>(); | 295 var o = new core.List<core.List<core.Object>>(); |
296 o.add(buildUnnamed217()); | 296 o.add(buildUnnamed219()); |
297 o.add(buildUnnamed217()); | 297 o.add(buildUnnamed219()); |
298 return o; | 298 return o; |
299 } | 299 } |
300 | 300 |
301 checkUnnamed218(core.List<core.List<core.Object>> o) { | 301 checkUnnamed220(core.List<core.List<core.Object>> o) { |
302 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
303 checkUnnamed217(o[0]); | 303 checkUnnamed219(o[0]); |
304 checkUnnamed217(o[1]); | 304 checkUnnamed219(o[1]); |
305 } | 305 } |
306 | 306 |
307 core.int buildCounterResultTable = 0; | 307 core.int buildCounterResultTable = 0; |
308 buildResultTable() { | 308 buildResultTable() { |
309 var o = new api.ResultTable(); | 309 var o = new api.ResultTable(); |
310 buildCounterResultTable++; | 310 buildCounterResultTable++; |
311 if (buildCounterResultTable < 3) { | 311 if (buildCounterResultTable < 3) { |
312 o.columnHeaders = buildUnnamed216(); | 312 o.columnHeaders = buildUnnamed218(); |
313 o.kind = "foo"; | 313 o.kind = "foo"; |
314 o.rows = buildUnnamed218(); | 314 o.rows = buildUnnamed220(); |
315 } | 315 } |
316 buildCounterResultTable--; | 316 buildCounterResultTable--; |
317 return o; | 317 return o; |
318 } | 318 } |
319 | 319 |
320 checkResultTable(api.ResultTable o) { | 320 checkResultTable(api.ResultTable o) { |
321 buildCounterResultTable++; | 321 buildCounterResultTable++; |
322 if (buildCounterResultTable < 3) { | 322 if (buildCounterResultTable < 3) { |
323 checkUnnamed216(o.columnHeaders); | 323 checkUnnamed218(o.columnHeaders); |
324 unittest.expect(o.kind, unittest.equals('foo')); | 324 unittest.expect(o.kind, unittest.equals('foo')); |
325 checkUnnamed218(o.rows); | 325 checkUnnamed220(o.rows); |
326 } | 326 } |
327 buildCounterResultTable--; | 327 buildCounterResultTable--; |
328 } | 328 } |
329 | 329 |
330 | 330 |
331 main() { | 331 main() { |
332 unittest.group("obj-schema-GroupContentDetails", () { | 332 unittest.group("obj-schema-GroupContentDetails", () { |
333 unittest.test("to-json--from-json", () { | 333 unittest.test("to-json--from-json", () { |
334 var o = buildGroupContentDetails(); | 334 var o = buildGroupContentDetails(); |
335 var od = new api.GroupContentDetails.fromJson(o.toJson()); | 335 var od = new api.GroupContentDetails.fromJson(o.toJson()); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 }); | 410 }); |
411 | 411 |
412 | 412 |
413 unittest.group("resource-GroupItemsResourceApi", () { | 413 unittest.group("resource-GroupItemsResourceApi", () { |
414 unittest.test("method--delete", () { | 414 unittest.test("method--delete", () { |
415 | 415 |
416 var mock = new HttpServerMock(); | 416 var mock = new HttpServerMock(); |
417 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; | 417 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; |
418 var arg_id = "foo"; | 418 var arg_id = "foo"; |
419 var arg_onBehalfOfContentOwner = "foo"; | 419 var arg_onBehalfOfContentOwner = "foo"; |
420 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 420 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
421 var path = (req.url).path; | 421 var path = (req.url).path; |
422 var pathOffset = 0; | 422 var pathOffset = 0; |
423 var index; | 423 var index; |
424 var subPart; | 424 var subPart; |
425 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 425 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
426 pathOffset += 1; | 426 pathOffset += 1; |
427 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 427 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
428 pathOffset += 21; | 428 pathOffset += 21; |
429 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("groupItems")); | 429 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("groupItems")); |
430 pathOffset += 10; | 430 pathOffset += 10; |
(...skipping 17 matching lines...) Expand all Loading... |
448 unittest.expect(queryMap["id"].first, unittest.equals(arg_id)); | 448 unittest.expect(queryMap["id"].first, unittest.equals(arg_id)); |
449 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 449 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
450 | 450 |
451 | 451 |
452 var h = { | 452 var h = { |
453 "content-type" : "application/json; charset=utf-8", | 453 "content-type" : "application/json; charset=utf-8", |
454 }; | 454 }; |
455 var resp = ""; | 455 var resp = ""; |
456 return new async.Future.value(stringResponse(200, h, resp)); | 456 return new async.Future.value(stringResponse(200, h, resp)); |
457 }), true); | 457 }), true); |
458 res.delete(arg_id, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the
n(unittest.expectAsync((_) {})); | 458 res.delete(arg_id, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the
n(unittest.expectAsync1((_) {})); |
459 }); | 459 }); |
460 | 460 |
461 unittest.test("method--insert", () { | 461 unittest.test("method--insert", () { |
462 | 462 |
463 var mock = new HttpServerMock(); | 463 var mock = new HttpServerMock(); |
464 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; | 464 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; |
465 var arg_request = buildGroupItem(); | 465 var arg_request = buildGroupItem(); |
466 var arg_onBehalfOfContentOwner = "foo"; | 466 var arg_onBehalfOfContentOwner = "foo"; |
467 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 467 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
468 var obj = new api.GroupItem.fromJson(json); | 468 var obj = new api.GroupItem.fromJson(json); |
469 checkGroupItem(obj); | 469 checkGroupItem(obj); |
470 | 470 |
471 var path = (req.url).path; | 471 var path = (req.url).path; |
472 var pathOffset = 0; | 472 var pathOffset = 0; |
473 var index; | 473 var index; |
474 var subPart; | 474 var subPart; |
475 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 475 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
476 pathOffset += 1; | 476 pathOffset += 1; |
477 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 477 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
(...skipping 19 matching lines...) Expand all Loading... |
497 } | 497 } |
498 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 498 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
499 | 499 |
500 | 500 |
501 var h = { | 501 var h = { |
502 "content-type" : "application/json; charset=utf-8", | 502 "content-type" : "application/json; charset=utf-8", |
503 }; | 503 }; |
504 var resp = convert.JSON.encode(buildGroupItem()); | 504 var resp = convert.JSON.encode(buildGroupItem()); |
505 return new async.Future.value(stringResponse(200, h, resp)); | 505 return new async.Future.value(stringResponse(200, h, resp)); |
506 }), true); | 506 }), true); |
507 res.insert(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync(((api.GroupItem response) { | 507 res.insert(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync1(((api.GroupItem response) { |
508 checkGroupItem(response); | 508 checkGroupItem(response); |
509 }))); | 509 }))); |
510 }); | 510 }); |
511 | 511 |
512 unittest.test("method--list", () { | 512 unittest.test("method--list", () { |
513 | 513 |
514 var mock = new HttpServerMock(); | 514 var mock = new HttpServerMock(); |
515 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; | 515 api.GroupItemsResourceApi res = new api.YoutubeAnalyticsApi(mock).groupIte
ms; |
516 var arg_groupId = "foo"; | 516 var arg_groupId = "foo"; |
517 var arg_onBehalfOfContentOwner = "foo"; | 517 var arg_onBehalfOfContentOwner = "foo"; |
518 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 518 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
519 var path = (req.url).path; | 519 var path = (req.url).path; |
520 var pathOffset = 0; | 520 var pathOffset = 0; |
521 var index; | 521 var index; |
522 var subPart; | 522 var subPart; |
523 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 523 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
524 pathOffset += 1; | 524 pathOffset += 1; |
525 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 525 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
526 pathOffset += 21; | 526 pathOffset += 21; |
527 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("groupItems")); | 527 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("groupItems")); |
528 pathOffset += 10; | 528 pathOffset += 10; |
(...skipping 17 matching lines...) Expand all Loading... |
546 unittest.expect(queryMap["groupId"].first, unittest.equals(arg_groupId))
; | 546 unittest.expect(queryMap["groupId"].first, unittest.equals(arg_groupId))
; |
547 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 547 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
548 | 548 |
549 | 549 |
550 var h = { | 550 var h = { |
551 "content-type" : "application/json; charset=utf-8", | 551 "content-type" : "application/json; charset=utf-8", |
552 }; | 552 }; |
553 var resp = convert.JSON.encode(buildGroupItemListResponse()); | 553 var resp = convert.JSON.encode(buildGroupItemListResponse()); |
554 return new async.Future.value(stringResponse(200, h, resp)); | 554 return new async.Future.value(stringResponse(200, h, resp)); |
555 }), true); | 555 }), true); |
556 res.list(arg_groupId, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).
then(unittest.expectAsync(((api.GroupItemListResponse response) { | 556 res.list(arg_groupId, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).
then(unittest.expectAsync1(((api.GroupItemListResponse response) { |
557 checkGroupItemListResponse(response); | 557 checkGroupItemListResponse(response); |
558 }))); | 558 }))); |
559 }); | 559 }); |
560 | 560 |
561 }); | 561 }); |
562 | 562 |
563 | 563 |
564 unittest.group("resource-GroupsResourceApi", () { | 564 unittest.group("resource-GroupsResourceApi", () { |
565 unittest.test("method--delete", () { | 565 unittest.test("method--delete", () { |
566 | 566 |
567 var mock = new HttpServerMock(); | 567 var mock = new HttpServerMock(); |
568 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; | 568 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; |
569 var arg_id = "foo"; | 569 var arg_id = "foo"; |
570 var arg_onBehalfOfContentOwner = "foo"; | 570 var arg_onBehalfOfContentOwner = "foo"; |
571 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 571 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
572 var path = (req.url).path; | 572 var path = (req.url).path; |
573 var pathOffset = 0; | 573 var pathOffset = 0; |
574 var index; | 574 var index; |
575 var subPart; | 575 var subPart; |
576 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 576 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
577 pathOffset += 1; | 577 pathOffset += 1; |
578 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 578 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
579 pathOffset += 21; | 579 pathOffset += 21; |
580 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("groups")); | 580 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("groups")); |
581 pathOffset += 6; | 581 pathOffset += 6; |
(...skipping 17 matching lines...) Expand all Loading... |
599 unittest.expect(queryMap["id"].first, unittest.equals(arg_id)); | 599 unittest.expect(queryMap["id"].first, unittest.equals(arg_id)); |
600 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 600 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
601 | 601 |
602 | 602 |
603 var h = { | 603 var h = { |
604 "content-type" : "application/json; charset=utf-8", | 604 "content-type" : "application/json; charset=utf-8", |
605 }; | 605 }; |
606 var resp = ""; | 606 var resp = ""; |
607 return new async.Future.value(stringResponse(200, h, resp)); | 607 return new async.Future.value(stringResponse(200, h, resp)); |
608 }), true); | 608 }), true); |
609 res.delete(arg_id, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the
n(unittest.expectAsync((_) {})); | 609 res.delete(arg_id, onBehalfOfContentOwner: arg_onBehalfOfContentOwner).the
n(unittest.expectAsync1((_) {})); |
610 }); | 610 }); |
611 | 611 |
612 unittest.test("method--insert", () { | 612 unittest.test("method--insert", () { |
613 | 613 |
614 var mock = new HttpServerMock(); | 614 var mock = new HttpServerMock(); |
615 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; | 615 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; |
616 var arg_request = buildGroup(); | 616 var arg_request = buildGroup(); |
617 var arg_onBehalfOfContentOwner = "foo"; | 617 var arg_onBehalfOfContentOwner = "foo"; |
618 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 618 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
619 var obj = new api.Group.fromJson(json); | 619 var obj = new api.Group.fromJson(json); |
620 checkGroup(obj); | 620 checkGroup(obj); |
621 | 621 |
622 var path = (req.url).path; | 622 var path = (req.url).path; |
623 var pathOffset = 0; | 623 var pathOffset = 0; |
624 var index; | 624 var index; |
625 var subPart; | 625 var subPart; |
626 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 626 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
627 pathOffset += 1; | 627 pathOffset += 1; |
628 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 628 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
(...skipping 19 matching lines...) Expand all Loading... |
648 } | 648 } |
649 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 649 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
650 | 650 |
651 | 651 |
652 var h = { | 652 var h = { |
653 "content-type" : "application/json; charset=utf-8", | 653 "content-type" : "application/json; charset=utf-8", |
654 }; | 654 }; |
655 var resp = convert.JSON.encode(buildGroup()); | 655 var resp = convert.JSON.encode(buildGroup()); |
656 return new async.Future.value(stringResponse(200, h, resp)); | 656 return new async.Future.value(stringResponse(200, h, resp)); |
657 }), true); | 657 }), true); |
658 res.insert(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync(((api.Group response) { | 658 res.insert(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync1(((api.Group response) { |
659 checkGroup(response); | 659 checkGroup(response); |
660 }))); | 660 }))); |
661 }); | 661 }); |
662 | 662 |
663 unittest.test("method--list", () { | 663 unittest.test("method--list", () { |
664 | 664 |
665 var mock = new HttpServerMock(); | 665 var mock = new HttpServerMock(); |
666 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; | 666 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; |
667 var arg_id = "foo"; | 667 var arg_id = "foo"; |
668 var arg_mine = true; | 668 var arg_mine = true; |
669 var arg_onBehalfOfContentOwner = "foo"; | 669 var arg_onBehalfOfContentOwner = "foo"; |
670 var arg_pageToken = "foo"; | 670 var arg_pageToken = "foo"; |
671 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 671 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
672 var path = (req.url).path; | 672 var path = (req.url).path; |
673 var pathOffset = 0; | 673 var pathOffset = 0; |
674 var index; | 674 var index; |
675 var subPart; | 675 var subPart; |
676 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 676 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
677 pathOffset += 1; | 677 pathOffset += 1; |
678 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 678 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
679 pathOffset += 21; | 679 pathOffset += 21; |
680 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("groups")); | 680 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("groups")); |
681 pathOffset += 6; | 681 pathOffset += 6; |
(...skipping 19 matching lines...) Expand all Loading... |
701 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 701 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
702 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 702 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
703 | 703 |
704 | 704 |
705 var h = { | 705 var h = { |
706 "content-type" : "application/json; charset=utf-8", | 706 "content-type" : "application/json; charset=utf-8", |
707 }; | 707 }; |
708 var resp = convert.JSON.encode(buildGroupListResponse()); | 708 var resp = convert.JSON.encode(buildGroupListResponse()); |
709 return new async.Future.value(stringResponse(200, h, resp)); | 709 return new async.Future.value(stringResponse(200, h, resp)); |
710 }), true); | 710 }), true); |
711 res.list(id: arg_id, mine: arg_mine, onBehalfOfContentOwner: arg_onBehalfO
fContentOwner, pageToken: arg_pageToken).then(unittest.expectAsync(((api.GroupLi
stResponse response) { | 711 res.list(id: arg_id, mine: arg_mine, onBehalfOfContentOwner: arg_onBehalfO
fContentOwner, pageToken: arg_pageToken).then(unittest.expectAsync1(((api.GroupL
istResponse response) { |
712 checkGroupListResponse(response); | 712 checkGroupListResponse(response); |
713 }))); | 713 }))); |
714 }); | 714 }); |
715 | 715 |
716 unittest.test("method--update", () { | 716 unittest.test("method--update", () { |
717 | 717 |
718 var mock = new HttpServerMock(); | 718 var mock = new HttpServerMock(); |
719 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; | 719 api.GroupsResourceApi res = new api.YoutubeAnalyticsApi(mock).groups; |
720 var arg_request = buildGroup(); | 720 var arg_request = buildGroup(); |
721 var arg_onBehalfOfContentOwner = "foo"; | 721 var arg_onBehalfOfContentOwner = "foo"; |
722 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 722 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
723 var obj = new api.Group.fromJson(json); | 723 var obj = new api.Group.fromJson(json); |
724 checkGroup(obj); | 724 checkGroup(obj); |
725 | 725 |
726 var path = (req.url).path; | 726 var path = (req.url).path; |
727 var pathOffset = 0; | 727 var pathOffset = 0; |
728 var index; | 728 var index; |
729 var subPart; | 729 var subPart; |
730 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 730 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
731 pathOffset += 1; | 731 pathOffset += 1; |
732 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 732 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
(...skipping 19 matching lines...) Expand all Loading... |
752 } | 752 } |
753 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); | 753 unittest.expect(queryMap["onBehalfOfContentOwner"].first, unittest.equal
s(arg_onBehalfOfContentOwner)); |
754 | 754 |
755 | 755 |
756 var h = { | 756 var h = { |
757 "content-type" : "application/json; charset=utf-8", | 757 "content-type" : "application/json; charset=utf-8", |
758 }; | 758 }; |
759 var resp = convert.JSON.encode(buildGroup()); | 759 var resp = convert.JSON.encode(buildGroup()); |
760 return new async.Future.value(stringResponse(200, h, resp)); | 760 return new async.Future.value(stringResponse(200, h, resp)); |
761 }), true); | 761 }), true); |
762 res.update(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync(((api.Group response) { | 762 res.update(arg_request, onBehalfOfContentOwner: arg_onBehalfOfContentOwner
).then(unittest.expectAsync1(((api.Group response) { |
763 checkGroup(response); | 763 checkGroup(response); |
764 }))); | 764 }))); |
765 }); | 765 }); |
766 | 766 |
767 }); | 767 }); |
768 | 768 |
769 | 769 |
770 unittest.group("resource-ReportsResourceApi", () { | 770 unittest.group("resource-ReportsResourceApi", () { |
771 unittest.test("method--query", () { | 771 unittest.test("method--query", () { |
772 | 772 |
773 var mock = new HttpServerMock(); | 773 var mock = new HttpServerMock(); |
774 api.ReportsResourceApi res = new api.YoutubeAnalyticsApi(mock).reports; | 774 api.ReportsResourceApi res = new api.YoutubeAnalyticsApi(mock).reports; |
775 var arg_ids = "foo"; | 775 var arg_ids = "foo"; |
776 var arg_start_date = "foo"; | 776 var arg_start_date = "foo"; |
777 var arg_end_date = "foo"; | 777 var arg_end_date = "foo"; |
778 var arg_metrics = "foo"; | 778 var arg_metrics = "foo"; |
779 var arg_currency = "foo"; | 779 var arg_currency = "foo"; |
780 var arg_dimensions = "foo"; | 780 var arg_dimensions = "foo"; |
781 var arg_filters = "foo"; | 781 var arg_filters = "foo"; |
782 var arg_include_historical_channel_data = true; | 782 var arg_include_historical_channel_data = true; |
783 var arg_max_results = 42; | 783 var arg_max_results = 42; |
784 var arg_sort = "foo"; | 784 var arg_sort = "foo"; |
785 var arg_start_index = 42; | 785 var arg_start_index = 42; |
786 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 786 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
787 var path = (req.url).path; | 787 var path = (req.url).path; |
788 var pathOffset = 0; | 788 var pathOffset = 0; |
789 var index; | 789 var index; |
790 var subPart; | 790 var subPart; |
791 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 791 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
792 pathOffset += 1; | 792 pathOffset += 1; |
793 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); | 793 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("youtube/analytics/v1/")); |
794 pathOffset += 21; | 794 pathOffset += 21; |
795 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("reports")); | 795 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("reports")); |
796 pathOffset += 7; | 796 pathOffset += 7; |
(...skipping 26 matching lines...) Expand all Loading... |
823 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); | 823 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); |
824 unittest.expect(core.int.parse(queryMap["start-index"].first), unittest.
equals(arg_start_index)); | 824 unittest.expect(core.int.parse(queryMap["start-index"].first), unittest.
equals(arg_start_index)); |
825 | 825 |
826 | 826 |
827 var h = { | 827 var h = { |
828 "content-type" : "application/json; charset=utf-8", | 828 "content-type" : "application/json; charset=utf-8", |
829 }; | 829 }; |
830 var resp = convert.JSON.encode(buildResultTable()); | 830 var resp = convert.JSON.encode(buildResultTable()); |
831 return new async.Future.value(stringResponse(200, h, resp)); | 831 return new async.Future.value(stringResponse(200, h, resp)); |
832 }), true); | 832 }), true); |
833 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, include_historical
_channel_data: arg_include_historical_channel_data, max_results: arg_max_results
, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAsync(((api.
ResultTable response) { | 833 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, include_historical
_channel_data: arg_include_historical_channel_data, max_results: arg_max_results
, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAsync1(((api
.ResultTable response) { |
834 checkResultTable(response); | 834 checkResultTable(response); |
835 }))); | 835 }))); |
836 }); | 836 }); |
837 | 837 |
838 }); | 838 }); |
839 | 839 |
840 | 840 |
841 } | 841 } |
842 | 842 |
OLD | NEW |