OLD | NEW |
1 library googleapis.cloudtrace.v1.test; | 1 library googleapis.cloudtrace.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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 }); | 377 }); |
378 | 378 |
379 unittest.test("method--list", () { | 379 unittest.test("method--list", () { |
380 | 380 |
381 var mock = new HttpServerMock(); | 381 var mock = new HttpServerMock(); |
382 api.ProjectsTracesResourceApi res = new api.CloudtraceApi(mock).projects.t
races; | 382 api.ProjectsTracesResourceApi res = new api.CloudtraceApi(mock).projects.t
races; |
383 var arg_projectId = "foo"; | 383 var arg_projectId = "foo"; |
384 var arg_orderBy = "foo"; | 384 var arg_orderBy = "foo"; |
385 var arg_filter = "foo"; | 385 var arg_filter = "foo"; |
386 var arg_endTime = "foo"; | 386 var arg_endTime = "foo"; |
| 387 var arg_pageToken = "foo"; |
387 var arg_startTime = "foo"; | 388 var arg_startTime = "foo"; |
388 var arg_pageToken = "foo"; | |
389 var arg_pageSize = 42; | 389 var arg_pageSize = 42; |
390 var arg_view = "foo"; | 390 var arg_view = "foo"; |
391 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 391 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
392 var path = (req.url).path; | 392 var path = (req.url).path; |
393 var pathOffset = 0; | 393 var pathOffset = 0; |
394 var index; | 394 var index; |
395 var subPart; | 395 var subPart; |
396 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 396 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
397 pathOffset += 1; | 397 pathOffset += 1; |
398 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); | 398 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
(...skipping 18 matching lines...) Expand all Loading... |
417 } | 417 } |
418 if (query.length > 0) { | 418 if (query.length > 0) { |
419 for (var part in query.split("&")) { | 419 for (var part in query.split("&")) { |
420 var keyvalue = part.split("="); | 420 var keyvalue = part.split("="); |
421 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 421 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
422 } | 422 } |
423 } | 423 } |
424 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; | 424 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; |
425 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 425 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
426 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; | 426 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; |
| 427 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
427 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); | 428 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); |
428 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
429 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 429 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
430 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); | 430 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
431 | 431 |
432 | 432 |
433 var h = { | 433 var h = { |
434 "content-type" : "application/json; charset=utf-8", | 434 "content-type" : "application/json; charset=utf-8", |
435 }; | 435 }; |
436 var resp = convert.JSON.encode(buildListTracesResponse()); | 436 var resp = convert.JSON.encode(buildListTracesResponse()); |
437 return new async.Future.value(stringResponse(200, h, resp)); | 437 return new async.Future.value(stringResponse(200, h, resp)); |
438 }), true); | 438 }), true); |
439 res.list(arg_projectId, orderBy: arg_orderBy, filter: arg_filter, endTime:
arg_endTime, startTime: arg_startTime, pageToken: arg_pageToken, pageSize: arg_
pageSize, view: arg_view).then(unittest.expectAsync(((api.ListTracesResponse res
ponse) { | 439 res.list(arg_projectId, orderBy: arg_orderBy, filter: arg_filter, endTime:
arg_endTime, pageToken: arg_pageToken, startTime: arg_startTime, pageSize: arg_
pageSize, view: arg_view).then(unittest.expectAsync(((api.ListTracesResponse res
ponse) { |
440 checkListTracesResponse(response); | 440 checkListTracesResponse(response); |
441 }))); | 441 }))); |
442 }); | 442 }); |
443 | 443 |
444 }); | 444 }); |
445 | 445 |
446 | 446 |
447 } | 447 } |
448 | 448 |
OLD | NEW |