| OLD | NEW |
| 1 library googleapis.gamesConfiguration.v1configuration.test; | 1 library googleapis.gamesConfiguration.v1configuration.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | |
| 5 import "dart:async" as async; | 4 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
| 7 | 6 |
| 8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | |
| 10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
| 11 | 9 |
| 12 import 'package:googleapis/gamesconfiguration/v1configuration.dart' as api; | 10 import 'package:googleapis/gamesconfiguration/v1configuration.dart' as api; |
| 13 | 11 |
| 14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 13 core.Function _callback; |
| 16 core.bool _expectJson; | 14 core.bool _expectJson; |
| 17 | 15 |
| 18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 17 _callback = callback; |
| 20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
| 21 } | 19 } |
| 22 | 20 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { | 22 if (_expectJson) { |
| 25 return request.finalize() | 23 return request |
| 24 .finalize() |
| 26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
| 27 .join('') | 26 .join('') |
| 28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); | 29 return _callback(request, null); |
| 31 } else { | 30 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } | 32 } |
| 34 }); | 33 }); |
| 35 } else { | 34 } else { |
| 36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
| 37 if (stream == null) { | 36 if (stream == null) { |
| 38 return _callback(request, []); | 37 return _callback(request, []); |
| 39 } else { | 38 } else { |
| 40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 40 return _callback(request, data); |
| 42 }); | 41 }); |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
| 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 51 } |
| 53 | 52 |
| 54 core.int buildCounterAchievementConfiguration = 0; | 53 core.int buildCounterAchievementConfiguration = 0; |
| 55 buildAchievementConfiguration() { | 54 buildAchievementConfiguration() { |
| 56 var o = new api.AchievementConfiguration(); | 55 var o = new api.AchievementConfiguration(); |
| 57 buildCounterAchievementConfiguration++; | 56 buildCounterAchievementConfiguration++; |
| 58 if (buildCounterAchievementConfiguration < 3) { | 57 if (buildCounterAchievementConfiguration < 3) { |
| 59 o.achievementType = "foo"; | 58 o.achievementType = "foo"; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 buildCounterAchievementConfigurationListResponse++; | 131 buildCounterAchievementConfigurationListResponse++; |
| 133 if (buildCounterAchievementConfigurationListResponse < 3) { | 132 if (buildCounterAchievementConfigurationListResponse < 3) { |
| 134 o.items = buildUnnamed755(); | 133 o.items = buildUnnamed755(); |
| 135 o.kind = "foo"; | 134 o.kind = "foo"; |
| 136 o.nextPageToken = "foo"; | 135 o.nextPageToken = "foo"; |
| 137 } | 136 } |
| 138 buildCounterAchievementConfigurationListResponse--; | 137 buildCounterAchievementConfigurationListResponse--; |
| 139 return o; | 138 return o; |
| 140 } | 139 } |
| 141 | 140 |
| 142 checkAchievementConfigurationListResponse(api.AchievementConfigurationListRespon
se o) { | 141 checkAchievementConfigurationListResponse( |
| 142 api.AchievementConfigurationListResponse o) { |
| 143 buildCounterAchievementConfigurationListResponse++; | 143 buildCounterAchievementConfigurationListResponse++; |
| 144 if (buildCounterAchievementConfigurationListResponse < 3) { | 144 if (buildCounterAchievementConfigurationListResponse < 3) { |
| 145 checkUnnamed755(o.items); | 145 checkUnnamed755(o.items); |
| 146 unittest.expect(o.kind, unittest.equals('foo')); | 146 unittest.expect(o.kind, unittest.equals('foo')); |
| 147 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 147 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 148 } | 148 } |
| 149 buildCounterAchievementConfigurationListResponse--; | 149 buildCounterAchievementConfigurationListResponse--; |
| 150 } | 150 } |
| 151 | 151 |
| 152 core.int buildCounterGamesNumberAffixConfiguration = 0; | 152 core.int buildCounterGamesNumberAffixConfiguration = 0; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 buildCounterLeaderboardConfigurationListResponse++; | 307 buildCounterLeaderboardConfigurationListResponse++; |
| 308 if (buildCounterLeaderboardConfigurationListResponse < 3) { | 308 if (buildCounterLeaderboardConfigurationListResponse < 3) { |
| 309 o.items = buildUnnamed756(); | 309 o.items = buildUnnamed756(); |
| 310 o.kind = "foo"; | 310 o.kind = "foo"; |
| 311 o.nextPageToken = "foo"; | 311 o.nextPageToken = "foo"; |
| 312 } | 312 } |
| 313 buildCounterLeaderboardConfigurationListResponse--; | 313 buildCounterLeaderboardConfigurationListResponse--; |
| 314 return o; | 314 return o; |
| 315 } | 315 } |
| 316 | 316 |
| 317 checkLeaderboardConfigurationListResponse(api.LeaderboardConfigurationListRespon
se o) { | 317 checkLeaderboardConfigurationListResponse( |
| 318 api.LeaderboardConfigurationListResponse o) { |
| 318 buildCounterLeaderboardConfigurationListResponse++; | 319 buildCounterLeaderboardConfigurationListResponse++; |
| 319 if (buildCounterLeaderboardConfigurationListResponse < 3) { | 320 if (buildCounterLeaderboardConfigurationListResponse < 3) { |
| 320 checkUnnamed756(o.items); | 321 checkUnnamed756(o.items); |
| 321 unittest.expect(o.kind, unittest.equals('foo')); | 322 unittest.expect(o.kind, unittest.equals('foo')); |
| 322 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 323 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 323 } | 324 } |
| 324 buildCounterLeaderboardConfigurationListResponse--; | 325 buildCounterLeaderboardConfigurationListResponse--; |
| 325 } | 326 } |
| 326 | 327 |
| 327 core.int buildCounterLocalizedString = 0; | 328 core.int buildCounterLocalizedString = 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 375 |
| 375 checkLocalizedStringBundle(api.LocalizedStringBundle o) { | 376 checkLocalizedStringBundle(api.LocalizedStringBundle o) { |
| 376 buildCounterLocalizedStringBundle++; | 377 buildCounterLocalizedStringBundle++; |
| 377 if (buildCounterLocalizedStringBundle < 3) { | 378 if (buildCounterLocalizedStringBundle < 3) { |
| 378 unittest.expect(o.kind, unittest.equals('foo')); | 379 unittest.expect(o.kind, unittest.equals('foo')); |
| 379 checkUnnamed757(o.translations); | 380 checkUnnamed757(o.translations); |
| 380 } | 381 } |
| 381 buildCounterLocalizedStringBundle--; | 382 buildCounterLocalizedStringBundle--; |
| 382 } | 383 } |
| 383 | 384 |
| 384 | |
| 385 main() { | 385 main() { |
| 386 unittest.group("obj-schema-AchievementConfiguration", () { | 386 unittest.group("obj-schema-AchievementConfiguration", () { |
| 387 unittest.test("to-json--from-json", () { | 387 unittest.test("to-json--from-json", () { |
| 388 var o = buildAchievementConfiguration(); | 388 var o = buildAchievementConfiguration(); |
| 389 var od = new api.AchievementConfiguration.fromJson(o.toJson()); | 389 var od = new api.AchievementConfiguration.fromJson(o.toJson()); |
| 390 checkAchievementConfiguration(od); | 390 checkAchievementConfiguration(od); |
| 391 }); | 391 }); |
| 392 }); | 392 }); |
| 393 | 393 |
| 394 | |
| 395 unittest.group("obj-schema-AchievementConfigurationDetail", () { | 394 unittest.group("obj-schema-AchievementConfigurationDetail", () { |
| 396 unittest.test("to-json--from-json", () { | 395 unittest.test("to-json--from-json", () { |
| 397 var o = buildAchievementConfigurationDetail(); | 396 var o = buildAchievementConfigurationDetail(); |
| 398 var od = new api.AchievementConfigurationDetail.fromJson(o.toJson()); | 397 var od = new api.AchievementConfigurationDetail.fromJson(o.toJson()); |
| 399 checkAchievementConfigurationDetail(od); | 398 checkAchievementConfigurationDetail(od); |
| 400 }); | 399 }); |
| 401 }); | 400 }); |
| 402 | 401 |
| 403 | |
| 404 unittest.group("obj-schema-AchievementConfigurationListResponse", () { | 402 unittest.group("obj-schema-AchievementConfigurationListResponse", () { |
| 405 unittest.test("to-json--from-json", () { | 403 unittest.test("to-json--from-json", () { |
| 406 var o = buildAchievementConfigurationListResponse(); | 404 var o = buildAchievementConfigurationListResponse(); |
| 407 var od = new api.AchievementConfigurationListResponse.fromJson(o.toJson())
; | 405 var od = |
| 406 new api.AchievementConfigurationListResponse.fromJson(o.toJson()); |
| 408 checkAchievementConfigurationListResponse(od); | 407 checkAchievementConfigurationListResponse(od); |
| 409 }); | 408 }); |
| 410 }); | 409 }); |
| 411 | 410 |
| 412 | |
| 413 unittest.group("obj-schema-GamesNumberAffixConfiguration", () { | 411 unittest.group("obj-schema-GamesNumberAffixConfiguration", () { |
| 414 unittest.test("to-json--from-json", () { | 412 unittest.test("to-json--from-json", () { |
| 415 var o = buildGamesNumberAffixConfiguration(); | 413 var o = buildGamesNumberAffixConfiguration(); |
| 416 var od = new api.GamesNumberAffixConfiguration.fromJson(o.toJson()); | 414 var od = new api.GamesNumberAffixConfiguration.fromJson(o.toJson()); |
| 417 checkGamesNumberAffixConfiguration(od); | 415 checkGamesNumberAffixConfiguration(od); |
| 418 }); | 416 }); |
| 419 }); | 417 }); |
| 420 | 418 |
| 421 | |
| 422 unittest.group("obj-schema-GamesNumberFormatConfiguration", () { | 419 unittest.group("obj-schema-GamesNumberFormatConfiguration", () { |
| 423 unittest.test("to-json--from-json", () { | 420 unittest.test("to-json--from-json", () { |
| 424 var o = buildGamesNumberFormatConfiguration(); | 421 var o = buildGamesNumberFormatConfiguration(); |
| 425 var od = new api.GamesNumberFormatConfiguration.fromJson(o.toJson()); | 422 var od = new api.GamesNumberFormatConfiguration.fromJson(o.toJson()); |
| 426 checkGamesNumberFormatConfiguration(od); | 423 checkGamesNumberFormatConfiguration(od); |
| 427 }); | 424 }); |
| 428 }); | 425 }); |
| 429 | 426 |
| 430 | |
| 431 unittest.group("obj-schema-ImageConfiguration", () { | 427 unittest.group("obj-schema-ImageConfiguration", () { |
| 432 unittest.test("to-json--from-json", () { | 428 unittest.test("to-json--from-json", () { |
| 433 var o = buildImageConfiguration(); | 429 var o = buildImageConfiguration(); |
| 434 var od = new api.ImageConfiguration.fromJson(o.toJson()); | 430 var od = new api.ImageConfiguration.fromJson(o.toJson()); |
| 435 checkImageConfiguration(od); | 431 checkImageConfiguration(od); |
| 436 }); | 432 }); |
| 437 }); | 433 }); |
| 438 | 434 |
| 439 | |
| 440 unittest.group("obj-schema-LeaderboardConfiguration", () { | 435 unittest.group("obj-schema-LeaderboardConfiguration", () { |
| 441 unittest.test("to-json--from-json", () { | 436 unittest.test("to-json--from-json", () { |
| 442 var o = buildLeaderboardConfiguration(); | 437 var o = buildLeaderboardConfiguration(); |
| 443 var od = new api.LeaderboardConfiguration.fromJson(o.toJson()); | 438 var od = new api.LeaderboardConfiguration.fromJson(o.toJson()); |
| 444 checkLeaderboardConfiguration(od); | 439 checkLeaderboardConfiguration(od); |
| 445 }); | 440 }); |
| 446 }); | 441 }); |
| 447 | 442 |
| 448 | |
| 449 unittest.group("obj-schema-LeaderboardConfigurationDetail", () { | 443 unittest.group("obj-schema-LeaderboardConfigurationDetail", () { |
| 450 unittest.test("to-json--from-json", () { | 444 unittest.test("to-json--from-json", () { |
| 451 var o = buildLeaderboardConfigurationDetail(); | 445 var o = buildLeaderboardConfigurationDetail(); |
| 452 var od = new api.LeaderboardConfigurationDetail.fromJson(o.toJson()); | 446 var od = new api.LeaderboardConfigurationDetail.fromJson(o.toJson()); |
| 453 checkLeaderboardConfigurationDetail(od); | 447 checkLeaderboardConfigurationDetail(od); |
| 454 }); | 448 }); |
| 455 }); | 449 }); |
| 456 | 450 |
| 457 | |
| 458 unittest.group("obj-schema-LeaderboardConfigurationListResponse", () { | 451 unittest.group("obj-schema-LeaderboardConfigurationListResponse", () { |
| 459 unittest.test("to-json--from-json", () { | 452 unittest.test("to-json--from-json", () { |
| 460 var o = buildLeaderboardConfigurationListResponse(); | 453 var o = buildLeaderboardConfigurationListResponse(); |
| 461 var od = new api.LeaderboardConfigurationListResponse.fromJson(o.toJson())
; | 454 var od = |
| 455 new api.LeaderboardConfigurationListResponse.fromJson(o.toJson()); |
| 462 checkLeaderboardConfigurationListResponse(od); | 456 checkLeaderboardConfigurationListResponse(od); |
| 463 }); | 457 }); |
| 464 }); | 458 }); |
| 465 | 459 |
| 466 | |
| 467 unittest.group("obj-schema-LocalizedString", () { | 460 unittest.group("obj-schema-LocalizedString", () { |
| 468 unittest.test("to-json--from-json", () { | 461 unittest.test("to-json--from-json", () { |
| 469 var o = buildLocalizedString(); | 462 var o = buildLocalizedString(); |
| 470 var od = new api.LocalizedString.fromJson(o.toJson()); | 463 var od = new api.LocalizedString.fromJson(o.toJson()); |
| 471 checkLocalizedString(od); | 464 checkLocalizedString(od); |
| 472 }); | 465 }); |
| 473 }); | 466 }); |
| 474 | 467 |
| 475 | |
| 476 unittest.group("obj-schema-LocalizedStringBundle", () { | 468 unittest.group("obj-schema-LocalizedStringBundle", () { |
| 477 unittest.test("to-json--from-json", () { | 469 unittest.test("to-json--from-json", () { |
| 478 var o = buildLocalizedStringBundle(); | 470 var o = buildLocalizedStringBundle(); |
| 479 var od = new api.LocalizedStringBundle.fromJson(o.toJson()); | 471 var od = new api.LocalizedStringBundle.fromJson(o.toJson()); |
| 480 checkLocalizedStringBundle(od); | 472 checkLocalizedStringBundle(od); |
| 481 }); | 473 }); |
| 482 }); | 474 }); |
| 483 | 475 |
| 484 | |
| 485 unittest.group("resource-AchievementConfigurationsResourceApi", () { | 476 unittest.group("resource-AchievementConfigurationsResourceApi", () { |
| 486 unittest.test("method--delete", () { | 477 unittest.test("method--delete", () { |
| 487 | |
| 488 var mock = new HttpServerMock(); | 478 var mock = new HttpServerMock(); |
| 489 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 479 api.AchievementConfigurationsResourceApi res = |
| 480 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 490 var arg_achievementId = "foo"; | 481 var arg_achievementId = "foo"; |
| 491 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 482 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 492 var path = (req.url).path; | 483 var path = (req.url).path; |
| 493 var pathOffset = 0; | 484 var pathOffset = 0; |
| 494 var index; | 485 var index; |
| 495 var subPart; | 486 var subPart; |
| 496 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 487 unittest.expect( |
| 488 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 497 pathOffset += 1; | 489 pathOffset += 1; |
| 498 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 490 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 491 unittest.equals("games/v1configuration/")); |
| 499 pathOffset += 22; | 492 pathOffset += 22; |
| 500 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); | 493 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 494 unittest.equals("achievements/")); |
| 501 pathOffset += 13; | 495 pathOffset += 13; |
| 502 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 496 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 503 pathOffset = path.length; | 497 pathOffset = path.length; |
| 504 unittest.expect(subPart, unittest.equals("$arg_achievementId")); | 498 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 505 | 499 |
| 506 var query = (req.url).query; | 500 var query = (req.url).query; |
| 507 var queryOffset = 0; | 501 var queryOffset = 0; |
| 508 var queryMap = {}; | 502 var queryMap = {}; |
| 509 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 503 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 510 parseBool(n) { | 504 parseBool(n) { |
| 511 if (n == "true") return true; | 505 if (n == "true") return true; |
| 512 if (n == "false") return false; | 506 if (n == "false") return false; |
| 513 if (n == null) return null; | 507 if (n == null) return null; |
| 514 throw new core.ArgumentError("Invalid boolean: $n"); | 508 throw new core.ArgumentError("Invalid boolean: $n"); |
| 515 } | 509 } |
| 510 |
| 516 if (query.length > 0) { | 511 if (query.length > 0) { |
| 517 for (var part in query.split("&")) { | 512 for (var part in query.split("&")) { |
| 518 var keyvalue = part.split("="); | 513 var keyvalue = part.split("="); |
| 519 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 514 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 515 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 520 } | 516 } |
| 521 } | 517 } |
| 522 | 518 |
| 523 | |
| 524 var h = { | 519 var h = { |
| 525 "content-type" : "application/json; charset=utf-8", | 520 "content-type": "application/json; charset=utf-8", |
| 526 }; | 521 }; |
| 527 var resp = ""; | 522 var resp = ""; |
| 528 return new async.Future.value(stringResponse(200, h, resp)); | 523 return new async.Future.value(stringResponse(200, h, resp)); |
| 529 }), true); | 524 }), true); |
| 530 res.delete(arg_achievementId).then(unittest.expectAsync1((_) {})); | 525 res.delete(arg_achievementId).then(unittest.expectAsync1((_) {})); |
| 531 }); | 526 }); |
| 532 | 527 |
| 533 unittest.test("method--get", () { | 528 unittest.test("method--get", () { |
| 534 | |
| 535 var mock = new HttpServerMock(); | 529 var mock = new HttpServerMock(); |
| 536 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 530 api.AchievementConfigurationsResourceApi res = |
| 531 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 537 var arg_achievementId = "foo"; | 532 var arg_achievementId = "foo"; |
| 538 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 533 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 539 var path = (req.url).path; | 534 var path = (req.url).path; |
| 540 var pathOffset = 0; | 535 var pathOffset = 0; |
| 541 var index; | 536 var index; |
| 542 var subPart; | 537 var subPart; |
| 543 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 538 unittest.expect( |
| 539 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 544 pathOffset += 1; | 540 pathOffset += 1; |
| 545 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 541 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 542 unittest.equals("games/v1configuration/")); |
| 546 pathOffset += 22; | 543 pathOffset += 22; |
| 547 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); | 544 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 545 unittest.equals("achievements/")); |
| 548 pathOffset += 13; | 546 pathOffset += 13; |
| 549 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 547 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 550 pathOffset = path.length; | 548 pathOffset = path.length; |
| 551 unittest.expect(subPart, unittest.equals("$arg_achievementId")); | 549 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 552 | 550 |
| 553 var query = (req.url).query; | 551 var query = (req.url).query; |
| 554 var queryOffset = 0; | 552 var queryOffset = 0; |
| 555 var queryMap = {}; | 553 var queryMap = {}; |
| 556 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 554 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 557 parseBool(n) { | 555 parseBool(n) { |
| 558 if (n == "true") return true; | 556 if (n == "true") return true; |
| 559 if (n == "false") return false; | 557 if (n == "false") return false; |
| 560 if (n == null) return null; | 558 if (n == null) return null; |
| 561 throw new core.ArgumentError("Invalid boolean: $n"); | 559 throw new core.ArgumentError("Invalid boolean: $n"); |
| 562 } | 560 } |
| 561 |
| 563 if (query.length > 0) { | 562 if (query.length > 0) { |
| 564 for (var part in query.split("&")) { | 563 for (var part in query.split("&")) { |
| 565 var keyvalue = part.split("="); | 564 var keyvalue = part.split("="); |
| 566 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 565 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 566 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 | 569 |
| 570 | |
| 571 var h = { | 570 var h = { |
| 572 "content-type" : "application/json; charset=utf-8", | 571 "content-type": "application/json; charset=utf-8", |
| 573 }; | 572 }; |
| 574 var resp = convert.JSON.encode(buildAchievementConfiguration()); | 573 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 575 return new async.Future.value(stringResponse(200, h, resp)); | 574 return new async.Future.value(stringResponse(200, h, resp)); |
| 576 }), true); | 575 }), true); |
| 577 res.get(arg_achievementId).then(unittest.expectAsync1(((api.AchievementCon
figuration response) { | 576 res |
| 577 .get(arg_achievementId) |
| 578 .then(unittest.expectAsync1(((api.AchievementConfiguration response) { |
| 578 checkAchievementConfiguration(response); | 579 checkAchievementConfiguration(response); |
| 579 }))); | 580 }))); |
| 580 }); | 581 }); |
| 581 | 582 |
| 582 unittest.test("method--insert", () { | 583 unittest.test("method--insert", () { |
| 583 | |
| 584 var mock = new HttpServerMock(); | 584 var mock = new HttpServerMock(); |
| 585 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 585 api.AchievementConfigurationsResourceApi res = |
| 586 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 586 var arg_request = buildAchievementConfiguration(); | 587 var arg_request = buildAchievementConfiguration(); |
| 587 var arg_applicationId = "foo"; | 588 var arg_applicationId = "foo"; |
| 588 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 589 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 589 var obj = new api.AchievementConfiguration.fromJson(json); | 590 var obj = new api.AchievementConfiguration.fromJson(json); |
| 590 checkAchievementConfiguration(obj); | 591 checkAchievementConfiguration(obj); |
| 591 | 592 |
| 592 var path = (req.url).path; | 593 var path = (req.url).path; |
| 593 var pathOffset = 0; | 594 var pathOffset = 0; |
| 594 var index; | 595 var index; |
| 595 var subPart; | 596 var subPart; |
| 596 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 597 unittest.expect( |
| 598 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 597 pathOffset += 1; | 599 pathOffset += 1; |
| 598 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 600 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 601 unittest.equals("games/v1configuration/")); |
| 599 pathOffset += 22; | 602 pathOffset += 22; |
| 600 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); | 603 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 604 unittest.equals("applications/")); |
| 601 pathOffset += 13; | 605 pathOffset += 13; |
| 602 index = path.indexOf("/achievements", pathOffset); | 606 index = path.indexOf("/achievements", pathOffset); |
| 603 unittest.expect(index >= 0, unittest.isTrue); | 607 unittest.expect(index >= 0, unittest.isTrue); |
| 604 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 608 subPart = |
| 609 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 605 pathOffset = index; | 610 pathOffset = index; |
| 606 unittest.expect(subPart, unittest.equals("$arg_applicationId")); | 611 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 607 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/achievements")); | 612 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 613 unittest.equals("/achievements")); |
| 608 pathOffset += 13; | 614 pathOffset += 13; |
| 609 | 615 |
| 610 var query = (req.url).query; | 616 var query = (req.url).query; |
| 611 var queryOffset = 0; | 617 var queryOffset = 0; |
| 612 var queryMap = {}; | 618 var queryMap = {}; |
| 613 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 619 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 614 parseBool(n) { | 620 parseBool(n) { |
| 615 if (n == "true") return true; | 621 if (n == "true") return true; |
| 616 if (n == "false") return false; | 622 if (n == "false") return false; |
| 617 if (n == null) return null; | 623 if (n == null) return null; |
| 618 throw new core.ArgumentError("Invalid boolean: $n"); | 624 throw new core.ArgumentError("Invalid boolean: $n"); |
| 619 } | 625 } |
| 626 |
| 620 if (query.length > 0) { | 627 if (query.length > 0) { |
| 621 for (var part in query.split("&")) { | 628 for (var part in query.split("&")) { |
| 622 var keyvalue = part.split("="); | 629 var keyvalue = part.split("="); |
| 623 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 630 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 631 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 624 } | 632 } |
| 625 } | 633 } |
| 626 | 634 |
| 627 | |
| 628 var h = { | 635 var h = { |
| 629 "content-type" : "application/json; charset=utf-8", | 636 "content-type": "application/json; charset=utf-8", |
| 630 }; | 637 }; |
| 631 var resp = convert.JSON.encode(buildAchievementConfiguration()); | 638 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 632 return new async.Future.value(stringResponse(200, h, resp)); | 639 return new async.Future.value(stringResponse(200, h, resp)); |
| 633 }), true); | 640 }), true); |
| 634 res.insert(arg_request, arg_applicationId).then(unittest.expectAsync1(((ap
i.AchievementConfiguration response) { | 641 res |
| 642 .insert(arg_request, arg_applicationId) |
| 643 .then(unittest.expectAsync1(((api.AchievementConfiguration response) { |
| 635 checkAchievementConfiguration(response); | 644 checkAchievementConfiguration(response); |
| 636 }))); | 645 }))); |
| 637 }); | 646 }); |
| 638 | 647 |
| 639 unittest.test("method--list", () { | 648 unittest.test("method--list", () { |
| 640 | |
| 641 var mock = new HttpServerMock(); | 649 var mock = new HttpServerMock(); |
| 642 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 650 api.AchievementConfigurationsResourceApi res = |
| 651 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 643 var arg_applicationId = "foo"; | 652 var arg_applicationId = "foo"; |
| 644 var arg_maxResults = 42; | 653 var arg_maxResults = 42; |
| 645 var arg_pageToken = "foo"; | 654 var arg_pageToken = "foo"; |
| 646 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 655 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 647 var path = (req.url).path; | 656 var path = (req.url).path; |
| 648 var pathOffset = 0; | 657 var pathOffset = 0; |
| 649 var index; | 658 var index; |
| 650 var subPart; | 659 var subPart; |
| 651 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 660 unittest.expect( |
| 661 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 652 pathOffset += 1; | 662 pathOffset += 1; |
| 653 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 663 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 664 unittest.equals("games/v1configuration/")); |
| 654 pathOffset += 22; | 665 pathOffset += 22; |
| 655 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); | 666 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 667 unittest.equals("applications/")); |
| 656 pathOffset += 13; | 668 pathOffset += 13; |
| 657 index = path.indexOf("/achievements", pathOffset); | 669 index = path.indexOf("/achievements", pathOffset); |
| 658 unittest.expect(index >= 0, unittest.isTrue); | 670 unittest.expect(index >= 0, unittest.isTrue); |
| 659 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 671 subPart = |
| 672 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 660 pathOffset = index; | 673 pathOffset = index; |
| 661 unittest.expect(subPart, unittest.equals("$arg_applicationId")); | 674 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 662 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/achievements")); | 675 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 676 unittest.equals("/achievements")); |
| 663 pathOffset += 13; | 677 pathOffset += 13; |
| 664 | 678 |
| 665 var query = (req.url).query; | 679 var query = (req.url).query; |
| 666 var queryOffset = 0; | 680 var queryOffset = 0; |
| 667 var queryMap = {}; | 681 var queryMap = {}; |
| 668 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 682 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 669 parseBool(n) { | 683 parseBool(n) { |
| 670 if (n == "true") return true; | 684 if (n == "true") return true; |
| 671 if (n == "false") return false; | 685 if (n == "false") return false; |
| 672 if (n == null) return null; | 686 if (n == null) return null; |
| 673 throw new core.ArgumentError("Invalid boolean: $n"); | 687 throw new core.ArgumentError("Invalid boolean: $n"); |
| 674 } | 688 } |
| 689 |
| 675 if (query.length > 0) { | 690 if (query.length > 0) { |
| 676 for (var part in query.split("&")) { | 691 for (var part in query.split("&")) { |
| 677 var keyvalue = part.split("="); | 692 var keyvalue = part.split("="); |
| 678 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 693 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 694 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 679 } | 695 } |
| 680 } | 696 } |
| 681 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 697 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 682 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 698 unittest.equals(arg_maxResults)); |
| 683 | 699 unittest.expect( |
| 700 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 684 | 701 |
| 685 var h = { | 702 var h = { |
| 686 "content-type" : "application/json; charset=utf-8", | 703 "content-type": "application/json; charset=utf-8", |
| 687 }; | 704 }; |
| 688 var resp = convert.JSON.encode(buildAchievementConfigurationListResponse
()); | 705 var resp = |
| 706 convert.JSON.encode(buildAchievementConfigurationListResponse()); |
| 689 return new async.Future.value(stringResponse(200, h, resp)); | 707 return new async.Future.value(stringResponse(200, h, resp)); |
| 690 }), true); | 708 }), true); |
| 691 res.list(arg_applicationId, maxResults: arg_maxResults, pageToken: arg_pag
eToken).then(unittest.expectAsync1(((api.AchievementConfigurationListResponse re
sponse) { | 709 res |
| 710 .list(arg_applicationId, |
| 711 maxResults: arg_maxResults, pageToken: arg_pageToken) |
| 712 .then(unittest.expectAsync1( |
| 713 ((api.AchievementConfigurationListResponse response) { |
| 692 checkAchievementConfigurationListResponse(response); | 714 checkAchievementConfigurationListResponse(response); |
| 693 }))); | 715 }))); |
| 694 }); | 716 }); |
| 695 | 717 |
| 696 unittest.test("method--patch", () { | 718 unittest.test("method--patch", () { |
| 697 | |
| 698 var mock = new HttpServerMock(); | 719 var mock = new HttpServerMock(); |
| 699 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 720 api.AchievementConfigurationsResourceApi res = |
| 721 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 700 var arg_request = buildAchievementConfiguration(); | 722 var arg_request = buildAchievementConfiguration(); |
| 701 var arg_achievementId = "foo"; | 723 var arg_achievementId = "foo"; |
| 702 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 724 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 703 var obj = new api.AchievementConfiguration.fromJson(json); | 725 var obj = new api.AchievementConfiguration.fromJson(json); |
| 704 checkAchievementConfiguration(obj); | 726 checkAchievementConfiguration(obj); |
| 705 | 727 |
| 706 var path = (req.url).path; | 728 var path = (req.url).path; |
| 707 var pathOffset = 0; | 729 var pathOffset = 0; |
| 708 var index; | 730 var index; |
| 709 var subPart; | 731 var subPart; |
| 710 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 732 unittest.expect( |
| 733 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 711 pathOffset += 1; | 734 pathOffset += 1; |
| 712 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 735 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 736 unittest.equals("games/v1configuration/")); |
| 713 pathOffset += 22; | 737 pathOffset += 22; |
| 714 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); | 738 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 739 unittest.equals("achievements/")); |
| 715 pathOffset += 13; | 740 pathOffset += 13; |
| 716 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 741 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 717 pathOffset = path.length; | 742 pathOffset = path.length; |
| 718 unittest.expect(subPart, unittest.equals("$arg_achievementId")); | 743 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 719 | 744 |
| 720 var query = (req.url).query; | 745 var query = (req.url).query; |
| 721 var queryOffset = 0; | 746 var queryOffset = 0; |
| 722 var queryMap = {}; | 747 var queryMap = {}; |
| 723 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 748 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 724 parseBool(n) { | 749 parseBool(n) { |
| 725 if (n == "true") return true; | 750 if (n == "true") return true; |
| 726 if (n == "false") return false; | 751 if (n == "false") return false; |
| 727 if (n == null) return null; | 752 if (n == null) return null; |
| 728 throw new core.ArgumentError("Invalid boolean: $n"); | 753 throw new core.ArgumentError("Invalid boolean: $n"); |
| 729 } | 754 } |
| 755 |
| 730 if (query.length > 0) { | 756 if (query.length > 0) { |
| 731 for (var part in query.split("&")) { | 757 for (var part in query.split("&")) { |
| 732 var keyvalue = part.split("="); | 758 var keyvalue = part.split("="); |
| 733 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 759 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 760 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 734 } | 761 } |
| 735 } | 762 } |
| 736 | 763 |
| 737 | |
| 738 var h = { | 764 var h = { |
| 739 "content-type" : "application/json; charset=utf-8", | 765 "content-type": "application/json; charset=utf-8", |
| 740 }; | 766 }; |
| 741 var resp = convert.JSON.encode(buildAchievementConfiguration()); | 767 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 742 return new async.Future.value(stringResponse(200, h, resp)); | 768 return new async.Future.value(stringResponse(200, h, resp)); |
| 743 }), true); | 769 }), true); |
| 744 res.patch(arg_request, arg_achievementId).then(unittest.expectAsync1(((api
.AchievementConfiguration response) { | 770 res |
| 771 .patch(arg_request, arg_achievementId) |
| 772 .then(unittest.expectAsync1(((api.AchievementConfiguration response) { |
| 745 checkAchievementConfiguration(response); | 773 checkAchievementConfiguration(response); |
| 746 }))); | 774 }))); |
| 747 }); | 775 }); |
| 748 | 776 |
| 749 unittest.test("method--update", () { | 777 unittest.test("method--update", () { |
| 750 | |
| 751 var mock = new HttpServerMock(); | 778 var mock = new HttpServerMock(); |
| 752 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; | 779 api.AchievementConfigurationsResourceApi res = |
| 780 new api.GamesConfigurationApi(mock).achievementConfigurations; |
| 753 var arg_request = buildAchievementConfiguration(); | 781 var arg_request = buildAchievementConfiguration(); |
| 754 var arg_achievementId = "foo"; | 782 var arg_achievementId = "foo"; |
| 755 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 783 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 756 var obj = new api.AchievementConfiguration.fromJson(json); | 784 var obj = new api.AchievementConfiguration.fromJson(json); |
| 757 checkAchievementConfiguration(obj); | 785 checkAchievementConfiguration(obj); |
| 758 | 786 |
| 759 var path = (req.url).path; | 787 var path = (req.url).path; |
| 760 var pathOffset = 0; | 788 var pathOffset = 0; |
| 761 var index; | 789 var index; |
| 762 var subPart; | 790 var subPart; |
| 763 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 791 unittest.expect( |
| 792 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 764 pathOffset += 1; | 793 pathOffset += 1; |
| 765 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 794 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 795 unittest.equals("games/v1configuration/")); |
| 766 pathOffset += 22; | 796 pathOffset += 22; |
| 767 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); | 797 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 798 unittest.equals("achievements/")); |
| 768 pathOffset += 13; | 799 pathOffset += 13; |
| 769 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 800 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 770 pathOffset = path.length; | 801 pathOffset = path.length; |
| 771 unittest.expect(subPart, unittest.equals("$arg_achievementId")); | 802 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 772 | 803 |
| 773 var query = (req.url).query; | 804 var query = (req.url).query; |
| 774 var queryOffset = 0; | 805 var queryOffset = 0; |
| 775 var queryMap = {}; | 806 var queryMap = {}; |
| 776 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 807 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 777 parseBool(n) { | 808 parseBool(n) { |
| 778 if (n == "true") return true; | 809 if (n == "true") return true; |
| 779 if (n == "false") return false; | 810 if (n == "false") return false; |
| 780 if (n == null) return null; | 811 if (n == null) return null; |
| 781 throw new core.ArgumentError("Invalid boolean: $n"); | 812 throw new core.ArgumentError("Invalid boolean: $n"); |
| 782 } | 813 } |
| 814 |
| 783 if (query.length > 0) { | 815 if (query.length > 0) { |
| 784 for (var part in query.split("&")) { | 816 for (var part in query.split("&")) { |
| 785 var keyvalue = part.split("="); | 817 var keyvalue = part.split("="); |
| 786 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 818 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 819 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 787 } | 820 } |
| 788 } | 821 } |
| 789 | 822 |
| 790 | |
| 791 var h = { | 823 var h = { |
| 792 "content-type" : "application/json; charset=utf-8", | 824 "content-type": "application/json; charset=utf-8", |
| 793 }; | 825 }; |
| 794 var resp = convert.JSON.encode(buildAchievementConfiguration()); | 826 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 795 return new async.Future.value(stringResponse(200, h, resp)); | 827 return new async.Future.value(stringResponse(200, h, resp)); |
| 796 }), true); | 828 }), true); |
| 797 res.update(arg_request, arg_achievementId).then(unittest.expectAsync1(((ap
i.AchievementConfiguration response) { | 829 res |
| 830 .update(arg_request, arg_achievementId) |
| 831 .then(unittest.expectAsync1(((api.AchievementConfiguration response) { |
| 798 checkAchievementConfiguration(response); | 832 checkAchievementConfiguration(response); |
| 799 }))); | 833 }))); |
| 800 }); | 834 }); |
| 801 | |
| 802 }); | 835 }); |
| 803 | 836 |
| 804 | |
| 805 unittest.group("resource-ImageConfigurationsResourceApi", () { | 837 unittest.group("resource-ImageConfigurationsResourceApi", () { |
| 806 unittest.test("method--upload", () { | 838 unittest.test("method--upload", () { |
| 807 // TODO: Implement tests for media upload; | 839 // TODO: Implement tests for media upload; |
| 808 // TODO: Implement tests for media download; | 840 // TODO: Implement tests for media download; |
| 809 | 841 |
| 810 var mock = new HttpServerMock(); | 842 var mock = new HttpServerMock(); |
| 811 api.ImageConfigurationsResourceApi res = new api.GamesConfigurationApi(moc
k).imageConfigurations; | 843 api.ImageConfigurationsResourceApi res = |
| 844 new api.GamesConfigurationApi(mock).imageConfigurations; |
| 812 var arg_resourceId = "foo"; | 845 var arg_resourceId = "foo"; |
| 813 var arg_imageType = "foo"; | 846 var arg_imageType = "foo"; |
| 814 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 847 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 815 var path = (req.url).path; | 848 var path = (req.url).path; |
| 816 var pathOffset = 0; | 849 var pathOffset = 0; |
| 817 var index; | 850 var index; |
| 818 var subPart; | 851 var subPart; |
| 819 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 852 unittest.expect( |
| 853 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 820 pathOffset += 1; | 854 pathOffset += 1; |
| 821 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 855 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 856 unittest.equals("games/v1configuration/")); |
| 822 pathOffset += 22; | 857 pathOffset += 22; |
| 823 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("images/")); | 858 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 859 unittest.equals("images/")); |
| 824 pathOffset += 7; | 860 pathOffset += 7; |
| 825 index = path.indexOf("/imageType/", pathOffset); | 861 index = path.indexOf("/imageType/", pathOffset); |
| 826 unittest.expect(index >= 0, unittest.isTrue); | 862 unittest.expect(index >= 0, unittest.isTrue); |
| 827 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 863 subPart = |
| 864 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 828 pathOffset = index; | 865 pathOffset = index; |
| 829 unittest.expect(subPart, unittest.equals("$arg_resourceId")); | 866 unittest.expect(subPart, unittest.equals("$arg_resourceId")); |
| 830 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/imageType/")); | 867 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 868 unittest.equals("/imageType/")); |
| 831 pathOffset += 11; | 869 pathOffset += 11; |
| 832 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 870 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 833 pathOffset = path.length; | 871 pathOffset = path.length; |
| 834 unittest.expect(subPart, unittest.equals("$arg_imageType")); | 872 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 835 | 873 |
| 836 var query = (req.url).query; | 874 var query = (req.url).query; |
| 837 var queryOffset = 0; | 875 var queryOffset = 0; |
| 838 var queryMap = {}; | 876 var queryMap = {}; |
| 839 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 877 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 840 parseBool(n) { | 878 parseBool(n) { |
| 841 if (n == "true") return true; | 879 if (n == "true") return true; |
| 842 if (n == "false") return false; | 880 if (n == "false") return false; |
| 843 if (n == null) return null; | 881 if (n == null) return null; |
| 844 throw new core.ArgumentError("Invalid boolean: $n"); | 882 throw new core.ArgumentError("Invalid boolean: $n"); |
| 845 } | 883 } |
| 884 |
| 846 if (query.length > 0) { | 885 if (query.length > 0) { |
| 847 for (var part in query.split("&")) { | 886 for (var part in query.split("&")) { |
| 848 var keyvalue = part.split("="); | 887 var keyvalue = part.split("="); |
| 849 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 888 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 889 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 850 } | 890 } |
| 851 } | 891 } |
| 852 | 892 |
| 853 | |
| 854 var h = { | 893 var h = { |
| 855 "content-type" : "application/json; charset=utf-8", | 894 "content-type": "application/json; charset=utf-8", |
| 856 }; | 895 }; |
| 857 var resp = convert.JSON.encode(buildImageConfiguration()); | 896 var resp = convert.JSON.encode(buildImageConfiguration()); |
| 858 return new async.Future.value(stringResponse(200, h, resp)); | 897 return new async.Future.value(stringResponse(200, h, resp)); |
| 859 }), true); | 898 }), true); |
| 860 res.upload(arg_resourceId, arg_imageType).then(unittest.expectAsync1(((api
.ImageConfiguration response) { | 899 res |
| 900 .upload(arg_resourceId, arg_imageType) |
| 901 .then(unittest.expectAsync1(((api.ImageConfiguration response) { |
| 861 checkImageConfiguration(response); | 902 checkImageConfiguration(response); |
| 862 }))); | 903 }))); |
| 863 }); | 904 }); |
| 864 | |
| 865 }); | 905 }); |
| 866 | 906 |
| 867 | |
| 868 unittest.group("resource-LeaderboardConfigurationsResourceApi", () { | 907 unittest.group("resource-LeaderboardConfigurationsResourceApi", () { |
| 869 unittest.test("method--delete", () { | 908 unittest.test("method--delete", () { |
| 870 | |
| 871 var mock = new HttpServerMock(); | 909 var mock = new HttpServerMock(); |
| 872 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 910 api.LeaderboardConfigurationsResourceApi res = |
| 911 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 873 var arg_leaderboardId = "foo"; | 912 var arg_leaderboardId = "foo"; |
| 874 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 913 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 875 var path = (req.url).path; | 914 var path = (req.url).path; |
| 876 var pathOffset = 0; | 915 var pathOffset = 0; |
| 877 var index; | 916 var index; |
| 878 var subPart; | 917 var subPart; |
| 879 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 918 unittest.expect( |
| 919 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 880 pathOffset += 1; | 920 pathOffset += 1; |
| 881 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 921 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 922 unittest.equals("games/v1configuration/")); |
| 882 pathOffset += 22; | 923 pathOffset += 22; |
| 883 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); | 924 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 925 unittest.equals("leaderboards/")); |
| 884 pathOffset += 13; | 926 pathOffset += 13; |
| 885 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 927 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 886 pathOffset = path.length; | 928 pathOffset = path.length; |
| 887 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); | 929 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 888 | 930 |
| 889 var query = (req.url).query; | 931 var query = (req.url).query; |
| 890 var queryOffset = 0; | 932 var queryOffset = 0; |
| 891 var queryMap = {}; | 933 var queryMap = {}; |
| 892 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 934 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 893 parseBool(n) { | 935 parseBool(n) { |
| 894 if (n == "true") return true; | 936 if (n == "true") return true; |
| 895 if (n == "false") return false; | 937 if (n == "false") return false; |
| 896 if (n == null) return null; | 938 if (n == null) return null; |
| 897 throw new core.ArgumentError("Invalid boolean: $n"); | 939 throw new core.ArgumentError("Invalid boolean: $n"); |
| 898 } | 940 } |
| 941 |
| 899 if (query.length > 0) { | 942 if (query.length > 0) { |
| 900 for (var part in query.split("&")) { | 943 for (var part in query.split("&")) { |
| 901 var keyvalue = part.split("="); | 944 var keyvalue = part.split("="); |
| 902 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 945 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 946 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 903 } | 947 } |
| 904 } | 948 } |
| 905 | 949 |
| 906 | |
| 907 var h = { | 950 var h = { |
| 908 "content-type" : "application/json; charset=utf-8", | 951 "content-type": "application/json; charset=utf-8", |
| 909 }; | 952 }; |
| 910 var resp = ""; | 953 var resp = ""; |
| 911 return new async.Future.value(stringResponse(200, h, resp)); | 954 return new async.Future.value(stringResponse(200, h, resp)); |
| 912 }), true); | 955 }), true); |
| 913 res.delete(arg_leaderboardId).then(unittest.expectAsync1((_) {})); | 956 res.delete(arg_leaderboardId).then(unittest.expectAsync1((_) {})); |
| 914 }); | 957 }); |
| 915 | 958 |
| 916 unittest.test("method--get", () { | 959 unittest.test("method--get", () { |
| 917 | |
| 918 var mock = new HttpServerMock(); | 960 var mock = new HttpServerMock(); |
| 919 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 961 api.LeaderboardConfigurationsResourceApi res = |
| 962 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 920 var arg_leaderboardId = "foo"; | 963 var arg_leaderboardId = "foo"; |
| 921 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 964 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 922 var path = (req.url).path; | 965 var path = (req.url).path; |
| 923 var pathOffset = 0; | 966 var pathOffset = 0; |
| 924 var index; | 967 var index; |
| 925 var subPart; | 968 var subPart; |
| 926 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 969 unittest.expect( |
| 970 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 927 pathOffset += 1; | 971 pathOffset += 1; |
| 928 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 972 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 973 unittest.equals("games/v1configuration/")); |
| 929 pathOffset += 22; | 974 pathOffset += 22; |
| 930 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); | 975 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 976 unittest.equals("leaderboards/")); |
| 931 pathOffset += 13; | 977 pathOffset += 13; |
| 932 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 978 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 933 pathOffset = path.length; | 979 pathOffset = path.length; |
| 934 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); | 980 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 935 | 981 |
| 936 var query = (req.url).query; | 982 var query = (req.url).query; |
| 937 var queryOffset = 0; | 983 var queryOffset = 0; |
| 938 var queryMap = {}; | 984 var queryMap = {}; |
| 939 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 985 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 940 parseBool(n) { | 986 parseBool(n) { |
| 941 if (n == "true") return true; | 987 if (n == "true") return true; |
| 942 if (n == "false") return false; | 988 if (n == "false") return false; |
| 943 if (n == null) return null; | 989 if (n == null) return null; |
| 944 throw new core.ArgumentError("Invalid boolean: $n"); | 990 throw new core.ArgumentError("Invalid boolean: $n"); |
| 945 } | 991 } |
| 992 |
| 946 if (query.length > 0) { | 993 if (query.length > 0) { |
| 947 for (var part in query.split("&")) { | 994 for (var part in query.split("&")) { |
| 948 var keyvalue = part.split("="); | 995 var keyvalue = part.split("="); |
| 949 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 996 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 997 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 950 } | 998 } |
| 951 } | 999 } |
| 952 | 1000 |
| 953 | |
| 954 var h = { | 1001 var h = { |
| 955 "content-type" : "application/json; charset=utf-8", | 1002 "content-type": "application/json; charset=utf-8", |
| 956 }; | 1003 }; |
| 957 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); | 1004 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 958 return new async.Future.value(stringResponse(200, h, resp)); | 1005 return new async.Future.value(stringResponse(200, h, resp)); |
| 959 }), true); | 1006 }), true); |
| 960 res.get(arg_leaderboardId).then(unittest.expectAsync1(((api.LeaderboardCon
figuration response) { | 1007 res |
| 1008 .get(arg_leaderboardId) |
| 1009 .then(unittest.expectAsync1(((api.LeaderboardConfiguration response) { |
| 961 checkLeaderboardConfiguration(response); | 1010 checkLeaderboardConfiguration(response); |
| 962 }))); | 1011 }))); |
| 963 }); | 1012 }); |
| 964 | 1013 |
| 965 unittest.test("method--insert", () { | 1014 unittest.test("method--insert", () { |
| 966 | |
| 967 var mock = new HttpServerMock(); | 1015 var mock = new HttpServerMock(); |
| 968 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 1016 api.LeaderboardConfigurationsResourceApi res = |
| 1017 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 969 var arg_request = buildLeaderboardConfiguration(); | 1018 var arg_request = buildLeaderboardConfiguration(); |
| 970 var arg_applicationId = "foo"; | 1019 var arg_applicationId = "foo"; |
| 971 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1020 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 972 var obj = new api.LeaderboardConfiguration.fromJson(json); | 1021 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 973 checkLeaderboardConfiguration(obj); | 1022 checkLeaderboardConfiguration(obj); |
| 974 | 1023 |
| 975 var path = (req.url).path; | 1024 var path = (req.url).path; |
| 976 var pathOffset = 0; | 1025 var pathOffset = 0; |
| 977 var index; | 1026 var index; |
| 978 var subPart; | 1027 var subPart; |
| 979 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1028 unittest.expect( |
| 1029 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 980 pathOffset += 1; | 1030 pathOffset += 1; |
| 981 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 1031 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 1032 unittest.equals("games/v1configuration/")); |
| 982 pathOffset += 22; | 1033 pathOffset += 22; |
| 983 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); | 1034 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1035 unittest.equals("applications/")); |
| 984 pathOffset += 13; | 1036 pathOffset += 13; |
| 985 index = path.indexOf("/leaderboards", pathOffset); | 1037 index = path.indexOf("/leaderboards", pathOffset); |
| 986 unittest.expect(index >= 0, unittest.isTrue); | 1038 unittest.expect(index >= 0, unittest.isTrue); |
| 987 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1039 subPart = |
| 1040 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 988 pathOffset = index; | 1041 pathOffset = index; |
| 989 unittest.expect(subPart, unittest.equals("$arg_applicationId")); | 1042 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 990 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/leaderboards")); | 1043 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1044 unittest.equals("/leaderboards")); |
| 991 pathOffset += 13; | 1045 pathOffset += 13; |
| 992 | 1046 |
| 993 var query = (req.url).query; | 1047 var query = (req.url).query; |
| 994 var queryOffset = 0; | 1048 var queryOffset = 0; |
| 995 var queryMap = {}; | 1049 var queryMap = {}; |
| 996 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1050 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 997 parseBool(n) { | 1051 parseBool(n) { |
| 998 if (n == "true") return true; | 1052 if (n == "true") return true; |
| 999 if (n == "false") return false; | 1053 if (n == "false") return false; |
| 1000 if (n == null) return null; | 1054 if (n == null) return null; |
| 1001 throw new core.ArgumentError("Invalid boolean: $n"); | 1055 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1002 } | 1056 } |
| 1057 |
| 1003 if (query.length > 0) { | 1058 if (query.length > 0) { |
| 1004 for (var part in query.split("&")) { | 1059 for (var part in query.split("&")) { |
| 1005 var keyvalue = part.split("="); | 1060 var keyvalue = part.split("="); |
| 1006 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1061 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1062 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1007 } | 1063 } |
| 1008 } | 1064 } |
| 1009 | 1065 |
| 1010 | |
| 1011 var h = { | 1066 var h = { |
| 1012 "content-type" : "application/json; charset=utf-8", | 1067 "content-type": "application/json; charset=utf-8", |
| 1013 }; | 1068 }; |
| 1014 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); | 1069 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 1015 return new async.Future.value(stringResponse(200, h, resp)); | 1070 return new async.Future.value(stringResponse(200, h, resp)); |
| 1016 }), true); | 1071 }), true); |
| 1017 res.insert(arg_request, arg_applicationId).then(unittest.expectAsync1(((ap
i.LeaderboardConfiguration response) { | 1072 res |
| 1073 .insert(arg_request, arg_applicationId) |
| 1074 .then(unittest.expectAsync1(((api.LeaderboardConfiguration response) { |
| 1018 checkLeaderboardConfiguration(response); | 1075 checkLeaderboardConfiguration(response); |
| 1019 }))); | 1076 }))); |
| 1020 }); | 1077 }); |
| 1021 | 1078 |
| 1022 unittest.test("method--list", () { | 1079 unittest.test("method--list", () { |
| 1023 | |
| 1024 var mock = new HttpServerMock(); | 1080 var mock = new HttpServerMock(); |
| 1025 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 1081 api.LeaderboardConfigurationsResourceApi res = |
| 1082 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 1026 var arg_applicationId = "foo"; | 1083 var arg_applicationId = "foo"; |
| 1027 var arg_maxResults = 42; | 1084 var arg_maxResults = 42; |
| 1028 var arg_pageToken = "foo"; | 1085 var arg_pageToken = "foo"; |
| 1029 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1086 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1030 var path = (req.url).path; | 1087 var path = (req.url).path; |
| 1031 var pathOffset = 0; | 1088 var pathOffset = 0; |
| 1032 var index; | 1089 var index; |
| 1033 var subPart; | 1090 var subPart; |
| 1034 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1091 unittest.expect( |
| 1092 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1035 pathOffset += 1; | 1093 pathOffset += 1; |
| 1036 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 1094 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 1095 unittest.equals("games/v1configuration/")); |
| 1037 pathOffset += 22; | 1096 pathOffset += 22; |
| 1038 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); | 1097 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1098 unittest.equals("applications/")); |
| 1039 pathOffset += 13; | 1099 pathOffset += 13; |
| 1040 index = path.indexOf("/leaderboards", pathOffset); | 1100 index = path.indexOf("/leaderboards", pathOffset); |
| 1041 unittest.expect(index >= 0, unittest.isTrue); | 1101 unittest.expect(index >= 0, unittest.isTrue); |
| 1042 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1102 subPart = |
| 1103 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1043 pathOffset = index; | 1104 pathOffset = index; |
| 1044 unittest.expect(subPart, unittest.equals("$arg_applicationId")); | 1105 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 1045 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/leaderboards")); | 1106 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1107 unittest.equals("/leaderboards")); |
| 1046 pathOffset += 13; | 1108 pathOffset += 13; |
| 1047 | 1109 |
| 1048 var query = (req.url).query; | 1110 var query = (req.url).query; |
| 1049 var queryOffset = 0; | 1111 var queryOffset = 0; |
| 1050 var queryMap = {}; | 1112 var queryMap = {}; |
| 1051 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1113 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1052 parseBool(n) { | 1114 parseBool(n) { |
| 1053 if (n == "true") return true; | 1115 if (n == "true") return true; |
| 1054 if (n == "false") return false; | 1116 if (n == "false") return false; |
| 1055 if (n == null) return null; | 1117 if (n == null) return null; |
| 1056 throw new core.ArgumentError("Invalid boolean: $n"); | 1118 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1057 } | 1119 } |
| 1120 |
| 1058 if (query.length > 0) { | 1121 if (query.length > 0) { |
| 1059 for (var part in query.split("&")) { | 1122 for (var part in query.split("&")) { |
| 1060 var keyvalue = part.split("="); | 1123 var keyvalue = part.split("="); |
| 1061 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1124 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1125 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1062 } | 1126 } |
| 1063 } | 1127 } |
| 1064 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 1128 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 1065 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1129 unittest.equals(arg_maxResults)); |
| 1066 | 1130 unittest.expect( |
| 1131 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1067 | 1132 |
| 1068 var h = { | 1133 var h = { |
| 1069 "content-type" : "application/json; charset=utf-8", | 1134 "content-type": "application/json; charset=utf-8", |
| 1070 }; | 1135 }; |
| 1071 var resp = convert.JSON.encode(buildLeaderboardConfigurationListResponse
()); | 1136 var resp = |
| 1137 convert.JSON.encode(buildLeaderboardConfigurationListResponse()); |
| 1072 return new async.Future.value(stringResponse(200, h, resp)); | 1138 return new async.Future.value(stringResponse(200, h, resp)); |
| 1073 }), true); | 1139 }), true); |
| 1074 res.list(arg_applicationId, maxResults: arg_maxResults, pageToken: arg_pag
eToken).then(unittest.expectAsync1(((api.LeaderboardConfigurationListResponse re
sponse) { | 1140 res |
| 1141 .list(arg_applicationId, |
| 1142 maxResults: arg_maxResults, pageToken: arg_pageToken) |
| 1143 .then(unittest.expectAsync1( |
| 1144 ((api.LeaderboardConfigurationListResponse response) { |
| 1075 checkLeaderboardConfigurationListResponse(response); | 1145 checkLeaderboardConfigurationListResponse(response); |
| 1076 }))); | 1146 }))); |
| 1077 }); | 1147 }); |
| 1078 | 1148 |
| 1079 unittest.test("method--patch", () { | 1149 unittest.test("method--patch", () { |
| 1080 | |
| 1081 var mock = new HttpServerMock(); | 1150 var mock = new HttpServerMock(); |
| 1082 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 1151 api.LeaderboardConfigurationsResourceApi res = |
| 1152 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 1083 var arg_request = buildLeaderboardConfiguration(); | 1153 var arg_request = buildLeaderboardConfiguration(); |
| 1084 var arg_leaderboardId = "foo"; | 1154 var arg_leaderboardId = "foo"; |
| 1085 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1155 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1086 var obj = new api.LeaderboardConfiguration.fromJson(json); | 1156 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 1087 checkLeaderboardConfiguration(obj); | 1157 checkLeaderboardConfiguration(obj); |
| 1088 | 1158 |
| 1089 var path = (req.url).path; | 1159 var path = (req.url).path; |
| 1090 var pathOffset = 0; | 1160 var pathOffset = 0; |
| 1091 var index; | 1161 var index; |
| 1092 var subPart; | 1162 var subPart; |
| 1093 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1163 unittest.expect( |
| 1164 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1094 pathOffset += 1; | 1165 pathOffset += 1; |
| 1095 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 1166 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 1167 unittest.equals("games/v1configuration/")); |
| 1096 pathOffset += 22; | 1168 pathOffset += 22; |
| 1097 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); | 1169 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1170 unittest.equals("leaderboards/")); |
| 1098 pathOffset += 13; | 1171 pathOffset += 13; |
| 1099 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1172 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1100 pathOffset = path.length; | 1173 pathOffset = path.length; |
| 1101 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); | 1174 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 1102 | 1175 |
| 1103 var query = (req.url).query; | 1176 var query = (req.url).query; |
| 1104 var queryOffset = 0; | 1177 var queryOffset = 0; |
| 1105 var queryMap = {}; | 1178 var queryMap = {}; |
| 1106 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1179 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1107 parseBool(n) { | 1180 parseBool(n) { |
| 1108 if (n == "true") return true; | 1181 if (n == "true") return true; |
| 1109 if (n == "false") return false; | 1182 if (n == "false") return false; |
| 1110 if (n == null) return null; | 1183 if (n == null) return null; |
| 1111 throw new core.ArgumentError("Invalid boolean: $n"); | 1184 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1112 } | 1185 } |
| 1186 |
| 1113 if (query.length > 0) { | 1187 if (query.length > 0) { |
| 1114 for (var part in query.split("&")) { | 1188 for (var part in query.split("&")) { |
| 1115 var keyvalue = part.split("="); | 1189 var keyvalue = part.split("="); |
| 1116 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1190 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1191 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1117 } | 1192 } |
| 1118 } | 1193 } |
| 1119 | 1194 |
| 1120 | |
| 1121 var h = { | 1195 var h = { |
| 1122 "content-type" : "application/json; charset=utf-8", | 1196 "content-type": "application/json; charset=utf-8", |
| 1123 }; | 1197 }; |
| 1124 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); | 1198 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 1125 return new async.Future.value(stringResponse(200, h, resp)); | 1199 return new async.Future.value(stringResponse(200, h, resp)); |
| 1126 }), true); | 1200 }), true); |
| 1127 res.patch(arg_request, arg_leaderboardId).then(unittest.expectAsync1(((api
.LeaderboardConfiguration response) { | 1201 res |
| 1202 .patch(arg_request, arg_leaderboardId) |
| 1203 .then(unittest.expectAsync1(((api.LeaderboardConfiguration response) { |
| 1128 checkLeaderboardConfiguration(response); | 1204 checkLeaderboardConfiguration(response); |
| 1129 }))); | 1205 }))); |
| 1130 }); | 1206 }); |
| 1131 | 1207 |
| 1132 unittest.test("method--update", () { | 1208 unittest.test("method--update", () { |
| 1133 | |
| 1134 var mock = new HttpServerMock(); | 1209 var mock = new HttpServerMock(); |
| 1135 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; | 1210 api.LeaderboardConfigurationsResourceApi res = |
| 1211 new api.GamesConfigurationApi(mock).leaderboardConfigurations; |
| 1136 var arg_request = buildLeaderboardConfiguration(); | 1212 var arg_request = buildLeaderboardConfiguration(); |
| 1137 var arg_leaderboardId = "foo"; | 1213 var arg_leaderboardId = "foo"; |
| 1138 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1214 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1139 var obj = new api.LeaderboardConfiguration.fromJson(json); | 1215 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 1140 checkLeaderboardConfiguration(obj); | 1216 checkLeaderboardConfiguration(obj); |
| 1141 | 1217 |
| 1142 var path = (req.url).path; | 1218 var path = (req.url).path; |
| 1143 var pathOffset = 0; | 1219 var pathOffset = 0; |
| 1144 var index; | 1220 var index; |
| 1145 var subPart; | 1221 var subPart; |
| 1146 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1222 unittest.expect( |
| 1223 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1147 pathOffset += 1; | 1224 pathOffset += 1; |
| 1148 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); | 1225 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 1226 unittest.equals("games/v1configuration/")); |
| 1149 pathOffset += 22; | 1227 pathOffset += 22; |
| 1150 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); | 1228 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1229 unittest.equals("leaderboards/")); |
| 1151 pathOffset += 13; | 1230 pathOffset += 13; |
| 1152 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1231 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1153 pathOffset = path.length; | 1232 pathOffset = path.length; |
| 1154 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); | 1233 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 1155 | 1234 |
| 1156 var query = (req.url).query; | 1235 var query = (req.url).query; |
| 1157 var queryOffset = 0; | 1236 var queryOffset = 0; |
| 1158 var queryMap = {}; | 1237 var queryMap = {}; |
| 1159 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1238 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1160 parseBool(n) { | 1239 parseBool(n) { |
| 1161 if (n == "true") return true; | 1240 if (n == "true") return true; |
| 1162 if (n == "false") return false; | 1241 if (n == "false") return false; |
| 1163 if (n == null) return null; | 1242 if (n == null) return null; |
| 1164 throw new core.ArgumentError("Invalid boolean: $n"); | 1243 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1165 } | 1244 } |
| 1245 |
| 1166 if (query.length > 0) { | 1246 if (query.length > 0) { |
| 1167 for (var part in query.split("&")) { | 1247 for (var part in query.split("&")) { |
| 1168 var keyvalue = part.split("="); | 1248 var keyvalue = part.split("="); |
| 1169 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1249 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1250 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1170 } | 1251 } |
| 1171 } | 1252 } |
| 1172 | 1253 |
| 1173 | |
| 1174 var h = { | 1254 var h = { |
| 1175 "content-type" : "application/json; charset=utf-8", | 1255 "content-type": "application/json; charset=utf-8", |
| 1176 }; | 1256 }; |
| 1177 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); | 1257 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 1178 return new async.Future.value(stringResponse(200, h, resp)); | 1258 return new async.Future.value(stringResponse(200, h, resp)); |
| 1179 }), true); | 1259 }), true); |
| 1180 res.update(arg_request, arg_leaderboardId).then(unittest.expectAsync1(((ap
i.LeaderboardConfiguration response) { | 1260 res |
| 1261 .update(arg_request, arg_leaderboardId) |
| 1262 .then(unittest.expectAsync1(((api.LeaderboardConfiguration response) { |
| 1181 checkLeaderboardConfiguration(response); | 1263 checkLeaderboardConfiguration(response); |
| 1182 }))); | 1264 }))); |
| 1183 }); | 1265 }); |
| 1184 | |
| 1185 }); | 1266 }); |
| 1186 | |
| 1187 | |
| 1188 } | 1267 } |
| 1189 | |
| OLD | NEW |