OLD | NEW |
(Empty) | |
| 1 library googleapis.adsensehost.v4_1.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/adsensehost/v4_1.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterAccount = 0; |
| 20 buildAccount() { |
| 21 var o = new api.Account(); |
| 22 buildCounterAccount++; |
| 23 if (buildCounterAccount < 3) { |
| 24 o.id = "foo"; |
| 25 o.kind = "foo"; |
| 26 o.name = "foo"; |
| 27 o.status = "foo"; |
| 28 } |
| 29 buildCounterAccount--; |
| 30 return o; |
| 31 } |
| 32 |
| 33 checkAccount(api.Account o) { |
| 34 buildCounterAccount++; |
| 35 if (buildCounterAccount < 3) { |
| 36 unittest.expect(o.id, unittest.equals('foo')); |
| 37 unittest.expect(o.kind, unittest.equals('foo')); |
| 38 unittest.expect(o.name, unittest.equals('foo')); |
| 39 unittest.expect(o.status, unittest.equals('foo')); |
| 40 } |
| 41 buildCounterAccount--; |
| 42 } |
| 43 |
| 44 buildUnnamed967() { |
| 45 var o = new core.List<api.Account>(); |
| 46 o.add(buildAccount()); |
| 47 o.add(buildAccount()); |
| 48 return o; |
| 49 } |
| 50 |
| 51 checkUnnamed967(core.List<api.Account> o) { |
| 52 unittest.expect(o, unittest.hasLength(2)); |
| 53 checkAccount(o[0]); |
| 54 checkAccount(o[1]); |
| 55 } |
| 56 |
| 57 core.int buildCounterAccounts = 0; |
| 58 buildAccounts() { |
| 59 var o = new api.Accounts(); |
| 60 buildCounterAccounts++; |
| 61 if (buildCounterAccounts < 3) { |
| 62 o.etag = "foo"; |
| 63 o.items = buildUnnamed967(); |
| 64 o.kind = "foo"; |
| 65 } |
| 66 buildCounterAccounts--; |
| 67 return o; |
| 68 } |
| 69 |
| 70 checkAccounts(api.Accounts o) { |
| 71 buildCounterAccounts++; |
| 72 if (buildCounterAccounts < 3) { |
| 73 unittest.expect(o.etag, unittest.equals('foo')); |
| 74 checkUnnamed967(o.items); |
| 75 unittest.expect(o.kind, unittest.equals('foo')); |
| 76 } |
| 77 buildCounterAccounts--; |
| 78 } |
| 79 |
| 80 core.int buildCounterAdClient = 0; |
| 81 buildAdClient() { |
| 82 var o = new api.AdClient(); |
| 83 buildCounterAdClient++; |
| 84 if (buildCounterAdClient < 3) { |
| 85 o.arcOptIn = true; |
| 86 o.id = "foo"; |
| 87 o.kind = "foo"; |
| 88 o.productCode = "foo"; |
| 89 o.supportsReporting = true; |
| 90 } |
| 91 buildCounterAdClient--; |
| 92 return o; |
| 93 } |
| 94 |
| 95 checkAdClient(api.AdClient o) { |
| 96 buildCounterAdClient++; |
| 97 if (buildCounterAdClient < 3) { |
| 98 unittest.expect(o.arcOptIn, unittest.isTrue); |
| 99 unittest.expect(o.id, unittest.equals('foo')); |
| 100 unittest.expect(o.kind, unittest.equals('foo')); |
| 101 unittest.expect(o.productCode, unittest.equals('foo')); |
| 102 unittest.expect(o.supportsReporting, unittest.isTrue); |
| 103 } |
| 104 buildCounterAdClient--; |
| 105 } |
| 106 |
| 107 buildUnnamed968() { |
| 108 var o = new core.List<api.AdClient>(); |
| 109 o.add(buildAdClient()); |
| 110 o.add(buildAdClient()); |
| 111 return o; |
| 112 } |
| 113 |
| 114 checkUnnamed968(core.List<api.AdClient> o) { |
| 115 unittest.expect(o, unittest.hasLength(2)); |
| 116 checkAdClient(o[0]); |
| 117 checkAdClient(o[1]); |
| 118 } |
| 119 |
| 120 core.int buildCounterAdClients = 0; |
| 121 buildAdClients() { |
| 122 var o = new api.AdClients(); |
| 123 buildCounterAdClients++; |
| 124 if (buildCounterAdClients < 3) { |
| 125 o.etag = "foo"; |
| 126 o.items = buildUnnamed968(); |
| 127 o.kind = "foo"; |
| 128 o.nextPageToken = "foo"; |
| 129 } |
| 130 buildCounterAdClients--; |
| 131 return o; |
| 132 } |
| 133 |
| 134 checkAdClients(api.AdClients o) { |
| 135 buildCounterAdClients++; |
| 136 if (buildCounterAdClients < 3) { |
| 137 unittest.expect(o.etag, unittest.equals('foo')); |
| 138 checkUnnamed968(o.items); |
| 139 unittest.expect(o.kind, unittest.equals('foo')); |
| 140 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 141 } |
| 142 buildCounterAdClients--; |
| 143 } |
| 144 |
| 145 core.int buildCounterAdCode = 0; |
| 146 buildAdCode() { |
| 147 var o = new api.AdCode(); |
| 148 buildCounterAdCode++; |
| 149 if (buildCounterAdCode < 3) { |
| 150 o.adCode = "foo"; |
| 151 o.kind = "foo"; |
| 152 } |
| 153 buildCounterAdCode--; |
| 154 return o; |
| 155 } |
| 156 |
| 157 checkAdCode(api.AdCode o) { |
| 158 buildCounterAdCode++; |
| 159 if (buildCounterAdCode < 3) { |
| 160 unittest.expect(o.adCode, unittest.equals('foo')); |
| 161 unittest.expect(o.kind, unittest.equals('foo')); |
| 162 } |
| 163 buildCounterAdCode--; |
| 164 } |
| 165 |
| 166 core.int buildCounterAdStyleColors = 0; |
| 167 buildAdStyleColors() { |
| 168 var o = new api.AdStyleColors(); |
| 169 buildCounterAdStyleColors++; |
| 170 if (buildCounterAdStyleColors < 3) { |
| 171 o.background = "foo"; |
| 172 o.border = "foo"; |
| 173 o.text = "foo"; |
| 174 o.title = "foo"; |
| 175 o.url = "foo"; |
| 176 } |
| 177 buildCounterAdStyleColors--; |
| 178 return o; |
| 179 } |
| 180 |
| 181 checkAdStyleColors(api.AdStyleColors o) { |
| 182 buildCounterAdStyleColors++; |
| 183 if (buildCounterAdStyleColors < 3) { |
| 184 unittest.expect(o.background, unittest.equals('foo')); |
| 185 unittest.expect(o.border, unittest.equals('foo')); |
| 186 unittest.expect(o.text, unittest.equals('foo')); |
| 187 unittest.expect(o.title, unittest.equals('foo')); |
| 188 unittest.expect(o.url, unittest.equals('foo')); |
| 189 } |
| 190 buildCounterAdStyleColors--; |
| 191 } |
| 192 |
| 193 core.int buildCounterAdStyleFont = 0; |
| 194 buildAdStyleFont() { |
| 195 var o = new api.AdStyleFont(); |
| 196 buildCounterAdStyleFont++; |
| 197 if (buildCounterAdStyleFont < 3) { |
| 198 o.family = "foo"; |
| 199 o.size = "foo"; |
| 200 } |
| 201 buildCounterAdStyleFont--; |
| 202 return o; |
| 203 } |
| 204 |
| 205 checkAdStyleFont(api.AdStyleFont o) { |
| 206 buildCounterAdStyleFont++; |
| 207 if (buildCounterAdStyleFont < 3) { |
| 208 unittest.expect(o.family, unittest.equals('foo')); |
| 209 unittest.expect(o.size, unittest.equals('foo')); |
| 210 } |
| 211 buildCounterAdStyleFont--; |
| 212 } |
| 213 |
| 214 core.int buildCounterAdStyle = 0; |
| 215 buildAdStyle() { |
| 216 var o = new api.AdStyle(); |
| 217 buildCounterAdStyle++; |
| 218 if (buildCounterAdStyle < 3) { |
| 219 o.colors = buildAdStyleColors(); |
| 220 o.corners = "foo"; |
| 221 o.font = buildAdStyleFont(); |
| 222 o.kind = "foo"; |
| 223 } |
| 224 buildCounterAdStyle--; |
| 225 return o; |
| 226 } |
| 227 |
| 228 checkAdStyle(api.AdStyle o) { |
| 229 buildCounterAdStyle++; |
| 230 if (buildCounterAdStyle < 3) { |
| 231 checkAdStyleColors(o.colors); |
| 232 unittest.expect(o.corners, unittest.equals('foo')); |
| 233 checkAdStyleFont(o.font); |
| 234 unittest.expect(o.kind, unittest.equals('foo')); |
| 235 } |
| 236 buildCounterAdStyle--; |
| 237 } |
| 238 |
| 239 core.int buildCounterAdUnitContentAdsSettingsBackupOption = 0; |
| 240 buildAdUnitContentAdsSettingsBackupOption() { |
| 241 var o = new api.AdUnitContentAdsSettingsBackupOption(); |
| 242 buildCounterAdUnitContentAdsSettingsBackupOption++; |
| 243 if (buildCounterAdUnitContentAdsSettingsBackupOption < 3) { |
| 244 o.color = "foo"; |
| 245 o.type = "foo"; |
| 246 o.url = "foo"; |
| 247 } |
| 248 buildCounterAdUnitContentAdsSettingsBackupOption--; |
| 249 return o; |
| 250 } |
| 251 |
| 252 checkAdUnitContentAdsSettingsBackupOption(api.AdUnitContentAdsSettingsBackupOpti
on o) { |
| 253 buildCounterAdUnitContentAdsSettingsBackupOption++; |
| 254 if (buildCounterAdUnitContentAdsSettingsBackupOption < 3) { |
| 255 unittest.expect(o.color, unittest.equals('foo')); |
| 256 unittest.expect(o.type, unittest.equals('foo')); |
| 257 unittest.expect(o.url, unittest.equals('foo')); |
| 258 } |
| 259 buildCounterAdUnitContentAdsSettingsBackupOption--; |
| 260 } |
| 261 |
| 262 core.int buildCounterAdUnitContentAdsSettings = 0; |
| 263 buildAdUnitContentAdsSettings() { |
| 264 var o = new api.AdUnitContentAdsSettings(); |
| 265 buildCounterAdUnitContentAdsSettings++; |
| 266 if (buildCounterAdUnitContentAdsSettings < 3) { |
| 267 o.backupOption = buildAdUnitContentAdsSettingsBackupOption(); |
| 268 o.size = "foo"; |
| 269 o.type = "foo"; |
| 270 } |
| 271 buildCounterAdUnitContentAdsSettings--; |
| 272 return o; |
| 273 } |
| 274 |
| 275 checkAdUnitContentAdsSettings(api.AdUnitContentAdsSettings o) { |
| 276 buildCounterAdUnitContentAdsSettings++; |
| 277 if (buildCounterAdUnitContentAdsSettings < 3) { |
| 278 checkAdUnitContentAdsSettingsBackupOption(o.backupOption); |
| 279 unittest.expect(o.size, unittest.equals('foo')); |
| 280 unittest.expect(o.type, unittest.equals('foo')); |
| 281 } |
| 282 buildCounterAdUnitContentAdsSettings--; |
| 283 } |
| 284 |
| 285 core.int buildCounterAdUnitMobileContentAdsSettings = 0; |
| 286 buildAdUnitMobileContentAdsSettings() { |
| 287 var o = new api.AdUnitMobileContentAdsSettings(); |
| 288 buildCounterAdUnitMobileContentAdsSettings++; |
| 289 if (buildCounterAdUnitMobileContentAdsSettings < 3) { |
| 290 o.markupLanguage = "foo"; |
| 291 o.scriptingLanguage = "foo"; |
| 292 o.size = "foo"; |
| 293 o.type = "foo"; |
| 294 } |
| 295 buildCounterAdUnitMobileContentAdsSettings--; |
| 296 return o; |
| 297 } |
| 298 |
| 299 checkAdUnitMobileContentAdsSettings(api.AdUnitMobileContentAdsSettings o) { |
| 300 buildCounterAdUnitMobileContentAdsSettings++; |
| 301 if (buildCounterAdUnitMobileContentAdsSettings < 3) { |
| 302 unittest.expect(o.markupLanguage, unittest.equals('foo')); |
| 303 unittest.expect(o.scriptingLanguage, unittest.equals('foo')); |
| 304 unittest.expect(o.size, unittest.equals('foo')); |
| 305 unittest.expect(o.type, unittest.equals('foo')); |
| 306 } |
| 307 buildCounterAdUnitMobileContentAdsSettings--; |
| 308 } |
| 309 |
| 310 core.int buildCounterAdUnit = 0; |
| 311 buildAdUnit() { |
| 312 var o = new api.AdUnit(); |
| 313 buildCounterAdUnit++; |
| 314 if (buildCounterAdUnit < 3) { |
| 315 o.code = "foo"; |
| 316 o.contentAdsSettings = buildAdUnitContentAdsSettings(); |
| 317 o.customStyle = buildAdStyle(); |
| 318 o.id = "foo"; |
| 319 o.kind = "foo"; |
| 320 o.mobileContentAdsSettings = buildAdUnitMobileContentAdsSettings(); |
| 321 o.name = "foo"; |
| 322 o.status = "foo"; |
| 323 } |
| 324 buildCounterAdUnit--; |
| 325 return o; |
| 326 } |
| 327 |
| 328 checkAdUnit(api.AdUnit o) { |
| 329 buildCounterAdUnit++; |
| 330 if (buildCounterAdUnit < 3) { |
| 331 unittest.expect(o.code, unittest.equals('foo')); |
| 332 checkAdUnitContentAdsSettings(o.contentAdsSettings); |
| 333 checkAdStyle(o.customStyle); |
| 334 unittest.expect(o.id, unittest.equals('foo')); |
| 335 unittest.expect(o.kind, unittest.equals('foo')); |
| 336 checkAdUnitMobileContentAdsSettings(o.mobileContentAdsSettings); |
| 337 unittest.expect(o.name, unittest.equals('foo')); |
| 338 unittest.expect(o.status, unittest.equals('foo')); |
| 339 } |
| 340 buildCounterAdUnit--; |
| 341 } |
| 342 |
| 343 buildUnnamed969() { |
| 344 var o = new core.List<api.AdUnit>(); |
| 345 o.add(buildAdUnit()); |
| 346 o.add(buildAdUnit()); |
| 347 return o; |
| 348 } |
| 349 |
| 350 checkUnnamed969(core.List<api.AdUnit> o) { |
| 351 unittest.expect(o, unittest.hasLength(2)); |
| 352 checkAdUnit(o[0]); |
| 353 checkAdUnit(o[1]); |
| 354 } |
| 355 |
| 356 core.int buildCounterAdUnits = 0; |
| 357 buildAdUnits() { |
| 358 var o = new api.AdUnits(); |
| 359 buildCounterAdUnits++; |
| 360 if (buildCounterAdUnits < 3) { |
| 361 o.etag = "foo"; |
| 362 o.items = buildUnnamed969(); |
| 363 o.kind = "foo"; |
| 364 o.nextPageToken = "foo"; |
| 365 } |
| 366 buildCounterAdUnits--; |
| 367 return o; |
| 368 } |
| 369 |
| 370 checkAdUnits(api.AdUnits o) { |
| 371 buildCounterAdUnits++; |
| 372 if (buildCounterAdUnits < 3) { |
| 373 unittest.expect(o.etag, unittest.equals('foo')); |
| 374 checkUnnamed969(o.items); |
| 375 unittest.expect(o.kind, unittest.equals('foo')); |
| 376 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 377 } |
| 378 buildCounterAdUnits--; |
| 379 } |
| 380 |
| 381 buildUnnamed970() { |
| 382 var o = new core.List<core.String>(); |
| 383 o.add("foo"); |
| 384 o.add("foo"); |
| 385 return o; |
| 386 } |
| 387 |
| 388 checkUnnamed970(core.List<core.String> o) { |
| 389 unittest.expect(o, unittest.hasLength(2)); |
| 390 unittest.expect(o[0], unittest.equals('foo')); |
| 391 unittest.expect(o[1], unittest.equals('foo')); |
| 392 } |
| 393 |
| 394 core.int buildCounterAssociationSession = 0; |
| 395 buildAssociationSession() { |
| 396 var o = new api.AssociationSession(); |
| 397 buildCounterAssociationSession++; |
| 398 if (buildCounterAssociationSession < 3) { |
| 399 o.accountId = "foo"; |
| 400 o.id = "foo"; |
| 401 o.kind = "foo"; |
| 402 o.productCodes = buildUnnamed970(); |
| 403 o.redirectUrl = "foo"; |
| 404 o.status = "foo"; |
| 405 o.userLocale = "foo"; |
| 406 o.websiteLocale = "foo"; |
| 407 o.websiteUrl = "foo"; |
| 408 } |
| 409 buildCounterAssociationSession--; |
| 410 return o; |
| 411 } |
| 412 |
| 413 checkAssociationSession(api.AssociationSession o) { |
| 414 buildCounterAssociationSession++; |
| 415 if (buildCounterAssociationSession < 3) { |
| 416 unittest.expect(o.accountId, unittest.equals('foo')); |
| 417 unittest.expect(o.id, unittest.equals('foo')); |
| 418 unittest.expect(o.kind, unittest.equals('foo')); |
| 419 checkUnnamed970(o.productCodes); |
| 420 unittest.expect(o.redirectUrl, unittest.equals('foo')); |
| 421 unittest.expect(o.status, unittest.equals('foo')); |
| 422 unittest.expect(o.userLocale, unittest.equals('foo')); |
| 423 unittest.expect(o.websiteLocale, unittest.equals('foo')); |
| 424 unittest.expect(o.websiteUrl, unittest.equals('foo')); |
| 425 } |
| 426 buildCounterAssociationSession--; |
| 427 } |
| 428 |
| 429 core.int buildCounterCustomChannel = 0; |
| 430 buildCustomChannel() { |
| 431 var o = new api.CustomChannel(); |
| 432 buildCounterCustomChannel++; |
| 433 if (buildCounterCustomChannel < 3) { |
| 434 o.code = "foo"; |
| 435 o.id = "foo"; |
| 436 o.kind = "foo"; |
| 437 o.name = "foo"; |
| 438 } |
| 439 buildCounterCustomChannel--; |
| 440 return o; |
| 441 } |
| 442 |
| 443 checkCustomChannel(api.CustomChannel o) { |
| 444 buildCounterCustomChannel++; |
| 445 if (buildCounterCustomChannel < 3) { |
| 446 unittest.expect(o.code, unittest.equals('foo')); |
| 447 unittest.expect(o.id, unittest.equals('foo')); |
| 448 unittest.expect(o.kind, unittest.equals('foo')); |
| 449 unittest.expect(o.name, unittest.equals('foo')); |
| 450 } |
| 451 buildCounterCustomChannel--; |
| 452 } |
| 453 |
| 454 buildUnnamed971() { |
| 455 var o = new core.List<api.CustomChannel>(); |
| 456 o.add(buildCustomChannel()); |
| 457 o.add(buildCustomChannel()); |
| 458 return o; |
| 459 } |
| 460 |
| 461 checkUnnamed971(core.List<api.CustomChannel> o) { |
| 462 unittest.expect(o, unittest.hasLength(2)); |
| 463 checkCustomChannel(o[0]); |
| 464 checkCustomChannel(o[1]); |
| 465 } |
| 466 |
| 467 core.int buildCounterCustomChannels = 0; |
| 468 buildCustomChannels() { |
| 469 var o = new api.CustomChannels(); |
| 470 buildCounterCustomChannels++; |
| 471 if (buildCounterCustomChannels < 3) { |
| 472 o.etag = "foo"; |
| 473 o.items = buildUnnamed971(); |
| 474 o.kind = "foo"; |
| 475 o.nextPageToken = "foo"; |
| 476 } |
| 477 buildCounterCustomChannels--; |
| 478 return o; |
| 479 } |
| 480 |
| 481 checkCustomChannels(api.CustomChannels o) { |
| 482 buildCounterCustomChannels++; |
| 483 if (buildCounterCustomChannels < 3) { |
| 484 unittest.expect(o.etag, unittest.equals('foo')); |
| 485 checkUnnamed971(o.items); |
| 486 unittest.expect(o.kind, unittest.equals('foo')); |
| 487 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 488 } |
| 489 buildCounterCustomChannels--; |
| 490 } |
| 491 |
| 492 buildUnnamed972() { |
| 493 var o = new core.List<core.String>(); |
| 494 o.add("foo"); |
| 495 o.add("foo"); |
| 496 return o; |
| 497 } |
| 498 |
| 499 checkUnnamed972(core.List<core.String> o) { |
| 500 unittest.expect(o, unittest.hasLength(2)); |
| 501 unittest.expect(o[0], unittest.equals('foo')); |
| 502 unittest.expect(o[1], unittest.equals('foo')); |
| 503 } |
| 504 |
| 505 core.int buildCounterReportHeaders = 0; |
| 506 buildReportHeaders() { |
| 507 var o = new api.ReportHeaders(); |
| 508 buildCounterReportHeaders++; |
| 509 if (buildCounterReportHeaders < 3) { |
| 510 o.currency = "foo"; |
| 511 o.name = "foo"; |
| 512 o.type = "foo"; |
| 513 } |
| 514 buildCounterReportHeaders--; |
| 515 return o; |
| 516 } |
| 517 |
| 518 checkReportHeaders(api.ReportHeaders o) { |
| 519 buildCounterReportHeaders++; |
| 520 if (buildCounterReportHeaders < 3) { |
| 521 unittest.expect(o.currency, unittest.equals('foo')); |
| 522 unittest.expect(o.name, unittest.equals('foo')); |
| 523 unittest.expect(o.type, unittest.equals('foo')); |
| 524 } |
| 525 buildCounterReportHeaders--; |
| 526 } |
| 527 |
| 528 buildUnnamed973() { |
| 529 var o = new core.List<api.ReportHeaders>(); |
| 530 o.add(buildReportHeaders()); |
| 531 o.add(buildReportHeaders()); |
| 532 return o; |
| 533 } |
| 534 |
| 535 checkUnnamed973(core.List<api.ReportHeaders> o) { |
| 536 unittest.expect(o, unittest.hasLength(2)); |
| 537 checkReportHeaders(o[0]); |
| 538 checkReportHeaders(o[1]); |
| 539 } |
| 540 |
| 541 buildUnnamed974() { |
| 542 var o = new core.List<core.String>(); |
| 543 o.add("foo"); |
| 544 o.add("foo"); |
| 545 return o; |
| 546 } |
| 547 |
| 548 checkUnnamed974(core.List<core.String> o) { |
| 549 unittest.expect(o, unittest.hasLength(2)); |
| 550 unittest.expect(o[0], unittest.equals('foo')); |
| 551 unittest.expect(o[1], unittest.equals('foo')); |
| 552 } |
| 553 |
| 554 buildUnnamed975() { |
| 555 var o = new core.List<core.List<core.String>>(); |
| 556 o.add(buildUnnamed974()); |
| 557 o.add(buildUnnamed974()); |
| 558 return o; |
| 559 } |
| 560 |
| 561 checkUnnamed975(core.List<core.List<core.String>> o) { |
| 562 unittest.expect(o, unittest.hasLength(2)); |
| 563 checkUnnamed974(o[0]); |
| 564 checkUnnamed974(o[1]); |
| 565 } |
| 566 |
| 567 buildUnnamed976() { |
| 568 var o = new core.List<core.String>(); |
| 569 o.add("foo"); |
| 570 o.add("foo"); |
| 571 return o; |
| 572 } |
| 573 |
| 574 checkUnnamed976(core.List<core.String> o) { |
| 575 unittest.expect(o, unittest.hasLength(2)); |
| 576 unittest.expect(o[0], unittest.equals('foo')); |
| 577 unittest.expect(o[1], unittest.equals('foo')); |
| 578 } |
| 579 |
| 580 buildUnnamed977() { |
| 581 var o = new core.List<core.String>(); |
| 582 o.add("foo"); |
| 583 o.add("foo"); |
| 584 return o; |
| 585 } |
| 586 |
| 587 checkUnnamed977(core.List<core.String> o) { |
| 588 unittest.expect(o, unittest.hasLength(2)); |
| 589 unittest.expect(o[0], unittest.equals('foo')); |
| 590 unittest.expect(o[1], unittest.equals('foo')); |
| 591 } |
| 592 |
| 593 core.int buildCounterReport = 0; |
| 594 buildReport() { |
| 595 var o = new api.Report(); |
| 596 buildCounterReport++; |
| 597 if (buildCounterReport < 3) { |
| 598 o.averages = buildUnnamed972(); |
| 599 o.headers = buildUnnamed973(); |
| 600 o.kind = "foo"; |
| 601 o.rows = buildUnnamed975(); |
| 602 o.totalMatchedRows = "foo"; |
| 603 o.totals = buildUnnamed976(); |
| 604 o.warnings = buildUnnamed977(); |
| 605 } |
| 606 buildCounterReport--; |
| 607 return o; |
| 608 } |
| 609 |
| 610 checkReport(api.Report o) { |
| 611 buildCounterReport++; |
| 612 if (buildCounterReport < 3) { |
| 613 checkUnnamed972(o.averages); |
| 614 checkUnnamed973(o.headers); |
| 615 unittest.expect(o.kind, unittest.equals('foo')); |
| 616 checkUnnamed975(o.rows); |
| 617 unittest.expect(o.totalMatchedRows, unittest.equals('foo')); |
| 618 checkUnnamed976(o.totals); |
| 619 checkUnnamed977(o.warnings); |
| 620 } |
| 621 buildCounterReport--; |
| 622 } |
| 623 |
| 624 core.int buildCounterUrlChannel = 0; |
| 625 buildUrlChannel() { |
| 626 var o = new api.UrlChannel(); |
| 627 buildCounterUrlChannel++; |
| 628 if (buildCounterUrlChannel < 3) { |
| 629 o.id = "foo"; |
| 630 o.kind = "foo"; |
| 631 o.urlPattern = "foo"; |
| 632 } |
| 633 buildCounterUrlChannel--; |
| 634 return o; |
| 635 } |
| 636 |
| 637 checkUrlChannel(api.UrlChannel o) { |
| 638 buildCounterUrlChannel++; |
| 639 if (buildCounterUrlChannel < 3) { |
| 640 unittest.expect(o.id, unittest.equals('foo')); |
| 641 unittest.expect(o.kind, unittest.equals('foo')); |
| 642 unittest.expect(o.urlPattern, unittest.equals('foo')); |
| 643 } |
| 644 buildCounterUrlChannel--; |
| 645 } |
| 646 |
| 647 buildUnnamed978() { |
| 648 var o = new core.List<api.UrlChannel>(); |
| 649 o.add(buildUrlChannel()); |
| 650 o.add(buildUrlChannel()); |
| 651 return o; |
| 652 } |
| 653 |
| 654 checkUnnamed978(core.List<api.UrlChannel> o) { |
| 655 unittest.expect(o, unittest.hasLength(2)); |
| 656 checkUrlChannel(o[0]); |
| 657 checkUrlChannel(o[1]); |
| 658 } |
| 659 |
| 660 core.int buildCounterUrlChannels = 0; |
| 661 buildUrlChannels() { |
| 662 var o = new api.UrlChannels(); |
| 663 buildCounterUrlChannels++; |
| 664 if (buildCounterUrlChannels < 3) { |
| 665 o.etag = "foo"; |
| 666 o.items = buildUnnamed978(); |
| 667 o.kind = "foo"; |
| 668 o.nextPageToken = "foo"; |
| 669 } |
| 670 buildCounterUrlChannels--; |
| 671 return o; |
| 672 } |
| 673 |
| 674 checkUrlChannels(api.UrlChannels o) { |
| 675 buildCounterUrlChannels++; |
| 676 if (buildCounterUrlChannels < 3) { |
| 677 unittest.expect(o.etag, unittest.equals('foo')); |
| 678 checkUnnamed978(o.items); |
| 679 unittest.expect(o.kind, unittest.equals('foo')); |
| 680 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 681 } |
| 682 buildCounterUrlChannels--; |
| 683 } |
| 684 |
| 685 buildUnnamed979() { |
| 686 var o = new core.List<core.String>(); |
| 687 o.add("foo"); |
| 688 o.add("foo"); |
| 689 return o; |
| 690 } |
| 691 |
| 692 checkUnnamed979(core.List<core.String> o) { |
| 693 unittest.expect(o, unittest.hasLength(2)); |
| 694 unittest.expect(o[0], unittest.equals('foo')); |
| 695 unittest.expect(o[1], unittest.equals('foo')); |
| 696 } |
| 697 |
| 698 buildUnnamed980() { |
| 699 var o = new core.List<core.String>(); |
| 700 o.add("foo"); |
| 701 o.add("foo"); |
| 702 return o; |
| 703 } |
| 704 |
| 705 checkUnnamed980(core.List<core.String> o) { |
| 706 unittest.expect(o, unittest.hasLength(2)); |
| 707 unittest.expect(o[0], unittest.equals('foo')); |
| 708 unittest.expect(o[1], unittest.equals('foo')); |
| 709 } |
| 710 |
| 711 buildUnnamed981() { |
| 712 var o = new core.List<core.String>(); |
| 713 o.add("foo"); |
| 714 o.add("foo"); |
| 715 return o; |
| 716 } |
| 717 |
| 718 checkUnnamed981(core.List<core.String> o) { |
| 719 unittest.expect(o, unittest.hasLength(2)); |
| 720 unittest.expect(o[0], unittest.equals('foo')); |
| 721 unittest.expect(o[1], unittest.equals('foo')); |
| 722 } |
| 723 |
| 724 buildUnnamed982() { |
| 725 var o = new core.List<core.String>(); |
| 726 o.add("foo"); |
| 727 o.add("foo"); |
| 728 return o; |
| 729 } |
| 730 |
| 731 checkUnnamed982(core.List<core.String> o) { |
| 732 unittest.expect(o, unittest.hasLength(2)); |
| 733 unittest.expect(o[0], unittest.equals('foo')); |
| 734 unittest.expect(o[1], unittest.equals('foo')); |
| 735 } |
| 736 |
| 737 buildUnnamed983() { |
| 738 var o = new core.List<core.String>(); |
| 739 o.add("foo"); |
| 740 o.add("foo"); |
| 741 return o; |
| 742 } |
| 743 |
| 744 checkUnnamed983(core.List<core.String> o) { |
| 745 unittest.expect(o, unittest.hasLength(2)); |
| 746 unittest.expect(o[0], unittest.equals('foo')); |
| 747 unittest.expect(o[1], unittest.equals('foo')); |
| 748 } |
| 749 |
| 750 buildUnnamed984() { |
| 751 var o = new core.List<core.String>(); |
| 752 o.add("foo"); |
| 753 o.add("foo"); |
| 754 return o; |
| 755 } |
| 756 |
| 757 checkUnnamed984(core.List<core.String> o) { |
| 758 unittest.expect(o, unittest.hasLength(2)); |
| 759 unittest.expect(o[0], unittest.equals('foo')); |
| 760 unittest.expect(o[1], unittest.equals('foo')); |
| 761 } |
| 762 |
| 763 buildUnnamed985() { |
| 764 var o = new core.List<core.String>(); |
| 765 o.add("foo"); |
| 766 o.add("foo"); |
| 767 return o; |
| 768 } |
| 769 |
| 770 checkUnnamed985(core.List<core.String> o) { |
| 771 unittest.expect(o, unittest.hasLength(2)); |
| 772 unittest.expect(o[0], unittest.equals('foo')); |
| 773 unittest.expect(o[1], unittest.equals('foo')); |
| 774 } |
| 775 |
| 776 buildUnnamed986() { |
| 777 var o = new core.List<core.String>(); |
| 778 o.add("foo"); |
| 779 o.add("foo"); |
| 780 return o; |
| 781 } |
| 782 |
| 783 checkUnnamed986(core.List<core.String> o) { |
| 784 unittest.expect(o, unittest.hasLength(2)); |
| 785 unittest.expect(o[0], unittest.equals('foo')); |
| 786 unittest.expect(o[1], unittest.equals('foo')); |
| 787 } |
| 788 |
| 789 buildUnnamed987() { |
| 790 var o = new core.List<core.String>(); |
| 791 o.add("foo"); |
| 792 o.add("foo"); |
| 793 return o; |
| 794 } |
| 795 |
| 796 checkUnnamed987(core.List<core.String> o) { |
| 797 unittest.expect(o, unittest.hasLength(2)); |
| 798 unittest.expect(o[0], unittest.equals('foo')); |
| 799 unittest.expect(o[1], unittest.equals('foo')); |
| 800 } |
| 801 |
| 802 buildUnnamed988() { |
| 803 var o = new core.List<core.String>(); |
| 804 o.add("foo"); |
| 805 o.add("foo"); |
| 806 return o; |
| 807 } |
| 808 |
| 809 checkUnnamed988(core.List<core.String> o) { |
| 810 unittest.expect(o, unittest.hasLength(2)); |
| 811 unittest.expect(o[0], unittest.equals('foo')); |
| 812 unittest.expect(o[1], unittest.equals('foo')); |
| 813 } |
| 814 |
| 815 buildUnnamed989() { |
| 816 var o = new core.List<core.String>(); |
| 817 o.add("foo"); |
| 818 o.add("foo"); |
| 819 return o; |
| 820 } |
| 821 |
| 822 checkUnnamed989(core.List<core.String> o) { |
| 823 unittest.expect(o, unittest.hasLength(2)); |
| 824 unittest.expect(o[0], unittest.equals('foo')); |
| 825 unittest.expect(o[1], unittest.equals('foo')); |
| 826 } |
| 827 |
| 828 |
| 829 main() { |
| 830 unittest.group("obj-schema-Account", () { |
| 831 unittest.test("to-json--from-json", () { |
| 832 var o = buildAccount(); |
| 833 var od = new api.Account.fromJson(o.toJson()); |
| 834 checkAccount(od); |
| 835 }); |
| 836 }); |
| 837 |
| 838 |
| 839 unittest.group("obj-schema-Accounts", () { |
| 840 unittest.test("to-json--from-json", () { |
| 841 var o = buildAccounts(); |
| 842 var od = new api.Accounts.fromJson(o.toJson()); |
| 843 checkAccounts(od); |
| 844 }); |
| 845 }); |
| 846 |
| 847 |
| 848 unittest.group("obj-schema-AdClient", () { |
| 849 unittest.test("to-json--from-json", () { |
| 850 var o = buildAdClient(); |
| 851 var od = new api.AdClient.fromJson(o.toJson()); |
| 852 checkAdClient(od); |
| 853 }); |
| 854 }); |
| 855 |
| 856 |
| 857 unittest.group("obj-schema-AdClients", () { |
| 858 unittest.test("to-json--from-json", () { |
| 859 var o = buildAdClients(); |
| 860 var od = new api.AdClients.fromJson(o.toJson()); |
| 861 checkAdClients(od); |
| 862 }); |
| 863 }); |
| 864 |
| 865 |
| 866 unittest.group("obj-schema-AdCode", () { |
| 867 unittest.test("to-json--from-json", () { |
| 868 var o = buildAdCode(); |
| 869 var od = new api.AdCode.fromJson(o.toJson()); |
| 870 checkAdCode(od); |
| 871 }); |
| 872 }); |
| 873 |
| 874 |
| 875 unittest.group("obj-schema-AdStyleColors", () { |
| 876 unittest.test("to-json--from-json", () { |
| 877 var o = buildAdStyleColors(); |
| 878 var od = new api.AdStyleColors.fromJson(o.toJson()); |
| 879 checkAdStyleColors(od); |
| 880 }); |
| 881 }); |
| 882 |
| 883 |
| 884 unittest.group("obj-schema-AdStyleFont", () { |
| 885 unittest.test("to-json--from-json", () { |
| 886 var o = buildAdStyleFont(); |
| 887 var od = new api.AdStyleFont.fromJson(o.toJson()); |
| 888 checkAdStyleFont(od); |
| 889 }); |
| 890 }); |
| 891 |
| 892 |
| 893 unittest.group("obj-schema-AdStyle", () { |
| 894 unittest.test("to-json--from-json", () { |
| 895 var o = buildAdStyle(); |
| 896 var od = new api.AdStyle.fromJson(o.toJson()); |
| 897 checkAdStyle(od); |
| 898 }); |
| 899 }); |
| 900 |
| 901 |
| 902 unittest.group("obj-schema-AdUnitContentAdsSettingsBackupOption", () { |
| 903 unittest.test("to-json--from-json", () { |
| 904 var o = buildAdUnitContentAdsSettingsBackupOption(); |
| 905 var od = new api.AdUnitContentAdsSettingsBackupOption.fromJson(o.toJson())
; |
| 906 checkAdUnitContentAdsSettingsBackupOption(od); |
| 907 }); |
| 908 }); |
| 909 |
| 910 |
| 911 unittest.group("obj-schema-AdUnitContentAdsSettings", () { |
| 912 unittest.test("to-json--from-json", () { |
| 913 var o = buildAdUnitContentAdsSettings(); |
| 914 var od = new api.AdUnitContentAdsSettings.fromJson(o.toJson()); |
| 915 checkAdUnitContentAdsSettings(od); |
| 916 }); |
| 917 }); |
| 918 |
| 919 |
| 920 unittest.group("obj-schema-AdUnitMobileContentAdsSettings", () { |
| 921 unittest.test("to-json--from-json", () { |
| 922 var o = buildAdUnitMobileContentAdsSettings(); |
| 923 var od = new api.AdUnitMobileContentAdsSettings.fromJson(o.toJson()); |
| 924 checkAdUnitMobileContentAdsSettings(od); |
| 925 }); |
| 926 }); |
| 927 |
| 928 |
| 929 unittest.group("obj-schema-AdUnit", () { |
| 930 unittest.test("to-json--from-json", () { |
| 931 var o = buildAdUnit(); |
| 932 var od = new api.AdUnit.fromJson(o.toJson()); |
| 933 checkAdUnit(od); |
| 934 }); |
| 935 }); |
| 936 |
| 937 |
| 938 unittest.group("obj-schema-AdUnits", () { |
| 939 unittest.test("to-json--from-json", () { |
| 940 var o = buildAdUnits(); |
| 941 var od = new api.AdUnits.fromJson(o.toJson()); |
| 942 checkAdUnits(od); |
| 943 }); |
| 944 }); |
| 945 |
| 946 |
| 947 unittest.group("obj-schema-AssociationSession", () { |
| 948 unittest.test("to-json--from-json", () { |
| 949 var o = buildAssociationSession(); |
| 950 var od = new api.AssociationSession.fromJson(o.toJson()); |
| 951 checkAssociationSession(od); |
| 952 }); |
| 953 }); |
| 954 |
| 955 |
| 956 unittest.group("obj-schema-CustomChannel", () { |
| 957 unittest.test("to-json--from-json", () { |
| 958 var o = buildCustomChannel(); |
| 959 var od = new api.CustomChannel.fromJson(o.toJson()); |
| 960 checkCustomChannel(od); |
| 961 }); |
| 962 }); |
| 963 |
| 964 |
| 965 unittest.group("obj-schema-CustomChannels", () { |
| 966 unittest.test("to-json--from-json", () { |
| 967 var o = buildCustomChannels(); |
| 968 var od = new api.CustomChannels.fromJson(o.toJson()); |
| 969 checkCustomChannels(od); |
| 970 }); |
| 971 }); |
| 972 |
| 973 |
| 974 unittest.group("obj-schema-ReportHeaders", () { |
| 975 unittest.test("to-json--from-json", () { |
| 976 var o = buildReportHeaders(); |
| 977 var od = new api.ReportHeaders.fromJson(o.toJson()); |
| 978 checkReportHeaders(od); |
| 979 }); |
| 980 }); |
| 981 |
| 982 |
| 983 unittest.group("obj-schema-Report", () { |
| 984 unittest.test("to-json--from-json", () { |
| 985 var o = buildReport(); |
| 986 var od = new api.Report.fromJson(o.toJson()); |
| 987 checkReport(od); |
| 988 }); |
| 989 }); |
| 990 |
| 991 |
| 992 unittest.group("obj-schema-UrlChannel", () { |
| 993 unittest.test("to-json--from-json", () { |
| 994 var o = buildUrlChannel(); |
| 995 var od = new api.UrlChannel.fromJson(o.toJson()); |
| 996 checkUrlChannel(od); |
| 997 }); |
| 998 }); |
| 999 |
| 1000 |
| 1001 unittest.group("obj-schema-UrlChannels", () { |
| 1002 unittest.test("to-json--from-json", () { |
| 1003 var o = buildUrlChannels(); |
| 1004 var od = new api.UrlChannels.fromJson(o.toJson()); |
| 1005 checkUrlChannels(od); |
| 1006 }); |
| 1007 }); |
| 1008 |
| 1009 |
| 1010 unittest.group("resource-AccountsResourceApi", () { |
| 1011 unittest.test("method--get", () { |
| 1012 |
| 1013 var mock = new common_test.HttpServerMock(); |
| 1014 api.AccountsResourceApi res = new api.AdsensehostApi(mock).accounts; |
| 1015 var arg_accountId = "foo"; |
| 1016 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1017 var path = (req.url).path; |
| 1018 var pathOffset = 0; |
| 1019 var index; |
| 1020 var subPart; |
| 1021 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1022 pathOffset += 18; |
| 1023 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1024 pathOffset += 9; |
| 1025 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1026 pathOffset = path.length; |
| 1027 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1028 |
| 1029 var query = (req.url).query; |
| 1030 var queryOffset = 0; |
| 1031 var queryMap = {}; |
| 1032 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1033 parseBool(n) { |
| 1034 if (n == "true") return true; |
| 1035 if (n == "false") return false; |
| 1036 if (n == null) return null; |
| 1037 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1038 } |
| 1039 if (query.length > 0) { |
| 1040 for (var part in query.split("&")) { |
| 1041 var keyvalue = part.split("="); |
| 1042 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1043 } |
| 1044 } |
| 1045 |
| 1046 |
| 1047 var h = { |
| 1048 "content-type" : "application/json; charset=utf-8", |
| 1049 }; |
| 1050 var resp = convert.JSON.encode(buildAccount()); |
| 1051 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1052 }), true); |
| 1053 res.get(arg_accountId).then(unittest.expectAsync(((api.Account response) { |
| 1054 checkAccount(response); |
| 1055 }))); |
| 1056 }); |
| 1057 |
| 1058 unittest.test("method--list", () { |
| 1059 |
| 1060 var mock = new common_test.HttpServerMock(); |
| 1061 api.AccountsResourceApi res = new api.AdsensehostApi(mock).accounts; |
| 1062 var arg_filterAdClientId = buildUnnamed979(); |
| 1063 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1064 var path = (req.url).path; |
| 1065 var pathOffset = 0; |
| 1066 var index; |
| 1067 var subPart; |
| 1068 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1069 pathOffset += 18; |
| 1070 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("accounts")); |
| 1071 pathOffset += 8; |
| 1072 |
| 1073 var query = (req.url).query; |
| 1074 var queryOffset = 0; |
| 1075 var queryMap = {}; |
| 1076 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1077 parseBool(n) { |
| 1078 if (n == "true") return true; |
| 1079 if (n == "false") return false; |
| 1080 if (n == null) return null; |
| 1081 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1082 } |
| 1083 if (query.length > 0) { |
| 1084 for (var part in query.split("&")) { |
| 1085 var keyvalue = part.split("="); |
| 1086 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1087 } |
| 1088 } |
| 1089 unittest.expect(queryMap["filterAdClientId"], unittest.equals(arg_filter
AdClientId)); |
| 1090 |
| 1091 |
| 1092 var h = { |
| 1093 "content-type" : "application/json; charset=utf-8", |
| 1094 }; |
| 1095 var resp = convert.JSON.encode(buildAccounts()); |
| 1096 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1097 }), true); |
| 1098 res.list(arg_filterAdClientId).then(unittest.expectAsync(((api.Accounts re
sponse) { |
| 1099 checkAccounts(response); |
| 1100 }))); |
| 1101 }); |
| 1102 |
| 1103 }); |
| 1104 |
| 1105 |
| 1106 unittest.group("resource-AccountsAdclientsResourceApi", () { |
| 1107 unittest.test("method--get", () { |
| 1108 |
| 1109 var mock = new common_test.HttpServerMock(); |
| 1110 api.AccountsAdclientsResourceApi res = new api.AdsensehostApi(mock).accoun
ts.adclients; |
| 1111 var arg_accountId = "foo"; |
| 1112 var arg_adClientId = "foo"; |
| 1113 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1114 var path = (req.url).path; |
| 1115 var pathOffset = 0; |
| 1116 var index; |
| 1117 var subPart; |
| 1118 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1119 pathOffset += 18; |
| 1120 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1121 pathOffset += 9; |
| 1122 index = path.indexOf("/adclients/", pathOffset); |
| 1123 unittest.expect(index >= 0, unittest.isTrue); |
| 1124 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1125 pathOffset = index; |
| 1126 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1127 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1128 pathOffset += 11; |
| 1129 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1130 pathOffset = path.length; |
| 1131 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1132 |
| 1133 var query = (req.url).query; |
| 1134 var queryOffset = 0; |
| 1135 var queryMap = {}; |
| 1136 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1137 parseBool(n) { |
| 1138 if (n == "true") return true; |
| 1139 if (n == "false") return false; |
| 1140 if (n == null) return null; |
| 1141 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1142 } |
| 1143 if (query.length > 0) { |
| 1144 for (var part in query.split("&")) { |
| 1145 var keyvalue = part.split("="); |
| 1146 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1147 } |
| 1148 } |
| 1149 |
| 1150 |
| 1151 var h = { |
| 1152 "content-type" : "application/json; charset=utf-8", |
| 1153 }; |
| 1154 var resp = convert.JSON.encode(buildAdClient()); |
| 1155 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1156 }), true); |
| 1157 res.get(arg_accountId, arg_adClientId).then(unittest.expectAsync(((api.AdC
lient response) { |
| 1158 checkAdClient(response); |
| 1159 }))); |
| 1160 }); |
| 1161 |
| 1162 unittest.test("method--list", () { |
| 1163 |
| 1164 var mock = new common_test.HttpServerMock(); |
| 1165 api.AccountsAdclientsResourceApi res = new api.AdsensehostApi(mock).accoun
ts.adclients; |
| 1166 var arg_accountId = "foo"; |
| 1167 var arg_maxResults = 42; |
| 1168 var arg_pageToken = "foo"; |
| 1169 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1170 var path = (req.url).path; |
| 1171 var pathOffset = 0; |
| 1172 var index; |
| 1173 var subPart; |
| 1174 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1175 pathOffset += 18; |
| 1176 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1177 pathOffset += 9; |
| 1178 index = path.indexOf("/adclients", pathOffset); |
| 1179 unittest.expect(index >= 0, unittest.isTrue); |
| 1180 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1181 pathOffset = index; |
| 1182 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1183 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/adclients")); |
| 1184 pathOffset += 10; |
| 1185 |
| 1186 var query = (req.url).query; |
| 1187 var queryOffset = 0; |
| 1188 var queryMap = {}; |
| 1189 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1190 parseBool(n) { |
| 1191 if (n == "true") return true; |
| 1192 if (n == "false") return false; |
| 1193 if (n == null) return null; |
| 1194 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1195 } |
| 1196 if (query.length > 0) { |
| 1197 for (var part in query.split("&")) { |
| 1198 var keyvalue = part.split("="); |
| 1199 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1200 } |
| 1201 } |
| 1202 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1203 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1204 |
| 1205 |
| 1206 var h = { |
| 1207 "content-type" : "application/json; charset=utf-8", |
| 1208 }; |
| 1209 var resp = convert.JSON.encode(buildAdClients()); |
| 1210 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1211 }), true); |
| 1212 res.list(arg_accountId, maxResults: arg_maxResults, pageToken: arg_pageTok
en).then(unittest.expectAsync(((api.AdClients response) { |
| 1213 checkAdClients(response); |
| 1214 }))); |
| 1215 }); |
| 1216 |
| 1217 }); |
| 1218 |
| 1219 |
| 1220 unittest.group("resource-AccountsAdunitsResourceApi", () { |
| 1221 unittest.test("method--delete", () { |
| 1222 |
| 1223 var mock = new common_test.HttpServerMock(); |
| 1224 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1225 var arg_accountId = "foo"; |
| 1226 var arg_adClientId = "foo"; |
| 1227 var arg_adUnitId = "foo"; |
| 1228 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1229 var path = (req.url).path; |
| 1230 var pathOffset = 0; |
| 1231 var index; |
| 1232 var subPart; |
| 1233 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1234 pathOffset += 18; |
| 1235 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1236 pathOffset += 9; |
| 1237 index = path.indexOf("/adclients/", pathOffset); |
| 1238 unittest.expect(index >= 0, unittest.isTrue); |
| 1239 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1240 pathOffset = index; |
| 1241 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1242 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1243 pathOffset += 11; |
| 1244 index = path.indexOf("/adunits/", pathOffset); |
| 1245 unittest.expect(index >= 0, unittest.isTrue); |
| 1246 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1247 pathOffset = index; |
| 1248 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1249 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/adunits/")); |
| 1250 pathOffset += 9; |
| 1251 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1252 pathOffset = path.length; |
| 1253 unittest.expect(subPart, unittest.equals("$arg_adUnitId")); |
| 1254 |
| 1255 var query = (req.url).query; |
| 1256 var queryOffset = 0; |
| 1257 var queryMap = {}; |
| 1258 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1259 parseBool(n) { |
| 1260 if (n == "true") return true; |
| 1261 if (n == "false") return false; |
| 1262 if (n == null) return null; |
| 1263 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1264 } |
| 1265 if (query.length > 0) { |
| 1266 for (var part in query.split("&")) { |
| 1267 var keyvalue = part.split("="); |
| 1268 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1269 } |
| 1270 } |
| 1271 |
| 1272 |
| 1273 var h = { |
| 1274 "content-type" : "application/json; charset=utf-8", |
| 1275 }; |
| 1276 var resp = convert.JSON.encode(buildAdUnit()); |
| 1277 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1278 }), true); |
| 1279 res.delete(arg_accountId, arg_adClientId, arg_adUnitId).then(unittest.expe
ctAsync(((api.AdUnit response) { |
| 1280 checkAdUnit(response); |
| 1281 }))); |
| 1282 }); |
| 1283 |
| 1284 unittest.test("method--get", () { |
| 1285 |
| 1286 var mock = new common_test.HttpServerMock(); |
| 1287 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1288 var arg_accountId = "foo"; |
| 1289 var arg_adClientId = "foo"; |
| 1290 var arg_adUnitId = "foo"; |
| 1291 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1292 var path = (req.url).path; |
| 1293 var pathOffset = 0; |
| 1294 var index; |
| 1295 var subPart; |
| 1296 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1297 pathOffset += 18; |
| 1298 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1299 pathOffset += 9; |
| 1300 index = path.indexOf("/adclients/", pathOffset); |
| 1301 unittest.expect(index >= 0, unittest.isTrue); |
| 1302 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1303 pathOffset = index; |
| 1304 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1305 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1306 pathOffset += 11; |
| 1307 index = path.indexOf("/adunits/", pathOffset); |
| 1308 unittest.expect(index >= 0, unittest.isTrue); |
| 1309 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1310 pathOffset = index; |
| 1311 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1312 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/adunits/")); |
| 1313 pathOffset += 9; |
| 1314 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1315 pathOffset = path.length; |
| 1316 unittest.expect(subPart, unittest.equals("$arg_adUnitId")); |
| 1317 |
| 1318 var query = (req.url).query; |
| 1319 var queryOffset = 0; |
| 1320 var queryMap = {}; |
| 1321 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1322 parseBool(n) { |
| 1323 if (n == "true") return true; |
| 1324 if (n == "false") return false; |
| 1325 if (n == null) return null; |
| 1326 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1327 } |
| 1328 if (query.length > 0) { |
| 1329 for (var part in query.split("&")) { |
| 1330 var keyvalue = part.split("="); |
| 1331 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1332 } |
| 1333 } |
| 1334 |
| 1335 |
| 1336 var h = { |
| 1337 "content-type" : "application/json; charset=utf-8", |
| 1338 }; |
| 1339 var resp = convert.JSON.encode(buildAdUnit()); |
| 1340 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1341 }), true); |
| 1342 res.get(arg_accountId, arg_adClientId, arg_adUnitId).then(unittest.expectA
sync(((api.AdUnit response) { |
| 1343 checkAdUnit(response); |
| 1344 }))); |
| 1345 }); |
| 1346 |
| 1347 unittest.test("method--getAdCode", () { |
| 1348 |
| 1349 var mock = new common_test.HttpServerMock(); |
| 1350 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1351 var arg_accountId = "foo"; |
| 1352 var arg_adClientId = "foo"; |
| 1353 var arg_adUnitId = "foo"; |
| 1354 var arg_hostCustomChannelId = buildUnnamed980(); |
| 1355 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1356 var path = (req.url).path; |
| 1357 var pathOffset = 0; |
| 1358 var index; |
| 1359 var subPart; |
| 1360 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1361 pathOffset += 18; |
| 1362 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1363 pathOffset += 9; |
| 1364 index = path.indexOf("/adclients/", pathOffset); |
| 1365 unittest.expect(index >= 0, unittest.isTrue); |
| 1366 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1367 pathOffset = index; |
| 1368 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1369 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1370 pathOffset += 11; |
| 1371 index = path.indexOf("/adunits/", pathOffset); |
| 1372 unittest.expect(index >= 0, unittest.isTrue); |
| 1373 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1374 pathOffset = index; |
| 1375 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1376 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/adunits/")); |
| 1377 pathOffset += 9; |
| 1378 index = path.indexOf("/adcode", pathOffset); |
| 1379 unittest.expect(index >= 0, unittest.isTrue); |
| 1380 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1381 pathOffset = index; |
| 1382 unittest.expect(subPart, unittest.equals("$arg_adUnitId")); |
| 1383 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/adcode")); |
| 1384 pathOffset += 7; |
| 1385 |
| 1386 var query = (req.url).query; |
| 1387 var queryOffset = 0; |
| 1388 var queryMap = {}; |
| 1389 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1390 parseBool(n) { |
| 1391 if (n == "true") return true; |
| 1392 if (n == "false") return false; |
| 1393 if (n == null) return null; |
| 1394 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1395 } |
| 1396 if (query.length > 0) { |
| 1397 for (var part in query.split("&")) { |
| 1398 var keyvalue = part.split("="); |
| 1399 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1400 } |
| 1401 } |
| 1402 unittest.expect(queryMap["hostCustomChannelId"], unittest.equals(arg_hos
tCustomChannelId)); |
| 1403 |
| 1404 |
| 1405 var h = { |
| 1406 "content-type" : "application/json; charset=utf-8", |
| 1407 }; |
| 1408 var resp = convert.JSON.encode(buildAdCode()); |
| 1409 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1410 }), true); |
| 1411 res.getAdCode(arg_accountId, arg_adClientId, arg_adUnitId, hostCustomChann
elId: arg_hostCustomChannelId).then(unittest.expectAsync(((api.AdCode response)
{ |
| 1412 checkAdCode(response); |
| 1413 }))); |
| 1414 }); |
| 1415 |
| 1416 unittest.test("method--insert", () { |
| 1417 |
| 1418 var mock = new common_test.HttpServerMock(); |
| 1419 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1420 var arg_request = buildAdUnit(); |
| 1421 var arg_accountId = "foo"; |
| 1422 var arg_adClientId = "foo"; |
| 1423 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1424 var obj = new api.AdUnit.fromJson(json); |
| 1425 checkAdUnit(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 + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1432 pathOffset += 18; |
| 1433 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1434 pathOffset += 9; |
| 1435 index = path.indexOf("/adclients/", pathOffset); |
| 1436 unittest.expect(index >= 0, unittest.isTrue); |
| 1437 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1438 pathOffset = index; |
| 1439 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1440 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1441 pathOffset += 11; |
| 1442 index = path.indexOf("/adunits", pathOffset); |
| 1443 unittest.expect(index >= 0, unittest.isTrue); |
| 1444 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1445 pathOffset = index; |
| 1446 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1447 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/adunits")); |
| 1448 pathOffset += 8; |
| 1449 |
| 1450 var query = (req.url).query; |
| 1451 var queryOffset = 0; |
| 1452 var queryMap = {}; |
| 1453 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1454 parseBool(n) { |
| 1455 if (n == "true") return true; |
| 1456 if (n == "false") return false; |
| 1457 if (n == null) return null; |
| 1458 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1459 } |
| 1460 if (query.length > 0) { |
| 1461 for (var part in query.split("&")) { |
| 1462 var keyvalue = part.split("="); |
| 1463 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1464 } |
| 1465 } |
| 1466 |
| 1467 |
| 1468 var h = { |
| 1469 "content-type" : "application/json; charset=utf-8", |
| 1470 }; |
| 1471 var resp = convert.JSON.encode(buildAdUnit()); |
| 1472 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1473 }), true); |
| 1474 res.insert(arg_request, arg_accountId, arg_adClientId).then(unittest.expec
tAsync(((api.AdUnit response) { |
| 1475 checkAdUnit(response); |
| 1476 }))); |
| 1477 }); |
| 1478 |
| 1479 unittest.test("method--list", () { |
| 1480 |
| 1481 var mock = new common_test.HttpServerMock(); |
| 1482 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1483 var arg_accountId = "foo"; |
| 1484 var arg_adClientId = "foo"; |
| 1485 var arg_includeInactive = true; |
| 1486 var arg_maxResults = 42; |
| 1487 var arg_pageToken = "foo"; |
| 1488 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1489 var path = (req.url).path; |
| 1490 var pathOffset = 0; |
| 1491 var index; |
| 1492 var subPart; |
| 1493 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1494 pathOffset += 18; |
| 1495 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1496 pathOffset += 9; |
| 1497 index = path.indexOf("/adclients/", pathOffset); |
| 1498 unittest.expect(index >= 0, unittest.isTrue); |
| 1499 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1500 pathOffset = index; |
| 1501 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1502 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1503 pathOffset += 11; |
| 1504 index = path.indexOf("/adunits", pathOffset); |
| 1505 unittest.expect(index >= 0, unittest.isTrue); |
| 1506 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1507 pathOffset = index; |
| 1508 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1509 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/adunits")); |
| 1510 pathOffset += 8; |
| 1511 |
| 1512 var query = (req.url).query; |
| 1513 var queryOffset = 0; |
| 1514 var queryMap = {}; |
| 1515 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1516 parseBool(n) { |
| 1517 if (n == "true") return true; |
| 1518 if (n == "false") return false; |
| 1519 if (n == null) return null; |
| 1520 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1521 } |
| 1522 if (query.length > 0) { |
| 1523 for (var part in query.split("&")) { |
| 1524 var keyvalue = part.split("="); |
| 1525 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1526 } |
| 1527 } |
| 1528 unittest.expect(queryMap["includeInactive"].first, unittest.equals("$arg
_includeInactive")); |
| 1529 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1530 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1531 |
| 1532 |
| 1533 var h = { |
| 1534 "content-type" : "application/json; charset=utf-8", |
| 1535 }; |
| 1536 var resp = convert.JSON.encode(buildAdUnits()); |
| 1537 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1538 }), true); |
| 1539 res.list(arg_accountId, arg_adClientId, includeInactive: arg_includeInacti
ve, maxResults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAs
ync(((api.AdUnits response) { |
| 1540 checkAdUnits(response); |
| 1541 }))); |
| 1542 }); |
| 1543 |
| 1544 unittest.test("method--patch", () { |
| 1545 |
| 1546 var mock = new common_test.HttpServerMock(); |
| 1547 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1548 var arg_request = buildAdUnit(); |
| 1549 var arg_accountId = "foo"; |
| 1550 var arg_adClientId = "foo"; |
| 1551 var arg_adUnitId = "foo"; |
| 1552 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1553 var obj = new api.AdUnit.fromJson(json); |
| 1554 checkAdUnit(obj); |
| 1555 |
| 1556 var path = (req.url).path; |
| 1557 var pathOffset = 0; |
| 1558 var index; |
| 1559 var subPart; |
| 1560 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1561 pathOffset += 18; |
| 1562 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1563 pathOffset += 9; |
| 1564 index = path.indexOf("/adclients/", pathOffset); |
| 1565 unittest.expect(index >= 0, unittest.isTrue); |
| 1566 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1567 pathOffset = index; |
| 1568 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1569 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1570 pathOffset += 11; |
| 1571 index = path.indexOf("/adunits", pathOffset); |
| 1572 unittest.expect(index >= 0, unittest.isTrue); |
| 1573 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1574 pathOffset = index; |
| 1575 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1576 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/adunits")); |
| 1577 pathOffset += 8; |
| 1578 |
| 1579 var query = (req.url).query; |
| 1580 var queryOffset = 0; |
| 1581 var queryMap = {}; |
| 1582 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1583 parseBool(n) { |
| 1584 if (n == "true") return true; |
| 1585 if (n == "false") return false; |
| 1586 if (n == null) return null; |
| 1587 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1588 } |
| 1589 if (query.length > 0) { |
| 1590 for (var part in query.split("&")) { |
| 1591 var keyvalue = part.split("="); |
| 1592 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1593 } |
| 1594 } |
| 1595 unittest.expect(queryMap["adUnitId"].first, unittest.equals(arg_adUnitId
)); |
| 1596 |
| 1597 |
| 1598 var h = { |
| 1599 "content-type" : "application/json; charset=utf-8", |
| 1600 }; |
| 1601 var resp = convert.JSON.encode(buildAdUnit()); |
| 1602 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1603 }), true); |
| 1604 res.patch(arg_request, arg_accountId, arg_adClientId, arg_adUnitId).then(u
nittest.expectAsync(((api.AdUnit response) { |
| 1605 checkAdUnit(response); |
| 1606 }))); |
| 1607 }); |
| 1608 |
| 1609 unittest.test("method--update", () { |
| 1610 |
| 1611 var mock = new common_test.HttpServerMock(); |
| 1612 api.AccountsAdunitsResourceApi res = new api.AdsensehostApi(mock).accounts
.adunits; |
| 1613 var arg_request = buildAdUnit(); |
| 1614 var arg_accountId = "foo"; |
| 1615 var arg_adClientId = "foo"; |
| 1616 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1617 var obj = new api.AdUnit.fromJson(json); |
| 1618 checkAdUnit(obj); |
| 1619 |
| 1620 var path = (req.url).path; |
| 1621 var pathOffset = 0; |
| 1622 var index; |
| 1623 var subPart; |
| 1624 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1625 pathOffset += 18; |
| 1626 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1627 pathOffset += 9; |
| 1628 index = path.indexOf("/adclients/", pathOffset); |
| 1629 unittest.expect(index >= 0, unittest.isTrue); |
| 1630 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1631 pathOffset = index; |
| 1632 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1633 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/adclients/")); |
| 1634 pathOffset += 11; |
| 1635 index = path.indexOf("/adunits", pathOffset); |
| 1636 unittest.expect(index >= 0, unittest.isTrue); |
| 1637 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1638 pathOffset = index; |
| 1639 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1640 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/adunits")); |
| 1641 pathOffset += 8; |
| 1642 |
| 1643 var query = (req.url).query; |
| 1644 var queryOffset = 0; |
| 1645 var queryMap = {}; |
| 1646 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1647 parseBool(n) { |
| 1648 if (n == "true") return true; |
| 1649 if (n == "false") return false; |
| 1650 if (n == null) return null; |
| 1651 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1652 } |
| 1653 if (query.length > 0) { |
| 1654 for (var part in query.split("&")) { |
| 1655 var keyvalue = part.split("="); |
| 1656 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1657 } |
| 1658 } |
| 1659 |
| 1660 |
| 1661 var h = { |
| 1662 "content-type" : "application/json; charset=utf-8", |
| 1663 }; |
| 1664 var resp = convert.JSON.encode(buildAdUnit()); |
| 1665 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1666 }), true); |
| 1667 res.update(arg_request, arg_accountId, arg_adClientId).then(unittest.expec
tAsync(((api.AdUnit response) { |
| 1668 checkAdUnit(response); |
| 1669 }))); |
| 1670 }); |
| 1671 |
| 1672 }); |
| 1673 |
| 1674 |
| 1675 unittest.group("resource-AccountsReportsResourceApi", () { |
| 1676 unittest.test("method--generate", () { |
| 1677 |
| 1678 var mock = new common_test.HttpServerMock(); |
| 1679 api.AccountsReportsResourceApi res = new api.AdsensehostApi(mock).accounts
.reports; |
| 1680 var arg_accountId = "foo"; |
| 1681 var arg_startDate = "foo"; |
| 1682 var arg_endDate = "foo"; |
| 1683 var arg_dimension = buildUnnamed981(); |
| 1684 var arg_filter = buildUnnamed982(); |
| 1685 var arg_locale = "foo"; |
| 1686 var arg_maxResults = 42; |
| 1687 var arg_metric = buildUnnamed983(); |
| 1688 var arg_sort = buildUnnamed984(); |
| 1689 var arg_startIndex = 42; |
| 1690 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1691 var path = (req.url).path; |
| 1692 var pathOffset = 0; |
| 1693 var index; |
| 1694 var subPart; |
| 1695 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1696 pathOffset += 18; |
| 1697 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("accounts/")); |
| 1698 pathOffset += 9; |
| 1699 index = path.indexOf("/reports", pathOffset); |
| 1700 unittest.expect(index >= 0, unittest.isTrue); |
| 1701 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1702 pathOffset = index; |
| 1703 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1704 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/reports")); |
| 1705 pathOffset += 8; |
| 1706 |
| 1707 var query = (req.url).query; |
| 1708 var queryOffset = 0; |
| 1709 var queryMap = {}; |
| 1710 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1711 parseBool(n) { |
| 1712 if (n == "true") return true; |
| 1713 if (n == "false") return false; |
| 1714 if (n == null) return null; |
| 1715 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1716 } |
| 1717 if (query.length > 0) { |
| 1718 for (var part in query.split("&")) { |
| 1719 var keyvalue = part.split("="); |
| 1720 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1721 } |
| 1722 } |
| 1723 unittest.expect(queryMap["startDate"].first, unittest.equals(arg_startDa
te)); |
| 1724 unittest.expect(queryMap["endDate"].first, unittest.equals(arg_endDate))
; |
| 1725 unittest.expect(queryMap["dimension"], unittest.equals(arg_dimension)); |
| 1726 unittest.expect(queryMap["filter"], unittest.equals(arg_filter)); |
| 1727 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); |
| 1728 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1729 unittest.expect(queryMap["metric"], unittest.equals(arg_metric)); |
| 1730 unittest.expect(queryMap["sort"], unittest.equals(arg_sort)); |
| 1731 unittest.expect(core.int.parse(queryMap["startIndex"].first), unittest.e
quals(arg_startIndex)); |
| 1732 |
| 1733 |
| 1734 var h = { |
| 1735 "content-type" : "application/json; charset=utf-8", |
| 1736 }; |
| 1737 var resp = convert.JSON.encode(buildReport()); |
| 1738 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1739 }), true); |
| 1740 res.generate(arg_accountId, arg_startDate, arg_endDate, dimension: arg_dim
ension, filter: arg_filter, locale: arg_locale, maxResults: arg_maxResults, metr
ic: arg_metric, sort: arg_sort, startIndex: arg_startIndex).then(unittest.expect
Async(((api.Report response) { |
| 1741 checkReport(response); |
| 1742 }))); |
| 1743 }); |
| 1744 |
| 1745 }); |
| 1746 |
| 1747 |
| 1748 unittest.group("resource-AdclientsResourceApi", () { |
| 1749 unittest.test("method--get", () { |
| 1750 |
| 1751 var mock = new common_test.HttpServerMock(); |
| 1752 api.AdclientsResourceApi res = new api.AdsensehostApi(mock).adclients; |
| 1753 var arg_adClientId = "foo"; |
| 1754 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1755 var path = (req.url).path; |
| 1756 var pathOffset = 0; |
| 1757 var index; |
| 1758 var subPart; |
| 1759 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1760 pathOffset += 18; |
| 1761 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 1762 pathOffset += 10; |
| 1763 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1764 pathOffset = path.length; |
| 1765 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1766 |
| 1767 var query = (req.url).query; |
| 1768 var queryOffset = 0; |
| 1769 var queryMap = {}; |
| 1770 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1771 parseBool(n) { |
| 1772 if (n == "true") return true; |
| 1773 if (n == "false") return false; |
| 1774 if (n == null) return null; |
| 1775 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1776 } |
| 1777 if (query.length > 0) { |
| 1778 for (var part in query.split("&")) { |
| 1779 var keyvalue = part.split("="); |
| 1780 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1781 } |
| 1782 } |
| 1783 |
| 1784 |
| 1785 var h = { |
| 1786 "content-type" : "application/json; charset=utf-8", |
| 1787 }; |
| 1788 var resp = convert.JSON.encode(buildAdClient()); |
| 1789 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1790 }), true); |
| 1791 res.get(arg_adClientId).then(unittest.expectAsync(((api.AdClient response)
{ |
| 1792 checkAdClient(response); |
| 1793 }))); |
| 1794 }); |
| 1795 |
| 1796 unittest.test("method--list", () { |
| 1797 |
| 1798 var mock = new common_test.HttpServerMock(); |
| 1799 api.AdclientsResourceApi res = new api.AdsensehostApi(mock).adclients; |
| 1800 var arg_maxResults = 42; |
| 1801 var arg_pageToken = "foo"; |
| 1802 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1803 var path = (req.url).path; |
| 1804 var pathOffset = 0; |
| 1805 var index; |
| 1806 var subPart; |
| 1807 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1808 pathOffset += 18; |
| 1809 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("adclients")); |
| 1810 pathOffset += 9; |
| 1811 |
| 1812 var query = (req.url).query; |
| 1813 var queryOffset = 0; |
| 1814 var queryMap = {}; |
| 1815 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1816 parseBool(n) { |
| 1817 if (n == "true") return true; |
| 1818 if (n == "false") return false; |
| 1819 if (n == null) return null; |
| 1820 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1821 } |
| 1822 if (query.length > 0) { |
| 1823 for (var part in query.split("&")) { |
| 1824 var keyvalue = part.split("="); |
| 1825 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1826 } |
| 1827 } |
| 1828 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1829 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1830 |
| 1831 |
| 1832 var h = { |
| 1833 "content-type" : "application/json; charset=utf-8", |
| 1834 }; |
| 1835 var resp = convert.JSON.encode(buildAdClients()); |
| 1836 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1837 }), true); |
| 1838 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken).then(unitte
st.expectAsync(((api.AdClients response) { |
| 1839 checkAdClients(response); |
| 1840 }))); |
| 1841 }); |
| 1842 |
| 1843 }); |
| 1844 |
| 1845 |
| 1846 unittest.group("resource-AssociationsessionsResourceApi", () { |
| 1847 unittest.test("method--start", () { |
| 1848 |
| 1849 var mock = new common_test.HttpServerMock(); |
| 1850 api.AssociationsessionsResourceApi res = new api.AdsensehostApi(mock).asso
ciationsessions; |
| 1851 var arg_productCode = buildUnnamed985(); |
| 1852 var arg_websiteUrl = "foo"; |
| 1853 var arg_userLocale = "foo"; |
| 1854 var arg_websiteLocale = "foo"; |
| 1855 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1856 var path = (req.url).path; |
| 1857 var pathOffset = 0; |
| 1858 var index; |
| 1859 var subPart; |
| 1860 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1861 pathOffset += 18; |
| 1862 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("associationsessions/start")); |
| 1863 pathOffset += 25; |
| 1864 |
| 1865 var query = (req.url).query; |
| 1866 var queryOffset = 0; |
| 1867 var queryMap = {}; |
| 1868 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1869 parseBool(n) { |
| 1870 if (n == "true") return true; |
| 1871 if (n == "false") return false; |
| 1872 if (n == null) return null; |
| 1873 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1874 } |
| 1875 if (query.length > 0) { |
| 1876 for (var part in query.split("&")) { |
| 1877 var keyvalue = part.split("="); |
| 1878 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1879 } |
| 1880 } |
| 1881 unittest.expect(queryMap["productCode"], unittest.equals(arg_productCode
)); |
| 1882 unittest.expect(queryMap["websiteUrl"].first, unittest.equals(arg_websit
eUrl)); |
| 1883 unittest.expect(queryMap["userLocale"].first, unittest.equals(arg_userLo
cale)); |
| 1884 unittest.expect(queryMap["websiteLocale"].first, unittest.equals(arg_web
siteLocale)); |
| 1885 |
| 1886 |
| 1887 var h = { |
| 1888 "content-type" : "application/json; charset=utf-8", |
| 1889 }; |
| 1890 var resp = convert.JSON.encode(buildAssociationSession()); |
| 1891 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1892 }), true); |
| 1893 res.start(arg_productCode, arg_websiteUrl, userLocale: arg_userLocale, web
siteLocale: arg_websiteLocale).then(unittest.expectAsync(((api.AssociationSessio
n response) { |
| 1894 checkAssociationSession(response); |
| 1895 }))); |
| 1896 }); |
| 1897 |
| 1898 unittest.test("method--verify", () { |
| 1899 |
| 1900 var mock = new common_test.HttpServerMock(); |
| 1901 api.AssociationsessionsResourceApi res = new api.AdsensehostApi(mock).asso
ciationsessions; |
| 1902 var arg_token = "foo"; |
| 1903 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1904 var path = (req.url).path; |
| 1905 var pathOffset = 0; |
| 1906 var index; |
| 1907 var subPart; |
| 1908 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1909 pathOffset += 18; |
| 1910 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("associationsessions/verify")); |
| 1911 pathOffset += 26; |
| 1912 |
| 1913 var query = (req.url).query; |
| 1914 var queryOffset = 0; |
| 1915 var queryMap = {}; |
| 1916 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1917 parseBool(n) { |
| 1918 if (n == "true") return true; |
| 1919 if (n == "false") return false; |
| 1920 if (n == null) return null; |
| 1921 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1922 } |
| 1923 if (query.length > 0) { |
| 1924 for (var part in query.split("&")) { |
| 1925 var keyvalue = part.split("="); |
| 1926 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1927 } |
| 1928 } |
| 1929 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); |
| 1930 |
| 1931 |
| 1932 var h = { |
| 1933 "content-type" : "application/json; charset=utf-8", |
| 1934 }; |
| 1935 var resp = convert.JSON.encode(buildAssociationSession()); |
| 1936 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1937 }), true); |
| 1938 res.verify(arg_token).then(unittest.expectAsync(((api.AssociationSession r
esponse) { |
| 1939 checkAssociationSession(response); |
| 1940 }))); |
| 1941 }); |
| 1942 |
| 1943 }); |
| 1944 |
| 1945 |
| 1946 unittest.group("resource-CustomchannelsResourceApi", () { |
| 1947 unittest.test("method--delete", () { |
| 1948 |
| 1949 var mock = new common_test.HttpServerMock(); |
| 1950 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 1951 var arg_adClientId = "foo"; |
| 1952 var arg_customChannelId = "foo"; |
| 1953 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1954 var path = (req.url).path; |
| 1955 var pathOffset = 0; |
| 1956 var index; |
| 1957 var subPart; |
| 1958 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 1959 pathOffset += 18; |
| 1960 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 1961 pathOffset += 10; |
| 1962 index = path.indexOf("/customchannels/", pathOffset); |
| 1963 unittest.expect(index >= 0, unittest.isTrue); |
| 1964 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1965 pathOffset = index; |
| 1966 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 1967 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/customchannels/")); |
| 1968 pathOffset += 16; |
| 1969 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1970 pathOffset = path.length; |
| 1971 unittest.expect(subPart, unittest.equals("$arg_customChannelId")); |
| 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(buildCustomChannel()); |
| 1995 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1996 }), true); |
| 1997 res.delete(arg_adClientId, arg_customChannelId).then(unittest.expectAsync(
((api.CustomChannel response) { |
| 1998 checkCustomChannel(response); |
| 1999 }))); |
| 2000 }); |
| 2001 |
| 2002 unittest.test("method--get", () { |
| 2003 |
| 2004 var mock = new common_test.HttpServerMock(); |
| 2005 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 2006 var arg_adClientId = "foo"; |
| 2007 var arg_customChannelId = "foo"; |
| 2008 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2009 var path = (req.url).path; |
| 2010 var pathOffset = 0; |
| 2011 var index; |
| 2012 var subPart; |
| 2013 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2014 pathOffset += 18; |
| 2015 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2016 pathOffset += 10; |
| 2017 index = path.indexOf("/customchannels/", 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_adClientId")); |
| 2022 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/customchannels/")); |
| 2023 pathOffset += 16; |
| 2024 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2025 pathOffset = path.length; |
| 2026 unittest.expect(subPart, unittest.equals("$arg_customChannelId")); |
| 2027 |
| 2028 var query = (req.url).query; |
| 2029 var queryOffset = 0; |
| 2030 var queryMap = {}; |
| 2031 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2032 parseBool(n) { |
| 2033 if (n == "true") return true; |
| 2034 if (n == "false") return false; |
| 2035 if (n == null) return null; |
| 2036 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2037 } |
| 2038 if (query.length > 0) { |
| 2039 for (var part in query.split("&")) { |
| 2040 var keyvalue = part.split("="); |
| 2041 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2042 } |
| 2043 } |
| 2044 |
| 2045 |
| 2046 var h = { |
| 2047 "content-type" : "application/json; charset=utf-8", |
| 2048 }; |
| 2049 var resp = convert.JSON.encode(buildCustomChannel()); |
| 2050 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2051 }), true); |
| 2052 res.get(arg_adClientId, arg_customChannelId).then(unittest.expectAsync(((a
pi.CustomChannel response) { |
| 2053 checkCustomChannel(response); |
| 2054 }))); |
| 2055 }); |
| 2056 |
| 2057 unittest.test("method--insert", () { |
| 2058 |
| 2059 var mock = new common_test.HttpServerMock(); |
| 2060 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 2061 var arg_request = buildCustomChannel(); |
| 2062 var arg_adClientId = "foo"; |
| 2063 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2064 var obj = new api.CustomChannel.fromJson(json); |
| 2065 checkCustomChannel(obj); |
| 2066 |
| 2067 var path = (req.url).path; |
| 2068 var pathOffset = 0; |
| 2069 var index; |
| 2070 var subPart; |
| 2071 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2072 pathOffset += 18; |
| 2073 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2074 pathOffset += 10; |
| 2075 index = path.indexOf("/customchannels", pathOffset); |
| 2076 unittest.expect(index >= 0, unittest.isTrue); |
| 2077 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2078 pathOffset = index; |
| 2079 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2080 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/customchannels")); |
| 2081 pathOffset += 15; |
| 2082 |
| 2083 var query = (req.url).query; |
| 2084 var queryOffset = 0; |
| 2085 var queryMap = {}; |
| 2086 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2087 parseBool(n) { |
| 2088 if (n == "true") return true; |
| 2089 if (n == "false") return false; |
| 2090 if (n == null) return null; |
| 2091 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2092 } |
| 2093 if (query.length > 0) { |
| 2094 for (var part in query.split("&")) { |
| 2095 var keyvalue = part.split("="); |
| 2096 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2097 } |
| 2098 } |
| 2099 |
| 2100 |
| 2101 var h = { |
| 2102 "content-type" : "application/json; charset=utf-8", |
| 2103 }; |
| 2104 var resp = convert.JSON.encode(buildCustomChannel()); |
| 2105 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2106 }), true); |
| 2107 res.insert(arg_request, arg_adClientId).then(unittest.expectAsync(((api.Cu
stomChannel response) { |
| 2108 checkCustomChannel(response); |
| 2109 }))); |
| 2110 }); |
| 2111 |
| 2112 unittest.test("method--list", () { |
| 2113 |
| 2114 var mock = new common_test.HttpServerMock(); |
| 2115 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 2116 var arg_adClientId = "foo"; |
| 2117 var arg_maxResults = 42; |
| 2118 var arg_pageToken = "foo"; |
| 2119 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2120 var path = (req.url).path; |
| 2121 var pathOffset = 0; |
| 2122 var index; |
| 2123 var subPart; |
| 2124 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2125 pathOffset += 18; |
| 2126 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2127 pathOffset += 10; |
| 2128 index = path.indexOf("/customchannels", pathOffset); |
| 2129 unittest.expect(index >= 0, unittest.isTrue); |
| 2130 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2131 pathOffset = index; |
| 2132 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2133 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/customchannels")); |
| 2134 pathOffset += 15; |
| 2135 |
| 2136 var query = (req.url).query; |
| 2137 var queryOffset = 0; |
| 2138 var queryMap = {}; |
| 2139 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2140 parseBool(n) { |
| 2141 if (n == "true") return true; |
| 2142 if (n == "false") return false; |
| 2143 if (n == null) return null; |
| 2144 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2145 } |
| 2146 if (query.length > 0) { |
| 2147 for (var part in query.split("&")) { |
| 2148 var keyvalue = part.split("="); |
| 2149 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2150 } |
| 2151 } |
| 2152 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 2153 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2154 |
| 2155 |
| 2156 var h = { |
| 2157 "content-type" : "application/json; charset=utf-8", |
| 2158 }; |
| 2159 var resp = convert.JSON.encode(buildCustomChannels()); |
| 2160 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2161 }), true); |
| 2162 res.list(arg_adClientId, maxResults: arg_maxResults, pageToken: arg_pageTo
ken).then(unittest.expectAsync(((api.CustomChannels response) { |
| 2163 checkCustomChannels(response); |
| 2164 }))); |
| 2165 }); |
| 2166 |
| 2167 unittest.test("method--patch", () { |
| 2168 |
| 2169 var mock = new common_test.HttpServerMock(); |
| 2170 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 2171 var arg_request = buildCustomChannel(); |
| 2172 var arg_adClientId = "foo"; |
| 2173 var arg_customChannelId = "foo"; |
| 2174 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2175 var obj = new api.CustomChannel.fromJson(json); |
| 2176 checkCustomChannel(obj); |
| 2177 |
| 2178 var path = (req.url).path; |
| 2179 var pathOffset = 0; |
| 2180 var index; |
| 2181 var subPart; |
| 2182 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2183 pathOffset += 18; |
| 2184 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2185 pathOffset += 10; |
| 2186 index = path.indexOf("/customchannels", pathOffset); |
| 2187 unittest.expect(index >= 0, unittest.isTrue); |
| 2188 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2189 pathOffset = index; |
| 2190 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2191 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/customchannels")); |
| 2192 pathOffset += 15; |
| 2193 |
| 2194 var query = (req.url).query; |
| 2195 var queryOffset = 0; |
| 2196 var queryMap = {}; |
| 2197 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2198 parseBool(n) { |
| 2199 if (n == "true") return true; |
| 2200 if (n == "false") return false; |
| 2201 if (n == null) return null; |
| 2202 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2203 } |
| 2204 if (query.length > 0) { |
| 2205 for (var part in query.split("&")) { |
| 2206 var keyvalue = part.split("="); |
| 2207 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2208 } |
| 2209 } |
| 2210 unittest.expect(queryMap["customChannelId"].first, unittest.equals(arg_c
ustomChannelId)); |
| 2211 |
| 2212 |
| 2213 var h = { |
| 2214 "content-type" : "application/json; charset=utf-8", |
| 2215 }; |
| 2216 var resp = convert.JSON.encode(buildCustomChannel()); |
| 2217 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2218 }), true); |
| 2219 res.patch(arg_request, arg_adClientId, arg_customChannelId).then(unittest.
expectAsync(((api.CustomChannel response) { |
| 2220 checkCustomChannel(response); |
| 2221 }))); |
| 2222 }); |
| 2223 |
| 2224 unittest.test("method--update", () { |
| 2225 |
| 2226 var mock = new common_test.HttpServerMock(); |
| 2227 api.CustomchannelsResourceApi res = new api.AdsensehostApi(mock).customcha
nnels; |
| 2228 var arg_request = buildCustomChannel(); |
| 2229 var arg_adClientId = "foo"; |
| 2230 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2231 var obj = new api.CustomChannel.fromJson(json); |
| 2232 checkCustomChannel(obj); |
| 2233 |
| 2234 var path = (req.url).path; |
| 2235 var pathOffset = 0; |
| 2236 var index; |
| 2237 var subPart; |
| 2238 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2239 pathOffset += 18; |
| 2240 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2241 pathOffset += 10; |
| 2242 index = path.indexOf("/customchannels", pathOffset); |
| 2243 unittest.expect(index >= 0, unittest.isTrue); |
| 2244 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2245 pathOffset = index; |
| 2246 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2247 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/customchannels")); |
| 2248 pathOffset += 15; |
| 2249 |
| 2250 var query = (req.url).query; |
| 2251 var queryOffset = 0; |
| 2252 var queryMap = {}; |
| 2253 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2254 parseBool(n) { |
| 2255 if (n == "true") return true; |
| 2256 if (n == "false") return false; |
| 2257 if (n == null) return null; |
| 2258 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2259 } |
| 2260 if (query.length > 0) { |
| 2261 for (var part in query.split("&")) { |
| 2262 var keyvalue = part.split("="); |
| 2263 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2264 } |
| 2265 } |
| 2266 |
| 2267 |
| 2268 var h = { |
| 2269 "content-type" : "application/json; charset=utf-8", |
| 2270 }; |
| 2271 var resp = convert.JSON.encode(buildCustomChannel()); |
| 2272 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2273 }), true); |
| 2274 res.update(arg_request, arg_adClientId).then(unittest.expectAsync(((api.Cu
stomChannel response) { |
| 2275 checkCustomChannel(response); |
| 2276 }))); |
| 2277 }); |
| 2278 |
| 2279 }); |
| 2280 |
| 2281 |
| 2282 unittest.group("resource-ReportsResourceApi", () { |
| 2283 unittest.test("method--generate", () { |
| 2284 |
| 2285 var mock = new common_test.HttpServerMock(); |
| 2286 api.ReportsResourceApi res = new api.AdsensehostApi(mock).reports; |
| 2287 var arg_startDate = "foo"; |
| 2288 var arg_endDate = "foo"; |
| 2289 var arg_dimension = buildUnnamed986(); |
| 2290 var arg_filter = buildUnnamed987(); |
| 2291 var arg_locale = "foo"; |
| 2292 var arg_maxResults = 42; |
| 2293 var arg_metric = buildUnnamed988(); |
| 2294 var arg_sort = buildUnnamed989(); |
| 2295 var arg_startIndex = 42; |
| 2296 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2297 var path = (req.url).path; |
| 2298 var pathOffset = 0; |
| 2299 var index; |
| 2300 var subPart; |
| 2301 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2302 pathOffset += 18; |
| 2303 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("reports")); |
| 2304 pathOffset += 7; |
| 2305 |
| 2306 var query = (req.url).query; |
| 2307 var queryOffset = 0; |
| 2308 var queryMap = {}; |
| 2309 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2310 parseBool(n) { |
| 2311 if (n == "true") return true; |
| 2312 if (n == "false") return false; |
| 2313 if (n == null) return null; |
| 2314 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2315 } |
| 2316 if (query.length > 0) { |
| 2317 for (var part in query.split("&")) { |
| 2318 var keyvalue = part.split("="); |
| 2319 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2320 } |
| 2321 } |
| 2322 unittest.expect(queryMap["startDate"].first, unittest.equals(arg_startDa
te)); |
| 2323 unittest.expect(queryMap["endDate"].first, unittest.equals(arg_endDate))
; |
| 2324 unittest.expect(queryMap["dimension"], unittest.equals(arg_dimension)); |
| 2325 unittest.expect(queryMap["filter"], unittest.equals(arg_filter)); |
| 2326 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); |
| 2327 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 2328 unittest.expect(queryMap["metric"], unittest.equals(arg_metric)); |
| 2329 unittest.expect(queryMap["sort"], unittest.equals(arg_sort)); |
| 2330 unittest.expect(core.int.parse(queryMap["startIndex"].first), unittest.e
quals(arg_startIndex)); |
| 2331 |
| 2332 |
| 2333 var h = { |
| 2334 "content-type" : "application/json; charset=utf-8", |
| 2335 }; |
| 2336 var resp = convert.JSON.encode(buildReport()); |
| 2337 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2338 }), true); |
| 2339 res.generate(arg_startDate, arg_endDate, dimension: arg_dimension, filter:
arg_filter, locale: arg_locale, maxResults: arg_maxResults, metric: arg_metric,
sort: arg_sort, startIndex: arg_startIndex).then(unittest.expectAsync(((api.Rep
ort response) { |
| 2340 checkReport(response); |
| 2341 }))); |
| 2342 }); |
| 2343 |
| 2344 }); |
| 2345 |
| 2346 |
| 2347 unittest.group("resource-UrlchannelsResourceApi", () { |
| 2348 unittest.test("method--delete", () { |
| 2349 |
| 2350 var mock = new common_test.HttpServerMock(); |
| 2351 api.UrlchannelsResourceApi res = new api.AdsensehostApi(mock).urlchannels; |
| 2352 var arg_adClientId = "foo"; |
| 2353 var arg_urlChannelId = "foo"; |
| 2354 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2355 var path = (req.url).path; |
| 2356 var pathOffset = 0; |
| 2357 var index; |
| 2358 var subPart; |
| 2359 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2360 pathOffset += 18; |
| 2361 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2362 pathOffset += 10; |
| 2363 index = path.indexOf("/urlchannels/", pathOffset); |
| 2364 unittest.expect(index >= 0, unittest.isTrue); |
| 2365 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2366 pathOffset = index; |
| 2367 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2368 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/urlchannels/")); |
| 2369 pathOffset += 13; |
| 2370 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2371 pathOffset = path.length; |
| 2372 unittest.expect(subPart, unittest.equals("$arg_urlChannelId")); |
| 2373 |
| 2374 var query = (req.url).query; |
| 2375 var queryOffset = 0; |
| 2376 var queryMap = {}; |
| 2377 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2378 parseBool(n) { |
| 2379 if (n == "true") return true; |
| 2380 if (n == "false") return false; |
| 2381 if (n == null) return null; |
| 2382 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2383 } |
| 2384 if (query.length > 0) { |
| 2385 for (var part in query.split("&")) { |
| 2386 var keyvalue = part.split("="); |
| 2387 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2388 } |
| 2389 } |
| 2390 |
| 2391 |
| 2392 var h = { |
| 2393 "content-type" : "application/json; charset=utf-8", |
| 2394 }; |
| 2395 var resp = convert.JSON.encode(buildUrlChannel()); |
| 2396 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2397 }), true); |
| 2398 res.delete(arg_adClientId, arg_urlChannelId).then(unittest.expectAsync(((a
pi.UrlChannel response) { |
| 2399 checkUrlChannel(response); |
| 2400 }))); |
| 2401 }); |
| 2402 |
| 2403 unittest.test("method--insert", () { |
| 2404 |
| 2405 var mock = new common_test.HttpServerMock(); |
| 2406 api.UrlchannelsResourceApi res = new api.AdsensehostApi(mock).urlchannels; |
| 2407 var arg_request = buildUrlChannel(); |
| 2408 var arg_adClientId = "foo"; |
| 2409 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2410 var obj = new api.UrlChannel.fromJson(json); |
| 2411 checkUrlChannel(obj); |
| 2412 |
| 2413 var path = (req.url).path; |
| 2414 var pathOffset = 0; |
| 2415 var index; |
| 2416 var subPart; |
| 2417 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2418 pathOffset += 18; |
| 2419 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2420 pathOffset += 10; |
| 2421 index = path.indexOf("/urlchannels", pathOffset); |
| 2422 unittest.expect(index >= 0, unittest.isTrue); |
| 2423 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2424 pathOffset = index; |
| 2425 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2426 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/urlchannels")); |
| 2427 pathOffset += 12; |
| 2428 |
| 2429 var query = (req.url).query; |
| 2430 var queryOffset = 0; |
| 2431 var queryMap = {}; |
| 2432 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2433 parseBool(n) { |
| 2434 if (n == "true") return true; |
| 2435 if (n == "false") return false; |
| 2436 if (n == null) return null; |
| 2437 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2438 } |
| 2439 if (query.length > 0) { |
| 2440 for (var part in query.split("&")) { |
| 2441 var keyvalue = part.split("="); |
| 2442 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2443 } |
| 2444 } |
| 2445 |
| 2446 |
| 2447 var h = { |
| 2448 "content-type" : "application/json; charset=utf-8", |
| 2449 }; |
| 2450 var resp = convert.JSON.encode(buildUrlChannel()); |
| 2451 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2452 }), true); |
| 2453 res.insert(arg_request, arg_adClientId).then(unittest.expectAsync(((api.Ur
lChannel response) { |
| 2454 checkUrlChannel(response); |
| 2455 }))); |
| 2456 }); |
| 2457 |
| 2458 unittest.test("method--list", () { |
| 2459 |
| 2460 var mock = new common_test.HttpServerMock(); |
| 2461 api.UrlchannelsResourceApi res = new api.AdsensehostApi(mock).urlchannels; |
| 2462 var arg_adClientId = "foo"; |
| 2463 var arg_maxResults = 42; |
| 2464 var arg_pageToken = "foo"; |
| 2465 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2466 var path = (req.url).path; |
| 2467 var pathOffset = 0; |
| 2468 var index; |
| 2469 var subPart; |
| 2470 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/adsensehost/v4.1/")); |
| 2471 pathOffset += 18; |
| 2472 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("adclients/")); |
| 2473 pathOffset += 10; |
| 2474 index = path.indexOf("/urlchannels", pathOffset); |
| 2475 unittest.expect(index >= 0, unittest.isTrue); |
| 2476 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2477 pathOffset = index; |
| 2478 unittest.expect(subPart, unittest.equals("$arg_adClientId")); |
| 2479 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/urlchannels")); |
| 2480 pathOffset += 12; |
| 2481 |
| 2482 var query = (req.url).query; |
| 2483 var queryOffset = 0; |
| 2484 var queryMap = {}; |
| 2485 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2486 parseBool(n) { |
| 2487 if (n == "true") return true; |
| 2488 if (n == "false") return false; |
| 2489 if (n == null) return null; |
| 2490 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2491 } |
| 2492 if (query.length > 0) { |
| 2493 for (var part in query.split("&")) { |
| 2494 var keyvalue = part.split("="); |
| 2495 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2496 } |
| 2497 } |
| 2498 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 2499 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2500 |
| 2501 |
| 2502 var h = { |
| 2503 "content-type" : "application/json; charset=utf-8", |
| 2504 }; |
| 2505 var resp = convert.JSON.encode(buildUrlChannels()); |
| 2506 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2507 }), true); |
| 2508 res.list(arg_adClientId, maxResults: arg_maxResults, pageToken: arg_pageTo
ken).then(unittest.expectAsync(((api.UrlChannels response) { |
| 2509 checkUrlChannels(response); |
| 2510 }))); |
| 2511 }); |
| 2512 |
| 2513 }); |
| 2514 |
| 2515 |
| 2516 } |
| 2517 |
OLD | NEW |