OLD | NEW |
(Empty) | |
| 1 library googleapis.gamesConfiguration.v1configuration.test; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; |
| 11 import 'package:googleapis/common/common.dart' as common; |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; |
| 13 import '../common/common_internal_test.dart' as common_test; |
| 14 |
| 15 import 'package:googleapis/gamesconfiguration/v1configuration.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterAchievementConfiguration = 0; |
| 20 buildAchievementConfiguration() { |
| 21 var o = new api.AchievementConfiguration(); |
| 22 buildCounterAchievementConfiguration++; |
| 23 if (buildCounterAchievementConfiguration < 3) { |
| 24 o.achievementType = "foo"; |
| 25 o.draft = buildAchievementConfigurationDetail(); |
| 26 o.id = "foo"; |
| 27 o.initialState = "foo"; |
| 28 o.kind = "foo"; |
| 29 o.published = buildAchievementConfigurationDetail(); |
| 30 o.stepsToUnlock = 42; |
| 31 o.token = "foo"; |
| 32 } |
| 33 buildCounterAchievementConfiguration--; |
| 34 return o; |
| 35 } |
| 36 |
| 37 checkAchievementConfiguration(api.AchievementConfiguration o) { |
| 38 buildCounterAchievementConfiguration++; |
| 39 if (buildCounterAchievementConfiguration < 3) { |
| 40 unittest.expect(o.achievementType, unittest.equals('foo')); |
| 41 checkAchievementConfigurationDetail(o.draft); |
| 42 unittest.expect(o.id, unittest.equals('foo')); |
| 43 unittest.expect(o.initialState, unittest.equals('foo')); |
| 44 unittest.expect(o.kind, unittest.equals('foo')); |
| 45 checkAchievementConfigurationDetail(o.published); |
| 46 unittest.expect(o.stepsToUnlock, unittest.equals(42)); |
| 47 unittest.expect(o.token, unittest.equals('foo')); |
| 48 } |
| 49 buildCounterAchievementConfiguration--; |
| 50 } |
| 51 |
| 52 core.int buildCounterAchievementConfigurationDetail = 0; |
| 53 buildAchievementConfigurationDetail() { |
| 54 var o = new api.AchievementConfigurationDetail(); |
| 55 buildCounterAchievementConfigurationDetail++; |
| 56 if (buildCounterAchievementConfigurationDetail < 3) { |
| 57 o.description = buildLocalizedStringBundle(); |
| 58 o.iconUrl = "foo"; |
| 59 o.kind = "foo"; |
| 60 o.name = buildLocalizedStringBundle(); |
| 61 o.pointValue = 42; |
| 62 o.sortRank = 42; |
| 63 } |
| 64 buildCounterAchievementConfigurationDetail--; |
| 65 return o; |
| 66 } |
| 67 |
| 68 checkAchievementConfigurationDetail(api.AchievementConfigurationDetail o) { |
| 69 buildCounterAchievementConfigurationDetail++; |
| 70 if (buildCounterAchievementConfigurationDetail < 3) { |
| 71 checkLocalizedStringBundle(o.description); |
| 72 unittest.expect(o.iconUrl, unittest.equals('foo')); |
| 73 unittest.expect(o.kind, unittest.equals('foo')); |
| 74 checkLocalizedStringBundle(o.name); |
| 75 unittest.expect(o.pointValue, unittest.equals(42)); |
| 76 unittest.expect(o.sortRank, unittest.equals(42)); |
| 77 } |
| 78 buildCounterAchievementConfigurationDetail--; |
| 79 } |
| 80 |
| 81 buildUnnamed1124() { |
| 82 var o = new core.List<api.AchievementConfiguration>(); |
| 83 o.add(buildAchievementConfiguration()); |
| 84 o.add(buildAchievementConfiguration()); |
| 85 return o; |
| 86 } |
| 87 |
| 88 checkUnnamed1124(core.List<api.AchievementConfiguration> o) { |
| 89 unittest.expect(o, unittest.hasLength(2)); |
| 90 checkAchievementConfiguration(o[0]); |
| 91 checkAchievementConfiguration(o[1]); |
| 92 } |
| 93 |
| 94 core.int buildCounterAchievementConfigurationListResponse = 0; |
| 95 buildAchievementConfigurationListResponse() { |
| 96 var o = new api.AchievementConfigurationListResponse(); |
| 97 buildCounterAchievementConfigurationListResponse++; |
| 98 if (buildCounterAchievementConfigurationListResponse < 3) { |
| 99 o.items = buildUnnamed1124(); |
| 100 o.kind = "foo"; |
| 101 o.nextPageToken = "foo"; |
| 102 } |
| 103 buildCounterAchievementConfigurationListResponse--; |
| 104 return o; |
| 105 } |
| 106 |
| 107 checkAchievementConfigurationListResponse(api.AchievementConfigurationListRespon
se o) { |
| 108 buildCounterAchievementConfigurationListResponse++; |
| 109 if (buildCounterAchievementConfigurationListResponse < 3) { |
| 110 checkUnnamed1124(o.items); |
| 111 unittest.expect(o.kind, unittest.equals('foo')); |
| 112 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 113 } |
| 114 buildCounterAchievementConfigurationListResponse--; |
| 115 } |
| 116 |
| 117 core.int buildCounterGamesNumberAffixConfiguration = 0; |
| 118 buildGamesNumberAffixConfiguration() { |
| 119 var o = new api.GamesNumberAffixConfiguration(); |
| 120 buildCounterGamesNumberAffixConfiguration++; |
| 121 if (buildCounterGamesNumberAffixConfiguration < 3) { |
| 122 o.few = buildLocalizedStringBundle(); |
| 123 o.many = buildLocalizedStringBundle(); |
| 124 o.one = buildLocalizedStringBundle(); |
| 125 o.other = buildLocalizedStringBundle(); |
| 126 o.two = buildLocalizedStringBundle(); |
| 127 o.zero = buildLocalizedStringBundle(); |
| 128 } |
| 129 buildCounterGamesNumberAffixConfiguration--; |
| 130 return o; |
| 131 } |
| 132 |
| 133 checkGamesNumberAffixConfiguration(api.GamesNumberAffixConfiguration o) { |
| 134 buildCounterGamesNumberAffixConfiguration++; |
| 135 if (buildCounterGamesNumberAffixConfiguration < 3) { |
| 136 checkLocalizedStringBundle(o.few); |
| 137 checkLocalizedStringBundle(o.many); |
| 138 checkLocalizedStringBundle(o.one); |
| 139 checkLocalizedStringBundle(o.other); |
| 140 checkLocalizedStringBundle(o.two); |
| 141 checkLocalizedStringBundle(o.zero); |
| 142 } |
| 143 buildCounterGamesNumberAffixConfiguration--; |
| 144 } |
| 145 |
| 146 core.int buildCounterGamesNumberFormatConfiguration = 0; |
| 147 buildGamesNumberFormatConfiguration() { |
| 148 var o = new api.GamesNumberFormatConfiguration(); |
| 149 buildCounterGamesNumberFormatConfiguration++; |
| 150 if (buildCounterGamesNumberFormatConfiguration < 3) { |
| 151 o.currencyCode = "foo"; |
| 152 o.numDecimalPlaces = 42; |
| 153 o.numberFormatType = "foo"; |
| 154 o.suffix = buildGamesNumberAffixConfiguration(); |
| 155 } |
| 156 buildCounterGamesNumberFormatConfiguration--; |
| 157 return o; |
| 158 } |
| 159 |
| 160 checkGamesNumberFormatConfiguration(api.GamesNumberFormatConfiguration o) { |
| 161 buildCounterGamesNumberFormatConfiguration++; |
| 162 if (buildCounterGamesNumberFormatConfiguration < 3) { |
| 163 unittest.expect(o.currencyCode, unittest.equals('foo')); |
| 164 unittest.expect(o.numDecimalPlaces, unittest.equals(42)); |
| 165 unittest.expect(o.numberFormatType, unittest.equals('foo')); |
| 166 checkGamesNumberAffixConfiguration(o.suffix); |
| 167 } |
| 168 buildCounterGamesNumberFormatConfiguration--; |
| 169 } |
| 170 |
| 171 core.int buildCounterImageConfiguration = 0; |
| 172 buildImageConfiguration() { |
| 173 var o = new api.ImageConfiguration(); |
| 174 buildCounterImageConfiguration++; |
| 175 if (buildCounterImageConfiguration < 3) { |
| 176 o.imageType = "foo"; |
| 177 o.kind = "foo"; |
| 178 o.resourceId = "foo"; |
| 179 o.url = "foo"; |
| 180 } |
| 181 buildCounterImageConfiguration--; |
| 182 return o; |
| 183 } |
| 184 |
| 185 checkImageConfiguration(api.ImageConfiguration o) { |
| 186 buildCounterImageConfiguration++; |
| 187 if (buildCounterImageConfiguration < 3) { |
| 188 unittest.expect(o.imageType, unittest.equals('foo')); |
| 189 unittest.expect(o.kind, unittest.equals('foo')); |
| 190 unittest.expect(o.resourceId, unittest.equals('foo')); |
| 191 unittest.expect(o.url, unittest.equals('foo')); |
| 192 } |
| 193 buildCounterImageConfiguration--; |
| 194 } |
| 195 |
| 196 core.int buildCounterLeaderboardConfiguration = 0; |
| 197 buildLeaderboardConfiguration() { |
| 198 var o = new api.LeaderboardConfiguration(); |
| 199 buildCounterLeaderboardConfiguration++; |
| 200 if (buildCounterLeaderboardConfiguration < 3) { |
| 201 o.draft = buildLeaderboardConfigurationDetail(); |
| 202 o.id = "foo"; |
| 203 o.kind = "foo"; |
| 204 o.published = buildLeaderboardConfigurationDetail(); |
| 205 o.scoreMax = "foo"; |
| 206 o.scoreMin = "foo"; |
| 207 o.scoreOrder = "foo"; |
| 208 o.token = "foo"; |
| 209 } |
| 210 buildCounterLeaderboardConfiguration--; |
| 211 return o; |
| 212 } |
| 213 |
| 214 checkLeaderboardConfiguration(api.LeaderboardConfiguration o) { |
| 215 buildCounterLeaderboardConfiguration++; |
| 216 if (buildCounterLeaderboardConfiguration < 3) { |
| 217 checkLeaderboardConfigurationDetail(o.draft); |
| 218 unittest.expect(o.id, unittest.equals('foo')); |
| 219 unittest.expect(o.kind, unittest.equals('foo')); |
| 220 checkLeaderboardConfigurationDetail(o.published); |
| 221 unittest.expect(o.scoreMax, unittest.equals('foo')); |
| 222 unittest.expect(o.scoreMin, unittest.equals('foo')); |
| 223 unittest.expect(o.scoreOrder, unittest.equals('foo')); |
| 224 unittest.expect(o.token, unittest.equals('foo')); |
| 225 } |
| 226 buildCounterLeaderboardConfiguration--; |
| 227 } |
| 228 |
| 229 core.int buildCounterLeaderboardConfigurationDetail = 0; |
| 230 buildLeaderboardConfigurationDetail() { |
| 231 var o = new api.LeaderboardConfigurationDetail(); |
| 232 buildCounterLeaderboardConfigurationDetail++; |
| 233 if (buildCounterLeaderboardConfigurationDetail < 3) { |
| 234 o.iconUrl = "foo"; |
| 235 o.kind = "foo"; |
| 236 o.name = buildLocalizedStringBundle(); |
| 237 o.scoreFormat = buildGamesNumberFormatConfiguration(); |
| 238 o.sortRank = 42; |
| 239 } |
| 240 buildCounterLeaderboardConfigurationDetail--; |
| 241 return o; |
| 242 } |
| 243 |
| 244 checkLeaderboardConfigurationDetail(api.LeaderboardConfigurationDetail o) { |
| 245 buildCounterLeaderboardConfigurationDetail++; |
| 246 if (buildCounterLeaderboardConfigurationDetail < 3) { |
| 247 unittest.expect(o.iconUrl, unittest.equals('foo')); |
| 248 unittest.expect(o.kind, unittest.equals('foo')); |
| 249 checkLocalizedStringBundle(o.name); |
| 250 checkGamesNumberFormatConfiguration(o.scoreFormat); |
| 251 unittest.expect(o.sortRank, unittest.equals(42)); |
| 252 } |
| 253 buildCounterLeaderboardConfigurationDetail--; |
| 254 } |
| 255 |
| 256 buildUnnamed1125() { |
| 257 var o = new core.List<api.LeaderboardConfiguration>(); |
| 258 o.add(buildLeaderboardConfiguration()); |
| 259 o.add(buildLeaderboardConfiguration()); |
| 260 return o; |
| 261 } |
| 262 |
| 263 checkUnnamed1125(core.List<api.LeaderboardConfiguration> o) { |
| 264 unittest.expect(o, unittest.hasLength(2)); |
| 265 checkLeaderboardConfiguration(o[0]); |
| 266 checkLeaderboardConfiguration(o[1]); |
| 267 } |
| 268 |
| 269 core.int buildCounterLeaderboardConfigurationListResponse = 0; |
| 270 buildLeaderboardConfigurationListResponse() { |
| 271 var o = new api.LeaderboardConfigurationListResponse(); |
| 272 buildCounterLeaderboardConfigurationListResponse++; |
| 273 if (buildCounterLeaderboardConfigurationListResponse < 3) { |
| 274 o.items = buildUnnamed1125(); |
| 275 o.kind = "foo"; |
| 276 o.nextPageToken = "foo"; |
| 277 } |
| 278 buildCounterLeaderboardConfigurationListResponse--; |
| 279 return o; |
| 280 } |
| 281 |
| 282 checkLeaderboardConfigurationListResponse(api.LeaderboardConfigurationListRespon
se o) { |
| 283 buildCounterLeaderboardConfigurationListResponse++; |
| 284 if (buildCounterLeaderboardConfigurationListResponse < 3) { |
| 285 checkUnnamed1125(o.items); |
| 286 unittest.expect(o.kind, unittest.equals('foo')); |
| 287 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 288 } |
| 289 buildCounterLeaderboardConfigurationListResponse--; |
| 290 } |
| 291 |
| 292 core.int buildCounterLocalizedString = 0; |
| 293 buildLocalizedString() { |
| 294 var o = new api.LocalizedString(); |
| 295 buildCounterLocalizedString++; |
| 296 if (buildCounterLocalizedString < 3) { |
| 297 o.kind = "foo"; |
| 298 o.locale = "foo"; |
| 299 o.value = "foo"; |
| 300 } |
| 301 buildCounterLocalizedString--; |
| 302 return o; |
| 303 } |
| 304 |
| 305 checkLocalizedString(api.LocalizedString o) { |
| 306 buildCounterLocalizedString++; |
| 307 if (buildCounterLocalizedString < 3) { |
| 308 unittest.expect(o.kind, unittest.equals('foo')); |
| 309 unittest.expect(o.locale, unittest.equals('foo')); |
| 310 unittest.expect(o.value, unittest.equals('foo')); |
| 311 } |
| 312 buildCounterLocalizedString--; |
| 313 } |
| 314 |
| 315 buildUnnamed1126() { |
| 316 var o = new core.List<api.LocalizedString>(); |
| 317 o.add(buildLocalizedString()); |
| 318 o.add(buildLocalizedString()); |
| 319 return o; |
| 320 } |
| 321 |
| 322 checkUnnamed1126(core.List<api.LocalizedString> o) { |
| 323 unittest.expect(o, unittest.hasLength(2)); |
| 324 checkLocalizedString(o[0]); |
| 325 checkLocalizedString(o[1]); |
| 326 } |
| 327 |
| 328 core.int buildCounterLocalizedStringBundle = 0; |
| 329 buildLocalizedStringBundle() { |
| 330 var o = new api.LocalizedStringBundle(); |
| 331 buildCounterLocalizedStringBundle++; |
| 332 if (buildCounterLocalizedStringBundle < 3) { |
| 333 o.kind = "foo"; |
| 334 o.translations = buildUnnamed1126(); |
| 335 } |
| 336 buildCounterLocalizedStringBundle--; |
| 337 return o; |
| 338 } |
| 339 |
| 340 checkLocalizedStringBundle(api.LocalizedStringBundle o) { |
| 341 buildCounterLocalizedStringBundle++; |
| 342 if (buildCounterLocalizedStringBundle < 3) { |
| 343 unittest.expect(o.kind, unittest.equals('foo')); |
| 344 checkUnnamed1126(o.translations); |
| 345 } |
| 346 buildCounterLocalizedStringBundle--; |
| 347 } |
| 348 |
| 349 |
| 350 main() { |
| 351 unittest.group("obj-schema-AchievementConfiguration", () { |
| 352 unittest.test("to-json--from-json", () { |
| 353 var o = buildAchievementConfiguration(); |
| 354 var od = new api.AchievementConfiguration.fromJson(o.toJson()); |
| 355 checkAchievementConfiguration(od); |
| 356 }); |
| 357 }); |
| 358 |
| 359 |
| 360 unittest.group("obj-schema-AchievementConfigurationDetail", () { |
| 361 unittest.test("to-json--from-json", () { |
| 362 var o = buildAchievementConfigurationDetail(); |
| 363 var od = new api.AchievementConfigurationDetail.fromJson(o.toJson()); |
| 364 checkAchievementConfigurationDetail(od); |
| 365 }); |
| 366 }); |
| 367 |
| 368 |
| 369 unittest.group("obj-schema-AchievementConfigurationListResponse", () { |
| 370 unittest.test("to-json--from-json", () { |
| 371 var o = buildAchievementConfigurationListResponse(); |
| 372 var od = new api.AchievementConfigurationListResponse.fromJson(o.toJson())
; |
| 373 checkAchievementConfigurationListResponse(od); |
| 374 }); |
| 375 }); |
| 376 |
| 377 |
| 378 unittest.group("obj-schema-GamesNumberAffixConfiguration", () { |
| 379 unittest.test("to-json--from-json", () { |
| 380 var o = buildGamesNumberAffixConfiguration(); |
| 381 var od = new api.GamesNumberAffixConfiguration.fromJson(o.toJson()); |
| 382 checkGamesNumberAffixConfiguration(od); |
| 383 }); |
| 384 }); |
| 385 |
| 386 |
| 387 unittest.group("obj-schema-GamesNumberFormatConfiguration", () { |
| 388 unittest.test("to-json--from-json", () { |
| 389 var o = buildGamesNumberFormatConfiguration(); |
| 390 var od = new api.GamesNumberFormatConfiguration.fromJson(o.toJson()); |
| 391 checkGamesNumberFormatConfiguration(od); |
| 392 }); |
| 393 }); |
| 394 |
| 395 |
| 396 unittest.group("obj-schema-ImageConfiguration", () { |
| 397 unittest.test("to-json--from-json", () { |
| 398 var o = buildImageConfiguration(); |
| 399 var od = new api.ImageConfiguration.fromJson(o.toJson()); |
| 400 checkImageConfiguration(od); |
| 401 }); |
| 402 }); |
| 403 |
| 404 |
| 405 unittest.group("obj-schema-LeaderboardConfiguration", () { |
| 406 unittest.test("to-json--from-json", () { |
| 407 var o = buildLeaderboardConfiguration(); |
| 408 var od = new api.LeaderboardConfiguration.fromJson(o.toJson()); |
| 409 checkLeaderboardConfiguration(od); |
| 410 }); |
| 411 }); |
| 412 |
| 413 |
| 414 unittest.group("obj-schema-LeaderboardConfigurationDetail", () { |
| 415 unittest.test("to-json--from-json", () { |
| 416 var o = buildLeaderboardConfigurationDetail(); |
| 417 var od = new api.LeaderboardConfigurationDetail.fromJson(o.toJson()); |
| 418 checkLeaderboardConfigurationDetail(od); |
| 419 }); |
| 420 }); |
| 421 |
| 422 |
| 423 unittest.group("obj-schema-LeaderboardConfigurationListResponse", () { |
| 424 unittest.test("to-json--from-json", () { |
| 425 var o = buildLeaderboardConfigurationListResponse(); |
| 426 var od = new api.LeaderboardConfigurationListResponse.fromJson(o.toJson())
; |
| 427 checkLeaderboardConfigurationListResponse(od); |
| 428 }); |
| 429 }); |
| 430 |
| 431 |
| 432 unittest.group("obj-schema-LocalizedString", () { |
| 433 unittest.test("to-json--from-json", () { |
| 434 var o = buildLocalizedString(); |
| 435 var od = new api.LocalizedString.fromJson(o.toJson()); |
| 436 checkLocalizedString(od); |
| 437 }); |
| 438 }); |
| 439 |
| 440 |
| 441 unittest.group("obj-schema-LocalizedStringBundle", () { |
| 442 unittest.test("to-json--from-json", () { |
| 443 var o = buildLocalizedStringBundle(); |
| 444 var od = new api.LocalizedStringBundle.fromJson(o.toJson()); |
| 445 checkLocalizedStringBundle(od); |
| 446 }); |
| 447 }); |
| 448 |
| 449 |
| 450 unittest.group("resource-AchievementConfigurationsResourceApi", () { |
| 451 unittest.test("method--delete", () { |
| 452 |
| 453 var mock = new common_test.HttpServerMock(); |
| 454 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 455 var arg_achievementId = "foo"; |
| 456 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 457 var path = (req.url).path; |
| 458 var pathOffset = 0; |
| 459 var index; |
| 460 var subPart; |
| 461 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 462 pathOffset += 1; |
| 463 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 464 pathOffset += 22; |
| 465 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); |
| 466 pathOffset += 13; |
| 467 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 468 pathOffset = path.length; |
| 469 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 470 |
| 471 var query = (req.url).query; |
| 472 var queryOffset = 0; |
| 473 var queryMap = {}; |
| 474 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 475 parseBool(n) { |
| 476 if (n == "true") return true; |
| 477 if (n == "false") return false; |
| 478 if (n == null) return null; |
| 479 throw new core.ArgumentError("Invalid boolean: $n"); |
| 480 } |
| 481 if (query.length > 0) { |
| 482 for (var part in query.split("&")) { |
| 483 var keyvalue = part.split("="); |
| 484 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 485 } |
| 486 } |
| 487 |
| 488 |
| 489 var h = { |
| 490 "content-type" : "application/json; charset=utf-8", |
| 491 }; |
| 492 var resp = ""; |
| 493 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 494 }), true); |
| 495 res.delete(arg_achievementId).then(unittest.expectAsync((_) {})); |
| 496 }); |
| 497 |
| 498 unittest.test("method--get", () { |
| 499 |
| 500 var mock = new common_test.HttpServerMock(); |
| 501 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 502 var arg_achievementId = "foo"; |
| 503 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 504 var path = (req.url).path; |
| 505 var pathOffset = 0; |
| 506 var index; |
| 507 var subPart; |
| 508 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 509 pathOffset += 1; |
| 510 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 511 pathOffset += 22; |
| 512 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); |
| 513 pathOffset += 13; |
| 514 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 515 pathOffset = path.length; |
| 516 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 517 |
| 518 var query = (req.url).query; |
| 519 var queryOffset = 0; |
| 520 var queryMap = {}; |
| 521 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 522 parseBool(n) { |
| 523 if (n == "true") return true; |
| 524 if (n == "false") return false; |
| 525 if (n == null) return null; |
| 526 throw new core.ArgumentError("Invalid boolean: $n"); |
| 527 } |
| 528 if (query.length > 0) { |
| 529 for (var part in query.split("&")) { |
| 530 var keyvalue = part.split("="); |
| 531 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 532 } |
| 533 } |
| 534 |
| 535 |
| 536 var h = { |
| 537 "content-type" : "application/json; charset=utf-8", |
| 538 }; |
| 539 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 540 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 541 }), true); |
| 542 res.get(arg_achievementId).then(unittest.expectAsync(((api.AchievementConf
iguration response) { |
| 543 checkAchievementConfiguration(response); |
| 544 }))); |
| 545 }); |
| 546 |
| 547 unittest.test("method--insert", () { |
| 548 |
| 549 var mock = new common_test.HttpServerMock(); |
| 550 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 551 var arg_request = buildAchievementConfiguration(); |
| 552 var arg_applicationId = "foo"; |
| 553 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 554 var obj = new api.AchievementConfiguration.fromJson(json); |
| 555 checkAchievementConfiguration(obj); |
| 556 |
| 557 var path = (req.url).path; |
| 558 var pathOffset = 0; |
| 559 var index; |
| 560 var subPart; |
| 561 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 562 pathOffset += 1; |
| 563 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 564 pathOffset += 22; |
| 565 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); |
| 566 pathOffset += 13; |
| 567 index = path.indexOf("/achievements", pathOffset); |
| 568 unittest.expect(index >= 0, unittest.isTrue); |
| 569 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 570 pathOffset = index; |
| 571 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 572 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/achievements")); |
| 573 pathOffset += 13; |
| 574 |
| 575 var query = (req.url).query; |
| 576 var queryOffset = 0; |
| 577 var queryMap = {}; |
| 578 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 579 parseBool(n) { |
| 580 if (n == "true") return true; |
| 581 if (n == "false") return false; |
| 582 if (n == null) return null; |
| 583 throw new core.ArgumentError("Invalid boolean: $n"); |
| 584 } |
| 585 if (query.length > 0) { |
| 586 for (var part in query.split("&")) { |
| 587 var keyvalue = part.split("="); |
| 588 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 589 } |
| 590 } |
| 591 |
| 592 |
| 593 var h = { |
| 594 "content-type" : "application/json; charset=utf-8", |
| 595 }; |
| 596 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 597 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 598 }), true); |
| 599 res.insert(arg_request, arg_applicationId).then(unittest.expectAsync(((api
.AchievementConfiguration response) { |
| 600 checkAchievementConfiguration(response); |
| 601 }))); |
| 602 }); |
| 603 |
| 604 unittest.test("method--list", () { |
| 605 |
| 606 var mock = new common_test.HttpServerMock(); |
| 607 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 608 var arg_applicationId = "foo"; |
| 609 var arg_maxResults = 42; |
| 610 var arg_pageToken = "foo"; |
| 611 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 612 var path = (req.url).path; |
| 613 var pathOffset = 0; |
| 614 var index; |
| 615 var subPart; |
| 616 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 617 pathOffset += 1; |
| 618 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 619 pathOffset += 22; |
| 620 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); |
| 621 pathOffset += 13; |
| 622 index = path.indexOf("/achievements", pathOffset); |
| 623 unittest.expect(index >= 0, unittest.isTrue); |
| 624 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 625 pathOffset = index; |
| 626 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 627 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/achievements")); |
| 628 pathOffset += 13; |
| 629 |
| 630 var query = (req.url).query; |
| 631 var queryOffset = 0; |
| 632 var queryMap = {}; |
| 633 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 634 parseBool(n) { |
| 635 if (n == "true") return true; |
| 636 if (n == "false") return false; |
| 637 if (n == null) return null; |
| 638 throw new core.ArgumentError("Invalid boolean: $n"); |
| 639 } |
| 640 if (query.length > 0) { |
| 641 for (var part in query.split("&")) { |
| 642 var keyvalue = part.split("="); |
| 643 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 644 } |
| 645 } |
| 646 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 647 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 648 |
| 649 |
| 650 var h = { |
| 651 "content-type" : "application/json; charset=utf-8", |
| 652 }; |
| 653 var resp = convert.JSON.encode(buildAchievementConfigurationListResponse
()); |
| 654 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 655 }), true); |
| 656 res.list(arg_applicationId, maxResults: arg_maxResults, pageToken: arg_pag
eToken).then(unittest.expectAsync(((api.AchievementConfigurationListResponse res
ponse) { |
| 657 checkAchievementConfigurationListResponse(response); |
| 658 }))); |
| 659 }); |
| 660 |
| 661 unittest.test("method--patch", () { |
| 662 |
| 663 var mock = new common_test.HttpServerMock(); |
| 664 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 665 var arg_request = buildAchievementConfiguration(); |
| 666 var arg_achievementId = "foo"; |
| 667 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 668 var obj = new api.AchievementConfiguration.fromJson(json); |
| 669 checkAchievementConfiguration(obj); |
| 670 |
| 671 var path = (req.url).path; |
| 672 var pathOffset = 0; |
| 673 var index; |
| 674 var subPart; |
| 675 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 676 pathOffset += 1; |
| 677 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 678 pathOffset += 22; |
| 679 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); |
| 680 pathOffset += 13; |
| 681 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 682 pathOffset = path.length; |
| 683 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 684 |
| 685 var query = (req.url).query; |
| 686 var queryOffset = 0; |
| 687 var queryMap = {}; |
| 688 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 689 parseBool(n) { |
| 690 if (n == "true") return true; |
| 691 if (n == "false") return false; |
| 692 if (n == null) return null; |
| 693 throw new core.ArgumentError("Invalid boolean: $n"); |
| 694 } |
| 695 if (query.length > 0) { |
| 696 for (var part in query.split("&")) { |
| 697 var keyvalue = part.split("="); |
| 698 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 699 } |
| 700 } |
| 701 |
| 702 |
| 703 var h = { |
| 704 "content-type" : "application/json; charset=utf-8", |
| 705 }; |
| 706 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 707 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 708 }), true); |
| 709 res.patch(arg_request, arg_achievementId).then(unittest.expectAsync(((api.
AchievementConfiguration response) { |
| 710 checkAchievementConfiguration(response); |
| 711 }))); |
| 712 }); |
| 713 |
| 714 unittest.test("method--update", () { |
| 715 |
| 716 var mock = new common_test.HttpServerMock(); |
| 717 api.AchievementConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).achievementConfigurations; |
| 718 var arg_request = buildAchievementConfiguration(); |
| 719 var arg_achievementId = "foo"; |
| 720 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 721 var obj = new api.AchievementConfiguration.fromJson(json); |
| 722 checkAchievementConfiguration(obj); |
| 723 |
| 724 var path = (req.url).path; |
| 725 var pathOffset = 0; |
| 726 var index; |
| 727 var subPart; |
| 728 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 729 pathOffset += 1; |
| 730 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 731 pathOffset += 22; |
| 732 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("achievements/")); |
| 733 pathOffset += 13; |
| 734 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 735 pathOffset = path.length; |
| 736 unittest.expect(subPart, unittest.equals("$arg_achievementId")); |
| 737 |
| 738 var query = (req.url).query; |
| 739 var queryOffset = 0; |
| 740 var queryMap = {}; |
| 741 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 742 parseBool(n) { |
| 743 if (n == "true") return true; |
| 744 if (n == "false") return false; |
| 745 if (n == null) return null; |
| 746 throw new core.ArgumentError("Invalid boolean: $n"); |
| 747 } |
| 748 if (query.length > 0) { |
| 749 for (var part in query.split("&")) { |
| 750 var keyvalue = part.split("="); |
| 751 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 752 } |
| 753 } |
| 754 |
| 755 |
| 756 var h = { |
| 757 "content-type" : "application/json; charset=utf-8", |
| 758 }; |
| 759 var resp = convert.JSON.encode(buildAchievementConfiguration()); |
| 760 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 761 }), true); |
| 762 res.update(arg_request, arg_achievementId).then(unittest.expectAsync(((api
.AchievementConfiguration response) { |
| 763 checkAchievementConfiguration(response); |
| 764 }))); |
| 765 }); |
| 766 |
| 767 }); |
| 768 |
| 769 |
| 770 unittest.group("resource-ImageConfigurationsResourceApi", () { |
| 771 unittest.test("method--upload", () { |
| 772 // TODO: Implement tests for media upload; |
| 773 // TODO: Implement tests for media download; |
| 774 |
| 775 var mock = new common_test.HttpServerMock(); |
| 776 api.ImageConfigurationsResourceApi res = new api.GamesConfigurationApi(moc
k).imageConfigurations; |
| 777 var arg_resourceId = "foo"; |
| 778 var arg_imageType = "foo"; |
| 779 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 780 var path = (req.url).path; |
| 781 var pathOffset = 0; |
| 782 var index; |
| 783 var subPart; |
| 784 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 785 pathOffset += 1; |
| 786 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 787 pathOffset += 22; |
| 788 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("images/")); |
| 789 pathOffset += 7; |
| 790 index = path.indexOf("/imageType/", pathOffset); |
| 791 unittest.expect(index >= 0, unittest.isTrue); |
| 792 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 793 pathOffset = index; |
| 794 unittest.expect(subPart, unittest.equals("$arg_resourceId")); |
| 795 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/imageType/")); |
| 796 pathOffset += 11; |
| 797 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 798 pathOffset = path.length; |
| 799 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 800 |
| 801 var query = (req.url).query; |
| 802 var queryOffset = 0; |
| 803 var queryMap = {}; |
| 804 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 805 parseBool(n) { |
| 806 if (n == "true") return true; |
| 807 if (n == "false") return false; |
| 808 if (n == null) return null; |
| 809 throw new core.ArgumentError("Invalid boolean: $n"); |
| 810 } |
| 811 if (query.length > 0) { |
| 812 for (var part in query.split("&")) { |
| 813 var keyvalue = part.split("="); |
| 814 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 815 } |
| 816 } |
| 817 |
| 818 |
| 819 var h = { |
| 820 "content-type" : "application/json; charset=utf-8", |
| 821 }; |
| 822 var resp = convert.JSON.encode(buildImageConfiguration()); |
| 823 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 824 }), true); |
| 825 res.upload(arg_resourceId, arg_imageType).then(unittest.expectAsync(((api.
ImageConfiguration response) { |
| 826 checkImageConfiguration(response); |
| 827 }))); |
| 828 }); |
| 829 |
| 830 }); |
| 831 |
| 832 |
| 833 unittest.group("resource-LeaderboardConfigurationsResourceApi", () { |
| 834 unittest.test("method--delete", () { |
| 835 |
| 836 var mock = new common_test.HttpServerMock(); |
| 837 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 838 var arg_leaderboardId = "foo"; |
| 839 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 840 var path = (req.url).path; |
| 841 var pathOffset = 0; |
| 842 var index; |
| 843 var subPart; |
| 844 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 845 pathOffset += 1; |
| 846 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 847 pathOffset += 22; |
| 848 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); |
| 849 pathOffset += 13; |
| 850 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 851 pathOffset = path.length; |
| 852 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 853 |
| 854 var query = (req.url).query; |
| 855 var queryOffset = 0; |
| 856 var queryMap = {}; |
| 857 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 858 parseBool(n) { |
| 859 if (n == "true") return true; |
| 860 if (n == "false") return false; |
| 861 if (n == null) return null; |
| 862 throw new core.ArgumentError("Invalid boolean: $n"); |
| 863 } |
| 864 if (query.length > 0) { |
| 865 for (var part in query.split("&")) { |
| 866 var keyvalue = part.split("="); |
| 867 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 868 } |
| 869 } |
| 870 |
| 871 |
| 872 var h = { |
| 873 "content-type" : "application/json; charset=utf-8", |
| 874 }; |
| 875 var resp = ""; |
| 876 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 877 }), true); |
| 878 res.delete(arg_leaderboardId).then(unittest.expectAsync((_) {})); |
| 879 }); |
| 880 |
| 881 unittest.test("method--get", () { |
| 882 |
| 883 var mock = new common_test.HttpServerMock(); |
| 884 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 885 var arg_leaderboardId = "foo"; |
| 886 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 887 var path = (req.url).path; |
| 888 var pathOffset = 0; |
| 889 var index; |
| 890 var subPart; |
| 891 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 892 pathOffset += 1; |
| 893 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 894 pathOffset += 22; |
| 895 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); |
| 896 pathOffset += 13; |
| 897 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 898 pathOffset = path.length; |
| 899 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 900 |
| 901 var query = (req.url).query; |
| 902 var queryOffset = 0; |
| 903 var queryMap = {}; |
| 904 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 905 parseBool(n) { |
| 906 if (n == "true") return true; |
| 907 if (n == "false") return false; |
| 908 if (n == null) return null; |
| 909 throw new core.ArgumentError("Invalid boolean: $n"); |
| 910 } |
| 911 if (query.length > 0) { |
| 912 for (var part in query.split("&")) { |
| 913 var keyvalue = part.split("="); |
| 914 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 915 } |
| 916 } |
| 917 |
| 918 |
| 919 var h = { |
| 920 "content-type" : "application/json; charset=utf-8", |
| 921 }; |
| 922 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 923 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 924 }), true); |
| 925 res.get(arg_leaderboardId).then(unittest.expectAsync(((api.LeaderboardConf
iguration response) { |
| 926 checkLeaderboardConfiguration(response); |
| 927 }))); |
| 928 }); |
| 929 |
| 930 unittest.test("method--insert", () { |
| 931 |
| 932 var mock = new common_test.HttpServerMock(); |
| 933 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 934 var arg_request = buildLeaderboardConfiguration(); |
| 935 var arg_applicationId = "foo"; |
| 936 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 937 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 938 checkLeaderboardConfiguration(obj); |
| 939 |
| 940 var path = (req.url).path; |
| 941 var pathOffset = 0; |
| 942 var index; |
| 943 var subPart; |
| 944 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 945 pathOffset += 1; |
| 946 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 947 pathOffset += 22; |
| 948 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); |
| 949 pathOffset += 13; |
| 950 index = path.indexOf("/leaderboards", pathOffset); |
| 951 unittest.expect(index >= 0, unittest.isTrue); |
| 952 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 953 pathOffset = index; |
| 954 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 955 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/leaderboards")); |
| 956 pathOffset += 13; |
| 957 |
| 958 var query = (req.url).query; |
| 959 var queryOffset = 0; |
| 960 var queryMap = {}; |
| 961 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 962 parseBool(n) { |
| 963 if (n == "true") return true; |
| 964 if (n == "false") return false; |
| 965 if (n == null) return null; |
| 966 throw new core.ArgumentError("Invalid boolean: $n"); |
| 967 } |
| 968 if (query.length > 0) { |
| 969 for (var part in query.split("&")) { |
| 970 var keyvalue = part.split("="); |
| 971 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 972 } |
| 973 } |
| 974 |
| 975 |
| 976 var h = { |
| 977 "content-type" : "application/json; charset=utf-8", |
| 978 }; |
| 979 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 980 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 981 }), true); |
| 982 res.insert(arg_request, arg_applicationId).then(unittest.expectAsync(((api
.LeaderboardConfiguration response) { |
| 983 checkLeaderboardConfiguration(response); |
| 984 }))); |
| 985 }); |
| 986 |
| 987 unittest.test("method--list", () { |
| 988 |
| 989 var mock = new common_test.HttpServerMock(); |
| 990 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 991 var arg_applicationId = "foo"; |
| 992 var arg_maxResults = 42; |
| 993 var arg_pageToken = "foo"; |
| 994 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 995 var path = (req.url).path; |
| 996 var pathOffset = 0; |
| 997 var index; |
| 998 var subPart; |
| 999 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1000 pathOffset += 1; |
| 1001 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 1002 pathOffset += 22; |
| 1003 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("applications/")); |
| 1004 pathOffset += 13; |
| 1005 index = path.indexOf("/leaderboards", pathOffset); |
| 1006 unittest.expect(index >= 0, unittest.isTrue); |
| 1007 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1008 pathOffset = index; |
| 1009 unittest.expect(subPart, unittest.equals("$arg_applicationId")); |
| 1010 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/leaderboards")); |
| 1011 pathOffset += 13; |
| 1012 |
| 1013 var query = (req.url).query; |
| 1014 var queryOffset = 0; |
| 1015 var queryMap = {}; |
| 1016 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1017 parseBool(n) { |
| 1018 if (n == "true") return true; |
| 1019 if (n == "false") return false; |
| 1020 if (n == null) return null; |
| 1021 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1022 } |
| 1023 if (query.length > 0) { |
| 1024 for (var part in query.split("&")) { |
| 1025 var keyvalue = part.split("="); |
| 1026 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1027 } |
| 1028 } |
| 1029 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1030 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1031 |
| 1032 |
| 1033 var h = { |
| 1034 "content-type" : "application/json; charset=utf-8", |
| 1035 }; |
| 1036 var resp = convert.JSON.encode(buildLeaderboardConfigurationListResponse
()); |
| 1037 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1038 }), true); |
| 1039 res.list(arg_applicationId, maxResults: arg_maxResults, pageToken: arg_pag
eToken).then(unittest.expectAsync(((api.LeaderboardConfigurationListResponse res
ponse) { |
| 1040 checkLeaderboardConfigurationListResponse(response); |
| 1041 }))); |
| 1042 }); |
| 1043 |
| 1044 unittest.test("method--patch", () { |
| 1045 |
| 1046 var mock = new common_test.HttpServerMock(); |
| 1047 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 1048 var arg_request = buildLeaderboardConfiguration(); |
| 1049 var arg_leaderboardId = "foo"; |
| 1050 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1051 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 1052 checkLeaderboardConfiguration(obj); |
| 1053 |
| 1054 var path = (req.url).path; |
| 1055 var pathOffset = 0; |
| 1056 var index; |
| 1057 var subPart; |
| 1058 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1059 pathOffset += 1; |
| 1060 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 1061 pathOffset += 22; |
| 1062 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); |
| 1063 pathOffset += 13; |
| 1064 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1065 pathOffset = path.length; |
| 1066 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 1067 |
| 1068 var query = (req.url).query; |
| 1069 var queryOffset = 0; |
| 1070 var queryMap = {}; |
| 1071 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1072 parseBool(n) { |
| 1073 if (n == "true") return true; |
| 1074 if (n == "false") return false; |
| 1075 if (n == null) return null; |
| 1076 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1077 } |
| 1078 if (query.length > 0) { |
| 1079 for (var part in query.split("&")) { |
| 1080 var keyvalue = part.split("="); |
| 1081 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1082 } |
| 1083 } |
| 1084 |
| 1085 |
| 1086 var h = { |
| 1087 "content-type" : "application/json; charset=utf-8", |
| 1088 }; |
| 1089 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 1090 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1091 }), true); |
| 1092 res.patch(arg_request, arg_leaderboardId).then(unittest.expectAsync(((api.
LeaderboardConfiguration response) { |
| 1093 checkLeaderboardConfiguration(response); |
| 1094 }))); |
| 1095 }); |
| 1096 |
| 1097 unittest.test("method--update", () { |
| 1098 |
| 1099 var mock = new common_test.HttpServerMock(); |
| 1100 api.LeaderboardConfigurationsResourceApi res = new api.GamesConfigurationA
pi(mock).leaderboardConfigurations; |
| 1101 var arg_request = buildLeaderboardConfiguration(); |
| 1102 var arg_leaderboardId = "foo"; |
| 1103 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1104 var obj = new api.LeaderboardConfiguration.fromJson(json); |
| 1105 checkLeaderboardConfiguration(obj); |
| 1106 |
| 1107 var path = (req.url).path; |
| 1108 var pathOffset = 0; |
| 1109 var index; |
| 1110 var subPart; |
| 1111 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1112 pathOffset += 1; |
| 1113 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("games/v1configuration/")); |
| 1114 pathOffset += 22; |
| 1115 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("leaderboards/")); |
| 1116 pathOffset += 13; |
| 1117 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1118 pathOffset = path.length; |
| 1119 unittest.expect(subPart, unittest.equals("$arg_leaderboardId")); |
| 1120 |
| 1121 var query = (req.url).query; |
| 1122 var queryOffset = 0; |
| 1123 var queryMap = {}; |
| 1124 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1125 parseBool(n) { |
| 1126 if (n == "true") return true; |
| 1127 if (n == "false") return false; |
| 1128 if (n == null) return null; |
| 1129 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1130 } |
| 1131 if (query.length > 0) { |
| 1132 for (var part in query.split("&")) { |
| 1133 var keyvalue = part.split("="); |
| 1134 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1135 } |
| 1136 } |
| 1137 |
| 1138 |
| 1139 var h = { |
| 1140 "content-type" : "application/json; charset=utf-8", |
| 1141 }; |
| 1142 var resp = convert.JSON.encode(buildLeaderboardConfiguration()); |
| 1143 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1144 }), true); |
| 1145 res.update(arg_request, arg_leaderboardId).then(unittest.expectAsync(((api
.LeaderboardConfiguration response) { |
| 1146 checkLeaderboardConfiguration(response); |
| 1147 }))); |
| 1148 }); |
| 1149 |
| 1150 }); |
| 1151 |
| 1152 |
| 1153 } |
| 1154 |
OLD | NEW |