OLD | NEW |
(Empty) | |
| 1 library googleapis.androidpublisher.v2.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/androidpublisher/v2.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterApk = 0; |
| 20 buildApk() { |
| 21 var o = new api.Apk(); |
| 22 buildCounterApk++; |
| 23 if (buildCounterApk < 3) { |
| 24 o.binary = buildApkBinary(); |
| 25 o.versionCode = 42; |
| 26 } |
| 27 buildCounterApk--; |
| 28 return o; |
| 29 } |
| 30 |
| 31 checkApk(api.Apk o) { |
| 32 buildCounterApk++; |
| 33 if (buildCounterApk < 3) { |
| 34 checkApkBinary(o.binary); |
| 35 unittest.expect(o.versionCode, unittest.equals(42)); |
| 36 } |
| 37 buildCounterApk--; |
| 38 } |
| 39 |
| 40 core.int buildCounterApkBinary = 0; |
| 41 buildApkBinary() { |
| 42 var o = new api.ApkBinary(); |
| 43 buildCounterApkBinary++; |
| 44 if (buildCounterApkBinary < 3) { |
| 45 o.sha1 = "foo"; |
| 46 } |
| 47 buildCounterApkBinary--; |
| 48 return o; |
| 49 } |
| 50 |
| 51 checkApkBinary(api.ApkBinary o) { |
| 52 buildCounterApkBinary++; |
| 53 if (buildCounterApkBinary < 3) { |
| 54 unittest.expect(o.sha1, unittest.equals('foo')); |
| 55 } |
| 56 buildCounterApkBinary--; |
| 57 } |
| 58 |
| 59 core.int buildCounterApkListing = 0; |
| 60 buildApkListing() { |
| 61 var o = new api.ApkListing(); |
| 62 buildCounterApkListing++; |
| 63 if (buildCounterApkListing < 3) { |
| 64 o.language = "foo"; |
| 65 o.recentChanges = "foo"; |
| 66 } |
| 67 buildCounterApkListing--; |
| 68 return o; |
| 69 } |
| 70 |
| 71 checkApkListing(api.ApkListing o) { |
| 72 buildCounterApkListing++; |
| 73 if (buildCounterApkListing < 3) { |
| 74 unittest.expect(o.language, unittest.equals('foo')); |
| 75 unittest.expect(o.recentChanges, unittest.equals('foo')); |
| 76 } |
| 77 buildCounterApkListing--; |
| 78 } |
| 79 |
| 80 buildUnnamed953() { |
| 81 var o = new core.List<api.ApkListing>(); |
| 82 o.add(buildApkListing()); |
| 83 o.add(buildApkListing()); |
| 84 return o; |
| 85 } |
| 86 |
| 87 checkUnnamed953(core.List<api.ApkListing> o) { |
| 88 unittest.expect(o, unittest.hasLength(2)); |
| 89 checkApkListing(o[0]); |
| 90 checkApkListing(o[1]); |
| 91 } |
| 92 |
| 93 core.int buildCounterApkListingsListResponse = 0; |
| 94 buildApkListingsListResponse() { |
| 95 var o = new api.ApkListingsListResponse(); |
| 96 buildCounterApkListingsListResponse++; |
| 97 if (buildCounterApkListingsListResponse < 3) { |
| 98 o.kind = "foo"; |
| 99 o.listings = buildUnnamed953(); |
| 100 } |
| 101 buildCounterApkListingsListResponse--; |
| 102 return o; |
| 103 } |
| 104 |
| 105 checkApkListingsListResponse(api.ApkListingsListResponse o) { |
| 106 buildCounterApkListingsListResponse++; |
| 107 if (buildCounterApkListingsListResponse < 3) { |
| 108 unittest.expect(o.kind, unittest.equals('foo')); |
| 109 checkUnnamed953(o.listings); |
| 110 } |
| 111 buildCounterApkListingsListResponse--; |
| 112 } |
| 113 |
| 114 buildUnnamed954() { |
| 115 var o = new core.List<api.Apk>(); |
| 116 o.add(buildApk()); |
| 117 o.add(buildApk()); |
| 118 return o; |
| 119 } |
| 120 |
| 121 checkUnnamed954(core.List<api.Apk> o) { |
| 122 unittest.expect(o, unittest.hasLength(2)); |
| 123 checkApk(o[0]); |
| 124 checkApk(o[1]); |
| 125 } |
| 126 |
| 127 core.int buildCounterApksListResponse = 0; |
| 128 buildApksListResponse() { |
| 129 var o = new api.ApksListResponse(); |
| 130 buildCounterApksListResponse++; |
| 131 if (buildCounterApksListResponse < 3) { |
| 132 o.apks = buildUnnamed954(); |
| 133 o.kind = "foo"; |
| 134 } |
| 135 buildCounterApksListResponse--; |
| 136 return o; |
| 137 } |
| 138 |
| 139 checkApksListResponse(api.ApksListResponse o) { |
| 140 buildCounterApksListResponse++; |
| 141 if (buildCounterApksListResponse < 3) { |
| 142 checkUnnamed954(o.apks); |
| 143 unittest.expect(o.kind, unittest.equals('foo')); |
| 144 } |
| 145 buildCounterApksListResponse--; |
| 146 } |
| 147 |
| 148 core.int buildCounterAppDetails = 0; |
| 149 buildAppDetails() { |
| 150 var o = new api.AppDetails(); |
| 151 buildCounterAppDetails++; |
| 152 if (buildCounterAppDetails < 3) { |
| 153 o.contactEmail = "foo"; |
| 154 o.contactPhone = "foo"; |
| 155 o.contactWebsite = "foo"; |
| 156 o.defaultLanguage = "foo"; |
| 157 } |
| 158 buildCounterAppDetails--; |
| 159 return o; |
| 160 } |
| 161 |
| 162 checkAppDetails(api.AppDetails o) { |
| 163 buildCounterAppDetails++; |
| 164 if (buildCounterAppDetails < 3) { |
| 165 unittest.expect(o.contactEmail, unittest.equals('foo')); |
| 166 unittest.expect(o.contactPhone, unittest.equals('foo')); |
| 167 unittest.expect(o.contactWebsite, unittest.equals('foo')); |
| 168 unittest.expect(o.defaultLanguage, unittest.equals('foo')); |
| 169 } |
| 170 buildCounterAppDetails--; |
| 171 } |
| 172 |
| 173 core.int buildCounterAppEdit = 0; |
| 174 buildAppEdit() { |
| 175 var o = new api.AppEdit(); |
| 176 buildCounterAppEdit++; |
| 177 if (buildCounterAppEdit < 3) { |
| 178 o.expiryTimeSeconds = "foo"; |
| 179 o.id = "foo"; |
| 180 } |
| 181 buildCounterAppEdit--; |
| 182 return o; |
| 183 } |
| 184 |
| 185 checkAppEdit(api.AppEdit o) { |
| 186 buildCounterAppEdit++; |
| 187 if (buildCounterAppEdit < 3) { |
| 188 unittest.expect(o.expiryTimeSeconds, unittest.equals('foo')); |
| 189 unittest.expect(o.id, unittest.equals('foo')); |
| 190 } |
| 191 buildCounterAppEdit--; |
| 192 } |
| 193 |
| 194 core.int buildCounterExpansionFile = 0; |
| 195 buildExpansionFile() { |
| 196 var o = new api.ExpansionFile(); |
| 197 buildCounterExpansionFile++; |
| 198 if (buildCounterExpansionFile < 3) { |
| 199 o.fileSize = "foo"; |
| 200 o.referencesVersion = 42; |
| 201 } |
| 202 buildCounterExpansionFile--; |
| 203 return o; |
| 204 } |
| 205 |
| 206 checkExpansionFile(api.ExpansionFile o) { |
| 207 buildCounterExpansionFile++; |
| 208 if (buildCounterExpansionFile < 3) { |
| 209 unittest.expect(o.fileSize, unittest.equals('foo')); |
| 210 unittest.expect(o.referencesVersion, unittest.equals(42)); |
| 211 } |
| 212 buildCounterExpansionFile--; |
| 213 } |
| 214 |
| 215 core.int buildCounterExpansionFilesUploadResponse = 0; |
| 216 buildExpansionFilesUploadResponse() { |
| 217 var o = new api.ExpansionFilesUploadResponse(); |
| 218 buildCounterExpansionFilesUploadResponse++; |
| 219 if (buildCounterExpansionFilesUploadResponse < 3) { |
| 220 o.expansionFile = buildExpansionFile(); |
| 221 } |
| 222 buildCounterExpansionFilesUploadResponse--; |
| 223 return o; |
| 224 } |
| 225 |
| 226 checkExpansionFilesUploadResponse(api.ExpansionFilesUploadResponse o) { |
| 227 buildCounterExpansionFilesUploadResponse++; |
| 228 if (buildCounterExpansionFilesUploadResponse < 3) { |
| 229 checkExpansionFile(o.expansionFile); |
| 230 } |
| 231 buildCounterExpansionFilesUploadResponse--; |
| 232 } |
| 233 |
| 234 core.int buildCounterImage = 0; |
| 235 buildImage() { |
| 236 var o = new api.Image(); |
| 237 buildCounterImage++; |
| 238 if (buildCounterImage < 3) { |
| 239 o.id = "foo"; |
| 240 o.sha1 = "foo"; |
| 241 o.url = "foo"; |
| 242 } |
| 243 buildCounterImage--; |
| 244 return o; |
| 245 } |
| 246 |
| 247 checkImage(api.Image o) { |
| 248 buildCounterImage++; |
| 249 if (buildCounterImage < 3) { |
| 250 unittest.expect(o.id, unittest.equals('foo')); |
| 251 unittest.expect(o.sha1, unittest.equals('foo')); |
| 252 unittest.expect(o.url, unittest.equals('foo')); |
| 253 } |
| 254 buildCounterImage--; |
| 255 } |
| 256 |
| 257 buildUnnamed955() { |
| 258 var o = new core.List<api.Image>(); |
| 259 o.add(buildImage()); |
| 260 o.add(buildImage()); |
| 261 return o; |
| 262 } |
| 263 |
| 264 checkUnnamed955(core.List<api.Image> o) { |
| 265 unittest.expect(o, unittest.hasLength(2)); |
| 266 checkImage(o[0]); |
| 267 checkImage(o[1]); |
| 268 } |
| 269 |
| 270 core.int buildCounterImagesDeleteAllResponse = 0; |
| 271 buildImagesDeleteAllResponse() { |
| 272 var o = new api.ImagesDeleteAllResponse(); |
| 273 buildCounterImagesDeleteAllResponse++; |
| 274 if (buildCounterImagesDeleteAllResponse < 3) { |
| 275 o.deleted = buildUnnamed955(); |
| 276 } |
| 277 buildCounterImagesDeleteAllResponse--; |
| 278 return o; |
| 279 } |
| 280 |
| 281 checkImagesDeleteAllResponse(api.ImagesDeleteAllResponse o) { |
| 282 buildCounterImagesDeleteAllResponse++; |
| 283 if (buildCounterImagesDeleteAllResponse < 3) { |
| 284 checkUnnamed955(o.deleted); |
| 285 } |
| 286 buildCounterImagesDeleteAllResponse--; |
| 287 } |
| 288 |
| 289 buildUnnamed956() { |
| 290 var o = new core.List<api.Image>(); |
| 291 o.add(buildImage()); |
| 292 o.add(buildImage()); |
| 293 return o; |
| 294 } |
| 295 |
| 296 checkUnnamed956(core.List<api.Image> o) { |
| 297 unittest.expect(o, unittest.hasLength(2)); |
| 298 checkImage(o[0]); |
| 299 checkImage(o[1]); |
| 300 } |
| 301 |
| 302 core.int buildCounterImagesListResponse = 0; |
| 303 buildImagesListResponse() { |
| 304 var o = new api.ImagesListResponse(); |
| 305 buildCounterImagesListResponse++; |
| 306 if (buildCounterImagesListResponse < 3) { |
| 307 o.images = buildUnnamed956(); |
| 308 } |
| 309 buildCounterImagesListResponse--; |
| 310 return o; |
| 311 } |
| 312 |
| 313 checkImagesListResponse(api.ImagesListResponse o) { |
| 314 buildCounterImagesListResponse++; |
| 315 if (buildCounterImagesListResponse < 3) { |
| 316 checkUnnamed956(o.images); |
| 317 } |
| 318 buildCounterImagesListResponse--; |
| 319 } |
| 320 |
| 321 core.int buildCounterImagesUploadResponse = 0; |
| 322 buildImagesUploadResponse() { |
| 323 var o = new api.ImagesUploadResponse(); |
| 324 buildCounterImagesUploadResponse++; |
| 325 if (buildCounterImagesUploadResponse < 3) { |
| 326 o.image = buildImage(); |
| 327 } |
| 328 buildCounterImagesUploadResponse--; |
| 329 return o; |
| 330 } |
| 331 |
| 332 checkImagesUploadResponse(api.ImagesUploadResponse o) { |
| 333 buildCounterImagesUploadResponse++; |
| 334 if (buildCounterImagesUploadResponse < 3) { |
| 335 checkImage(o.image); |
| 336 } |
| 337 buildCounterImagesUploadResponse--; |
| 338 } |
| 339 |
| 340 buildUnnamed957() { |
| 341 var o = new core.Map<core.String, api.InAppProductListing>(); |
| 342 o["x"] = buildInAppProductListing(); |
| 343 o["y"] = buildInAppProductListing(); |
| 344 return o; |
| 345 } |
| 346 |
| 347 checkUnnamed957(core.Map<core.String, api.InAppProductListing> o) { |
| 348 unittest.expect(o, unittest.hasLength(2)); |
| 349 checkInAppProductListing(o["x"]); |
| 350 checkInAppProductListing(o["y"]); |
| 351 } |
| 352 |
| 353 buildUnnamed958() { |
| 354 var o = new core.Map<core.String, api.Price>(); |
| 355 o["x"] = buildPrice(); |
| 356 o["y"] = buildPrice(); |
| 357 return o; |
| 358 } |
| 359 |
| 360 checkUnnamed958(core.Map<core.String, api.Price> o) { |
| 361 unittest.expect(o, unittest.hasLength(2)); |
| 362 checkPrice(o["x"]); |
| 363 checkPrice(o["y"]); |
| 364 } |
| 365 |
| 366 core.int buildCounterInAppProduct = 0; |
| 367 buildInAppProduct() { |
| 368 var o = new api.InAppProduct(); |
| 369 buildCounterInAppProduct++; |
| 370 if (buildCounterInAppProduct < 3) { |
| 371 o.defaultLanguage = "foo"; |
| 372 o.defaultPrice = buildPrice(); |
| 373 o.listings = buildUnnamed957(); |
| 374 o.packageName = "foo"; |
| 375 o.prices = buildUnnamed958(); |
| 376 o.purchaseType = "foo"; |
| 377 o.sku = "foo"; |
| 378 o.status = "foo"; |
| 379 o.subscriptionPeriod = "foo"; |
| 380 o.trialPeriod = "foo"; |
| 381 } |
| 382 buildCounterInAppProduct--; |
| 383 return o; |
| 384 } |
| 385 |
| 386 checkInAppProduct(api.InAppProduct o) { |
| 387 buildCounterInAppProduct++; |
| 388 if (buildCounterInAppProduct < 3) { |
| 389 unittest.expect(o.defaultLanguage, unittest.equals('foo')); |
| 390 checkPrice(o.defaultPrice); |
| 391 checkUnnamed957(o.listings); |
| 392 unittest.expect(o.packageName, unittest.equals('foo')); |
| 393 checkUnnamed958(o.prices); |
| 394 unittest.expect(o.purchaseType, unittest.equals('foo')); |
| 395 unittest.expect(o.sku, unittest.equals('foo')); |
| 396 unittest.expect(o.status, unittest.equals('foo')); |
| 397 unittest.expect(o.subscriptionPeriod, unittest.equals('foo')); |
| 398 unittest.expect(o.trialPeriod, unittest.equals('foo')); |
| 399 } |
| 400 buildCounterInAppProduct--; |
| 401 } |
| 402 |
| 403 core.int buildCounterInAppProductListing = 0; |
| 404 buildInAppProductListing() { |
| 405 var o = new api.InAppProductListing(); |
| 406 buildCounterInAppProductListing++; |
| 407 if (buildCounterInAppProductListing < 3) { |
| 408 o.description = "foo"; |
| 409 o.title = "foo"; |
| 410 } |
| 411 buildCounterInAppProductListing--; |
| 412 return o; |
| 413 } |
| 414 |
| 415 checkInAppProductListing(api.InAppProductListing o) { |
| 416 buildCounterInAppProductListing++; |
| 417 if (buildCounterInAppProductListing < 3) { |
| 418 unittest.expect(o.description, unittest.equals('foo')); |
| 419 unittest.expect(o.title, unittest.equals('foo')); |
| 420 } |
| 421 buildCounterInAppProductListing--; |
| 422 } |
| 423 |
| 424 buildUnnamed959() { |
| 425 var o = new core.List<api.InappproductsBatchRequestEntry>(); |
| 426 o.add(buildInappproductsBatchRequestEntry()); |
| 427 o.add(buildInappproductsBatchRequestEntry()); |
| 428 return o; |
| 429 } |
| 430 |
| 431 checkUnnamed959(core.List<api.InappproductsBatchRequestEntry> o) { |
| 432 unittest.expect(o, unittest.hasLength(2)); |
| 433 checkInappproductsBatchRequestEntry(o[0]); |
| 434 checkInappproductsBatchRequestEntry(o[1]); |
| 435 } |
| 436 |
| 437 core.int buildCounterInappproductsBatchRequest = 0; |
| 438 buildInappproductsBatchRequest() { |
| 439 var o = new api.InappproductsBatchRequest(); |
| 440 buildCounterInappproductsBatchRequest++; |
| 441 if (buildCounterInappproductsBatchRequest < 3) { |
| 442 o.entrys = buildUnnamed959(); |
| 443 } |
| 444 buildCounterInappproductsBatchRequest--; |
| 445 return o; |
| 446 } |
| 447 |
| 448 checkInappproductsBatchRequest(api.InappproductsBatchRequest o) { |
| 449 buildCounterInappproductsBatchRequest++; |
| 450 if (buildCounterInappproductsBatchRequest < 3) { |
| 451 checkUnnamed959(o.entrys); |
| 452 } |
| 453 buildCounterInappproductsBatchRequest--; |
| 454 } |
| 455 |
| 456 core.int buildCounterInappproductsBatchRequestEntry = 0; |
| 457 buildInappproductsBatchRequestEntry() { |
| 458 var o = new api.InappproductsBatchRequestEntry(); |
| 459 buildCounterInappproductsBatchRequestEntry++; |
| 460 if (buildCounterInappproductsBatchRequestEntry < 3) { |
| 461 o.batchId = 42; |
| 462 o.inappproductsinsertrequest = buildInappproductsInsertRequest(); |
| 463 o.inappproductsupdaterequest = buildInappproductsUpdateRequest(); |
| 464 o.methodName = "foo"; |
| 465 } |
| 466 buildCounterInappproductsBatchRequestEntry--; |
| 467 return o; |
| 468 } |
| 469 |
| 470 checkInappproductsBatchRequestEntry(api.InappproductsBatchRequestEntry o) { |
| 471 buildCounterInappproductsBatchRequestEntry++; |
| 472 if (buildCounterInappproductsBatchRequestEntry < 3) { |
| 473 unittest.expect(o.batchId, unittest.equals(42)); |
| 474 checkInappproductsInsertRequest(o.inappproductsinsertrequest); |
| 475 checkInappproductsUpdateRequest(o.inappproductsupdaterequest); |
| 476 unittest.expect(o.methodName, unittest.equals('foo')); |
| 477 } |
| 478 buildCounterInappproductsBatchRequestEntry--; |
| 479 } |
| 480 |
| 481 buildUnnamed960() { |
| 482 var o = new core.List<api.InappproductsBatchResponseEntry>(); |
| 483 o.add(buildInappproductsBatchResponseEntry()); |
| 484 o.add(buildInappproductsBatchResponseEntry()); |
| 485 return o; |
| 486 } |
| 487 |
| 488 checkUnnamed960(core.List<api.InappproductsBatchResponseEntry> o) { |
| 489 unittest.expect(o, unittest.hasLength(2)); |
| 490 checkInappproductsBatchResponseEntry(o[0]); |
| 491 checkInappproductsBatchResponseEntry(o[1]); |
| 492 } |
| 493 |
| 494 core.int buildCounterInappproductsBatchResponse = 0; |
| 495 buildInappproductsBatchResponse() { |
| 496 var o = new api.InappproductsBatchResponse(); |
| 497 buildCounterInappproductsBatchResponse++; |
| 498 if (buildCounterInappproductsBatchResponse < 3) { |
| 499 o.entrys = buildUnnamed960(); |
| 500 o.kind = "foo"; |
| 501 } |
| 502 buildCounterInappproductsBatchResponse--; |
| 503 return o; |
| 504 } |
| 505 |
| 506 checkInappproductsBatchResponse(api.InappproductsBatchResponse o) { |
| 507 buildCounterInappproductsBatchResponse++; |
| 508 if (buildCounterInappproductsBatchResponse < 3) { |
| 509 checkUnnamed960(o.entrys); |
| 510 unittest.expect(o.kind, unittest.equals('foo')); |
| 511 } |
| 512 buildCounterInappproductsBatchResponse--; |
| 513 } |
| 514 |
| 515 core.int buildCounterInappproductsBatchResponseEntry = 0; |
| 516 buildInappproductsBatchResponseEntry() { |
| 517 var o = new api.InappproductsBatchResponseEntry(); |
| 518 buildCounterInappproductsBatchResponseEntry++; |
| 519 if (buildCounterInappproductsBatchResponseEntry < 3) { |
| 520 o.batchId = 42; |
| 521 o.inappproductsinsertresponse = buildInappproductsInsertResponse(); |
| 522 o.inappproductsupdateresponse = buildInappproductsUpdateResponse(); |
| 523 } |
| 524 buildCounterInappproductsBatchResponseEntry--; |
| 525 return o; |
| 526 } |
| 527 |
| 528 checkInappproductsBatchResponseEntry(api.InappproductsBatchResponseEntry o) { |
| 529 buildCounterInappproductsBatchResponseEntry++; |
| 530 if (buildCounterInappproductsBatchResponseEntry < 3) { |
| 531 unittest.expect(o.batchId, unittest.equals(42)); |
| 532 checkInappproductsInsertResponse(o.inappproductsinsertresponse); |
| 533 checkInappproductsUpdateResponse(o.inappproductsupdateresponse); |
| 534 } |
| 535 buildCounterInappproductsBatchResponseEntry--; |
| 536 } |
| 537 |
| 538 core.int buildCounterInappproductsInsertRequest = 0; |
| 539 buildInappproductsInsertRequest() { |
| 540 var o = new api.InappproductsInsertRequest(); |
| 541 buildCounterInappproductsInsertRequest++; |
| 542 if (buildCounterInappproductsInsertRequest < 3) { |
| 543 o.inappproduct = buildInAppProduct(); |
| 544 } |
| 545 buildCounterInappproductsInsertRequest--; |
| 546 return o; |
| 547 } |
| 548 |
| 549 checkInappproductsInsertRequest(api.InappproductsInsertRequest o) { |
| 550 buildCounterInappproductsInsertRequest++; |
| 551 if (buildCounterInappproductsInsertRequest < 3) { |
| 552 checkInAppProduct(o.inappproduct); |
| 553 } |
| 554 buildCounterInappproductsInsertRequest--; |
| 555 } |
| 556 |
| 557 core.int buildCounterInappproductsInsertResponse = 0; |
| 558 buildInappproductsInsertResponse() { |
| 559 var o = new api.InappproductsInsertResponse(); |
| 560 buildCounterInappproductsInsertResponse++; |
| 561 if (buildCounterInappproductsInsertResponse < 3) { |
| 562 o.inappproduct = buildInAppProduct(); |
| 563 } |
| 564 buildCounterInappproductsInsertResponse--; |
| 565 return o; |
| 566 } |
| 567 |
| 568 checkInappproductsInsertResponse(api.InappproductsInsertResponse o) { |
| 569 buildCounterInappproductsInsertResponse++; |
| 570 if (buildCounterInappproductsInsertResponse < 3) { |
| 571 checkInAppProduct(o.inappproduct); |
| 572 } |
| 573 buildCounterInappproductsInsertResponse--; |
| 574 } |
| 575 |
| 576 buildUnnamed961() { |
| 577 var o = new core.List<api.InAppProduct>(); |
| 578 o.add(buildInAppProduct()); |
| 579 o.add(buildInAppProduct()); |
| 580 return o; |
| 581 } |
| 582 |
| 583 checkUnnamed961(core.List<api.InAppProduct> o) { |
| 584 unittest.expect(o, unittest.hasLength(2)); |
| 585 checkInAppProduct(o[0]); |
| 586 checkInAppProduct(o[1]); |
| 587 } |
| 588 |
| 589 core.int buildCounterInappproductsListResponse = 0; |
| 590 buildInappproductsListResponse() { |
| 591 var o = new api.InappproductsListResponse(); |
| 592 buildCounterInappproductsListResponse++; |
| 593 if (buildCounterInappproductsListResponse < 3) { |
| 594 o.inappproduct = buildUnnamed961(); |
| 595 o.kind = "foo"; |
| 596 o.pageInfo = buildPageInfo(); |
| 597 o.tokenPagination = buildTokenPagination(); |
| 598 } |
| 599 buildCounterInappproductsListResponse--; |
| 600 return o; |
| 601 } |
| 602 |
| 603 checkInappproductsListResponse(api.InappproductsListResponse o) { |
| 604 buildCounterInappproductsListResponse++; |
| 605 if (buildCounterInappproductsListResponse < 3) { |
| 606 checkUnnamed961(o.inappproduct); |
| 607 unittest.expect(o.kind, unittest.equals('foo')); |
| 608 checkPageInfo(o.pageInfo); |
| 609 checkTokenPagination(o.tokenPagination); |
| 610 } |
| 611 buildCounterInappproductsListResponse--; |
| 612 } |
| 613 |
| 614 core.int buildCounterInappproductsUpdateRequest = 0; |
| 615 buildInappproductsUpdateRequest() { |
| 616 var o = new api.InappproductsUpdateRequest(); |
| 617 buildCounterInappproductsUpdateRequest++; |
| 618 if (buildCounterInappproductsUpdateRequest < 3) { |
| 619 o.inappproduct = buildInAppProduct(); |
| 620 } |
| 621 buildCounterInappproductsUpdateRequest--; |
| 622 return o; |
| 623 } |
| 624 |
| 625 checkInappproductsUpdateRequest(api.InappproductsUpdateRequest o) { |
| 626 buildCounterInappproductsUpdateRequest++; |
| 627 if (buildCounterInappproductsUpdateRequest < 3) { |
| 628 checkInAppProduct(o.inappproduct); |
| 629 } |
| 630 buildCounterInappproductsUpdateRequest--; |
| 631 } |
| 632 |
| 633 core.int buildCounterInappproductsUpdateResponse = 0; |
| 634 buildInappproductsUpdateResponse() { |
| 635 var o = new api.InappproductsUpdateResponse(); |
| 636 buildCounterInappproductsUpdateResponse++; |
| 637 if (buildCounterInappproductsUpdateResponse < 3) { |
| 638 o.inappproduct = buildInAppProduct(); |
| 639 } |
| 640 buildCounterInappproductsUpdateResponse--; |
| 641 return o; |
| 642 } |
| 643 |
| 644 checkInappproductsUpdateResponse(api.InappproductsUpdateResponse o) { |
| 645 buildCounterInappproductsUpdateResponse++; |
| 646 if (buildCounterInappproductsUpdateResponse < 3) { |
| 647 checkInAppProduct(o.inappproduct); |
| 648 } |
| 649 buildCounterInappproductsUpdateResponse--; |
| 650 } |
| 651 |
| 652 core.int buildCounterListing = 0; |
| 653 buildListing() { |
| 654 var o = new api.Listing(); |
| 655 buildCounterListing++; |
| 656 if (buildCounterListing < 3) { |
| 657 o.fullDescription = "foo"; |
| 658 o.language = "foo"; |
| 659 o.shortDescription = "foo"; |
| 660 o.title = "foo"; |
| 661 o.video = "foo"; |
| 662 } |
| 663 buildCounterListing--; |
| 664 return o; |
| 665 } |
| 666 |
| 667 checkListing(api.Listing o) { |
| 668 buildCounterListing++; |
| 669 if (buildCounterListing < 3) { |
| 670 unittest.expect(o.fullDescription, unittest.equals('foo')); |
| 671 unittest.expect(o.language, unittest.equals('foo')); |
| 672 unittest.expect(o.shortDescription, unittest.equals('foo')); |
| 673 unittest.expect(o.title, unittest.equals('foo')); |
| 674 unittest.expect(o.video, unittest.equals('foo')); |
| 675 } |
| 676 buildCounterListing--; |
| 677 } |
| 678 |
| 679 buildUnnamed962() { |
| 680 var o = new core.List<api.Listing>(); |
| 681 o.add(buildListing()); |
| 682 o.add(buildListing()); |
| 683 return o; |
| 684 } |
| 685 |
| 686 checkUnnamed962(core.List<api.Listing> o) { |
| 687 unittest.expect(o, unittest.hasLength(2)); |
| 688 checkListing(o[0]); |
| 689 checkListing(o[1]); |
| 690 } |
| 691 |
| 692 core.int buildCounterListingsListResponse = 0; |
| 693 buildListingsListResponse() { |
| 694 var o = new api.ListingsListResponse(); |
| 695 buildCounterListingsListResponse++; |
| 696 if (buildCounterListingsListResponse < 3) { |
| 697 o.kind = "foo"; |
| 698 o.listings = buildUnnamed962(); |
| 699 } |
| 700 buildCounterListingsListResponse--; |
| 701 return o; |
| 702 } |
| 703 |
| 704 checkListingsListResponse(api.ListingsListResponse o) { |
| 705 buildCounterListingsListResponse++; |
| 706 if (buildCounterListingsListResponse < 3) { |
| 707 unittest.expect(o.kind, unittest.equals('foo')); |
| 708 checkUnnamed962(o.listings); |
| 709 } |
| 710 buildCounterListingsListResponse--; |
| 711 } |
| 712 |
| 713 core.int buildCounterPageInfo = 0; |
| 714 buildPageInfo() { |
| 715 var o = new api.PageInfo(); |
| 716 buildCounterPageInfo++; |
| 717 if (buildCounterPageInfo < 3) { |
| 718 o.resultPerPage = 42; |
| 719 o.startIndex = 42; |
| 720 o.totalResults = 42; |
| 721 } |
| 722 buildCounterPageInfo--; |
| 723 return o; |
| 724 } |
| 725 |
| 726 checkPageInfo(api.PageInfo o) { |
| 727 buildCounterPageInfo++; |
| 728 if (buildCounterPageInfo < 3) { |
| 729 unittest.expect(o.resultPerPage, unittest.equals(42)); |
| 730 unittest.expect(o.startIndex, unittest.equals(42)); |
| 731 unittest.expect(o.totalResults, unittest.equals(42)); |
| 732 } |
| 733 buildCounterPageInfo--; |
| 734 } |
| 735 |
| 736 core.int buildCounterPrice = 0; |
| 737 buildPrice() { |
| 738 var o = new api.Price(); |
| 739 buildCounterPrice++; |
| 740 if (buildCounterPrice < 3) { |
| 741 o.currency = "foo"; |
| 742 o.priceMicros = "foo"; |
| 743 } |
| 744 buildCounterPrice--; |
| 745 return o; |
| 746 } |
| 747 |
| 748 checkPrice(api.Price o) { |
| 749 buildCounterPrice++; |
| 750 if (buildCounterPrice < 3) { |
| 751 unittest.expect(o.currency, unittest.equals('foo')); |
| 752 unittest.expect(o.priceMicros, unittest.equals('foo')); |
| 753 } |
| 754 buildCounterPrice--; |
| 755 } |
| 756 |
| 757 core.int buildCounterProductPurchase = 0; |
| 758 buildProductPurchase() { |
| 759 var o = new api.ProductPurchase(); |
| 760 buildCounterProductPurchase++; |
| 761 if (buildCounterProductPurchase < 3) { |
| 762 o.consumptionState = 42; |
| 763 o.developerPayload = "foo"; |
| 764 o.kind = "foo"; |
| 765 o.purchaseState = 42; |
| 766 o.purchaseTimeMillis = "foo"; |
| 767 } |
| 768 buildCounterProductPurchase--; |
| 769 return o; |
| 770 } |
| 771 |
| 772 checkProductPurchase(api.ProductPurchase o) { |
| 773 buildCounterProductPurchase++; |
| 774 if (buildCounterProductPurchase < 3) { |
| 775 unittest.expect(o.consumptionState, unittest.equals(42)); |
| 776 unittest.expect(o.developerPayload, unittest.equals('foo')); |
| 777 unittest.expect(o.kind, unittest.equals('foo')); |
| 778 unittest.expect(o.purchaseState, unittest.equals(42)); |
| 779 unittest.expect(o.purchaseTimeMillis, unittest.equals('foo')); |
| 780 } |
| 781 buildCounterProductPurchase--; |
| 782 } |
| 783 |
| 784 core.int buildCounterSubscriptionPurchase = 0; |
| 785 buildSubscriptionPurchase() { |
| 786 var o = new api.SubscriptionPurchase(); |
| 787 buildCounterSubscriptionPurchase++; |
| 788 if (buildCounterSubscriptionPurchase < 3) { |
| 789 o.autoRenewing = true; |
| 790 o.expiryTimeMillis = "foo"; |
| 791 o.kind = "foo"; |
| 792 o.startTimeMillis = "foo"; |
| 793 } |
| 794 buildCounterSubscriptionPurchase--; |
| 795 return o; |
| 796 } |
| 797 |
| 798 checkSubscriptionPurchase(api.SubscriptionPurchase o) { |
| 799 buildCounterSubscriptionPurchase++; |
| 800 if (buildCounterSubscriptionPurchase < 3) { |
| 801 unittest.expect(o.autoRenewing, unittest.isTrue); |
| 802 unittest.expect(o.expiryTimeMillis, unittest.equals('foo')); |
| 803 unittest.expect(o.kind, unittest.equals('foo')); |
| 804 unittest.expect(o.startTimeMillis, unittest.equals('foo')); |
| 805 } |
| 806 buildCounterSubscriptionPurchase--; |
| 807 } |
| 808 |
| 809 buildUnnamed963() { |
| 810 var o = new core.List<core.String>(); |
| 811 o.add("foo"); |
| 812 o.add("foo"); |
| 813 return o; |
| 814 } |
| 815 |
| 816 checkUnnamed963(core.List<core.String> o) { |
| 817 unittest.expect(o, unittest.hasLength(2)); |
| 818 unittest.expect(o[0], unittest.equals('foo')); |
| 819 unittest.expect(o[1], unittest.equals('foo')); |
| 820 } |
| 821 |
| 822 buildUnnamed964() { |
| 823 var o = new core.List<core.String>(); |
| 824 o.add("foo"); |
| 825 o.add("foo"); |
| 826 return o; |
| 827 } |
| 828 |
| 829 checkUnnamed964(core.List<core.String> o) { |
| 830 unittest.expect(o, unittest.hasLength(2)); |
| 831 unittest.expect(o[0], unittest.equals('foo')); |
| 832 unittest.expect(o[1], unittest.equals('foo')); |
| 833 } |
| 834 |
| 835 core.int buildCounterTesters = 0; |
| 836 buildTesters() { |
| 837 var o = new api.Testers(); |
| 838 buildCounterTesters++; |
| 839 if (buildCounterTesters < 3) { |
| 840 o.googleGroups = buildUnnamed963(); |
| 841 o.googlePlusCommunities = buildUnnamed964(); |
| 842 } |
| 843 buildCounterTesters--; |
| 844 return o; |
| 845 } |
| 846 |
| 847 checkTesters(api.Testers o) { |
| 848 buildCounterTesters++; |
| 849 if (buildCounterTesters < 3) { |
| 850 checkUnnamed963(o.googleGroups); |
| 851 checkUnnamed964(o.googlePlusCommunities); |
| 852 } |
| 853 buildCounterTesters--; |
| 854 } |
| 855 |
| 856 core.int buildCounterTokenPagination = 0; |
| 857 buildTokenPagination() { |
| 858 var o = new api.TokenPagination(); |
| 859 buildCounterTokenPagination++; |
| 860 if (buildCounterTokenPagination < 3) { |
| 861 o.nextPageToken = "foo"; |
| 862 o.previousPageToken = "foo"; |
| 863 } |
| 864 buildCounterTokenPagination--; |
| 865 return o; |
| 866 } |
| 867 |
| 868 checkTokenPagination(api.TokenPagination o) { |
| 869 buildCounterTokenPagination++; |
| 870 if (buildCounterTokenPagination < 3) { |
| 871 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 872 unittest.expect(o.previousPageToken, unittest.equals('foo')); |
| 873 } |
| 874 buildCounterTokenPagination--; |
| 875 } |
| 876 |
| 877 buildUnnamed965() { |
| 878 var o = new core.List<core.int>(); |
| 879 o.add(42); |
| 880 o.add(42); |
| 881 return o; |
| 882 } |
| 883 |
| 884 checkUnnamed965(core.List<core.int> o) { |
| 885 unittest.expect(o, unittest.hasLength(2)); |
| 886 unittest.expect(o[0], unittest.equals(42)); |
| 887 unittest.expect(o[1], unittest.equals(42)); |
| 888 } |
| 889 |
| 890 core.int buildCounterTrack = 0; |
| 891 buildTrack() { |
| 892 var o = new api.Track(); |
| 893 buildCounterTrack++; |
| 894 if (buildCounterTrack < 3) { |
| 895 o.track = "foo"; |
| 896 o.userFraction = 42.0; |
| 897 o.versionCodes = buildUnnamed965(); |
| 898 } |
| 899 buildCounterTrack--; |
| 900 return o; |
| 901 } |
| 902 |
| 903 checkTrack(api.Track o) { |
| 904 buildCounterTrack++; |
| 905 if (buildCounterTrack < 3) { |
| 906 unittest.expect(o.track, unittest.equals('foo')); |
| 907 unittest.expect(o.userFraction, unittest.equals(42.0)); |
| 908 checkUnnamed965(o.versionCodes); |
| 909 } |
| 910 buildCounterTrack--; |
| 911 } |
| 912 |
| 913 buildUnnamed966() { |
| 914 var o = new core.List<api.Track>(); |
| 915 o.add(buildTrack()); |
| 916 o.add(buildTrack()); |
| 917 return o; |
| 918 } |
| 919 |
| 920 checkUnnamed966(core.List<api.Track> o) { |
| 921 unittest.expect(o, unittest.hasLength(2)); |
| 922 checkTrack(o[0]); |
| 923 checkTrack(o[1]); |
| 924 } |
| 925 |
| 926 core.int buildCounterTracksListResponse = 0; |
| 927 buildTracksListResponse() { |
| 928 var o = new api.TracksListResponse(); |
| 929 buildCounterTracksListResponse++; |
| 930 if (buildCounterTracksListResponse < 3) { |
| 931 o.kind = "foo"; |
| 932 o.tracks = buildUnnamed966(); |
| 933 } |
| 934 buildCounterTracksListResponse--; |
| 935 return o; |
| 936 } |
| 937 |
| 938 checkTracksListResponse(api.TracksListResponse o) { |
| 939 buildCounterTracksListResponse++; |
| 940 if (buildCounterTracksListResponse < 3) { |
| 941 unittest.expect(o.kind, unittest.equals('foo')); |
| 942 checkUnnamed966(o.tracks); |
| 943 } |
| 944 buildCounterTracksListResponse--; |
| 945 } |
| 946 |
| 947 |
| 948 main() { |
| 949 unittest.group("obj-schema-Apk", () { |
| 950 unittest.test("to-json--from-json", () { |
| 951 var o = buildApk(); |
| 952 var od = new api.Apk.fromJson(o.toJson()); |
| 953 checkApk(od); |
| 954 }); |
| 955 }); |
| 956 |
| 957 |
| 958 unittest.group("obj-schema-ApkBinary", () { |
| 959 unittest.test("to-json--from-json", () { |
| 960 var o = buildApkBinary(); |
| 961 var od = new api.ApkBinary.fromJson(o.toJson()); |
| 962 checkApkBinary(od); |
| 963 }); |
| 964 }); |
| 965 |
| 966 |
| 967 unittest.group("obj-schema-ApkListing", () { |
| 968 unittest.test("to-json--from-json", () { |
| 969 var o = buildApkListing(); |
| 970 var od = new api.ApkListing.fromJson(o.toJson()); |
| 971 checkApkListing(od); |
| 972 }); |
| 973 }); |
| 974 |
| 975 |
| 976 unittest.group("obj-schema-ApkListingsListResponse", () { |
| 977 unittest.test("to-json--from-json", () { |
| 978 var o = buildApkListingsListResponse(); |
| 979 var od = new api.ApkListingsListResponse.fromJson(o.toJson()); |
| 980 checkApkListingsListResponse(od); |
| 981 }); |
| 982 }); |
| 983 |
| 984 |
| 985 unittest.group("obj-schema-ApksListResponse", () { |
| 986 unittest.test("to-json--from-json", () { |
| 987 var o = buildApksListResponse(); |
| 988 var od = new api.ApksListResponse.fromJson(o.toJson()); |
| 989 checkApksListResponse(od); |
| 990 }); |
| 991 }); |
| 992 |
| 993 |
| 994 unittest.group("obj-schema-AppDetails", () { |
| 995 unittest.test("to-json--from-json", () { |
| 996 var o = buildAppDetails(); |
| 997 var od = new api.AppDetails.fromJson(o.toJson()); |
| 998 checkAppDetails(od); |
| 999 }); |
| 1000 }); |
| 1001 |
| 1002 |
| 1003 unittest.group("obj-schema-AppEdit", () { |
| 1004 unittest.test("to-json--from-json", () { |
| 1005 var o = buildAppEdit(); |
| 1006 var od = new api.AppEdit.fromJson(o.toJson()); |
| 1007 checkAppEdit(od); |
| 1008 }); |
| 1009 }); |
| 1010 |
| 1011 |
| 1012 unittest.group("obj-schema-ExpansionFile", () { |
| 1013 unittest.test("to-json--from-json", () { |
| 1014 var o = buildExpansionFile(); |
| 1015 var od = new api.ExpansionFile.fromJson(o.toJson()); |
| 1016 checkExpansionFile(od); |
| 1017 }); |
| 1018 }); |
| 1019 |
| 1020 |
| 1021 unittest.group("obj-schema-ExpansionFilesUploadResponse", () { |
| 1022 unittest.test("to-json--from-json", () { |
| 1023 var o = buildExpansionFilesUploadResponse(); |
| 1024 var od = new api.ExpansionFilesUploadResponse.fromJson(o.toJson()); |
| 1025 checkExpansionFilesUploadResponse(od); |
| 1026 }); |
| 1027 }); |
| 1028 |
| 1029 |
| 1030 unittest.group("obj-schema-Image", () { |
| 1031 unittest.test("to-json--from-json", () { |
| 1032 var o = buildImage(); |
| 1033 var od = new api.Image.fromJson(o.toJson()); |
| 1034 checkImage(od); |
| 1035 }); |
| 1036 }); |
| 1037 |
| 1038 |
| 1039 unittest.group("obj-schema-ImagesDeleteAllResponse", () { |
| 1040 unittest.test("to-json--from-json", () { |
| 1041 var o = buildImagesDeleteAllResponse(); |
| 1042 var od = new api.ImagesDeleteAllResponse.fromJson(o.toJson()); |
| 1043 checkImagesDeleteAllResponse(od); |
| 1044 }); |
| 1045 }); |
| 1046 |
| 1047 |
| 1048 unittest.group("obj-schema-ImagesListResponse", () { |
| 1049 unittest.test("to-json--from-json", () { |
| 1050 var o = buildImagesListResponse(); |
| 1051 var od = new api.ImagesListResponse.fromJson(o.toJson()); |
| 1052 checkImagesListResponse(od); |
| 1053 }); |
| 1054 }); |
| 1055 |
| 1056 |
| 1057 unittest.group("obj-schema-ImagesUploadResponse", () { |
| 1058 unittest.test("to-json--from-json", () { |
| 1059 var o = buildImagesUploadResponse(); |
| 1060 var od = new api.ImagesUploadResponse.fromJson(o.toJson()); |
| 1061 checkImagesUploadResponse(od); |
| 1062 }); |
| 1063 }); |
| 1064 |
| 1065 |
| 1066 unittest.group("obj-schema-InAppProduct", () { |
| 1067 unittest.test("to-json--from-json", () { |
| 1068 var o = buildInAppProduct(); |
| 1069 var od = new api.InAppProduct.fromJson(o.toJson()); |
| 1070 checkInAppProduct(od); |
| 1071 }); |
| 1072 }); |
| 1073 |
| 1074 |
| 1075 unittest.group("obj-schema-InAppProductListing", () { |
| 1076 unittest.test("to-json--from-json", () { |
| 1077 var o = buildInAppProductListing(); |
| 1078 var od = new api.InAppProductListing.fromJson(o.toJson()); |
| 1079 checkInAppProductListing(od); |
| 1080 }); |
| 1081 }); |
| 1082 |
| 1083 |
| 1084 unittest.group("obj-schema-InappproductsBatchRequest", () { |
| 1085 unittest.test("to-json--from-json", () { |
| 1086 var o = buildInappproductsBatchRequest(); |
| 1087 var od = new api.InappproductsBatchRequest.fromJson(o.toJson()); |
| 1088 checkInappproductsBatchRequest(od); |
| 1089 }); |
| 1090 }); |
| 1091 |
| 1092 |
| 1093 unittest.group("obj-schema-InappproductsBatchRequestEntry", () { |
| 1094 unittest.test("to-json--from-json", () { |
| 1095 var o = buildInappproductsBatchRequestEntry(); |
| 1096 var od = new api.InappproductsBatchRequestEntry.fromJson(o.toJson()); |
| 1097 checkInappproductsBatchRequestEntry(od); |
| 1098 }); |
| 1099 }); |
| 1100 |
| 1101 |
| 1102 unittest.group("obj-schema-InappproductsBatchResponse", () { |
| 1103 unittest.test("to-json--from-json", () { |
| 1104 var o = buildInappproductsBatchResponse(); |
| 1105 var od = new api.InappproductsBatchResponse.fromJson(o.toJson()); |
| 1106 checkInappproductsBatchResponse(od); |
| 1107 }); |
| 1108 }); |
| 1109 |
| 1110 |
| 1111 unittest.group("obj-schema-InappproductsBatchResponseEntry", () { |
| 1112 unittest.test("to-json--from-json", () { |
| 1113 var o = buildInappproductsBatchResponseEntry(); |
| 1114 var od = new api.InappproductsBatchResponseEntry.fromJson(o.toJson()); |
| 1115 checkInappproductsBatchResponseEntry(od); |
| 1116 }); |
| 1117 }); |
| 1118 |
| 1119 |
| 1120 unittest.group("obj-schema-InappproductsInsertRequest", () { |
| 1121 unittest.test("to-json--from-json", () { |
| 1122 var o = buildInappproductsInsertRequest(); |
| 1123 var od = new api.InappproductsInsertRequest.fromJson(o.toJson()); |
| 1124 checkInappproductsInsertRequest(od); |
| 1125 }); |
| 1126 }); |
| 1127 |
| 1128 |
| 1129 unittest.group("obj-schema-InappproductsInsertResponse", () { |
| 1130 unittest.test("to-json--from-json", () { |
| 1131 var o = buildInappproductsInsertResponse(); |
| 1132 var od = new api.InappproductsInsertResponse.fromJson(o.toJson()); |
| 1133 checkInappproductsInsertResponse(od); |
| 1134 }); |
| 1135 }); |
| 1136 |
| 1137 |
| 1138 unittest.group("obj-schema-InappproductsListResponse", () { |
| 1139 unittest.test("to-json--from-json", () { |
| 1140 var o = buildInappproductsListResponse(); |
| 1141 var od = new api.InappproductsListResponse.fromJson(o.toJson()); |
| 1142 checkInappproductsListResponse(od); |
| 1143 }); |
| 1144 }); |
| 1145 |
| 1146 |
| 1147 unittest.group("obj-schema-InappproductsUpdateRequest", () { |
| 1148 unittest.test("to-json--from-json", () { |
| 1149 var o = buildInappproductsUpdateRequest(); |
| 1150 var od = new api.InappproductsUpdateRequest.fromJson(o.toJson()); |
| 1151 checkInappproductsUpdateRequest(od); |
| 1152 }); |
| 1153 }); |
| 1154 |
| 1155 |
| 1156 unittest.group("obj-schema-InappproductsUpdateResponse", () { |
| 1157 unittest.test("to-json--from-json", () { |
| 1158 var o = buildInappproductsUpdateResponse(); |
| 1159 var od = new api.InappproductsUpdateResponse.fromJson(o.toJson()); |
| 1160 checkInappproductsUpdateResponse(od); |
| 1161 }); |
| 1162 }); |
| 1163 |
| 1164 |
| 1165 unittest.group("obj-schema-Listing", () { |
| 1166 unittest.test("to-json--from-json", () { |
| 1167 var o = buildListing(); |
| 1168 var od = new api.Listing.fromJson(o.toJson()); |
| 1169 checkListing(od); |
| 1170 }); |
| 1171 }); |
| 1172 |
| 1173 |
| 1174 unittest.group("obj-schema-ListingsListResponse", () { |
| 1175 unittest.test("to-json--from-json", () { |
| 1176 var o = buildListingsListResponse(); |
| 1177 var od = new api.ListingsListResponse.fromJson(o.toJson()); |
| 1178 checkListingsListResponse(od); |
| 1179 }); |
| 1180 }); |
| 1181 |
| 1182 |
| 1183 unittest.group("obj-schema-PageInfo", () { |
| 1184 unittest.test("to-json--from-json", () { |
| 1185 var o = buildPageInfo(); |
| 1186 var od = new api.PageInfo.fromJson(o.toJson()); |
| 1187 checkPageInfo(od); |
| 1188 }); |
| 1189 }); |
| 1190 |
| 1191 |
| 1192 unittest.group("obj-schema-Price", () { |
| 1193 unittest.test("to-json--from-json", () { |
| 1194 var o = buildPrice(); |
| 1195 var od = new api.Price.fromJson(o.toJson()); |
| 1196 checkPrice(od); |
| 1197 }); |
| 1198 }); |
| 1199 |
| 1200 |
| 1201 unittest.group("obj-schema-ProductPurchase", () { |
| 1202 unittest.test("to-json--from-json", () { |
| 1203 var o = buildProductPurchase(); |
| 1204 var od = new api.ProductPurchase.fromJson(o.toJson()); |
| 1205 checkProductPurchase(od); |
| 1206 }); |
| 1207 }); |
| 1208 |
| 1209 |
| 1210 unittest.group("obj-schema-SubscriptionPurchase", () { |
| 1211 unittest.test("to-json--from-json", () { |
| 1212 var o = buildSubscriptionPurchase(); |
| 1213 var od = new api.SubscriptionPurchase.fromJson(o.toJson()); |
| 1214 checkSubscriptionPurchase(od); |
| 1215 }); |
| 1216 }); |
| 1217 |
| 1218 |
| 1219 unittest.group("obj-schema-Testers", () { |
| 1220 unittest.test("to-json--from-json", () { |
| 1221 var o = buildTesters(); |
| 1222 var od = new api.Testers.fromJson(o.toJson()); |
| 1223 checkTesters(od); |
| 1224 }); |
| 1225 }); |
| 1226 |
| 1227 |
| 1228 unittest.group("obj-schema-TokenPagination", () { |
| 1229 unittest.test("to-json--from-json", () { |
| 1230 var o = buildTokenPagination(); |
| 1231 var od = new api.TokenPagination.fromJson(o.toJson()); |
| 1232 checkTokenPagination(od); |
| 1233 }); |
| 1234 }); |
| 1235 |
| 1236 |
| 1237 unittest.group("obj-schema-Track", () { |
| 1238 unittest.test("to-json--from-json", () { |
| 1239 var o = buildTrack(); |
| 1240 var od = new api.Track.fromJson(o.toJson()); |
| 1241 checkTrack(od); |
| 1242 }); |
| 1243 }); |
| 1244 |
| 1245 |
| 1246 unittest.group("obj-schema-TracksListResponse", () { |
| 1247 unittest.test("to-json--from-json", () { |
| 1248 var o = buildTracksListResponse(); |
| 1249 var od = new api.TracksListResponse.fromJson(o.toJson()); |
| 1250 checkTracksListResponse(od); |
| 1251 }); |
| 1252 }); |
| 1253 |
| 1254 |
| 1255 unittest.group("resource-EditsResourceApi", () { |
| 1256 unittest.test("method--commit", () { |
| 1257 |
| 1258 var mock = new common_test.HttpServerMock(); |
| 1259 api.EditsResourceApi res = new api.AndroidpublisherApi(mock).edits; |
| 1260 var arg_packageName = "foo"; |
| 1261 var arg_editId = "foo"; |
| 1262 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1263 var path = (req.url).path; |
| 1264 var pathOffset = 0; |
| 1265 var index; |
| 1266 var subPart; |
| 1267 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1268 pathOffset += 34; |
| 1269 index = path.indexOf("/edits/", pathOffset); |
| 1270 unittest.expect(index >= 0, unittest.isTrue); |
| 1271 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1272 pathOffset = index; |
| 1273 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1274 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1275 pathOffset += 7; |
| 1276 index = path.indexOf(":commit", pathOffset); |
| 1277 unittest.expect(index >= 0, unittest.isTrue); |
| 1278 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1279 pathOffset = index; |
| 1280 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1281 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als(":commit")); |
| 1282 pathOffset += 7; |
| 1283 |
| 1284 var query = (req.url).query; |
| 1285 var queryOffset = 0; |
| 1286 var queryMap = {}; |
| 1287 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1288 parseBool(n) { |
| 1289 if (n == "true") return true; |
| 1290 if (n == "false") return false; |
| 1291 if (n == null) return null; |
| 1292 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1293 } |
| 1294 if (query.length > 0) { |
| 1295 for (var part in query.split("&")) { |
| 1296 var keyvalue = part.split("="); |
| 1297 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1298 } |
| 1299 } |
| 1300 |
| 1301 |
| 1302 var h = { |
| 1303 "content-type" : "application/json; charset=utf-8", |
| 1304 }; |
| 1305 var resp = convert.JSON.encode(buildAppEdit()); |
| 1306 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1307 }), true); |
| 1308 res.commit(arg_packageName, arg_editId).then(unittest.expectAsync(((api.Ap
pEdit response) { |
| 1309 checkAppEdit(response); |
| 1310 }))); |
| 1311 }); |
| 1312 |
| 1313 unittest.test("method--delete", () { |
| 1314 |
| 1315 var mock = new common_test.HttpServerMock(); |
| 1316 api.EditsResourceApi res = new api.AndroidpublisherApi(mock).edits; |
| 1317 var arg_packageName = "foo"; |
| 1318 var arg_editId = "foo"; |
| 1319 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1320 var path = (req.url).path; |
| 1321 var pathOffset = 0; |
| 1322 var index; |
| 1323 var subPart; |
| 1324 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1325 pathOffset += 34; |
| 1326 index = path.indexOf("/edits/", pathOffset); |
| 1327 unittest.expect(index >= 0, unittest.isTrue); |
| 1328 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1329 pathOffset = index; |
| 1330 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1331 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1332 pathOffset += 7; |
| 1333 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1334 pathOffset = path.length; |
| 1335 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1336 |
| 1337 var query = (req.url).query; |
| 1338 var queryOffset = 0; |
| 1339 var queryMap = {}; |
| 1340 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1341 parseBool(n) { |
| 1342 if (n == "true") return true; |
| 1343 if (n == "false") return false; |
| 1344 if (n == null) return null; |
| 1345 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1346 } |
| 1347 if (query.length > 0) { |
| 1348 for (var part in query.split("&")) { |
| 1349 var keyvalue = part.split("="); |
| 1350 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1351 } |
| 1352 } |
| 1353 |
| 1354 |
| 1355 var h = { |
| 1356 "content-type" : "application/json; charset=utf-8", |
| 1357 }; |
| 1358 var resp = ""; |
| 1359 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1360 }), true); |
| 1361 res.delete(arg_packageName, arg_editId).then(unittest.expectAsync((_) {}))
; |
| 1362 }); |
| 1363 |
| 1364 unittest.test("method--get", () { |
| 1365 |
| 1366 var mock = new common_test.HttpServerMock(); |
| 1367 api.EditsResourceApi res = new api.AndroidpublisherApi(mock).edits; |
| 1368 var arg_packageName = "foo"; |
| 1369 var arg_editId = "foo"; |
| 1370 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1371 var path = (req.url).path; |
| 1372 var pathOffset = 0; |
| 1373 var index; |
| 1374 var subPart; |
| 1375 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1376 pathOffset += 34; |
| 1377 index = path.indexOf("/edits/", pathOffset); |
| 1378 unittest.expect(index >= 0, unittest.isTrue); |
| 1379 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1380 pathOffset = index; |
| 1381 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1382 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1383 pathOffset += 7; |
| 1384 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1385 pathOffset = path.length; |
| 1386 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1387 |
| 1388 var query = (req.url).query; |
| 1389 var queryOffset = 0; |
| 1390 var queryMap = {}; |
| 1391 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1392 parseBool(n) { |
| 1393 if (n == "true") return true; |
| 1394 if (n == "false") return false; |
| 1395 if (n == null) return null; |
| 1396 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1397 } |
| 1398 if (query.length > 0) { |
| 1399 for (var part in query.split("&")) { |
| 1400 var keyvalue = part.split("="); |
| 1401 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1402 } |
| 1403 } |
| 1404 |
| 1405 |
| 1406 var h = { |
| 1407 "content-type" : "application/json; charset=utf-8", |
| 1408 }; |
| 1409 var resp = convert.JSON.encode(buildAppEdit()); |
| 1410 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1411 }), true); |
| 1412 res.get(arg_packageName, arg_editId).then(unittest.expectAsync(((api.AppEd
it response) { |
| 1413 checkAppEdit(response); |
| 1414 }))); |
| 1415 }); |
| 1416 |
| 1417 unittest.test("method--insert", () { |
| 1418 |
| 1419 var mock = new common_test.HttpServerMock(); |
| 1420 api.EditsResourceApi res = new api.AndroidpublisherApi(mock).edits; |
| 1421 var arg_request = buildAppEdit(); |
| 1422 var arg_packageName = "foo"; |
| 1423 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1424 var obj = new api.AppEdit.fromJson(json); |
| 1425 checkAppEdit(obj); |
| 1426 |
| 1427 var path = (req.url).path; |
| 1428 var pathOffset = 0; |
| 1429 var index; |
| 1430 var subPart; |
| 1431 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1432 pathOffset += 34; |
| 1433 index = path.indexOf("/edits", pathOffset); |
| 1434 unittest.expect(index >= 0, unittest.isTrue); |
| 1435 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1436 pathOffset = index; |
| 1437 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1438 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/edits")); |
| 1439 pathOffset += 6; |
| 1440 |
| 1441 var query = (req.url).query; |
| 1442 var queryOffset = 0; |
| 1443 var queryMap = {}; |
| 1444 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1445 parseBool(n) { |
| 1446 if (n == "true") return true; |
| 1447 if (n == "false") return false; |
| 1448 if (n == null) return null; |
| 1449 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1450 } |
| 1451 if (query.length > 0) { |
| 1452 for (var part in query.split("&")) { |
| 1453 var keyvalue = part.split("="); |
| 1454 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1455 } |
| 1456 } |
| 1457 |
| 1458 |
| 1459 var h = { |
| 1460 "content-type" : "application/json; charset=utf-8", |
| 1461 }; |
| 1462 var resp = convert.JSON.encode(buildAppEdit()); |
| 1463 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1464 }), true); |
| 1465 res.insert(arg_request, arg_packageName).then(unittest.expectAsync(((api.A
ppEdit response) { |
| 1466 checkAppEdit(response); |
| 1467 }))); |
| 1468 }); |
| 1469 |
| 1470 unittest.test("method--validate", () { |
| 1471 |
| 1472 var mock = new common_test.HttpServerMock(); |
| 1473 api.EditsResourceApi res = new api.AndroidpublisherApi(mock).edits; |
| 1474 var arg_packageName = "foo"; |
| 1475 var arg_editId = "foo"; |
| 1476 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1477 var path = (req.url).path; |
| 1478 var pathOffset = 0; |
| 1479 var index; |
| 1480 var subPart; |
| 1481 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1482 pathOffset += 34; |
| 1483 index = path.indexOf("/edits/", pathOffset); |
| 1484 unittest.expect(index >= 0, unittest.isTrue); |
| 1485 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1486 pathOffset = index; |
| 1487 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1488 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1489 pathOffset += 7; |
| 1490 index = path.indexOf(":validate", pathOffset); |
| 1491 unittest.expect(index >= 0, unittest.isTrue); |
| 1492 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1493 pathOffset = index; |
| 1494 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1495 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als(":validate")); |
| 1496 pathOffset += 9; |
| 1497 |
| 1498 var query = (req.url).query; |
| 1499 var queryOffset = 0; |
| 1500 var queryMap = {}; |
| 1501 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1502 parseBool(n) { |
| 1503 if (n == "true") return true; |
| 1504 if (n == "false") return false; |
| 1505 if (n == null) return null; |
| 1506 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1507 } |
| 1508 if (query.length > 0) { |
| 1509 for (var part in query.split("&")) { |
| 1510 var keyvalue = part.split("="); |
| 1511 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1512 } |
| 1513 } |
| 1514 |
| 1515 |
| 1516 var h = { |
| 1517 "content-type" : "application/json; charset=utf-8", |
| 1518 }; |
| 1519 var resp = convert.JSON.encode(buildAppEdit()); |
| 1520 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1521 }), true); |
| 1522 res.validate(arg_packageName, arg_editId).then(unittest.expectAsync(((api.
AppEdit response) { |
| 1523 checkAppEdit(response); |
| 1524 }))); |
| 1525 }); |
| 1526 |
| 1527 }); |
| 1528 |
| 1529 |
| 1530 unittest.group("resource-EditsApklistingsResourceApi", () { |
| 1531 unittest.test("method--delete", () { |
| 1532 |
| 1533 var mock = new common_test.HttpServerMock(); |
| 1534 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1535 var arg_packageName = "foo"; |
| 1536 var arg_editId = "foo"; |
| 1537 var arg_apkVersionCode = 42; |
| 1538 var arg_language = "foo"; |
| 1539 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1540 var path = (req.url).path; |
| 1541 var pathOffset = 0; |
| 1542 var index; |
| 1543 var subPart; |
| 1544 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1545 pathOffset += 34; |
| 1546 index = path.indexOf("/edits/", pathOffset); |
| 1547 unittest.expect(index >= 0, unittest.isTrue); |
| 1548 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1549 pathOffset = index; |
| 1550 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1551 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1552 pathOffset += 7; |
| 1553 index = path.indexOf("/apks/", pathOffset); |
| 1554 unittest.expect(index >= 0, unittest.isTrue); |
| 1555 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1556 pathOffset = index; |
| 1557 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1558 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1559 pathOffset += 6; |
| 1560 index = path.indexOf("/listings/", pathOffset); |
| 1561 unittest.expect(index >= 0, unittest.isTrue); |
| 1562 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1563 pathOffset = index; |
| 1564 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1565 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 1566 pathOffset += 10; |
| 1567 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1568 pathOffset = path.length; |
| 1569 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 1570 |
| 1571 var query = (req.url).query; |
| 1572 var queryOffset = 0; |
| 1573 var queryMap = {}; |
| 1574 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1575 parseBool(n) { |
| 1576 if (n == "true") return true; |
| 1577 if (n == "false") return false; |
| 1578 if (n == null) return null; |
| 1579 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1580 } |
| 1581 if (query.length > 0) { |
| 1582 for (var part in query.split("&")) { |
| 1583 var keyvalue = part.split("="); |
| 1584 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1585 } |
| 1586 } |
| 1587 |
| 1588 |
| 1589 var h = { |
| 1590 "content-type" : "application/json; charset=utf-8", |
| 1591 }; |
| 1592 var resp = ""; |
| 1593 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1594 }), true); |
| 1595 res.delete(arg_packageName, arg_editId, arg_apkVersionCode, arg_language).
then(unittest.expectAsync((_) {})); |
| 1596 }); |
| 1597 |
| 1598 unittest.test("method--deleteall", () { |
| 1599 |
| 1600 var mock = new common_test.HttpServerMock(); |
| 1601 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1602 var arg_packageName = "foo"; |
| 1603 var arg_editId = "foo"; |
| 1604 var arg_apkVersionCode = 42; |
| 1605 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1606 var path = (req.url).path; |
| 1607 var pathOffset = 0; |
| 1608 var index; |
| 1609 var subPart; |
| 1610 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1611 pathOffset += 34; |
| 1612 index = path.indexOf("/edits/", pathOffset); |
| 1613 unittest.expect(index >= 0, unittest.isTrue); |
| 1614 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1615 pathOffset = index; |
| 1616 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1617 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1618 pathOffset += 7; |
| 1619 index = path.indexOf("/apks/", pathOffset); |
| 1620 unittest.expect(index >= 0, unittest.isTrue); |
| 1621 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1622 pathOffset = index; |
| 1623 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1624 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1625 pathOffset += 6; |
| 1626 index = path.indexOf("/listings", pathOffset); |
| 1627 unittest.expect(index >= 0, unittest.isTrue); |
| 1628 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1629 pathOffset = index; |
| 1630 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1631 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/listings")); |
| 1632 pathOffset += 9; |
| 1633 |
| 1634 var query = (req.url).query; |
| 1635 var queryOffset = 0; |
| 1636 var queryMap = {}; |
| 1637 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1638 parseBool(n) { |
| 1639 if (n == "true") return true; |
| 1640 if (n == "false") return false; |
| 1641 if (n == null) return null; |
| 1642 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1643 } |
| 1644 if (query.length > 0) { |
| 1645 for (var part in query.split("&")) { |
| 1646 var keyvalue = part.split("="); |
| 1647 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1648 } |
| 1649 } |
| 1650 |
| 1651 |
| 1652 var h = { |
| 1653 "content-type" : "application/json; charset=utf-8", |
| 1654 }; |
| 1655 var resp = ""; |
| 1656 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1657 }), true); |
| 1658 res.deleteall(arg_packageName, arg_editId, arg_apkVersionCode).then(unitte
st.expectAsync((_) {})); |
| 1659 }); |
| 1660 |
| 1661 unittest.test("method--get", () { |
| 1662 |
| 1663 var mock = new common_test.HttpServerMock(); |
| 1664 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1665 var arg_packageName = "foo"; |
| 1666 var arg_editId = "foo"; |
| 1667 var arg_apkVersionCode = 42; |
| 1668 var arg_language = "foo"; |
| 1669 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1670 var path = (req.url).path; |
| 1671 var pathOffset = 0; |
| 1672 var index; |
| 1673 var subPart; |
| 1674 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1675 pathOffset += 34; |
| 1676 index = path.indexOf("/edits/", pathOffset); |
| 1677 unittest.expect(index >= 0, unittest.isTrue); |
| 1678 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1679 pathOffset = index; |
| 1680 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1681 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1682 pathOffset += 7; |
| 1683 index = path.indexOf("/apks/", pathOffset); |
| 1684 unittest.expect(index >= 0, unittest.isTrue); |
| 1685 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1686 pathOffset = index; |
| 1687 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1688 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1689 pathOffset += 6; |
| 1690 index = path.indexOf("/listings/", pathOffset); |
| 1691 unittest.expect(index >= 0, unittest.isTrue); |
| 1692 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1693 pathOffset = index; |
| 1694 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1695 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 1696 pathOffset += 10; |
| 1697 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1698 pathOffset = path.length; |
| 1699 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 1700 |
| 1701 var query = (req.url).query; |
| 1702 var queryOffset = 0; |
| 1703 var queryMap = {}; |
| 1704 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1705 parseBool(n) { |
| 1706 if (n == "true") return true; |
| 1707 if (n == "false") return false; |
| 1708 if (n == null) return null; |
| 1709 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1710 } |
| 1711 if (query.length > 0) { |
| 1712 for (var part in query.split("&")) { |
| 1713 var keyvalue = part.split("="); |
| 1714 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1715 } |
| 1716 } |
| 1717 |
| 1718 |
| 1719 var h = { |
| 1720 "content-type" : "application/json; charset=utf-8", |
| 1721 }; |
| 1722 var resp = convert.JSON.encode(buildApkListing()); |
| 1723 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1724 }), true); |
| 1725 res.get(arg_packageName, arg_editId, arg_apkVersionCode, arg_language).the
n(unittest.expectAsync(((api.ApkListing response) { |
| 1726 checkApkListing(response); |
| 1727 }))); |
| 1728 }); |
| 1729 |
| 1730 unittest.test("method--list", () { |
| 1731 |
| 1732 var mock = new common_test.HttpServerMock(); |
| 1733 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1734 var arg_packageName = "foo"; |
| 1735 var arg_editId = "foo"; |
| 1736 var arg_apkVersionCode = 42; |
| 1737 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1738 var path = (req.url).path; |
| 1739 var pathOffset = 0; |
| 1740 var index; |
| 1741 var subPart; |
| 1742 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1743 pathOffset += 34; |
| 1744 index = path.indexOf("/edits/", pathOffset); |
| 1745 unittest.expect(index >= 0, unittest.isTrue); |
| 1746 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1747 pathOffset = index; |
| 1748 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1749 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1750 pathOffset += 7; |
| 1751 index = path.indexOf("/apks/", pathOffset); |
| 1752 unittest.expect(index >= 0, unittest.isTrue); |
| 1753 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1754 pathOffset = index; |
| 1755 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1756 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1757 pathOffset += 6; |
| 1758 index = path.indexOf("/listings", pathOffset); |
| 1759 unittest.expect(index >= 0, unittest.isTrue); |
| 1760 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1761 pathOffset = index; |
| 1762 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1763 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/listings")); |
| 1764 pathOffset += 9; |
| 1765 |
| 1766 var query = (req.url).query; |
| 1767 var queryOffset = 0; |
| 1768 var queryMap = {}; |
| 1769 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1770 parseBool(n) { |
| 1771 if (n == "true") return true; |
| 1772 if (n == "false") return false; |
| 1773 if (n == null) return null; |
| 1774 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1775 } |
| 1776 if (query.length > 0) { |
| 1777 for (var part in query.split("&")) { |
| 1778 var keyvalue = part.split("="); |
| 1779 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1780 } |
| 1781 } |
| 1782 |
| 1783 |
| 1784 var h = { |
| 1785 "content-type" : "application/json; charset=utf-8", |
| 1786 }; |
| 1787 var resp = convert.JSON.encode(buildApkListingsListResponse()); |
| 1788 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1789 }), true); |
| 1790 res.list(arg_packageName, arg_editId, arg_apkVersionCode).then(unittest.ex
pectAsync(((api.ApkListingsListResponse response) { |
| 1791 checkApkListingsListResponse(response); |
| 1792 }))); |
| 1793 }); |
| 1794 |
| 1795 unittest.test("method--patch", () { |
| 1796 |
| 1797 var mock = new common_test.HttpServerMock(); |
| 1798 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1799 var arg_request = buildApkListing(); |
| 1800 var arg_packageName = "foo"; |
| 1801 var arg_editId = "foo"; |
| 1802 var arg_apkVersionCode = 42; |
| 1803 var arg_language = "foo"; |
| 1804 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1805 var obj = new api.ApkListing.fromJson(json); |
| 1806 checkApkListing(obj); |
| 1807 |
| 1808 var path = (req.url).path; |
| 1809 var pathOffset = 0; |
| 1810 var index; |
| 1811 var subPart; |
| 1812 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1813 pathOffset += 34; |
| 1814 index = path.indexOf("/edits/", pathOffset); |
| 1815 unittest.expect(index >= 0, unittest.isTrue); |
| 1816 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1817 pathOffset = index; |
| 1818 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1819 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1820 pathOffset += 7; |
| 1821 index = path.indexOf("/apks/", pathOffset); |
| 1822 unittest.expect(index >= 0, unittest.isTrue); |
| 1823 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1824 pathOffset = index; |
| 1825 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1826 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1827 pathOffset += 6; |
| 1828 index = path.indexOf("/listings/", pathOffset); |
| 1829 unittest.expect(index >= 0, unittest.isTrue); |
| 1830 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1831 pathOffset = index; |
| 1832 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1833 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 1834 pathOffset += 10; |
| 1835 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1836 pathOffset = path.length; |
| 1837 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 1838 |
| 1839 var query = (req.url).query; |
| 1840 var queryOffset = 0; |
| 1841 var queryMap = {}; |
| 1842 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1843 parseBool(n) { |
| 1844 if (n == "true") return true; |
| 1845 if (n == "false") return false; |
| 1846 if (n == null) return null; |
| 1847 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1848 } |
| 1849 if (query.length > 0) { |
| 1850 for (var part in query.split("&")) { |
| 1851 var keyvalue = part.split("="); |
| 1852 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1853 } |
| 1854 } |
| 1855 |
| 1856 |
| 1857 var h = { |
| 1858 "content-type" : "application/json; charset=utf-8", |
| 1859 }; |
| 1860 var resp = convert.JSON.encode(buildApkListing()); |
| 1861 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1862 }), true); |
| 1863 res.patch(arg_request, arg_packageName, arg_editId, arg_apkVersionCode, ar
g_language).then(unittest.expectAsync(((api.ApkListing response) { |
| 1864 checkApkListing(response); |
| 1865 }))); |
| 1866 }); |
| 1867 |
| 1868 unittest.test("method--update", () { |
| 1869 |
| 1870 var mock = new common_test.HttpServerMock(); |
| 1871 api.EditsApklistingsResourceApi res = new api.AndroidpublisherApi(mock).ed
its.apklistings; |
| 1872 var arg_request = buildApkListing(); |
| 1873 var arg_packageName = "foo"; |
| 1874 var arg_editId = "foo"; |
| 1875 var arg_apkVersionCode = 42; |
| 1876 var arg_language = "foo"; |
| 1877 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1878 var obj = new api.ApkListing.fromJson(json); |
| 1879 checkApkListing(obj); |
| 1880 |
| 1881 var path = (req.url).path; |
| 1882 var pathOffset = 0; |
| 1883 var index; |
| 1884 var subPart; |
| 1885 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1886 pathOffset += 34; |
| 1887 index = path.indexOf("/edits/", pathOffset); |
| 1888 unittest.expect(index >= 0, unittest.isTrue); |
| 1889 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1890 pathOffset = index; |
| 1891 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1892 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1893 pathOffset += 7; |
| 1894 index = path.indexOf("/apks/", pathOffset); |
| 1895 unittest.expect(index >= 0, unittest.isTrue); |
| 1896 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1897 pathOffset = index; |
| 1898 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1899 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 1900 pathOffset += 6; |
| 1901 index = path.indexOf("/listings/", pathOffset); |
| 1902 unittest.expect(index >= 0, unittest.isTrue); |
| 1903 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1904 pathOffset = index; |
| 1905 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 1906 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 1907 pathOffset += 10; |
| 1908 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1909 pathOffset = path.length; |
| 1910 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 1911 |
| 1912 var query = (req.url).query; |
| 1913 var queryOffset = 0; |
| 1914 var queryMap = {}; |
| 1915 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1916 parseBool(n) { |
| 1917 if (n == "true") return true; |
| 1918 if (n == "false") return false; |
| 1919 if (n == null) return null; |
| 1920 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1921 } |
| 1922 if (query.length > 0) { |
| 1923 for (var part in query.split("&")) { |
| 1924 var keyvalue = part.split("="); |
| 1925 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1926 } |
| 1927 } |
| 1928 |
| 1929 |
| 1930 var h = { |
| 1931 "content-type" : "application/json; charset=utf-8", |
| 1932 }; |
| 1933 var resp = convert.JSON.encode(buildApkListing()); |
| 1934 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1935 }), true); |
| 1936 res.update(arg_request, arg_packageName, arg_editId, arg_apkVersionCode, a
rg_language).then(unittest.expectAsync(((api.ApkListing response) { |
| 1937 checkApkListing(response); |
| 1938 }))); |
| 1939 }); |
| 1940 |
| 1941 }); |
| 1942 |
| 1943 |
| 1944 unittest.group("resource-EditsApksResourceApi", () { |
| 1945 unittest.test("method--list", () { |
| 1946 |
| 1947 var mock = new common_test.HttpServerMock(); |
| 1948 api.EditsApksResourceApi res = new api.AndroidpublisherApi(mock).edits.apk
s; |
| 1949 var arg_packageName = "foo"; |
| 1950 var arg_editId = "foo"; |
| 1951 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1952 var path = (req.url).path; |
| 1953 var pathOffset = 0; |
| 1954 var index; |
| 1955 var subPart; |
| 1956 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 1957 pathOffset += 34; |
| 1958 index = path.indexOf("/edits/", pathOffset); |
| 1959 unittest.expect(index >= 0, unittest.isTrue); |
| 1960 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1961 pathOffset = index; |
| 1962 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 1963 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 1964 pathOffset += 7; |
| 1965 index = path.indexOf("/apks", pathOffset); |
| 1966 unittest.expect(index >= 0, unittest.isTrue); |
| 1967 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1968 pathOffset = index; |
| 1969 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 1970 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("/apks")); |
| 1971 pathOffset += 5; |
| 1972 |
| 1973 var query = (req.url).query; |
| 1974 var queryOffset = 0; |
| 1975 var queryMap = {}; |
| 1976 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1977 parseBool(n) { |
| 1978 if (n == "true") return true; |
| 1979 if (n == "false") return false; |
| 1980 if (n == null) return null; |
| 1981 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1982 } |
| 1983 if (query.length > 0) { |
| 1984 for (var part in query.split("&")) { |
| 1985 var keyvalue = part.split("="); |
| 1986 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1987 } |
| 1988 } |
| 1989 |
| 1990 |
| 1991 var h = { |
| 1992 "content-type" : "application/json; charset=utf-8", |
| 1993 }; |
| 1994 var resp = convert.JSON.encode(buildApksListResponse()); |
| 1995 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1996 }), true); |
| 1997 res.list(arg_packageName, arg_editId).then(unittest.expectAsync(((api.Apks
ListResponse response) { |
| 1998 checkApksListResponse(response); |
| 1999 }))); |
| 2000 }); |
| 2001 |
| 2002 unittest.test("method--upload", () { |
| 2003 // TODO: Implement tests for media upload; |
| 2004 // TODO: Implement tests for media download; |
| 2005 |
| 2006 var mock = new common_test.HttpServerMock(); |
| 2007 api.EditsApksResourceApi res = new api.AndroidpublisherApi(mock).edits.apk
s; |
| 2008 var arg_packageName = "foo"; |
| 2009 var arg_editId = "foo"; |
| 2010 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2011 var path = (req.url).path; |
| 2012 var pathOffset = 0; |
| 2013 var index; |
| 2014 var subPart; |
| 2015 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2016 pathOffset += 34; |
| 2017 index = path.indexOf("/edits/", pathOffset); |
| 2018 unittest.expect(index >= 0, unittest.isTrue); |
| 2019 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2020 pathOffset = index; |
| 2021 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2022 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2023 pathOffset += 7; |
| 2024 index = path.indexOf("/apks", pathOffset); |
| 2025 unittest.expect(index >= 0, unittest.isTrue); |
| 2026 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2027 pathOffset = index; |
| 2028 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2029 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("/apks")); |
| 2030 pathOffset += 5; |
| 2031 |
| 2032 var query = (req.url).query; |
| 2033 var queryOffset = 0; |
| 2034 var queryMap = {}; |
| 2035 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2036 parseBool(n) { |
| 2037 if (n == "true") return true; |
| 2038 if (n == "false") return false; |
| 2039 if (n == null) return null; |
| 2040 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2041 } |
| 2042 if (query.length > 0) { |
| 2043 for (var part in query.split("&")) { |
| 2044 var keyvalue = part.split("="); |
| 2045 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2046 } |
| 2047 } |
| 2048 |
| 2049 |
| 2050 var h = { |
| 2051 "content-type" : "application/json; charset=utf-8", |
| 2052 }; |
| 2053 var resp = convert.JSON.encode(buildApk()); |
| 2054 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2055 }), true); |
| 2056 res.upload(arg_packageName, arg_editId).then(unittest.expectAsync(((api.Ap
k response) { |
| 2057 checkApk(response); |
| 2058 }))); |
| 2059 }); |
| 2060 |
| 2061 }); |
| 2062 |
| 2063 |
| 2064 unittest.group("resource-EditsDetailsResourceApi", () { |
| 2065 unittest.test("method--get", () { |
| 2066 |
| 2067 var mock = new common_test.HttpServerMock(); |
| 2068 api.EditsDetailsResourceApi res = new api.AndroidpublisherApi(mock).edits.
details; |
| 2069 var arg_packageName = "foo"; |
| 2070 var arg_editId = "foo"; |
| 2071 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2072 var path = (req.url).path; |
| 2073 var pathOffset = 0; |
| 2074 var index; |
| 2075 var subPart; |
| 2076 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2077 pathOffset += 34; |
| 2078 index = path.indexOf("/edits/", pathOffset); |
| 2079 unittest.expect(index >= 0, unittest.isTrue); |
| 2080 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2081 pathOffset = index; |
| 2082 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2083 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2084 pathOffset += 7; |
| 2085 index = path.indexOf("/details", pathOffset); |
| 2086 unittest.expect(index >= 0, unittest.isTrue); |
| 2087 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2088 pathOffset = index; |
| 2089 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2090 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/details")); |
| 2091 pathOffset += 8; |
| 2092 |
| 2093 var query = (req.url).query; |
| 2094 var queryOffset = 0; |
| 2095 var queryMap = {}; |
| 2096 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2097 parseBool(n) { |
| 2098 if (n == "true") return true; |
| 2099 if (n == "false") return false; |
| 2100 if (n == null) return null; |
| 2101 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2102 } |
| 2103 if (query.length > 0) { |
| 2104 for (var part in query.split("&")) { |
| 2105 var keyvalue = part.split("="); |
| 2106 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2107 } |
| 2108 } |
| 2109 |
| 2110 |
| 2111 var h = { |
| 2112 "content-type" : "application/json; charset=utf-8", |
| 2113 }; |
| 2114 var resp = convert.JSON.encode(buildAppDetails()); |
| 2115 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2116 }), true); |
| 2117 res.get(arg_packageName, arg_editId).then(unittest.expectAsync(((api.AppDe
tails response) { |
| 2118 checkAppDetails(response); |
| 2119 }))); |
| 2120 }); |
| 2121 |
| 2122 unittest.test("method--patch", () { |
| 2123 |
| 2124 var mock = new common_test.HttpServerMock(); |
| 2125 api.EditsDetailsResourceApi res = new api.AndroidpublisherApi(mock).edits.
details; |
| 2126 var arg_request = buildAppDetails(); |
| 2127 var arg_packageName = "foo"; |
| 2128 var arg_editId = "foo"; |
| 2129 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2130 var obj = new api.AppDetails.fromJson(json); |
| 2131 checkAppDetails(obj); |
| 2132 |
| 2133 var path = (req.url).path; |
| 2134 var pathOffset = 0; |
| 2135 var index; |
| 2136 var subPart; |
| 2137 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2138 pathOffset += 34; |
| 2139 index = path.indexOf("/edits/", pathOffset); |
| 2140 unittest.expect(index >= 0, unittest.isTrue); |
| 2141 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2142 pathOffset = index; |
| 2143 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2144 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2145 pathOffset += 7; |
| 2146 index = path.indexOf("/details", pathOffset); |
| 2147 unittest.expect(index >= 0, unittest.isTrue); |
| 2148 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2149 pathOffset = index; |
| 2150 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2151 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/details")); |
| 2152 pathOffset += 8; |
| 2153 |
| 2154 var query = (req.url).query; |
| 2155 var queryOffset = 0; |
| 2156 var queryMap = {}; |
| 2157 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2158 parseBool(n) { |
| 2159 if (n == "true") return true; |
| 2160 if (n == "false") return false; |
| 2161 if (n == null) return null; |
| 2162 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2163 } |
| 2164 if (query.length > 0) { |
| 2165 for (var part in query.split("&")) { |
| 2166 var keyvalue = part.split("="); |
| 2167 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2168 } |
| 2169 } |
| 2170 |
| 2171 |
| 2172 var h = { |
| 2173 "content-type" : "application/json; charset=utf-8", |
| 2174 }; |
| 2175 var resp = convert.JSON.encode(buildAppDetails()); |
| 2176 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2177 }), true); |
| 2178 res.patch(arg_request, arg_packageName, arg_editId).then(unittest.expectAs
ync(((api.AppDetails response) { |
| 2179 checkAppDetails(response); |
| 2180 }))); |
| 2181 }); |
| 2182 |
| 2183 unittest.test("method--update", () { |
| 2184 |
| 2185 var mock = new common_test.HttpServerMock(); |
| 2186 api.EditsDetailsResourceApi res = new api.AndroidpublisherApi(mock).edits.
details; |
| 2187 var arg_request = buildAppDetails(); |
| 2188 var arg_packageName = "foo"; |
| 2189 var arg_editId = "foo"; |
| 2190 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2191 var obj = new api.AppDetails.fromJson(json); |
| 2192 checkAppDetails(obj); |
| 2193 |
| 2194 var path = (req.url).path; |
| 2195 var pathOffset = 0; |
| 2196 var index; |
| 2197 var subPart; |
| 2198 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2199 pathOffset += 34; |
| 2200 index = path.indexOf("/edits/", pathOffset); |
| 2201 unittest.expect(index >= 0, unittest.isTrue); |
| 2202 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2203 pathOffset = index; |
| 2204 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2205 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2206 pathOffset += 7; |
| 2207 index = path.indexOf("/details", pathOffset); |
| 2208 unittest.expect(index >= 0, unittest.isTrue); |
| 2209 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2210 pathOffset = index; |
| 2211 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2212 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/details")); |
| 2213 pathOffset += 8; |
| 2214 |
| 2215 var query = (req.url).query; |
| 2216 var queryOffset = 0; |
| 2217 var queryMap = {}; |
| 2218 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2219 parseBool(n) { |
| 2220 if (n == "true") return true; |
| 2221 if (n == "false") return false; |
| 2222 if (n == null) return null; |
| 2223 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2224 } |
| 2225 if (query.length > 0) { |
| 2226 for (var part in query.split("&")) { |
| 2227 var keyvalue = part.split("="); |
| 2228 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2229 } |
| 2230 } |
| 2231 |
| 2232 |
| 2233 var h = { |
| 2234 "content-type" : "application/json; charset=utf-8", |
| 2235 }; |
| 2236 var resp = convert.JSON.encode(buildAppDetails()); |
| 2237 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2238 }), true); |
| 2239 res.update(arg_request, arg_packageName, arg_editId).then(unittest.expectA
sync(((api.AppDetails response) { |
| 2240 checkAppDetails(response); |
| 2241 }))); |
| 2242 }); |
| 2243 |
| 2244 }); |
| 2245 |
| 2246 |
| 2247 unittest.group("resource-EditsExpansionfilesResourceApi", () { |
| 2248 unittest.test("method--get", () { |
| 2249 |
| 2250 var mock = new common_test.HttpServerMock(); |
| 2251 api.EditsExpansionfilesResourceApi res = new api.AndroidpublisherApi(mock)
.edits.expansionfiles; |
| 2252 var arg_packageName = "foo"; |
| 2253 var arg_editId = "foo"; |
| 2254 var arg_apkVersionCode = 42; |
| 2255 var arg_expansionFileType = "foo"; |
| 2256 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2257 var path = (req.url).path; |
| 2258 var pathOffset = 0; |
| 2259 var index; |
| 2260 var subPart; |
| 2261 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2262 pathOffset += 34; |
| 2263 index = path.indexOf("/edits/", pathOffset); |
| 2264 unittest.expect(index >= 0, unittest.isTrue); |
| 2265 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2266 pathOffset = index; |
| 2267 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2268 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2269 pathOffset += 7; |
| 2270 index = path.indexOf("/apks/", pathOffset); |
| 2271 unittest.expect(index >= 0, unittest.isTrue); |
| 2272 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2273 pathOffset = index; |
| 2274 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2275 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 2276 pathOffset += 6; |
| 2277 index = path.indexOf("/expansionFiles/", pathOffset); |
| 2278 unittest.expect(index >= 0, unittest.isTrue); |
| 2279 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2280 pathOffset = index; |
| 2281 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 2282 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/expansionFiles/")); |
| 2283 pathOffset += 16; |
| 2284 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2285 pathOffset = path.length; |
| 2286 unittest.expect(subPart, unittest.equals("$arg_expansionFileType")); |
| 2287 |
| 2288 var query = (req.url).query; |
| 2289 var queryOffset = 0; |
| 2290 var queryMap = {}; |
| 2291 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2292 parseBool(n) { |
| 2293 if (n == "true") return true; |
| 2294 if (n == "false") return false; |
| 2295 if (n == null) return null; |
| 2296 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2297 } |
| 2298 if (query.length > 0) { |
| 2299 for (var part in query.split("&")) { |
| 2300 var keyvalue = part.split("="); |
| 2301 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2302 } |
| 2303 } |
| 2304 |
| 2305 |
| 2306 var h = { |
| 2307 "content-type" : "application/json; charset=utf-8", |
| 2308 }; |
| 2309 var resp = convert.JSON.encode(buildExpansionFile()); |
| 2310 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2311 }), true); |
| 2312 res.get(arg_packageName, arg_editId, arg_apkVersionCode, arg_expansionFile
Type).then(unittest.expectAsync(((api.ExpansionFile response) { |
| 2313 checkExpansionFile(response); |
| 2314 }))); |
| 2315 }); |
| 2316 |
| 2317 unittest.test("method--patch", () { |
| 2318 |
| 2319 var mock = new common_test.HttpServerMock(); |
| 2320 api.EditsExpansionfilesResourceApi res = new api.AndroidpublisherApi(mock)
.edits.expansionfiles; |
| 2321 var arg_request = buildExpansionFile(); |
| 2322 var arg_packageName = "foo"; |
| 2323 var arg_editId = "foo"; |
| 2324 var arg_apkVersionCode = 42; |
| 2325 var arg_expansionFileType = "foo"; |
| 2326 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2327 var obj = new api.ExpansionFile.fromJson(json); |
| 2328 checkExpansionFile(obj); |
| 2329 |
| 2330 var path = (req.url).path; |
| 2331 var pathOffset = 0; |
| 2332 var index; |
| 2333 var subPart; |
| 2334 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2335 pathOffset += 34; |
| 2336 index = path.indexOf("/edits/", pathOffset); |
| 2337 unittest.expect(index >= 0, unittest.isTrue); |
| 2338 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2339 pathOffset = index; |
| 2340 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2341 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2342 pathOffset += 7; |
| 2343 index = path.indexOf("/apks/", pathOffset); |
| 2344 unittest.expect(index >= 0, unittest.isTrue); |
| 2345 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2346 pathOffset = index; |
| 2347 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2348 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 2349 pathOffset += 6; |
| 2350 index = path.indexOf("/expansionFiles/", pathOffset); |
| 2351 unittest.expect(index >= 0, unittest.isTrue); |
| 2352 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2353 pathOffset = index; |
| 2354 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 2355 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/expansionFiles/")); |
| 2356 pathOffset += 16; |
| 2357 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2358 pathOffset = path.length; |
| 2359 unittest.expect(subPart, unittest.equals("$arg_expansionFileType")); |
| 2360 |
| 2361 var query = (req.url).query; |
| 2362 var queryOffset = 0; |
| 2363 var queryMap = {}; |
| 2364 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2365 parseBool(n) { |
| 2366 if (n == "true") return true; |
| 2367 if (n == "false") return false; |
| 2368 if (n == null) return null; |
| 2369 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2370 } |
| 2371 if (query.length > 0) { |
| 2372 for (var part in query.split("&")) { |
| 2373 var keyvalue = part.split("="); |
| 2374 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2375 } |
| 2376 } |
| 2377 |
| 2378 |
| 2379 var h = { |
| 2380 "content-type" : "application/json; charset=utf-8", |
| 2381 }; |
| 2382 var resp = convert.JSON.encode(buildExpansionFile()); |
| 2383 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2384 }), true); |
| 2385 res.patch(arg_request, arg_packageName, arg_editId, arg_apkVersionCode, ar
g_expansionFileType).then(unittest.expectAsync(((api.ExpansionFile response) { |
| 2386 checkExpansionFile(response); |
| 2387 }))); |
| 2388 }); |
| 2389 |
| 2390 unittest.test("method--update", () { |
| 2391 |
| 2392 var mock = new common_test.HttpServerMock(); |
| 2393 api.EditsExpansionfilesResourceApi res = new api.AndroidpublisherApi(mock)
.edits.expansionfiles; |
| 2394 var arg_request = buildExpansionFile(); |
| 2395 var arg_packageName = "foo"; |
| 2396 var arg_editId = "foo"; |
| 2397 var arg_apkVersionCode = 42; |
| 2398 var arg_expansionFileType = "foo"; |
| 2399 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2400 var obj = new api.ExpansionFile.fromJson(json); |
| 2401 checkExpansionFile(obj); |
| 2402 |
| 2403 var path = (req.url).path; |
| 2404 var pathOffset = 0; |
| 2405 var index; |
| 2406 var subPart; |
| 2407 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2408 pathOffset += 34; |
| 2409 index = path.indexOf("/edits/", pathOffset); |
| 2410 unittest.expect(index >= 0, unittest.isTrue); |
| 2411 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2412 pathOffset = index; |
| 2413 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2414 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2415 pathOffset += 7; |
| 2416 index = path.indexOf("/apks/", pathOffset); |
| 2417 unittest.expect(index >= 0, unittest.isTrue); |
| 2418 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2419 pathOffset = index; |
| 2420 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2421 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 2422 pathOffset += 6; |
| 2423 index = path.indexOf("/expansionFiles/", pathOffset); |
| 2424 unittest.expect(index >= 0, unittest.isTrue); |
| 2425 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2426 pathOffset = index; |
| 2427 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 2428 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/expansionFiles/")); |
| 2429 pathOffset += 16; |
| 2430 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2431 pathOffset = path.length; |
| 2432 unittest.expect(subPart, unittest.equals("$arg_expansionFileType")); |
| 2433 |
| 2434 var query = (req.url).query; |
| 2435 var queryOffset = 0; |
| 2436 var queryMap = {}; |
| 2437 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2438 parseBool(n) { |
| 2439 if (n == "true") return true; |
| 2440 if (n == "false") return false; |
| 2441 if (n == null) return null; |
| 2442 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2443 } |
| 2444 if (query.length > 0) { |
| 2445 for (var part in query.split("&")) { |
| 2446 var keyvalue = part.split("="); |
| 2447 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2448 } |
| 2449 } |
| 2450 |
| 2451 |
| 2452 var h = { |
| 2453 "content-type" : "application/json; charset=utf-8", |
| 2454 }; |
| 2455 var resp = convert.JSON.encode(buildExpansionFile()); |
| 2456 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2457 }), true); |
| 2458 res.update(arg_request, arg_packageName, arg_editId, arg_apkVersionCode, a
rg_expansionFileType).then(unittest.expectAsync(((api.ExpansionFile response) { |
| 2459 checkExpansionFile(response); |
| 2460 }))); |
| 2461 }); |
| 2462 |
| 2463 unittest.test("method--upload", () { |
| 2464 // TODO: Implement tests for media upload; |
| 2465 // TODO: Implement tests for media download; |
| 2466 |
| 2467 var mock = new common_test.HttpServerMock(); |
| 2468 api.EditsExpansionfilesResourceApi res = new api.AndroidpublisherApi(mock)
.edits.expansionfiles; |
| 2469 var arg_packageName = "foo"; |
| 2470 var arg_editId = "foo"; |
| 2471 var arg_apkVersionCode = 42; |
| 2472 var arg_expansionFileType = "foo"; |
| 2473 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2474 var path = (req.url).path; |
| 2475 var pathOffset = 0; |
| 2476 var index; |
| 2477 var subPart; |
| 2478 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2479 pathOffset += 34; |
| 2480 index = path.indexOf("/edits/", pathOffset); |
| 2481 unittest.expect(index >= 0, unittest.isTrue); |
| 2482 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2483 pathOffset = index; |
| 2484 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2485 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2486 pathOffset += 7; |
| 2487 index = path.indexOf("/apks/", pathOffset); |
| 2488 unittest.expect(index >= 0, unittest.isTrue); |
| 2489 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2490 pathOffset = index; |
| 2491 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2492 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/apks/")); |
| 2493 pathOffset += 6; |
| 2494 index = path.indexOf("/expansionFiles/", pathOffset); |
| 2495 unittest.expect(index >= 0, unittest.isTrue); |
| 2496 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2497 pathOffset = index; |
| 2498 unittest.expect(subPart, unittest.equals("$arg_apkVersionCode")); |
| 2499 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/expansionFiles/")); |
| 2500 pathOffset += 16; |
| 2501 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2502 pathOffset = path.length; |
| 2503 unittest.expect(subPart, unittest.equals("$arg_expansionFileType")); |
| 2504 |
| 2505 var query = (req.url).query; |
| 2506 var queryOffset = 0; |
| 2507 var queryMap = {}; |
| 2508 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2509 parseBool(n) { |
| 2510 if (n == "true") return true; |
| 2511 if (n == "false") return false; |
| 2512 if (n == null) return null; |
| 2513 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2514 } |
| 2515 if (query.length > 0) { |
| 2516 for (var part in query.split("&")) { |
| 2517 var keyvalue = part.split("="); |
| 2518 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2519 } |
| 2520 } |
| 2521 |
| 2522 |
| 2523 var h = { |
| 2524 "content-type" : "application/json; charset=utf-8", |
| 2525 }; |
| 2526 var resp = convert.JSON.encode(buildExpansionFilesUploadResponse()); |
| 2527 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2528 }), true); |
| 2529 res.upload(arg_packageName, arg_editId, arg_apkVersionCode, arg_expansionF
ileType).then(unittest.expectAsync(((api.ExpansionFilesUploadResponse response)
{ |
| 2530 checkExpansionFilesUploadResponse(response); |
| 2531 }))); |
| 2532 }); |
| 2533 |
| 2534 }); |
| 2535 |
| 2536 |
| 2537 unittest.group("resource-EditsImagesResourceApi", () { |
| 2538 unittest.test("method--delete", () { |
| 2539 |
| 2540 var mock = new common_test.HttpServerMock(); |
| 2541 api.EditsImagesResourceApi res = new api.AndroidpublisherApi(mock).edits.i
mages; |
| 2542 var arg_packageName = "foo"; |
| 2543 var arg_editId = "foo"; |
| 2544 var arg_language = "foo"; |
| 2545 var arg_imageType = "foo"; |
| 2546 var arg_imageId = "foo"; |
| 2547 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2548 var path = (req.url).path; |
| 2549 var pathOffset = 0; |
| 2550 var index; |
| 2551 var subPart; |
| 2552 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2553 pathOffset += 34; |
| 2554 index = path.indexOf("/edits/", pathOffset); |
| 2555 unittest.expect(index >= 0, unittest.isTrue); |
| 2556 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2557 pathOffset = index; |
| 2558 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2559 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2560 pathOffset += 7; |
| 2561 index = path.indexOf("/listings/", pathOffset); |
| 2562 unittest.expect(index >= 0, unittest.isTrue); |
| 2563 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2564 pathOffset = index; |
| 2565 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2566 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2567 pathOffset += 10; |
| 2568 index = path.indexOf("/", pathOffset); |
| 2569 unittest.expect(index >= 0, unittest.isTrue); |
| 2570 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2571 pathOffset = index; |
| 2572 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2573 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2574 pathOffset += 1; |
| 2575 index = path.indexOf("/", pathOffset); |
| 2576 unittest.expect(index >= 0, unittest.isTrue); |
| 2577 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2578 pathOffset = index; |
| 2579 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 2580 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2581 pathOffset += 1; |
| 2582 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2583 pathOffset = path.length; |
| 2584 unittest.expect(subPart, unittest.equals("$arg_imageId")); |
| 2585 |
| 2586 var query = (req.url).query; |
| 2587 var queryOffset = 0; |
| 2588 var queryMap = {}; |
| 2589 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2590 parseBool(n) { |
| 2591 if (n == "true") return true; |
| 2592 if (n == "false") return false; |
| 2593 if (n == null) return null; |
| 2594 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2595 } |
| 2596 if (query.length > 0) { |
| 2597 for (var part in query.split("&")) { |
| 2598 var keyvalue = part.split("="); |
| 2599 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2600 } |
| 2601 } |
| 2602 |
| 2603 |
| 2604 var h = { |
| 2605 "content-type" : "application/json; charset=utf-8", |
| 2606 }; |
| 2607 var resp = ""; |
| 2608 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2609 }), true); |
| 2610 res.delete(arg_packageName, arg_editId, arg_language, arg_imageType, arg_i
mageId).then(unittest.expectAsync((_) {})); |
| 2611 }); |
| 2612 |
| 2613 unittest.test("method--deleteall", () { |
| 2614 |
| 2615 var mock = new common_test.HttpServerMock(); |
| 2616 api.EditsImagesResourceApi res = new api.AndroidpublisherApi(mock).edits.i
mages; |
| 2617 var arg_packageName = "foo"; |
| 2618 var arg_editId = "foo"; |
| 2619 var arg_language = "foo"; |
| 2620 var arg_imageType = "foo"; |
| 2621 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2622 var path = (req.url).path; |
| 2623 var pathOffset = 0; |
| 2624 var index; |
| 2625 var subPart; |
| 2626 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2627 pathOffset += 34; |
| 2628 index = path.indexOf("/edits/", pathOffset); |
| 2629 unittest.expect(index >= 0, unittest.isTrue); |
| 2630 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2631 pathOffset = index; |
| 2632 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2633 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2634 pathOffset += 7; |
| 2635 index = path.indexOf("/listings/", pathOffset); |
| 2636 unittest.expect(index >= 0, unittest.isTrue); |
| 2637 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2638 pathOffset = index; |
| 2639 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2640 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2641 pathOffset += 10; |
| 2642 index = path.indexOf("/", pathOffset); |
| 2643 unittest.expect(index >= 0, unittest.isTrue); |
| 2644 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2645 pathOffset = index; |
| 2646 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2647 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2648 pathOffset += 1; |
| 2649 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2650 pathOffset = path.length; |
| 2651 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 2652 |
| 2653 var query = (req.url).query; |
| 2654 var queryOffset = 0; |
| 2655 var queryMap = {}; |
| 2656 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2657 parseBool(n) { |
| 2658 if (n == "true") return true; |
| 2659 if (n == "false") return false; |
| 2660 if (n == null) return null; |
| 2661 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2662 } |
| 2663 if (query.length > 0) { |
| 2664 for (var part in query.split("&")) { |
| 2665 var keyvalue = part.split("="); |
| 2666 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2667 } |
| 2668 } |
| 2669 |
| 2670 |
| 2671 var h = { |
| 2672 "content-type" : "application/json; charset=utf-8", |
| 2673 }; |
| 2674 var resp = convert.JSON.encode(buildImagesDeleteAllResponse()); |
| 2675 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2676 }), true); |
| 2677 res.deleteall(arg_packageName, arg_editId, arg_language, arg_imageType).th
en(unittest.expectAsync(((api.ImagesDeleteAllResponse response) { |
| 2678 checkImagesDeleteAllResponse(response); |
| 2679 }))); |
| 2680 }); |
| 2681 |
| 2682 unittest.test("method--list", () { |
| 2683 |
| 2684 var mock = new common_test.HttpServerMock(); |
| 2685 api.EditsImagesResourceApi res = new api.AndroidpublisherApi(mock).edits.i
mages; |
| 2686 var arg_packageName = "foo"; |
| 2687 var arg_editId = "foo"; |
| 2688 var arg_language = "foo"; |
| 2689 var arg_imageType = "foo"; |
| 2690 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2691 var path = (req.url).path; |
| 2692 var pathOffset = 0; |
| 2693 var index; |
| 2694 var subPart; |
| 2695 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2696 pathOffset += 34; |
| 2697 index = path.indexOf("/edits/", pathOffset); |
| 2698 unittest.expect(index >= 0, unittest.isTrue); |
| 2699 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2700 pathOffset = index; |
| 2701 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2702 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2703 pathOffset += 7; |
| 2704 index = path.indexOf("/listings/", pathOffset); |
| 2705 unittest.expect(index >= 0, unittest.isTrue); |
| 2706 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2707 pathOffset = index; |
| 2708 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2709 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2710 pathOffset += 10; |
| 2711 index = path.indexOf("/", pathOffset); |
| 2712 unittest.expect(index >= 0, unittest.isTrue); |
| 2713 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2714 pathOffset = index; |
| 2715 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2716 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2717 pathOffset += 1; |
| 2718 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2719 pathOffset = path.length; |
| 2720 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 2721 |
| 2722 var query = (req.url).query; |
| 2723 var queryOffset = 0; |
| 2724 var queryMap = {}; |
| 2725 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2726 parseBool(n) { |
| 2727 if (n == "true") return true; |
| 2728 if (n == "false") return false; |
| 2729 if (n == null) return null; |
| 2730 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2731 } |
| 2732 if (query.length > 0) { |
| 2733 for (var part in query.split("&")) { |
| 2734 var keyvalue = part.split("="); |
| 2735 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2736 } |
| 2737 } |
| 2738 |
| 2739 |
| 2740 var h = { |
| 2741 "content-type" : "application/json; charset=utf-8", |
| 2742 }; |
| 2743 var resp = convert.JSON.encode(buildImagesListResponse()); |
| 2744 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2745 }), true); |
| 2746 res.list(arg_packageName, arg_editId, arg_language, arg_imageType).then(un
ittest.expectAsync(((api.ImagesListResponse response) { |
| 2747 checkImagesListResponse(response); |
| 2748 }))); |
| 2749 }); |
| 2750 |
| 2751 unittest.test("method--upload", () { |
| 2752 // TODO: Implement tests for media upload; |
| 2753 // TODO: Implement tests for media download; |
| 2754 |
| 2755 var mock = new common_test.HttpServerMock(); |
| 2756 api.EditsImagesResourceApi res = new api.AndroidpublisherApi(mock).edits.i
mages; |
| 2757 var arg_packageName = "foo"; |
| 2758 var arg_editId = "foo"; |
| 2759 var arg_language = "foo"; |
| 2760 var arg_imageType = "foo"; |
| 2761 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2762 var path = (req.url).path; |
| 2763 var pathOffset = 0; |
| 2764 var index; |
| 2765 var subPart; |
| 2766 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2767 pathOffset += 34; |
| 2768 index = path.indexOf("/edits/", pathOffset); |
| 2769 unittest.expect(index >= 0, unittest.isTrue); |
| 2770 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2771 pathOffset = index; |
| 2772 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2773 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2774 pathOffset += 7; |
| 2775 index = path.indexOf("/listings/", pathOffset); |
| 2776 unittest.expect(index >= 0, unittest.isTrue); |
| 2777 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2778 pathOffset = index; |
| 2779 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2780 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2781 pathOffset += 10; |
| 2782 index = path.indexOf("/", pathOffset); |
| 2783 unittest.expect(index >= 0, unittest.isTrue); |
| 2784 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2785 pathOffset = index; |
| 2786 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2787 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2788 pathOffset += 1; |
| 2789 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2790 pathOffset = path.length; |
| 2791 unittest.expect(subPart, unittest.equals("$arg_imageType")); |
| 2792 |
| 2793 var query = (req.url).query; |
| 2794 var queryOffset = 0; |
| 2795 var queryMap = {}; |
| 2796 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2797 parseBool(n) { |
| 2798 if (n == "true") return true; |
| 2799 if (n == "false") return false; |
| 2800 if (n == null) return null; |
| 2801 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2802 } |
| 2803 if (query.length > 0) { |
| 2804 for (var part in query.split("&")) { |
| 2805 var keyvalue = part.split("="); |
| 2806 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2807 } |
| 2808 } |
| 2809 |
| 2810 |
| 2811 var h = { |
| 2812 "content-type" : "application/json; charset=utf-8", |
| 2813 }; |
| 2814 var resp = convert.JSON.encode(buildImagesUploadResponse()); |
| 2815 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2816 }), true); |
| 2817 res.upload(arg_packageName, arg_editId, arg_language, arg_imageType).then(
unittest.expectAsync(((api.ImagesUploadResponse response) { |
| 2818 checkImagesUploadResponse(response); |
| 2819 }))); |
| 2820 }); |
| 2821 |
| 2822 }); |
| 2823 |
| 2824 |
| 2825 unittest.group("resource-EditsListingsResourceApi", () { |
| 2826 unittest.test("method--delete", () { |
| 2827 |
| 2828 var mock = new common_test.HttpServerMock(); |
| 2829 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 2830 var arg_packageName = "foo"; |
| 2831 var arg_editId = "foo"; |
| 2832 var arg_language = "foo"; |
| 2833 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2834 var path = (req.url).path; |
| 2835 var pathOffset = 0; |
| 2836 var index; |
| 2837 var subPart; |
| 2838 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2839 pathOffset += 34; |
| 2840 index = path.indexOf("/edits/", pathOffset); |
| 2841 unittest.expect(index >= 0, unittest.isTrue); |
| 2842 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2843 pathOffset = index; |
| 2844 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2845 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2846 pathOffset += 7; |
| 2847 index = path.indexOf("/listings/", pathOffset); |
| 2848 unittest.expect(index >= 0, unittest.isTrue); |
| 2849 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2850 pathOffset = index; |
| 2851 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2852 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2853 pathOffset += 10; |
| 2854 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2855 pathOffset = path.length; |
| 2856 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2857 |
| 2858 var query = (req.url).query; |
| 2859 var queryOffset = 0; |
| 2860 var queryMap = {}; |
| 2861 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2862 parseBool(n) { |
| 2863 if (n == "true") return true; |
| 2864 if (n == "false") return false; |
| 2865 if (n == null) return null; |
| 2866 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2867 } |
| 2868 if (query.length > 0) { |
| 2869 for (var part in query.split("&")) { |
| 2870 var keyvalue = part.split("="); |
| 2871 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2872 } |
| 2873 } |
| 2874 |
| 2875 |
| 2876 var h = { |
| 2877 "content-type" : "application/json; charset=utf-8", |
| 2878 }; |
| 2879 var resp = ""; |
| 2880 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2881 }), true); |
| 2882 res.delete(arg_packageName, arg_editId, arg_language).then(unittest.expect
Async((_) {})); |
| 2883 }); |
| 2884 |
| 2885 unittest.test("method--deleteall", () { |
| 2886 |
| 2887 var mock = new common_test.HttpServerMock(); |
| 2888 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 2889 var arg_packageName = "foo"; |
| 2890 var arg_editId = "foo"; |
| 2891 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2892 var path = (req.url).path; |
| 2893 var pathOffset = 0; |
| 2894 var index; |
| 2895 var subPart; |
| 2896 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2897 pathOffset += 34; |
| 2898 index = path.indexOf("/edits/", pathOffset); |
| 2899 unittest.expect(index >= 0, unittest.isTrue); |
| 2900 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2901 pathOffset = index; |
| 2902 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2903 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2904 pathOffset += 7; |
| 2905 index = path.indexOf("/listings", pathOffset); |
| 2906 unittest.expect(index >= 0, unittest.isTrue); |
| 2907 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2908 pathOffset = index; |
| 2909 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2910 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/listings")); |
| 2911 pathOffset += 9; |
| 2912 |
| 2913 var query = (req.url).query; |
| 2914 var queryOffset = 0; |
| 2915 var queryMap = {}; |
| 2916 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2917 parseBool(n) { |
| 2918 if (n == "true") return true; |
| 2919 if (n == "false") return false; |
| 2920 if (n == null) return null; |
| 2921 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2922 } |
| 2923 if (query.length > 0) { |
| 2924 for (var part in query.split("&")) { |
| 2925 var keyvalue = part.split("="); |
| 2926 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2927 } |
| 2928 } |
| 2929 |
| 2930 |
| 2931 var h = { |
| 2932 "content-type" : "application/json; charset=utf-8", |
| 2933 }; |
| 2934 var resp = ""; |
| 2935 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2936 }), true); |
| 2937 res.deleteall(arg_packageName, arg_editId).then(unittest.expectAsync((_) {
})); |
| 2938 }); |
| 2939 |
| 2940 unittest.test("method--get", () { |
| 2941 |
| 2942 var mock = new common_test.HttpServerMock(); |
| 2943 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 2944 var arg_packageName = "foo"; |
| 2945 var arg_editId = "foo"; |
| 2946 var arg_language = "foo"; |
| 2947 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2948 var path = (req.url).path; |
| 2949 var pathOffset = 0; |
| 2950 var index; |
| 2951 var subPart; |
| 2952 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 2953 pathOffset += 34; |
| 2954 index = path.indexOf("/edits/", pathOffset); |
| 2955 unittest.expect(index >= 0, unittest.isTrue); |
| 2956 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2957 pathOffset = index; |
| 2958 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 2959 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 2960 pathOffset += 7; |
| 2961 index = path.indexOf("/listings/", pathOffset); |
| 2962 unittest.expect(index >= 0, unittest.isTrue); |
| 2963 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2964 pathOffset = index; |
| 2965 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 2966 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 2967 pathOffset += 10; |
| 2968 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2969 pathOffset = path.length; |
| 2970 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 2971 |
| 2972 var query = (req.url).query; |
| 2973 var queryOffset = 0; |
| 2974 var queryMap = {}; |
| 2975 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2976 parseBool(n) { |
| 2977 if (n == "true") return true; |
| 2978 if (n == "false") return false; |
| 2979 if (n == null) return null; |
| 2980 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2981 } |
| 2982 if (query.length > 0) { |
| 2983 for (var part in query.split("&")) { |
| 2984 var keyvalue = part.split("="); |
| 2985 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2986 } |
| 2987 } |
| 2988 |
| 2989 |
| 2990 var h = { |
| 2991 "content-type" : "application/json; charset=utf-8", |
| 2992 }; |
| 2993 var resp = convert.JSON.encode(buildListing()); |
| 2994 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2995 }), true); |
| 2996 res.get(arg_packageName, arg_editId, arg_language).then(unittest.expectAsy
nc(((api.Listing response) { |
| 2997 checkListing(response); |
| 2998 }))); |
| 2999 }); |
| 3000 |
| 3001 unittest.test("method--list", () { |
| 3002 |
| 3003 var mock = new common_test.HttpServerMock(); |
| 3004 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 3005 var arg_packageName = "foo"; |
| 3006 var arg_editId = "foo"; |
| 3007 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3008 var path = (req.url).path; |
| 3009 var pathOffset = 0; |
| 3010 var index; |
| 3011 var subPart; |
| 3012 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3013 pathOffset += 34; |
| 3014 index = path.indexOf("/edits/", pathOffset); |
| 3015 unittest.expect(index >= 0, unittest.isTrue); |
| 3016 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3017 pathOffset = index; |
| 3018 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3019 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3020 pathOffset += 7; |
| 3021 index = path.indexOf("/listings", pathOffset); |
| 3022 unittest.expect(index >= 0, unittest.isTrue); |
| 3023 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3024 pathOffset = index; |
| 3025 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3026 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/listings")); |
| 3027 pathOffset += 9; |
| 3028 |
| 3029 var query = (req.url).query; |
| 3030 var queryOffset = 0; |
| 3031 var queryMap = {}; |
| 3032 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3033 parseBool(n) { |
| 3034 if (n == "true") return true; |
| 3035 if (n == "false") return false; |
| 3036 if (n == null) return null; |
| 3037 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3038 } |
| 3039 if (query.length > 0) { |
| 3040 for (var part in query.split("&")) { |
| 3041 var keyvalue = part.split("="); |
| 3042 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3043 } |
| 3044 } |
| 3045 |
| 3046 |
| 3047 var h = { |
| 3048 "content-type" : "application/json; charset=utf-8", |
| 3049 }; |
| 3050 var resp = convert.JSON.encode(buildListingsListResponse()); |
| 3051 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3052 }), true); |
| 3053 res.list(arg_packageName, arg_editId).then(unittest.expectAsync(((api.List
ingsListResponse response) { |
| 3054 checkListingsListResponse(response); |
| 3055 }))); |
| 3056 }); |
| 3057 |
| 3058 unittest.test("method--patch", () { |
| 3059 |
| 3060 var mock = new common_test.HttpServerMock(); |
| 3061 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 3062 var arg_request = buildListing(); |
| 3063 var arg_packageName = "foo"; |
| 3064 var arg_editId = "foo"; |
| 3065 var arg_language = "foo"; |
| 3066 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3067 var obj = new api.Listing.fromJson(json); |
| 3068 checkListing(obj); |
| 3069 |
| 3070 var path = (req.url).path; |
| 3071 var pathOffset = 0; |
| 3072 var index; |
| 3073 var subPart; |
| 3074 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3075 pathOffset += 34; |
| 3076 index = path.indexOf("/edits/", pathOffset); |
| 3077 unittest.expect(index >= 0, unittest.isTrue); |
| 3078 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3079 pathOffset = index; |
| 3080 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3081 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3082 pathOffset += 7; |
| 3083 index = path.indexOf("/listings/", pathOffset); |
| 3084 unittest.expect(index >= 0, unittest.isTrue); |
| 3085 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3086 pathOffset = index; |
| 3087 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3088 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 3089 pathOffset += 10; |
| 3090 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3091 pathOffset = path.length; |
| 3092 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 3093 |
| 3094 var query = (req.url).query; |
| 3095 var queryOffset = 0; |
| 3096 var queryMap = {}; |
| 3097 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3098 parseBool(n) { |
| 3099 if (n == "true") return true; |
| 3100 if (n == "false") return false; |
| 3101 if (n == null) return null; |
| 3102 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3103 } |
| 3104 if (query.length > 0) { |
| 3105 for (var part in query.split("&")) { |
| 3106 var keyvalue = part.split("="); |
| 3107 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3108 } |
| 3109 } |
| 3110 |
| 3111 |
| 3112 var h = { |
| 3113 "content-type" : "application/json; charset=utf-8", |
| 3114 }; |
| 3115 var resp = convert.JSON.encode(buildListing()); |
| 3116 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3117 }), true); |
| 3118 res.patch(arg_request, arg_packageName, arg_editId, arg_language).then(uni
ttest.expectAsync(((api.Listing response) { |
| 3119 checkListing(response); |
| 3120 }))); |
| 3121 }); |
| 3122 |
| 3123 unittest.test("method--update", () { |
| 3124 |
| 3125 var mock = new common_test.HttpServerMock(); |
| 3126 api.EditsListingsResourceApi res = new api.AndroidpublisherApi(mock).edits
.listings; |
| 3127 var arg_request = buildListing(); |
| 3128 var arg_packageName = "foo"; |
| 3129 var arg_editId = "foo"; |
| 3130 var arg_language = "foo"; |
| 3131 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3132 var obj = new api.Listing.fromJson(json); |
| 3133 checkListing(obj); |
| 3134 |
| 3135 var path = (req.url).path; |
| 3136 var pathOffset = 0; |
| 3137 var index; |
| 3138 var subPart; |
| 3139 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3140 pathOffset += 34; |
| 3141 index = path.indexOf("/edits/", pathOffset); |
| 3142 unittest.expect(index >= 0, unittest.isTrue); |
| 3143 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3144 pathOffset = index; |
| 3145 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3146 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3147 pathOffset += 7; |
| 3148 index = path.indexOf("/listings/", pathOffset); |
| 3149 unittest.expect(index >= 0, unittest.isTrue); |
| 3150 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3151 pathOffset = index; |
| 3152 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3153 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/listings/")); |
| 3154 pathOffset += 10; |
| 3155 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3156 pathOffset = path.length; |
| 3157 unittest.expect(subPart, unittest.equals("$arg_language")); |
| 3158 |
| 3159 var query = (req.url).query; |
| 3160 var queryOffset = 0; |
| 3161 var queryMap = {}; |
| 3162 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3163 parseBool(n) { |
| 3164 if (n == "true") return true; |
| 3165 if (n == "false") return false; |
| 3166 if (n == null) return null; |
| 3167 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3168 } |
| 3169 if (query.length > 0) { |
| 3170 for (var part in query.split("&")) { |
| 3171 var keyvalue = part.split("="); |
| 3172 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3173 } |
| 3174 } |
| 3175 |
| 3176 |
| 3177 var h = { |
| 3178 "content-type" : "application/json; charset=utf-8", |
| 3179 }; |
| 3180 var resp = convert.JSON.encode(buildListing()); |
| 3181 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3182 }), true); |
| 3183 res.update(arg_request, arg_packageName, arg_editId, arg_language).then(un
ittest.expectAsync(((api.Listing response) { |
| 3184 checkListing(response); |
| 3185 }))); |
| 3186 }); |
| 3187 |
| 3188 }); |
| 3189 |
| 3190 |
| 3191 unittest.group("resource-EditsTestersResourceApi", () { |
| 3192 unittest.test("method--get", () { |
| 3193 |
| 3194 var mock = new common_test.HttpServerMock(); |
| 3195 api.EditsTestersResourceApi res = new api.AndroidpublisherApi(mock).edits.
testers; |
| 3196 var arg_packageName = "foo"; |
| 3197 var arg_editId = "foo"; |
| 3198 var arg_track = "foo"; |
| 3199 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3200 var path = (req.url).path; |
| 3201 var pathOffset = 0; |
| 3202 var index; |
| 3203 var subPart; |
| 3204 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3205 pathOffset += 34; |
| 3206 index = path.indexOf("/edits/", pathOffset); |
| 3207 unittest.expect(index >= 0, unittest.isTrue); |
| 3208 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3209 pathOffset = index; |
| 3210 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3211 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3212 pathOffset += 7; |
| 3213 index = path.indexOf("/testers/", pathOffset); |
| 3214 unittest.expect(index >= 0, unittest.isTrue); |
| 3215 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3216 pathOffset = index; |
| 3217 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3218 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/testers/")); |
| 3219 pathOffset += 9; |
| 3220 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3221 pathOffset = path.length; |
| 3222 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3223 |
| 3224 var query = (req.url).query; |
| 3225 var queryOffset = 0; |
| 3226 var queryMap = {}; |
| 3227 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3228 parseBool(n) { |
| 3229 if (n == "true") return true; |
| 3230 if (n == "false") return false; |
| 3231 if (n == null) return null; |
| 3232 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3233 } |
| 3234 if (query.length > 0) { |
| 3235 for (var part in query.split("&")) { |
| 3236 var keyvalue = part.split("="); |
| 3237 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3238 } |
| 3239 } |
| 3240 |
| 3241 |
| 3242 var h = { |
| 3243 "content-type" : "application/json; charset=utf-8", |
| 3244 }; |
| 3245 var resp = convert.JSON.encode(buildTesters()); |
| 3246 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3247 }), true); |
| 3248 res.get(arg_packageName, arg_editId, arg_track).then(unittest.expectAsync(
((api.Testers response) { |
| 3249 checkTesters(response); |
| 3250 }))); |
| 3251 }); |
| 3252 |
| 3253 unittest.test("method--patch", () { |
| 3254 |
| 3255 var mock = new common_test.HttpServerMock(); |
| 3256 api.EditsTestersResourceApi res = new api.AndroidpublisherApi(mock).edits.
testers; |
| 3257 var arg_request = buildTesters(); |
| 3258 var arg_packageName = "foo"; |
| 3259 var arg_editId = "foo"; |
| 3260 var arg_track = "foo"; |
| 3261 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3262 var obj = new api.Testers.fromJson(json); |
| 3263 checkTesters(obj); |
| 3264 |
| 3265 var path = (req.url).path; |
| 3266 var pathOffset = 0; |
| 3267 var index; |
| 3268 var subPart; |
| 3269 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3270 pathOffset += 34; |
| 3271 index = path.indexOf("/edits/", pathOffset); |
| 3272 unittest.expect(index >= 0, unittest.isTrue); |
| 3273 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3274 pathOffset = index; |
| 3275 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3276 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3277 pathOffset += 7; |
| 3278 index = path.indexOf("/testers/", pathOffset); |
| 3279 unittest.expect(index >= 0, unittest.isTrue); |
| 3280 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3281 pathOffset = index; |
| 3282 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3283 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/testers/")); |
| 3284 pathOffset += 9; |
| 3285 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3286 pathOffset = path.length; |
| 3287 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3288 |
| 3289 var query = (req.url).query; |
| 3290 var queryOffset = 0; |
| 3291 var queryMap = {}; |
| 3292 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3293 parseBool(n) { |
| 3294 if (n == "true") return true; |
| 3295 if (n == "false") return false; |
| 3296 if (n == null) return null; |
| 3297 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3298 } |
| 3299 if (query.length > 0) { |
| 3300 for (var part in query.split("&")) { |
| 3301 var keyvalue = part.split("="); |
| 3302 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3303 } |
| 3304 } |
| 3305 |
| 3306 |
| 3307 var h = { |
| 3308 "content-type" : "application/json; charset=utf-8", |
| 3309 }; |
| 3310 var resp = convert.JSON.encode(buildTesters()); |
| 3311 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3312 }), true); |
| 3313 res.patch(arg_request, arg_packageName, arg_editId, arg_track).then(unitte
st.expectAsync(((api.Testers response) { |
| 3314 checkTesters(response); |
| 3315 }))); |
| 3316 }); |
| 3317 |
| 3318 unittest.test("method--update", () { |
| 3319 |
| 3320 var mock = new common_test.HttpServerMock(); |
| 3321 api.EditsTestersResourceApi res = new api.AndroidpublisherApi(mock).edits.
testers; |
| 3322 var arg_request = buildTesters(); |
| 3323 var arg_packageName = "foo"; |
| 3324 var arg_editId = "foo"; |
| 3325 var arg_track = "foo"; |
| 3326 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3327 var obj = new api.Testers.fromJson(json); |
| 3328 checkTesters(obj); |
| 3329 |
| 3330 var path = (req.url).path; |
| 3331 var pathOffset = 0; |
| 3332 var index; |
| 3333 var subPart; |
| 3334 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3335 pathOffset += 34; |
| 3336 index = path.indexOf("/edits/", pathOffset); |
| 3337 unittest.expect(index >= 0, unittest.isTrue); |
| 3338 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3339 pathOffset = index; |
| 3340 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3341 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3342 pathOffset += 7; |
| 3343 index = path.indexOf("/testers/", pathOffset); |
| 3344 unittest.expect(index >= 0, unittest.isTrue); |
| 3345 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3346 pathOffset = index; |
| 3347 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3348 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/testers/")); |
| 3349 pathOffset += 9; |
| 3350 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3351 pathOffset = path.length; |
| 3352 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3353 |
| 3354 var query = (req.url).query; |
| 3355 var queryOffset = 0; |
| 3356 var queryMap = {}; |
| 3357 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3358 parseBool(n) { |
| 3359 if (n == "true") return true; |
| 3360 if (n == "false") return false; |
| 3361 if (n == null) return null; |
| 3362 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3363 } |
| 3364 if (query.length > 0) { |
| 3365 for (var part in query.split("&")) { |
| 3366 var keyvalue = part.split("="); |
| 3367 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3368 } |
| 3369 } |
| 3370 |
| 3371 |
| 3372 var h = { |
| 3373 "content-type" : "application/json; charset=utf-8", |
| 3374 }; |
| 3375 var resp = convert.JSON.encode(buildTesters()); |
| 3376 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3377 }), true); |
| 3378 res.update(arg_request, arg_packageName, arg_editId, arg_track).then(unitt
est.expectAsync(((api.Testers response) { |
| 3379 checkTesters(response); |
| 3380 }))); |
| 3381 }); |
| 3382 |
| 3383 }); |
| 3384 |
| 3385 |
| 3386 unittest.group("resource-EditsTracksResourceApi", () { |
| 3387 unittest.test("method--get", () { |
| 3388 |
| 3389 var mock = new common_test.HttpServerMock(); |
| 3390 api.EditsTracksResourceApi res = new api.AndroidpublisherApi(mock).edits.t
racks; |
| 3391 var arg_packageName = "foo"; |
| 3392 var arg_editId = "foo"; |
| 3393 var arg_track = "foo"; |
| 3394 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3395 var path = (req.url).path; |
| 3396 var pathOffset = 0; |
| 3397 var index; |
| 3398 var subPart; |
| 3399 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3400 pathOffset += 34; |
| 3401 index = path.indexOf("/edits/", pathOffset); |
| 3402 unittest.expect(index >= 0, unittest.isTrue); |
| 3403 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3404 pathOffset = index; |
| 3405 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3406 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3407 pathOffset += 7; |
| 3408 index = path.indexOf("/tracks/", pathOffset); |
| 3409 unittest.expect(index >= 0, unittest.isTrue); |
| 3410 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3411 pathOffset = index; |
| 3412 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3413 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tracks/")); |
| 3414 pathOffset += 8; |
| 3415 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3416 pathOffset = path.length; |
| 3417 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3418 |
| 3419 var query = (req.url).query; |
| 3420 var queryOffset = 0; |
| 3421 var queryMap = {}; |
| 3422 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3423 parseBool(n) { |
| 3424 if (n == "true") return true; |
| 3425 if (n == "false") return false; |
| 3426 if (n == null) return null; |
| 3427 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3428 } |
| 3429 if (query.length > 0) { |
| 3430 for (var part in query.split("&")) { |
| 3431 var keyvalue = part.split("="); |
| 3432 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3433 } |
| 3434 } |
| 3435 |
| 3436 |
| 3437 var h = { |
| 3438 "content-type" : "application/json; charset=utf-8", |
| 3439 }; |
| 3440 var resp = convert.JSON.encode(buildTrack()); |
| 3441 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3442 }), true); |
| 3443 res.get(arg_packageName, arg_editId, arg_track).then(unittest.expectAsync(
((api.Track response) { |
| 3444 checkTrack(response); |
| 3445 }))); |
| 3446 }); |
| 3447 |
| 3448 unittest.test("method--list", () { |
| 3449 |
| 3450 var mock = new common_test.HttpServerMock(); |
| 3451 api.EditsTracksResourceApi res = new api.AndroidpublisherApi(mock).edits.t
racks; |
| 3452 var arg_packageName = "foo"; |
| 3453 var arg_editId = "foo"; |
| 3454 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3455 var path = (req.url).path; |
| 3456 var pathOffset = 0; |
| 3457 var index; |
| 3458 var subPart; |
| 3459 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3460 pathOffset += 34; |
| 3461 index = path.indexOf("/edits/", pathOffset); |
| 3462 unittest.expect(index >= 0, unittest.isTrue); |
| 3463 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3464 pathOffset = index; |
| 3465 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3466 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3467 pathOffset += 7; |
| 3468 index = path.indexOf("/tracks", pathOffset); |
| 3469 unittest.expect(index >= 0, unittest.isTrue); |
| 3470 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3471 pathOffset = index; |
| 3472 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3473 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/tracks")); |
| 3474 pathOffset += 7; |
| 3475 |
| 3476 var query = (req.url).query; |
| 3477 var queryOffset = 0; |
| 3478 var queryMap = {}; |
| 3479 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3480 parseBool(n) { |
| 3481 if (n == "true") return true; |
| 3482 if (n == "false") return false; |
| 3483 if (n == null) return null; |
| 3484 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3485 } |
| 3486 if (query.length > 0) { |
| 3487 for (var part in query.split("&")) { |
| 3488 var keyvalue = part.split("="); |
| 3489 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3490 } |
| 3491 } |
| 3492 |
| 3493 |
| 3494 var h = { |
| 3495 "content-type" : "application/json; charset=utf-8", |
| 3496 }; |
| 3497 var resp = convert.JSON.encode(buildTracksListResponse()); |
| 3498 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3499 }), true); |
| 3500 res.list(arg_packageName, arg_editId).then(unittest.expectAsync(((api.Trac
ksListResponse response) { |
| 3501 checkTracksListResponse(response); |
| 3502 }))); |
| 3503 }); |
| 3504 |
| 3505 unittest.test("method--patch", () { |
| 3506 |
| 3507 var mock = new common_test.HttpServerMock(); |
| 3508 api.EditsTracksResourceApi res = new api.AndroidpublisherApi(mock).edits.t
racks; |
| 3509 var arg_request = buildTrack(); |
| 3510 var arg_packageName = "foo"; |
| 3511 var arg_editId = "foo"; |
| 3512 var arg_track = "foo"; |
| 3513 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3514 var obj = new api.Track.fromJson(json); |
| 3515 checkTrack(obj); |
| 3516 |
| 3517 var path = (req.url).path; |
| 3518 var pathOffset = 0; |
| 3519 var index; |
| 3520 var subPart; |
| 3521 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3522 pathOffset += 34; |
| 3523 index = path.indexOf("/edits/", pathOffset); |
| 3524 unittest.expect(index >= 0, unittest.isTrue); |
| 3525 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3526 pathOffset = index; |
| 3527 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3528 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3529 pathOffset += 7; |
| 3530 index = path.indexOf("/tracks/", pathOffset); |
| 3531 unittest.expect(index >= 0, unittest.isTrue); |
| 3532 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3533 pathOffset = index; |
| 3534 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3535 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tracks/")); |
| 3536 pathOffset += 8; |
| 3537 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3538 pathOffset = path.length; |
| 3539 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3540 |
| 3541 var query = (req.url).query; |
| 3542 var queryOffset = 0; |
| 3543 var queryMap = {}; |
| 3544 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3545 parseBool(n) { |
| 3546 if (n == "true") return true; |
| 3547 if (n == "false") return false; |
| 3548 if (n == null) return null; |
| 3549 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3550 } |
| 3551 if (query.length > 0) { |
| 3552 for (var part in query.split("&")) { |
| 3553 var keyvalue = part.split("="); |
| 3554 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3555 } |
| 3556 } |
| 3557 |
| 3558 |
| 3559 var h = { |
| 3560 "content-type" : "application/json; charset=utf-8", |
| 3561 }; |
| 3562 var resp = convert.JSON.encode(buildTrack()); |
| 3563 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3564 }), true); |
| 3565 res.patch(arg_request, arg_packageName, arg_editId, arg_track).then(unitte
st.expectAsync(((api.Track response) { |
| 3566 checkTrack(response); |
| 3567 }))); |
| 3568 }); |
| 3569 |
| 3570 unittest.test("method--update", () { |
| 3571 |
| 3572 var mock = new common_test.HttpServerMock(); |
| 3573 api.EditsTracksResourceApi res = new api.AndroidpublisherApi(mock).edits.t
racks; |
| 3574 var arg_request = buildTrack(); |
| 3575 var arg_packageName = "foo"; |
| 3576 var arg_editId = "foo"; |
| 3577 var arg_track = "foo"; |
| 3578 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3579 var obj = new api.Track.fromJson(json); |
| 3580 checkTrack(obj); |
| 3581 |
| 3582 var path = (req.url).path; |
| 3583 var pathOffset = 0; |
| 3584 var index; |
| 3585 var subPart; |
| 3586 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3587 pathOffset += 34; |
| 3588 index = path.indexOf("/edits/", pathOffset); |
| 3589 unittest.expect(index >= 0, unittest.isTrue); |
| 3590 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3591 pathOffset = index; |
| 3592 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3593 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/edits/")); |
| 3594 pathOffset += 7; |
| 3595 index = path.indexOf("/tracks/", pathOffset); |
| 3596 unittest.expect(index >= 0, unittest.isTrue); |
| 3597 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3598 pathOffset = index; |
| 3599 unittest.expect(subPart, unittest.equals("$arg_editId")); |
| 3600 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tracks/")); |
| 3601 pathOffset += 8; |
| 3602 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3603 pathOffset = path.length; |
| 3604 unittest.expect(subPart, unittest.equals("$arg_track")); |
| 3605 |
| 3606 var query = (req.url).query; |
| 3607 var queryOffset = 0; |
| 3608 var queryMap = {}; |
| 3609 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3610 parseBool(n) { |
| 3611 if (n == "true") return true; |
| 3612 if (n == "false") return false; |
| 3613 if (n == null) return null; |
| 3614 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3615 } |
| 3616 if (query.length > 0) { |
| 3617 for (var part in query.split("&")) { |
| 3618 var keyvalue = part.split("="); |
| 3619 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3620 } |
| 3621 } |
| 3622 |
| 3623 |
| 3624 var h = { |
| 3625 "content-type" : "application/json; charset=utf-8", |
| 3626 }; |
| 3627 var resp = convert.JSON.encode(buildTrack()); |
| 3628 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3629 }), true); |
| 3630 res.update(arg_request, arg_packageName, arg_editId, arg_track).then(unitt
est.expectAsync(((api.Track response) { |
| 3631 checkTrack(response); |
| 3632 }))); |
| 3633 }); |
| 3634 |
| 3635 }); |
| 3636 |
| 3637 |
| 3638 unittest.group("resource-InappproductsResourceApi", () { |
| 3639 unittest.test("method--batch", () { |
| 3640 |
| 3641 var mock = new common_test.HttpServerMock(); |
| 3642 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3643 var arg_request = buildInappproductsBatchRequest(); |
| 3644 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3645 var obj = new api.InappproductsBatchRequest.fromJson(json); |
| 3646 checkInappproductsBatchRequest(obj); |
| 3647 |
| 3648 var path = (req.url).path; |
| 3649 var pathOffset = 0; |
| 3650 var index; |
| 3651 var subPart; |
| 3652 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3653 pathOffset += 34; |
| 3654 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("inappproducts/batch")); |
| 3655 pathOffset += 19; |
| 3656 |
| 3657 var query = (req.url).query; |
| 3658 var queryOffset = 0; |
| 3659 var queryMap = {}; |
| 3660 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3661 parseBool(n) { |
| 3662 if (n == "true") return true; |
| 3663 if (n == "false") return false; |
| 3664 if (n == null) return null; |
| 3665 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3666 } |
| 3667 if (query.length > 0) { |
| 3668 for (var part in query.split("&")) { |
| 3669 var keyvalue = part.split("="); |
| 3670 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3671 } |
| 3672 } |
| 3673 |
| 3674 |
| 3675 var h = { |
| 3676 "content-type" : "application/json; charset=utf-8", |
| 3677 }; |
| 3678 var resp = convert.JSON.encode(buildInappproductsBatchResponse()); |
| 3679 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3680 }), true); |
| 3681 res.batch(arg_request).then(unittest.expectAsync(((api.InappproductsBatchR
esponse response) { |
| 3682 checkInappproductsBatchResponse(response); |
| 3683 }))); |
| 3684 }); |
| 3685 |
| 3686 unittest.test("method--delete", () { |
| 3687 |
| 3688 var mock = new common_test.HttpServerMock(); |
| 3689 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3690 var arg_packageName = "foo"; |
| 3691 var arg_sku = "foo"; |
| 3692 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3693 var path = (req.url).path; |
| 3694 var pathOffset = 0; |
| 3695 var index; |
| 3696 var subPart; |
| 3697 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3698 pathOffset += 34; |
| 3699 index = path.indexOf("/inappproducts/", pathOffset); |
| 3700 unittest.expect(index >= 0, unittest.isTrue); |
| 3701 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3702 pathOffset = index; |
| 3703 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3704 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/inappproducts/")); |
| 3705 pathOffset += 15; |
| 3706 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3707 pathOffset = path.length; |
| 3708 unittest.expect(subPart, unittest.equals("$arg_sku")); |
| 3709 |
| 3710 var query = (req.url).query; |
| 3711 var queryOffset = 0; |
| 3712 var queryMap = {}; |
| 3713 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3714 parseBool(n) { |
| 3715 if (n == "true") return true; |
| 3716 if (n == "false") return false; |
| 3717 if (n == null) return null; |
| 3718 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3719 } |
| 3720 if (query.length > 0) { |
| 3721 for (var part in query.split("&")) { |
| 3722 var keyvalue = part.split("="); |
| 3723 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3724 } |
| 3725 } |
| 3726 |
| 3727 |
| 3728 var h = { |
| 3729 "content-type" : "application/json; charset=utf-8", |
| 3730 }; |
| 3731 var resp = ""; |
| 3732 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3733 }), true); |
| 3734 res.delete(arg_packageName, arg_sku).then(unittest.expectAsync((_) {})); |
| 3735 }); |
| 3736 |
| 3737 unittest.test("method--get", () { |
| 3738 |
| 3739 var mock = new common_test.HttpServerMock(); |
| 3740 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3741 var arg_packageName = "foo"; |
| 3742 var arg_sku = "foo"; |
| 3743 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3744 var path = (req.url).path; |
| 3745 var pathOffset = 0; |
| 3746 var index; |
| 3747 var subPart; |
| 3748 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3749 pathOffset += 34; |
| 3750 index = path.indexOf("/inappproducts/", pathOffset); |
| 3751 unittest.expect(index >= 0, unittest.isTrue); |
| 3752 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3753 pathOffset = index; |
| 3754 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3755 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/inappproducts/")); |
| 3756 pathOffset += 15; |
| 3757 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3758 pathOffset = path.length; |
| 3759 unittest.expect(subPart, unittest.equals("$arg_sku")); |
| 3760 |
| 3761 var query = (req.url).query; |
| 3762 var queryOffset = 0; |
| 3763 var queryMap = {}; |
| 3764 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3765 parseBool(n) { |
| 3766 if (n == "true") return true; |
| 3767 if (n == "false") return false; |
| 3768 if (n == null) return null; |
| 3769 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3770 } |
| 3771 if (query.length > 0) { |
| 3772 for (var part in query.split("&")) { |
| 3773 var keyvalue = part.split("="); |
| 3774 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3775 } |
| 3776 } |
| 3777 |
| 3778 |
| 3779 var h = { |
| 3780 "content-type" : "application/json; charset=utf-8", |
| 3781 }; |
| 3782 var resp = convert.JSON.encode(buildInAppProduct()); |
| 3783 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3784 }), true); |
| 3785 res.get(arg_packageName, arg_sku).then(unittest.expectAsync(((api.InAppPro
duct response) { |
| 3786 checkInAppProduct(response); |
| 3787 }))); |
| 3788 }); |
| 3789 |
| 3790 unittest.test("method--insert", () { |
| 3791 |
| 3792 var mock = new common_test.HttpServerMock(); |
| 3793 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3794 var arg_request = buildInAppProduct(); |
| 3795 var arg_packageName = "foo"; |
| 3796 var arg_autoConvertMissingPrices = true; |
| 3797 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3798 var obj = new api.InAppProduct.fromJson(json); |
| 3799 checkInAppProduct(obj); |
| 3800 |
| 3801 var path = (req.url).path; |
| 3802 var pathOffset = 0; |
| 3803 var index; |
| 3804 var subPart; |
| 3805 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3806 pathOffset += 34; |
| 3807 index = path.indexOf("/inappproducts", pathOffset); |
| 3808 unittest.expect(index >= 0, unittest.isTrue); |
| 3809 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3810 pathOffset = index; |
| 3811 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3812 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/inappproducts")); |
| 3813 pathOffset += 14; |
| 3814 |
| 3815 var query = (req.url).query; |
| 3816 var queryOffset = 0; |
| 3817 var queryMap = {}; |
| 3818 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3819 parseBool(n) { |
| 3820 if (n == "true") return true; |
| 3821 if (n == "false") return false; |
| 3822 if (n == null) return null; |
| 3823 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3824 } |
| 3825 if (query.length > 0) { |
| 3826 for (var part in query.split("&")) { |
| 3827 var keyvalue = part.split("="); |
| 3828 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3829 } |
| 3830 } |
| 3831 unittest.expect(queryMap["autoConvertMissingPrices"].first, unittest.equ
als("$arg_autoConvertMissingPrices")); |
| 3832 |
| 3833 |
| 3834 var h = { |
| 3835 "content-type" : "application/json; charset=utf-8", |
| 3836 }; |
| 3837 var resp = convert.JSON.encode(buildInAppProduct()); |
| 3838 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3839 }), true); |
| 3840 res.insert(arg_request, arg_packageName, autoConvertMissingPrices: arg_aut
oConvertMissingPrices).then(unittest.expectAsync(((api.InAppProduct response) { |
| 3841 checkInAppProduct(response); |
| 3842 }))); |
| 3843 }); |
| 3844 |
| 3845 unittest.test("method--list", () { |
| 3846 |
| 3847 var mock = new common_test.HttpServerMock(); |
| 3848 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3849 var arg_packageName = "foo"; |
| 3850 var arg_maxResults = 42; |
| 3851 var arg_startIndex = 42; |
| 3852 var arg_token = "foo"; |
| 3853 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3854 var path = (req.url).path; |
| 3855 var pathOffset = 0; |
| 3856 var index; |
| 3857 var subPart; |
| 3858 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3859 pathOffset += 34; |
| 3860 index = path.indexOf("/inappproducts", pathOffset); |
| 3861 unittest.expect(index >= 0, unittest.isTrue); |
| 3862 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3863 pathOffset = index; |
| 3864 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3865 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/inappproducts")); |
| 3866 pathOffset += 14; |
| 3867 |
| 3868 var query = (req.url).query; |
| 3869 var queryOffset = 0; |
| 3870 var queryMap = {}; |
| 3871 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3872 parseBool(n) { |
| 3873 if (n == "true") return true; |
| 3874 if (n == "false") return false; |
| 3875 if (n == null) return null; |
| 3876 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3877 } |
| 3878 if (query.length > 0) { |
| 3879 for (var part in query.split("&")) { |
| 3880 var keyvalue = part.split("="); |
| 3881 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3882 } |
| 3883 } |
| 3884 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 3885 unittest.expect(core.int.parse(queryMap["startIndex"].first), unittest.e
quals(arg_startIndex)); |
| 3886 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); |
| 3887 |
| 3888 |
| 3889 var h = { |
| 3890 "content-type" : "application/json; charset=utf-8", |
| 3891 }; |
| 3892 var resp = convert.JSON.encode(buildInappproductsListResponse()); |
| 3893 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3894 }), true); |
| 3895 res.list(arg_packageName, maxResults: arg_maxResults, startIndex: arg_star
tIndex, token: arg_token).then(unittest.expectAsync(((api.InappproductsListRespo
nse response) { |
| 3896 checkInappproductsListResponse(response); |
| 3897 }))); |
| 3898 }); |
| 3899 |
| 3900 unittest.test("method--patch", () { |
| 3901 |
| 3902 var mock = new common_test.HttpServerMock(); |
| 3903 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3904 var arg_request = buildInAppProduct(); |
| 3905 var arg_packageName = "foo"; |
| 3906 var arg_sku = "foo"; |
| 3907 var arg_autoConvertMissingPrices = true; |
| 3908 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3909 var obj = new api.InAppProduct.fromJson(json); |
| 3910 checkInAppProduct(obj); |
| 3911 |
| 3912 var path = (req.url).path; |
| 3913 var pathOffset = 0; |
| 3914 var index; |
| 3915 var subPart; |
| 3916 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3917 pathOffset += 34; |
| 3918 index = path.indexOf("/inappproducts/", pathOffset); |
| 3919 unittest.expect(index >= 0, unittest.isTrue); |
| 3920 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3921 pathOffset = index; |
| 3922 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3923 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/inappproducts/")); |
| 3924 pathOffset += 15; |
| 3925 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3926 pathOffset = path.length; |
| 3927 unittest.expect(subPart, unittest.equals("$arg_sku")); |
| 3928 |
| 3929 var query = (req.url).query; |
| 3930 var queryOffset = 0; |
| 3931 var queryMap = {}; |
| 3932 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3933 parseBool(n) { |
| 3934 if (n == "true") return true; |
| 3935 if (n == "false") return false; |
| 3936 if (n == null) return null; |
| 3937 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3938 } |
| 3939 if (query.length > 0) { |
| 3940 for (var part in query.split("&")) { |
| 3941 var keyvalue = part.split("="); |
| 3942 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3943 } |
| 3944 } |
| 3945 unittest.expect(queryMap["autoConvertMissingPrices"].first, unittest.equ
als("$arg_autoConvertMissingPrices")); |
| 3946 |
| 3947 |
| 3948 var h = { |
| 3949 "content-type" : "application/json; charset=utf-8", |
| 3950 }; |
| 3951 var resp = convert.JSON.encode(buildInAppProduct()); |
| 3952 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3953 }), true); |
| 3954 res.patch(arg_request, arg_packageName, arg_sku, autoConvertMissingPrices:
arg_autoConvertMissingPrices).then(unittest.expectAsync(((api.InAppProduct resp
onse) { |
| 3955 checkInAppProduct(response); |
| 3956 }))); |
| 3957 }); |
| 3958 |
| 3959 unittest.test("method--update", () { |
| 3960 |
| 3961 var mock = new common_test.HttpServerMock(); |
| 3962 api.InappproductsResourceApi res = new api.AndroidpublisherApi(mock).inapp
products; |
| 3963 var arg_request = buildInAppProduct(); |
| 3964 var arg_packageName = "foo"; |
| 3965 var arg_sku = "foo"; |
| 3966 var arg_autoConvertMissingPrices = true; |
| 3967 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3968 var obj = new api.InAppProduct.fromJson(json); |
| 3969 checkInAppProduct(obj); |
| 3970 |
| 3971 var path = (req.url).path; |
| 3972 var pathOffset = 0; |
| 3973 var index; |
| 3974 var subPart; |
| 3975 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 3976 pathOffset += 34; |
| 3977 index = path.indexOf("/inappproducts/", pathOffset); |
| 3978 unittest.expect(index >= 0, unittest.isTrue); |
| 3979 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3980 pathOffset = index; |
| 3981 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 3982 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/inappproducts/")); |
| 3983 pathOffset += 15; |
| 3984 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 3985 pathOffset = path.length; |
| 3986 unittest.expect(subPart, unittest.equals("$arg_sku")); |
| 3987 |
| 3988 var query = (req.url).query; |
| 3989 var queryOffset = 0; |
| 3990 var queryMap = {}; |
| 3991 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3992 parseBool(n) { |
| 3993 if (n == "true") return true; |
| 3994 if (n == "false") return false; |
| 3995 if (n == null) return null; |
| 3996 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3997 } |
| 3998 if (query.length > 0) { |
| 3999 for (var part in query.split("&")) { |
| 4000 var keyvalue = part.split("="); |
| 4001 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4002 } |
| 4003 } |
| 4004 unittest.expect(queryMap["autoConvertMissingPrices"].first, unittest.equ
als("$arg_autoConvertMissingPrices")); |
| 4005 |
| 4006 |
| 4007 var h = { |
| 4008 "content-type" : "application/json; charset=utf-8", |
| 4009 }; |
| 4010 var resp = convert.JSON.encode(buildInAppProduct()); |
| 4011 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 4012 }), true); |
| 4013 res.update(arg_request, arg_packageName, arg_sku, autoConvertMissingPrices
: arg_autoConvertMissingPrices).then(unittest.expectAsync(((api.InAppProduct res
ponse) { |
| 4014 checkInAppProduct(response); |
| 4015 }))); |
| 4016 }); |
| 4017 |
| 4018 }); |
| 4019 |
| 4020 |
| 4021 unittest.group("resource-PurchasesProductsResourceApi", () { |
| 4022 unittest.test("method--get", () { |
| 4023 |
| 4024 var mock = new common_test.HttpServerMock(); |
| 4025 api.PurchasesProductsResourceApi res = new api.AndroidpublisherApi(mock).p
urchases.products; |
| 4026 var arg_packageName = "foo"; |
| 4027 var arg_productId = "foo"; |
| 4028 var arg_token = "foo"; |
| 4029 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4030 var path = (req.url).path; |
| 4031 var pathOffset = 0; |
| 4032 var index; |
| 4033 var subPart; |
| 4034 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 4035 pathOffset += 34; |
| 4036 index = path.indexOf("/purchases/products/", pathOffset); |
| 4037 unittest.expect(index >= 0, unittest.isTrue); |
| 4038 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4039 pathOffset = index; |
| 4040 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 4041 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("/purchases/products/")); |
| 4042 pathOffset += 20; |
| 4043 index = path.indexOf("/tokens/", pathOffset); |
| 4044 unittest.expect(index >= 0, unittest.isTrue); |
| 4045 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4046 pathOffset = index; |
| 4047 unittest.expect(subPart, unittest.equals("$arg_productId")); |
| 4048 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tokens/")); |
| 4049 pathOffset += 8; |
| 4050 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 4051 pathOffset = path.length; |
| 4052 unittest.expect(subPart, unittest.equals("$arg_token")); |
| 4053 |
| 4054 var query = (req.url).query; |
| 4055 var queryOffset = 0; |
| 4056 var queryMap = {}; |
| 4057 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 4058 parseBool(n) { |
| 4059 if (n == "true") return true; |
| 4060 if (n == "false") return false; |
| 4061 if (n == null) return null; |
| 4062 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4063 } |
| 4064 if (query.length > 0) { |
| 4065 for (var part in query.split("&")) { |
| 4066 var keyvalue = part.split("="); |
| 4067 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4068 } |
| 4069 } |
| 4070 |
| 4071 |
| 4072 var h = { |
| 4073 "content-type" : "application/json; charset=utf-8", |
| 4074 }; |
| 4075 var resp = convert.JSON.encode(buildProductPurchase()); |
| 4076 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 4077 }), true); |
| 4078 res.get(arg_packageName, arg_productId, arg_token).then(unittest.expectAsy
nc(((api.ProductPurchase response) { |
| 4079 checkProductPurchase(response); |
| 4080 }))); |
| 4081 }); |
| 4082 |
| 4083 }); |
| 4084 |
| 4085 |
| 4086 unittest.group("resource-PurchasesSubscriptionsResourceApi", () { |
| 4087 unittest.test("method--cancel", () { |
| 4088 |
| 4089 var mock = new common_test.HttpServerMock(); |
| 4090 api.PurchasesSubscriptionsResourceApi res = new api.AndroidpublisherApi(mo
ck).purchases.subscriptions; |
| 4091 var arg_packageName = "foo"; |
| 4092 var arg_subscriptionId = "foo"; |
| 4093 var arg_token = "foo"; |
| 4094 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4095 var path = (req.url).path; |
| 4096 var pathOffset = 0; |
| 4097 var index; |
| 4098 var subPart; |
| 4099 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 4100 pathOffset += 34; |
| 4101 index = path.indexOf("/purchases/subscriptions/", pathOffset); |
| 4102 unittest.expect(index >= 0, unittest.isTrue); |
| 4103 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4104 pathOffset = index; |
| 4105 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 4106 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("/purchases/subscriptions/")); |
| 4107 pathOffset += 25; |
| 4108 index = path.indexOf("/tokens/", pathOffset); |
| 4109 unittest.expect(index >= 0, unittest.isTrue); |
| 4110 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4111 pathOffset = index; |
| 4112 unittest.expect(subPart, unittest.equals("$arg_subscriptionId")); |
| 4113 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tokens/")); |
| 4114 pathOffset += 8; |
| 4115 index = path.indexOf(":cancel", pathOffset); |
| 4116 unittest.expect(index >= 0, unittest.isTrue); |
| 4117 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4118 pathOffset = index; |
| 4119 unittest.expect(subPart, unittest.equals("$arg_token")); |
| 4120 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als(":cancel")); |
| 4121 pathOffset += 7; |
| 4122 |
| 4123 var query = (req.url).query; |
| 4124 var queryOffset = 0; |
| 4125 var queryMap = {}; |
| 4126 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 4127 parseBool(n) { |
| 4128 if (n == "true") return true; |
| 4129 if (n == "false") return false; |
| 4130 if (n == null) return null; |
| 4131 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4132 } |
| 4133 if (query.length > 0) { |
| 4134 for (var part in query.split("&")) { |
| 4135 var keyvalue = part.split("="); |
| 4136 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4137 } |
| 4138 } |
| 4139 |
| 4140 |
| 4141 var h = { |
| 4142 "content-type" : "application/json; charset=utf-8", |
| 4143 }; |
| 4144 var resp = ""; |
| 4145 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 4146 }), true); |
| 4147 res.cancel(arg_packageName, arg_subscriptionId, arg_token).then(unittest.e
xpectAsync((_) {})); |
| 4148 }); |
| 4149 |
| 4150 unittest.test("method--get", () { |
| 4151 |
| 4152 var mock = new common_test.HttpServerMock(); |
| 4153 api.PurchasesSubscriptionsResourceApi res = new api.AndroidpublisherApi(mo
ck).purchases.subscriptions; |
| 4154 var arg_packageName = "foo"; |
| 4155 var arg_subscriptionId = "foo"; |
| 4156 var arg_token = "foo"; |
| 4157 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4158 var path = (req.url).path; |
| 4159 var pathOffset = 0; |
| 4160 var index; |
| 4161 var subPart; |
| 4162 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/androidpublisher/v2/applications/")); |
| 4163 pathOffset += 34; |
| 4164 index = path.indexOf("/purchases/subscriptions/", pathOffset); |
| 4165 unittest.expect(index >= 0, unittest.isTrue); |
| 4166 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4167 pathOffset = index; |
| 4168 unittest.expect(subPart, unittest.equals("$arg_packageName")); |
| 4169 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("/purchases/subscriptions/")); |
| 4170 pathOffset += 25; |
| 4171 index = path.indexOf("/tokens/", pathOffset); |
| 4172 unittest.expect(index >= 0, unittest.isTrue); |
| 4173 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 4174 pathOffset = index; |
| 4175 unittest.expect(subPart, unittest.equals("$arg_subscriptionId")); |
| 4176 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/tokens/")); |
| 4177 pathOffset += 8; |
| 4178 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 4179 pathOffset = path.length; |
| 4180 unittest.expect(subPart, unittest.equals("$arg_token")); |
| 4181 |
| 4182 var query = (req.url).query; |
| 4183 var queryOffset = 0; |
| 4184 var queryMap = {}; |
| 4185 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 4186 parseBool(n) { |
| 4187 if (n == "true") return true; |
| 4188 if (n == "false") return false; |
| 4189 if (n == null) return null; |
| 4190 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4191 } |
| 4192 if (query.length > 0) { |
| 4193 for (var part in query.split("&")) { |
| 4194 var keyvalue = part.split("="); |
| 4195 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4196 } |
| 4197 } |
| 4198 |
| 4199 |
| 4200 var h = { |
| 4201 "content-type" : "application/json; charset=utf-8", |
| 4202 }; |
| 4203 var resp = convert.JSON.encode(buildSubscriptionPurchase()); |
| 4204 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 4205 }), true); |
| 4206 res.get(arg_packageName, arg_subscriptionId, arg_token).then(unittest.expe
ctAsync(((api.SubscriptionPurchase response) { |
| 4207 checkSubscriptionPurchase(response); |
| 4208 }))); |
| 4209 }); |
| 4210 |
| 4211 }); |
| 4212 |
| 4213 |
| 4214 } |
| 4215 |
OLD | NEW |