OLD | NEW |
(Empty) | |
| 1 library googleapis_beta.appengine.v1beta4.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 |
| 12 import 'package:googleapis_beta/appengine/v1beta4.dart' as api; |
| 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 53 |
| 54 core.int buildCounterApiConfigHandler = 0; |
| 55 buildApiConfigHandler() { |
| 56 var o = new api.ApiConfigHandler(); |
| 57 buildCounterApiConfigHandler++; |
| 58 if (buildCounterApiConfigHandler < 3) { |
| 59 o.authFailAction = "foo"; |
| 60 o.login = "foo"; |
| 61 o.script = "foo"; |
| 62 o.securityLevel = "foo"; |
| 63 o.url = "foo"; |
| 64 } |
| 65 buildCounterApiConfigHandler--; |
| 66 return o; |
| 67 } |
| 68 |
| 69 checkApiConfigHandler(api.ApiConfigHandler o) { |
| 70 buildCounterApiConfigHandler++; |
| 71 if (buildCounterApiConfigHandler < 3) { |
| 72 unittest.expect(o.authFailAction, unittest.equals('foo')); |
| 73 unittest.expect(o.login, unittest.equals('foo')); |
| 74 unittest.expect(o.script, unittest.equals('foo')); |
| 75 unittest.expect(o.securityLevel, unittest.equals('foo')); |
| 76 unittest.expect(o.url, unittest.equals('foo')); |
| 77 } |
| 78 buildCounterApiConfigHandler--; |
| 79 } |
| 80 |
| 81 core.int buildCounterApiEndpointHandler = 0; |
| 82 buildApiEndpointHandler() { |
| 83 var o = new api.ApiEndpointHandler(); |
| 84 buildCounterApiEndpointHandler++; |
| 85 if (buildCounterApiEndpointHandler < 3) { |
| 86 o.scriptPath = "foo"; |
| 87 } |
| 88 buildCounterApiEndpointHandler--; |
| 89 return o; |
| 90 } |
| 91 |
| 92 checkApiEndpointHandler(api.ApiEndpointHandler o) { |
| 93 buildCounterApiEndpointHandler++; |
| 94 if (buildCounterApiEndpointHandler < 3) { |
| 95 unittest.expect(o.scriptPath, unittest.equals('foo')); |
| 96 } |
| 97 buildCounterApiEndpointHandler--; |
| 98 } |
| 99 |
| 100 buildUnnamed2257() { |
| 101 var o = new core.List<api.UrlDispatchRule>(); |
| 102 o.add(buildUrlDispatchRule()); |
| 103 o.add(buildUrlDispatchRule()); |
| 104 return o; |
| 105 } |
| 106 |
| 107 checkUnnamed2257(core.List<api.UrlDispatchRule> o) { |
| 108 unittest.expect(o, unittest.hasLength(2)); |
| 109 checkUrlDispatchRule(o[0]); |
| 110 checkUrlDispatchRule(o[1]); |
| 111 } |
| 112 |
| 113 core.int buildCounterApplication = 0; |
| 114 buildApplication() { |
| 115 var o = new api.Application(); |
| 116 buildCounterApplication++; |
| 117 if (buildCounterApplication < 3) { |
| 118 o.codeBucket = "foo"; |
| 119 o.dispatchRules = buildUnnamed2257(); |
| 120 o.id = "foo"; |
| 121 o.location = "foo"; |
| 122 o.name = "foo"; |
| 123 } |
| 124 buildCounterApplication--; |
| 125 return o; |
| 126 } |
| 127 |
| 128 checkApplication(api.Application o) { |
| 129 buildCounterApplication++; |
| 130 if (buildCounterApplication < 3) { |
| 131 unittest.expect(o.codeBucket, unittest.equals('foo')); |
| 132 checkUnnamed2257(o.dispatchRules); |
| 133 unittest.expect(o.id, unittest.equals('foo')); |
| 134 unittest.expect(o.location, unittest.equals('foo')); |
| 135 unittest.expect(o.name, unittest.equals('foo')); |
| 136 } |
| 137 buildCounterApplication--; |
| 138 } |
| 139 |
| 140 core.int buildCounterAutomaticScaling = 0; |
| 141 buildAutomaticScaling() { |
| 142 var o = new api.AutomaticScaling(); |
| 143 buildCounterAutomaticScaling++; |
| 144 if (buildCounterAutomaticScaling < 3) { |
| 145 o.coolDownPeriod = "foo"; |
| 146 o.cpuUtilization = buildCpuUtilization(); |
| 147 o.maxConcurrentRequests = 42; |
| 148 o.maxIdleInstances = 42; |
| 149 o.maxPendingLatency = "foo"; |
| 150 o.maxTotalInstances = 42; |
| 151 o.minIdleInstances = 42; |
| 152 o.minPendingLatency = "foo"; |
| 153 o.minTotalInstances = 42; |
| 154 } |
| 155 buildCounterAutomaticScaling--; |
| 156 return o; |
| 157 } |
| 158 |
| 159 checkAutomaticScaling(api.AutomaticScaling o) { |
| 160 buildCounterAutomaticScaling++; |
| 161 if (buildCounterAutomaticScaling < 3) { |
| 162 unittest.expect(o.coolDownPeriod, unittest.equals('foo')); |
| 163 checkCpuUtilization(o.cpuUtilization); |
| 164 unittest.expect(o.maxConcurrentRequests, unittest.equals(42)); |
| 165 unittest.expect(o.maxIdleInstances, unittest.equals(42)); |
| 166 unittest.expect(o.maxPendingLatency, unittest.equals('foo')); |
| 167 unittest.expect(o.maxTotalInstances, unittest.equals(42)); |
| 168 unittest.expect(o.minIdleInstances, unittest.equals(42)); |
| 169 unittest.expect(o.minPendingLatency, unittest.equals('foo')); |
| 170 unittest.expect(o.minTotalInstances, unittest.equals(42)); |
| 171 } |
| 172 buildCounterAutomaticScaling--; |
| 173 } |
| 174 |
| 175 core.int buildCounterBasicScaling = 0; |
| 176 buildBasicScaling() { |
| 177 var o = new api.BasicScaling(); |
| 178 buildCounterBasicScaling++; |
| 179 if (buildCounterBasicScaling < 3) { |
| 180 o.idleTimeout = "foo"; |
| 181 o.maxInstances = 42; |
| 182 } |
| 183 buildCounterBasicScaling--; |
| 184 return o; |
| 185 } |
| 186 |
| 187 checkBasicScaling(api.BasicScaling o) { |
| 188 buildCounterBasicScaling++; |
| 189 if (buildCounterBasicScaling < 3) { |
| 190 unittest.expect(o.idleTimeout, unittest.equals('foo')); |
| 191 unittest.expect(o.maxInstances, unittest.equals(42)); |
| 192 } |
| 193 buildCounterBasicScaling--; |
| 194 } |
| 195 |
| 196 core.int buildCounterContainerInfo = 0; |
| 197 buildContainerInfo() { |
| 198 var o = new api.ContainerInfo(); |
| 199 buildCounterContainerInfo++; |
| 200 if (buildCounterContainerInfo < 3) { |
| 201 o.image = "foo"; |
| 202 o.sha256 = "foo"; |
| 203 } |
| 204 buildCounterContainerInfo--; |
| 205 return o; |
| 206 } |
| 207 |
| 208 checkContainerInfo(api.ContainerInfo o) { |
| 209 buildCounterContainerInfo++; |
| 210 if (buildCounterContainerInfo < 3) { |
| 211 unittest.expect(o.image, unittest.equals('foo')); |
| 212 unittest.expect(o.sha256, unittest.equals('foo')); |
| 213 } |
| 214 buildCounterContainerInfo--; |
| 215 } |
| 216 |
| 217 core.int buildCounterCpuUtilization = 0; |
| 218 buildCpuUtilization() { |
| 219 var o = new api.CpuUtilization(); |
| 220 buildCounterCpuUtilization++; |
| 221 if (buildCounterCpuUtilization < 3) { |
| 222 o.aggregationWindowLength = "foo"; |
| 223 o.targetUtilization = 42.0; |
| 224 } |
| 225 buildCounterCpuUtilization--; |
| 226 return o; |
| 227 } |
| 228 |
| 229 checkCpuUtilization(api.CpuUtilization o) { |
| 230 buildCounterCpuUtilization++; |
| 231 if (buildCounterCpuUtilization < 3) { |
| 232 unittest.expect(o.aggregationWindowLength, unittest.equals('foo')); |
| 233 unittest.expect(o.targetUtilization, unittest.equals(42.0)); |
| 234 } |
| 235 buildCounterCpuUtilization--; |
| 236 } |
| 237 |
| 238 buildUnnamed2258() { |
| 239 var o = new core.Map<core.String, api.FileInfo>(); |
| 240 o["x"] = buildFileInfo(); |
| 241 o["y"] = buildFileInfo(); |
| 242 return o; |
| 243 } |
| 244 |
| 245 checkUnnamed2258(core.Map<core.String, api.FileInfo> o) { |
| 246 unittest.expect(o, unittest.hasLength(2)); |
| 247 checkFileInfo(o["x"]); |
| 248 checkFileInfo(o["y"]); |
| 249 } |
| 250 |
| 251 buildUnnamed2259() { |
| 252 var o = new core.List<api.SourceReference>(); |
| 253 o.add(buildSourceReference()); |
| 254 o.add(buildSourceReference()); |
| 255 return o; |
| 256 } |
| 257 |
| 258 checkUnnamed2259(core.List<api.SourceReference> o) { |
| 259 unittest.expect(o, unittest.hasLength(2)); |
| 260 checkSourceReference(o[0]); |
| 261 checkSourceReference(o[1]); |
| 262 } |
| 263 |
| 264 core.int buildCounterDeployment = 0; |
| 265 buildDeployment() { |
| 266 var o = new api.Deployment(); |
| 267 buildCounterDeployment++; |
| 268 if (buildCounterDeployment < 3) { |
| 269 o.container = buildContainerInfo(); |
| 270 o.files = buildUnnamed2258(); |
| 271 o.sourceReferences = buildUnnamed2259(); |
| 272 } |
| 273 buildCounterDeployment--; |
| 274 return o; |
| 275 } |
| 276 |
| 277 checkDeployment(api.Deployment o) { |
| 278 buildCounterDeployment++; |
| 279 if (buildCounterDeployment < 3) { |
| 280 checkContainerInfo(o.container); |
| 281 checkUnnamed2258(o.files); |
| 282 checkUnnamed2259(o.sourceReferences); |
| 283 } |
| 284 buildCounterDeployment--; |
| 285 } |
| 286 |
| 287 core.int buildCounterErrorHandler = 0; |
| 288 buildErrorHandler() { |
| 289 var o = new api.ErrorHandler(); |
| 290 buildCounterErrorHandler++; |
| 291 if (buildCounterErrorHandler < 3) { |
| 292 o.errorCode = "foo"; |
| 293 o.mimeType = "foo"; |
| 294 o.staticFile = "foo"; |
| 295 } |
| 296 buildCounterErrorHandler--; |
| 297 return o; |
| 298 } |
| 299 |
| 300 checkErrorHandler(api.ErrorHandler o) { |
| 301 buildCounterErrorHandler++; |
| 302 if (buildCounterErrorHandler < 3) { |
| 303 unittest.expect(o.errorCode, unittest.equals('foo')); |
| 304 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 305 unittest.expect(o.staticFile, unittest.equals('foo')); |
| 306 } |
| 307 buildCounterErrorHandler--; |
| 308 } |
| 309 |
| 310 buildUnnamed2260() { |
| 311 var o = new core.List<api.Option>(); |
| 312 o.add(buildOption()); |
| 313 o.add(buildOption()); |
| 314 return o; |
| 315 } |
| 316 |
| 317 checkUnnamed2260(core.List<api.Option> o) { |
| 318 unittest.expect(o, unittest.hasLength(2)); |
| 319 checkOption(o[0]); |
| 320 checkOption(o[1]); |
| 321 } |
| 322 |
| 323 core.int buildCounterField = 0; |
| 324 buildField() { |
| 325 var o = new api.Field(); |
| 326 buildCounterField++; |
| 327 if (buildCounterField < 3) { |
| 328 o.cardinality = "foo"; |
| 329 o.jsonName = "foo"; |
| 330 o.kind = "foo"; |
| 331 o.name = "foo"; |
| 332 o.number = 42; |
| 333 o.oneofIndex = 42; |
| 334 o.options = buildUnnamed2260(); |
| 335 o.packed = true; |
| 336 o.typeUrl = "foo"; |
| 337 } |
| 338 buildCounterField--; |
| 339 return o; |
| 340 } |
| 341 |
| 342 checkField(api.Field o) { |
| 343 buildCounterField++; |
| 344 if (buildCounterField < 3) { |
| 345 unittest.expect(o.cardinality, unittest.equals('foo')); |
| 346 unittest.expect(o.jsonName, unittest.equals('foo')); |
| 347 unittest.expect(o.kind, unittest.equals('foo')); |
| 348 unittest.expect(o.name, unittest.equals('foo')); |
| 349 unittest.expect(o.number, unittest.equals(42)); |
| 350 unittest.expect(o.oneofIndex, unittest.equals(42)); |
| 351 checkUnnamed2260(o.options); |
| 352 unittest.expect(o.packed, unittest.isTrue); |
| 353 unittest.expect(o.typeUrl, unittest.equals('foo')); |
| 354 } |
| 355 buildCounterField--; |
| 356 } |
| 357 |
| 358 core.int buildCounterFileInfo = 0; |
| 359 buildFileInfo() { |
| 360 var o = new api.FileInfo(); |
| 361 buildCounterFileInfo++; |
| 362 if (buildCounterFileInfo < 3) { |
| 363 o.mimeType = "foo"; |
| 364 o.sha1Sum = "foo"; |
| 365 o.sourceUrl = "foo"; |
| 366 } |
| 367 buildCounterFileInfo--; |
| 368 return o; |
| 369 } |
| 370 |
| 371 checkFileInfo(api.FileInfo o) { |
| 372 buildCounterFileInfo++; |
| 373 if (buildCounterFileInfo < 3) { |
| 374 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 375 unittest.expect(o.sha1Sum, unittest.equals('foo')); |
| 376 unittest.expect(o.sourceUrl, unittest.equals('foo')); |
| 377 } |
| 378 buildCounterFileInfo--; |
| 379 } |
| 380 |
| 381 core.int buildCounterHealthCheck = 0; |
| 382 buildHealthCheck() { |
| 383 var o = new api.HealthCheck(); |
| 384 buildCounterHealthCheck++; |
| 385 if (buildCounterHealthCheck < 3) { |
| 386 o.checkInterval = "foo"; |
| 387 o.disableHealthCheck = true; |
| 388 o.healthyThreshold = 42; |
| 389 o.host = "foo"; |
| 390 o.restartThreshold = 42; |
| 391 o.timeout = "foo"; |
| 392 o.unhealthyThreshold = 42; |
| 393 } |
| 394 buildCounterHealthCheck--; |
| 395 return o; |
| 396 } |
| 397 |
| 398 checkHealthCheck(api.HealthCheck o) { |
| 399 buildCounterHealthCheck++; |
| 400 if (buildCounterHealthCheck < 3) { |
| 401 unittest.expect(o.checkInterval, unittest.equals('foo')); |
| 402 unittest.expect(o.disableHealthCheck, unittest.isTrue); |
| 403 unittest.expect(o.healthyThreshold, unittest.equals(42)); |
| 404 unittest.expect(o.host, unittest.equals('foo')); |
| 405 unittest.expect(o.restartThreshold, unittest.equals(42)); |
| 406 unittest.expect(o.timeout, unittest.equals('foo')); |
| 407 unittest.expect(o.unhealthyThreshold, unittest.equals(42)); |
| 408 } |
| 409 buildCounterHealthCheck--; |
| 410 } |
| 411 |
| 412 core.int buildCounterLibrary = 0; |
| 413 buildLibrary() { |
| 414 var o = new api.Library(); |
| 415 buildCounterLibrary++; |
| 416 if (buildCounterLibrary < 3) { |
| 417 o.name = "foo"; |
| 418 o.version = "foo"; |
| 419 } |
| 420 buildCounterLibrary--; |
| 421 return o; |
| 422 } |
| 423 |
| 424 checkLibrary(api.Library o) { |
| 425 buildCounterLibrary++; |
| 426 if (buildCounterLibrary < 3) { |
| 427 unittest.expect(o.name, unittest.equals('foo')); |
| 428 unittest.expect(o.version, unittest.equals('foo')); |
| 429 } |
| 430 buildCounterLibrary--; |
| 431 } |
| 432 |
| 433 buildUnnamed2261() { |
| 434 var o = new core.List<api.Module>(); |
| 435 o.add(buildModule()); |
| 436 o.add(buildModule()); |
| 437 return o; |
| 438 } |
| 439 |
| 440 checkUnnamed2261(core.List<api.Module> o) { |
| 441 unittest.expect(o, unittest.hasLength(2)); |
| 442 checkModule(o[0]); |
| 443 checkModule(o[1]); |
| 444 } |
| 445 |
| 446 core.int buildCounterListModulesResponse = 0; |
| 447 buildListModulesResponse() { |
| 448 var o = new api.ListModulesResponse(); |
| 449 buildCounterListModulesResponse++; |
| 450 if (buildCounterListModulesResponse < 3) { |
| 451 o.modules = buildUnnamed2261(); |
| 452 o.nextPageToken = "foo"; |
| 453 } |
| 454 buildCounterListModulesResponse--; |
| 455 return o; |
| 456 } |
| 457 |
| 458 checkListModulesResponse(api.ListModulesResponse o) { |
| 459 buildCounterListModulesResponse++; |
| 460 if (buildCounterListModulesResponse < 3) { |
| 461 checkUnnamed2261(o.modules); |
| 462 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 463 } |
| 464 buildCounterListModulesResponse--; |
| 465 } |
| 466 |
| 467 buildUnnamed2262() { |
| 468 var o = new core.List<api.Operation>(); |
| 469 o.add(buildOperation()); |
| 470 o.add(buildOperation()); |
| 471 return o; |
| 472 } |
| 473 |
| 474 checkUnnamed2262(core.List<api.Operation> o) { |
| 475 unittest.expect(o, unittest.hasLength(2)); |
| 476 checkOperation(o[0]); |
| 477 checkOperation(o[1]); |
| 478 } |
| 479 |
| 480 core.int buildCounterListOperationsResponse = 0; |
| 481 buildListOperationsResponse() { |
| 482 var o = new api.ListOperationsResponse(); |
| 483 buildCounterListOperationsResponse++; |
| 484 if (buildCounterListOperationsResponse < 3) { |
| 485 o.nextPageToken = "foo"; |
| 486 o.operations = buildUnnamed2262(); |
| 487 } |
| 488 buildCounterListOperationsResponse--; |
| 489 return o; |
| 490 } |
| 491 |
| 492 checkListOperationsResponse(api.ListOperationsResponse o) { |
| 493 buildCounterListOperationsResponse++; |
| 494 if (buildCounterListOperationsResponse < 3) { |
| 495 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 496 checkUnnamed2262(o.operations); |
| 497 } |
| 498 buildCounterListOperationsResponse--; |
| 499 } |
| 500 |
| 501 buildUnnamed2263() { |
| 502 var o = new core.List<api.Version>(); |
| 503 o.add(buildVersion()); |
| 504 o.add(buildVersion()); |
| 505 return o; |
| 506 } |
| 507 |
| 508 checkUnnamed2263(core.List<api.Version> o) { |
| 509 unittest.expect(o, unittest.hasLength(2)); |
| 510 checkVersion(o[0]); |
| 511 checkVersion(o[1]); |
| 512 } |
| 513 |
| 514 core.int buildCounterListVersionsResponse = 0; |
| 515 buildListVersionsResponse() { |
| 516 var o = new api.ListVersionsResponse(); |
| 517 buildCounterListVersionsResponse++; |
| 518 if (buildCounterListVersionsResponse < 3) { |
| 519 o.nextPageToken = "foo"; |
| 520 o.versions = buildUnnamed2263(); |
| 521 } |
| 522 buildCounterListVersionsResponse--; |
| 523 return o; |
| 524 } |
| 525 |
| 526 checkListVersionsResponse(api.ListVersionsResponse o) { |
| 527 buildCounterListVersionsResponse++; |
| 528 if (buildCounterListVersionsResponse < 3) { |
| 529 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 530 checkUnnamed2263(o.versions); |
| 531 } |
| 532 buildCounterListVersionsResponse--; |
| 533 } |
| 534 |
| 535 core.int buildCounterManualScaling = 0; |
| 536 buildManualScaling() { |
| 537 var o = new api.ManualScaling(); |
| 538 buildCounterManualScaling++; |
| 539 if (buildCounterManualScaling < 3) { |
| 540 o.instances = 42; |
| 541 } |
| 542 buildCounterManualScaling--; |
| 543 return o; |
| 544 } |
| 545 |
| 546 checkManualScaling(api.ManualScaling o) { |
| 547 buildCounterManualScaling++; |
| 548 if (buildCounterManualScaling < 3) { |
| 549 unittest.expect(o.instances, unittest.equals(42)); |
| 550 } |
| 551 buildCounterManualScaling--; |
| 552 } |
| 553 |
| 554 core.int buildCounterModule = 0; |
| 555 buildModule() { |
| 556 var o = new api.Module(); |
| 557 buildCounterModule++; |
| 558 if (buildCounterModule < 3) { |
| 559 o.id = "foo"; |
| 560 o.name = "foo"; |
| 561 o.split = buildTrafficSplit(); |
| 562 } |
| 563 buildCounterModule--; |
| 564 return o; |
| 565 } |
| 566 |
| 567 checkModule(api.Module o) { |
| 568 buildCounterModule++; |
| 569 if (buildCounterModule < 3) { |
| 570 unittest.expect(o.id, unittest.equals('foo')); |
| 571 unittest.expect(o.name, unittest.equals('foo')); |
| 572 checkTrafficSplit(o.split); |
| 573 } |
| 574 buildCounterModule--; |
| 575 } |
| 576 |
| 577 buildUnnamed2264() { |
| 578 var o = new core.List<core.String>(); |
| 579 o.add("foo"); |
| 580 o.add("foo"); |
| 581 return o; |
| 582 } |
| 583 |
| 584 checkUnnamed2264(core.List<core.String> o) { |
| 585 unittest.expect(o, unittest.hasLength(2)); |
| 586 unittest.expect(o[0], unittest.equals('foo')); |
| 587 unittest.expect(o[1], unittest.equals('foo')); |
| 588 } |
| 589 |
| 590 core.int buildCounterNetwork = 0; |
| 591 buildNetwork() { |
| 592 var o = new api.Network(); |
| 593 buildCounterNetwork++; |
| 594 if (buildCounterNetwork < 3) { |
| 595 o.forwardedPorts = buildUnnamed2264(); |
| 596 o.instanceTag = "foo"; |
| 597 o.name = "foo"; |
| 598 } |
| 599 buildCounterNetwork--; |
| 600 return o; |
| 601 } |
| 602 |
| 603 checkNetwork(api.Network o) { |
| 604 buildCounterNetwork++; |
| 605 if (buildCounterNetwork < 3) { |
| 606 checkUnnamed2264(o.forwardedPorts); |
| 607 unittest.expect(o.instanceTag, unittest.equals('foo')); |
| 608 unittest.expect(o.name, unittest.equals('foo')); |
| 609 } |
| 610 buildCounterNetwork--; |
| 611 } |
| 612 |
| 613 buildUnnamed2265() { |
| 614 var o = new core.Map<core.String, core.Object>(); |
| 615 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 616 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 617 return o; |
| 618 } |
| 619 |
| 620 checkUnnamed2265(core.Map<core.String, core.Object> o) { |
| 621 unittest.expect(o, unittest.hasLength(2)); |
| 622 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); |
| 623 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); |
| 624 } |
| 625 |
| 626 buildUnnamed2266() { |
| 627 var o = new core.Map<core.String, core.Object>(); |
| 628 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 629 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 630 return o; |
| 631 } |
| 632 |
| 633 checkUnnamed2266(core.Map<core.String, core.Object> o) { |
| 634 unittest.expect(o, unittest.hasLength(2)); |
| 635 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); |
| 636 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
| 637 } |
| 638 |
| 639 core.int buildCounterOperation = 0; |
| 640 buildOperation() { |
| 641 var o = new api.Operation(); |
| 642 buildCounterOperation++; |
| 643 if (buildCounterOperation < 3) { |
| 644 o.done = true; |
| 645 o.error = buildStatus(); |
| 646 o.metadata = buildUnnamed2265(); |
| 647 o.name = "foo"; |
| 648 o.response = buildUnnamed2266(); |
| 649 } |
| 650 buildCounterOperation--; |
| 651 return o; |
| 652 } |
| 653 |
| 654 checkOperation(api.Operation o) { |
| 655 buildCounterOperation++; |
| 656 if (buildCounterOperation < 3) { |
| 657 unittest.expect(o.done, unittest.isTrue); |
| 658 checkStatus(o.error); |
| 659 checkUnnamed2265(o.metadata); |
| 660 unittest.expect(o.name, unittest.equals('foo')); |
| 661 checkUnnamed2266(o.response); |
| 662 } |
| 663 buildCounterOperation--; |
| 664 } |
| 665 |
| 666 core.int buildCounterOperationMetadata = 0; |
| 667 buildOperationMetadata() { |
| 668 var o = new api.OperationMetadata(); |
| 669 buildCounterOperationMetadata++; |
| 670 if (buildCounterOperationMetadata < 3) { |
| 671 o.endTime = "foo"; |
| 672 o.insertTime = "foo"; |
| 673 o.operationType = "foo"; |
| 674 o.user = "foo"; |
| 675 } |
| 676 buildCounterOperationMetadata--; |
| 677 return o; |
| 678 } |
| 679 |
| 680 checkOperationMetadata(api.OperationMetadata o) { |
| 681 buildCounterOperationMetadata++; |
| 682 if (buildCounterOperationMetadata < 3) { |
| 683 unittest.expect(o.endTime, unittest.equals('foo')); |
| 684 unittest.expect(o.insertTime, unittest.equals('foo')); |
| 685 unittest.expect(o.operationType, unittest.equals('foo')); |
| 686 unittest.expect(o.user, unittest.equals('foo')); |
| 687 } |
| 688 buildCounterOperationMetadata--; |
| 689 } |
| 690 |
| 691 buildUnnamed2267() { |
| 692 var o = new core.Map<core.String, core.Object>(); |
| 693 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 694 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 695 return o; |
| 696 } |
| 697 |
| 698 checkUnnamed2267(core.Map<core.String, core.Object> o) { |
| 699 unittest.expect(o, unittest.hasLength(2)); |
| 700 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
| 701 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
| 702 } |
| 703 |
| 704 core.int buildCounterOption = 0; |
| 705 buildOption() { |
| 706 var o = new api.Option(); |
| 707 buildCounterOption++; |
| 708 if (buildCounterOption < 3) { |
| 709 o.name = "foo"; |
| 710 o.value = buildUnnamed2267(); |
| 711 } |
| 712 buildCounterOption--; |
| 713 return o; |
| 714 } |
| 715 |
| 716 checkOption(api.Option o) { |
| 717 buildCounterOption++; |
| 718 if (buildCounterOption < 3) { |
| 719 unittest.expect(o.name, unittest.equals('foo')); |
| 720 checkUnnamed2267(o.value); |
| 721 } |
| 722 buildCounterOption--; |
| 723 } |
| 724 |
| 725 core.int buildCounterResources = 0; |
| 726 buildResources() { |
| 727 var o = new api.Resources(); |
| 728 buildCounterResources++; |
| 729 if (buildCounterResources < 3) { |
| 730 o.cpu = 42.0; |
| 731 o.diskGb = 42.0; |
| 732 o.memoryGb = 42.0; |
| 733 } |
| 734 buildCounterResources--; |
| 735 return o; |
| 736 } |
| 737 |
| 738 checkResources(api.Resources o) { |
| 739 buildCounterResources++; |
| 740 if (buildCounterResources < 3) { |
| 741 unittest.expect(o.cpu, unittest.equals(42.0)); |
| 742 unittest.expect(o.diskGb, unittest.equals(42.0)); |
| 743 unittest.expect(o.memoryGb, unittest.equals(42.0)); |
| 744 } |
| 745 buildCounterResources--; |
| 746 } |
| 747 |
| 748 core.int buildCounterScriptHandler = 0; |
| 749 buildScriptHandler() { |
| 750 var o = new api.ScriptHandler(); |
| 751 buildCounterScriptHandler++; |
| 752 if (buildCounterScriptHandler < 3) { |
| 753 o.scriptPath = "foo"; |
| 754 } |
| 755 buildCounterScriptHandler--; |
| 756 return o; |
| 757 } |
| 758 |
| 759 checkScriptHandler(api.ScriptHandler o) { |
| 760 buildCounterScriptHandler++; |
| 761 if (buildCounterScriptHandler < 3) { |
| 762 unittest.expect(o.scriptPath, unittest.equals('foo')); |
| 763 } |
| 764 buildCounterScriptHandler--; |
| 765 } |
| 766 |
| 767 core.int buildCounterSourceContext = 0; |
| 768 buildSourceContext() { |
| 769 var o = new api.SourceContext(); |
| 770 buildCounterSourceContext++; |
| 771 if (buildCounterSourceContext < 3) { |
| 772 o.fileName = "foo"; |
| 773 } |
| 774 buildCounterSourceContext--; |
| 775 return o; |
| 776 } |
| 777 |
| 778 checkSourceContext(api.SourceContext o) { |
| 779 buildCounterSourceContext++; |
| 780 if (buildCounterSourceContext < 3) { |
| 781 unittest.expect(o.fileName, unittest.equals('foo')); |
| 782 } |
| 783 buildCounterSourceContext--; |
| 784 } |
| 785 |
| 786 core.int buildCounterSourceReference = 0; |
| 787 buildSourceReference() { |
| 788 var o = new api.SourceReference(); |
| 789 buildCounterSourceReference++; |
| 790 if (buildCounterSourceReference < 3) { |
| 791 o.repository = "foo"; |
| 792 o.revisionId = "foo"; |
| 793 } |
| 794 buildCounterSourceReference--; |
| 795 return o; |
| 796 } |
| 797 |
| 798 checkSourceReference(api.SourceReference o) { |
| 799 buildCounterSourceReference++; |
| 800 if (buildCounterSourceReference < 3) { |
| 801 unittest.expect(o.repository, unittest.equals('foo')); |
| 802 unittest.expect(o.revisionId, unittest.equals('foo')); |
| 803 } |
| 804 buildCounterSourceReference--; |
| 805 } |
| 806 |
| 807 buildUnnamed2268() { |
| 808 var o = new core.Map<core.String, core.String>(); |
| 809 o["x"] = "foo"; |
| 810 o["y"] = "foo"; |
| 811 return o; |
| 812 } |
| 813 |
| 814 checkUnnamed2268(core.Map<core.String, core.String> o) { |
| 815 unittest.expect(o, unittest.hasLength(2)); |
| 816 unittest.expect(o["x"], unittest.equals('foo')); |
| 817 unittest.expect(o["y"], unittest.equals('foo')); |
| 818 } |
| 819 |
| 820 core.int buildCounterStaticDirectoryHandler = 0; |
| 821 buildStaticDirectoryHandler() { |
| 822 var o = new api.StaticDirectoryHandler(); |
| 823 buildCounterStaticDirectoryHandler++; |
| 824 if (buildCounterStaticDirectoryHandler < 3) { |
| 825 o.applicationReadable = true; |
| 826 o.directory = "foo"; |
| 827 o.expiration = "foo"; |
| 828 o.httpHeaders = buildUnnamed2268(); |
| 829 o.mimeType = "foo"; |
| 830 o.requireMatchingFile = true; |
| 831 } |
| 832 buildCounterStaticDirectoryHandler--; |
| 833 return o; |
| 834 } |
| 835 |
| 836 checkStaticDirectoryHandler(api.StaticDirectoryHandler o) { |
| 837 buildCounterStaticDirectoryHandler++; |
| 838 if (buildCounterStaticDirectoryHandler < 3) { |
| 839 unittest.expect(o.applicationReadable, unittest.isTrue); |
| 840 unittest.expect(o.directory, unittest.equals('foo')); |
| 841 unittest.expect(o.expiration, unittest.equals('foo')); |
| 842 checkUnnamed2268(o.httpHeaders); |
| 843 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 844 unittest.expect(o.requireMatchingFile, unittest.isTrue); |
| 845 } |
| 846 buildCounterStaticDirectoryHandler--; |
| 847 } |
| 848 |
| 849 buildUnnamed2269() { |
| 850 var o = new core.Map<core.String, core.String>(); |
| 851 o["x"] = "foo"; |
| 852 o["y"] = "foo"; |
| 853 return o; |
| 854 } |
| 855 |
| 856 checkUnnamed2269(core.Map<core.String, core.String> o) { |
| 857 unittest.expect(o, unittest.hasLength(2)); |
| 858 unittest.expect(o["x"], unittest.equals('foo')); |
| 859 unittest.expect(o["y"], unittest.equals('foo')); |
| 860 } |
| 861 |
| 862 core.int buildCounterStaticFilesHandler = 0; |
| 863 buildStaticFilesHandler() { |
| 864 var o = new api.StaticFilesHandler(); |
| 865 buildCounterStaticFilesHandler++; |
| 866 if (buildCounterStaticFilesHandler < 3) { |
| 867 o.applicationReadable = true; |
| 868 o.expiration = "foo"; |
| 869 o.httpHeaders = buildUnnamed2269(); |
| 870 o.mimeType = "foo"; |
| 871 o.path = "foo"; |
| 872 o.requireMatchingFile = true; |
| 873 o.uploadPathRegex = "foo"; |
| 874 } |
| 875 buildCounterStaticFilesHandler--; |
| 876 return o; |
| 877 } |
| 878 |
| 879 checkStaticFilesHandler(api.StaticFilesHandler o) { |
| 880 buildCounterStaticFilesHandler++; |
| 881 if (buildCounterStaticFilesHandler < 3) { |
| 882 unittest.expect(o.applicationReadable, unittest.isTrue); |
| 883 unittest.expect(o.expiration, unittest.equals('foo')); |
| 884 checkUnnamed2269(o.httpHeaders); |
| 885 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 886 unittest.expect(o.path, unittest.equals('foo')); |
| 887 unittest.expect(o.requireMatchingFile, unittest.isTrue); |
| 888 unittest.expect(o.uploadPathRegex, unittest.equals('foo')); |
| 889 } |
| 890 buildCounterStaticFilesHandler--; |
| 891 } |
| 892 |
| 893 buildUnnamed2270() { |
| 894 var o = new core.Map<core.String, core.Object>(); |
| 895 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 896 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 897 return o; |
| 898 } |
| 899 |
| 900 checkUnnamed2270(core.Map<core.String, core.Object> o) { |
| 901 unittest.expect(o, unittest.hasLength(2)); |
| 902 var casted7 = (o["x"]) as core.Map; unittest.expect(casted7, unittest.hasLengt
h(3)); unittest.expect(casted7["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted7["bool"], unittest.equals(true)); unittest.expect(casted7["string"],
unittest.equals('foo')); |
| 903 var casted8 = (o["y"]) as core.Map; unittest.expect(casted8, unittest.hasLengt
h(3)); unittest.expect(casted8["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted8["bool"], unittest.equals(true)); unittest.expect(casted8["string"],
unittest.equals('foo')); |
| 904 } |
| 905 |
| 906 buildUnnamed2271() { |
| 907 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 908 o.add(buildUnnamed2270()); |
| 909 o.add(buildUnnamed2270()); |
| 910 return o; |
| 911 } |
| 912 |
| 913 checkUnnamed2271(core.List<core.Map<core.String, core.Object>> o) { |
| 914 unittest.expect(o, unittest.hasLength(2)); |
| 915 checkUnnamed2270(o[0]); |
| 916 checkUnnamed2270(o[1]); |
| 917 } |
| 918 |
| 919 core.int buildCounterStatus = 0; |
| 920 buildStatus() { |
| 921 var o = new api.Status(); |
| 922 buildCounterStatus++; |
| 923 if (buildCounterStatus < 3) { |
| 924 o.code = 42; |
| 925 o.details = buildUnnamed2271(); |
| 926 o.message = "foo"; |
| 927 } |
| 928 buildCounterStatus--; |
| 929 return o; |
| 930 } |
| 931 |
| 932 checkStatus(api.Status o) { |
| 933 buildCounterStatus++; |
| 934 if (buildCounterStatus < 3) { |
| 935 unittest.expect(o.code, unittest.equals(42)); |
| 936 checkUnnamed2271(o.details); |
| 937 unittest.expect(o.message, unittest.equals('foo')); |
| 938 } |
| 939 buildCounterStatus--; |
| 940 } |
| 941 |
| 942 buildUnnamed2272() { |
| 943 var o = new core.Map<core.String, core.double>(); |
| 944 o["x"] = 42.0; |
| 945 o["y"] = 42.0; |
| 946 return o; |
| 947 } |
| 948 |
| 949 checkUnnamed2272(core.Map<core.String, core.double> o) { |
| 950 unittest.expect(o, unittest.hasLength(2)); |
| 951 unittest.expect(o["x"], unittest.equals(42.0)); |
| 952 unittest.expect(o["y"], unittest.equals(42.0)); |
| 953 } |
| 954 |
| 955 core.int buildCounterTrafficSplit = 0; |
| 956 buildTrafficSplit() { |
| 957 var o = new api.TrafficSplit(); |
| 958 buildCounterTrafficSplit++; |
| 959 if (buildCounterTrafficSplit < 3) { |
| 960 o.allocations = buildUnnamed2272(); |
| 961 o.shardBy = "foo"; |
| 962 } |
| 963 buildCounterTrafficSplit--; |
| 964 return o; |
| 965 } |
| 966 |
| 967 checkTrafficSplit(api.TrafficSplit o) { |
| 968 buildCounterTrafficSplit++; |
| 969 if (buildCounterTrafficSplit < 3) { |
| 970 checkUnnamed2272(o.allocations); |
| 971 unittest.expect(o.shardBy, unittest.equals('foo')); |
| 972 } |
| 973 buildCounterTrafficSplit--; |
| 974 } |
| 975 |
| 976 buildUnnamed2273() { |
| 977 var o = new core.List<api.Field>(); |
| 978 o.add(buildField()); |
| 979 o.add(buildField()); |
| 980 return o; |
| 981 } |
| 982 |
| 983 checkUnnamed2273(core.List<api.Field> o) { |
| 984 unittest.expect(o, unittest.hasLength(2)); |
| 985 checkField(o[0]); |
| 986 checkField(o[1]); |
| 987 } |
| 988 |
| 989 buildUnnamed2274() { |
| 990 var o = new core.List<core.String>(); |
| 991 o.add("foo"); |
| 992 o.add("foo"); |
| 993 return o; |
| 994 } |
| 995 |
| 996 checkUnnamed2274(core.List<core.String> o) { |
| 997 unittest.expect(o, unittest.hasLength(2)); |
| 998 unittest.expect(o[0], unittest.equals('foo')); |
| 999 unittest.expect(o[1], unittest.equals('foo')); |
| 1000 } |
| 1001 |
| 1002 buildUnnamed2275() { |
| 1003 var o = new core.List<api.Option>(); |
| 1004 o.add(buildOption()); |
| 1005 o.add(buildOption()); |
| 1006 return o; |
| 1007 } |
| 1008 |
| 1009 checkUnnamed2275(core.List<api.Option> o) { |
| 1010 unittest.expect(o, unittest.hasLength(2)); |
| 1011 checkOption(o[0]); |
| 1012 checkOption(o[1]); |
| 1013 } |
| 1014 |
| 1015 core.int buildCounterType = 0; |
| 1016 buildType() { |
| 1017 var o = new api.Type(); |
| 1018 buildCounterType++; |
| 1019 if (buildCounterType < 3) { |
| 1020 o.fields = buildUnnamed2273(); |
| 1021 o.name = "foo"; |
| 1022 o.oneofs = buildUnnamed2274(); |
| 1023 o.options = buildUnnamed2275(); |
| 1024 o.sourceContext = buildSourceContext(); |
| 1025 o.syntax = "foo"; |
| 1026 } |
| 1027 buildCounterType--; |
| 1028 return o; |
| 1029 } |
| 1030 |
| 1031 checkType(api.Type o) { |
| 1032 buildCounterType++; |
| 1033 if (buildCounterType < 3) { |
| 1034 checkUnnamed2273(o.fields); |
| 1035 unittest.expect(o.name, unittest.equals('foo')); |
| 1036 checkUnnamed2274(o.oneofs); |
| 1037 checkUnnamed2275(o.options); |
| 1038 checkSourceContext(o.sourceContext); |
| 1039 unittest.expect(o.syntax, unittest.equals('foo')); |
| 1040 } |
| 1041 buildCounterType--; |
| 1042 } |
| 1043 |
| 1044 core.int buildCounterUrlDispatchRule = 0; |
| 1045 buildUrlDispatchRule() { |
| 1046 var o = new api.UrlDispatchRule(); |
| 1047 buildCounterUrlDispatchRule++; |
| 1048 if (buildCounterUrlDispatchRule < 3) { |
| 1049 o.domain = "foo"; |
| 1050 o.module = "foo"; |
| 1051 o.path = "foo"; |
| 1052 } |
| 1053 buildCounterUrlDispatchRule--; |
| 1054 return o; |
| 1055 } |
| 1056 |
| 1057 checkUrlDispatchRule(api.UrlDispatchRule o) { |
| 1058 buildCounterUrlDispatchRule++; |
| 1059 if (buildCounterUrlDispatchRule < 3) { |
| 1060 unittest.expect(o.domain, unittest.equals('foo')); |
| 1061 unittest.expect(o.module, unittest.equals('foo')); |
| 1062 unittest.expect(o.path, unittest.equals('foo')); |
| 1063 } |
| 1064 buildCounterUrlDispatchRule--; |
| 1065 } |
| 1066 |
| 1067 core.int buildCounterUrlMap = 0; |
| 1068 buildUrlMap() { |
| 1069 var o = new api.UrlMap(); |
| 1070 buildCounterUrlMap++; |
| 1071 if (buildCounterUrlMap < 3) { |
| 1072 o.apiEndpoint = buildApiEndpointHandler(); |
| 1073 o.authFailAction = "foo"; |
| 1074 o.login = "foo"; |
| 1075 o.redirectHttpResponseCode = "foo"; |
| 1076 o.script = buildScriptHandler(); |
| 1077 o.securityLevel = "foo"; |
| 1078 o.staticDirectory = buildStaticDirectoryHandler(); |
| 1079 o.staticFiles = buildStaticFilesHandler(); |
| 1080 o.urlRegex = "foo"; |
| 1081 } |
| 1082 buildCounterUrlMap--; |
| 1083 return o; |
| 1084 } |
| 1085 |
| 1086 checkUrlMap(api.UrlMap o) { |
| 1087 buildCounterUrlMap++; |
| 1088 if (buildCounterUrlMap < 3) { |
| 1089 checkApiEndpointHandler(o.apiEndpoint); |
| 1090 unittest.expect(o.authFailAction, unittest.equals('foo')); |
| 1091 unittest.expect(o.login, unittest.equals('foo')); |
| 1092 unittest.expect(o.redirectHttpResponseCode, unittest.equals('foo')); |
| 1093 checkScriptHandler(o.script); |
| 1094 unittest.expect(o.securityLevel, unittest.equals('foo')); |
| 1095 checkStaticDirectoryHandler(o.staticDirectory); |
| 1096 checkStaticFilesHandler(o.staticFiles); |
| 1097 unittest.expect(o.urlRegex, unittest.equals('foo')); |
| 1098 } |
| 1099 buildCounterUrlMap--; |
| 1100 } |
| 1101 |
| 1102 buildUnnamed2276() { |
| 1103 var o = new core.Map<core.String, core.String>(); |
| 1104 o["x"] = "foo"; |
| 1105 o["y"] = "foo"; |
| 1106 return o; |
| 1107 } |
| 1108 |
| 1109 checkUnnamed2276(core.Map<core.String, core.String> o) { |
| 1110 unittest.expect(o, unittest.hasLength(2)); |
| 1111 unittest.expect(o["x"], unittest.equals('foo')); |
| 1112 unittest.expect(o["y"], unittest.equals('foo')); |
| 1113 } |
| 1114 |
| 1115 buildUnnamed2277() { |
| 1116 var o = new core.Map<core.String, core.String>(); |
| 1117 o["x"] = "foo"; |
| 1118 o["y"] = "foo"; |
| 1119 return o; |
| 1120 } |
| 1121 |
| 1122 checkUnnamed2277(core.Map<core.String, core.String> o) { |
| 1123 unittest.expect(o, unittest.hasLength(2)); |
| 1124 unittest.expect(o["x"], unittest.equals('foo')); |
| 1125 unittest.expect(o["y"], unittest.equals('foo')); |
| 1126 } |
| 1127 |
| 1128 buildUnnamed2278() { |
| 1129 var o = new core.List<api.ErrorHandler>(); |
| 1130 o.add(buildErrorHandler()); |
| 1131 o.add(buildErrorHandler()); |
| 1132 return o; |
| 1133 } |
| 1134 |
| 1135 checkUnnamed2278(core.List<api.ErrorHandler> o) { |
| 1136 unittest.expect(o, unittest.hasLength(2)); |
| 1137 checkErrorHandler(o[0]); |
| 1138 checkErrorHandler(o[1]); |
| 1139 } |
| 1140 |
| 1141 buildUnnamed2279() { |
| 1142 var o = new core.List<api.UrlMap>(); |
| 1143 o.add(buildUrlMap()); |
| 1144 o.add(buildUrlMap()); |
| 1145 return o; |
| 1146 } |
| 1147 |
| 1148 checkUnnamed2279(core.List<api.UrlMap> o) { |
| 1149 unittest.expect(o, unittest.hasLength(2)); |
| 1150 checkUrlMap(o[0]); |
| 1151 checkUrlMap(o[1]); |
| 1152 } |
| 1153 |
| 1154 buildUnnamed2280() { |
| 1155 var o = new core.List<core.String>(); |
| 1156 o.add("foo"); |
| 1157 o.add("foo"); |
| 1158 return o; |
| 1159 } |
| 1160 |
| 1161 checkUnnamed2280(core.List<core.String> o) { |
| 1162 unittest.expect(o, unittest.hasLength(2)); |
| 1163 unittest.expect(o[0], unittest.equals('foo')); |
| 1164 unittest.expect(o[1], unittest.equals('foo')); |
| 1165 } |
| 1166 |
| 1167 buildUnnamed2281() { |
| 1168 var o = new core.List<api.Library>(); |
| 1169 o.add(buildLibrary()); |
| 1170 o.add(buildLibrary()); |
| 1171 return o; |
| 1172 } |
| 1173 |
| 1174 checkUnnamed2281(core.List<api.Library> o) { |
| 1175 unittest.expect(o, unittest.hasLength(2)); |
| 1176 checkLibrary(o[0]); |
| 1177 checkLibrary(o[1]); |
| 1178 } |
| 1179 |
| 1180 core.int buildCounterVersion = 0; |
| 1181 buildVersion() { |
| 1182 var o = new api.Version(); |
| 1183 buildCounterVersion++; |
| 1184 if (buildCounterVersion < 3) { |
| 1185 o.apiConfig = buildApiConfigHandler(); |
| 1186 o.automaticScaling = buildAutomaticScaling(); |
| 1187 o.basicScaling = buildBasicScaling(); |
| 1188 o.betaSettings = buildUnnamed2276(); |
| 1189 o.defaultExpiration = "foo"; |
| 1190 o.deployment = buildDeployment(); |
| 1191 o.envVariables = buildUnnamed2277(); |
| 1192 o.errorHandlers = buildUnnamed2278(); |
| 1193 o.handlers = buildUnnamed2279(); |
| 1194 o.healthCheck = buildHealthCheck(); |
| 1195 o.id = "foo"; |
| 1196 o.inboundServices = buildUnnamed2280(); |
| 1197 o.instanceClass = "foo"; |
| 1198 o.libraries = buildUnnamed2281(); |
| 1199 o.manualScaling = buildManualScaling(); |
| 1200 o.name = "foo"; |
| 1201 o.network = buildNetwork(); |
| 1202 o.nobuildFilesRegex = "foo"; |
| 1203 o.resources = buildResources(); |
| 1204 o.runtime = "foo"; |
| 1205 o.threadsafe = true; |
| 1206 o.vm = true; |
| 1207 } |
| 1208 buildCounterVersion--; |
| 1209 return o; |
| 1210 } |
| 1211 |
| 1212 checkVersion(api.Version o) { |
| 1213 buildCounterVersion++; |
| 1214 if (buildCounterVersion < 3) { |
| 1215 checkApiConfigHandler(o.apiConfig); |
| 1216 checkAutomaticScaling(o.automaticScaling); |
| 1217 checkBasicScaling(o.basicScaling); |
| 1218 checkUnnamed2276(o.betaSettings); |
| 1219 unittest.expect(o.defaultExpiration, unittest.equals('foo')); |
| 1220 checkDeployment(o.deployment); |
| 1221 checkUnnamed2277(o.envVariables); |
| 1222 checkUnnamed2278(o.errorHandlers); |
| 1223 checkUnnamed2279(o.handlers); |
| 1224 checkHealthCheck(o.healthCheck); |
| 1225 unittest.expect(o.id, unittest.equals('foo')); |
| 1226 checkUnnamed2280(o.inboundServices); |
| 1227 unittest.expect(o.instanceClass, unittest.equals('foo')); |
| 1228 checkUnnamed2281(o.libraries); |
| 1229 checkManualScaling(o.manualScaling); |
| 1230 unittest.expect(o.name, unittest.equals('foo')); |
| 1231 checkNetwork(o.network); |
| 1232 unittest.expect(o.nobuildFilesRegex, unittest.equals('foo')); |
| 1233 checkResources(o.resources); |
| 1234 unittest.expect(o.runtime, unittest.equals('foo')); |
| 1235 unittest.expect(o.threadsafe, unittest.isTrue); |
| 1236 unittest.expect(o.vm, unittest.isTrue); |
| 1237 } |
| 1238 buildCounterVersion--; |
| 1239 } |
| 1240 |
| 1241 |
| 1242 main() { |
| 1243 unittest.group("obj-schema-ApiConfigHandler", () { |
| 1244 unittest.test("to-json--from-json", () { |
| 1245 var o = buildApiConfigHandler(); |
| 1246 var od = new api.ApiConfigHandler.fromJson(o.toJson()); |
| 1247 checkApiConfigHandler(od); |
| 1248 }); |
| 1249 }); |
| 1250 |
| 1251 |
| 1252 unittest.group("obj-schema-ApiEndpointHandler", () { |
| 1253 unittest.test("to-json--from-json", () { |
| 1254 var o = buildApiEndpointHandler(); |
| 1255 var od = new api.ApiEndpointHandler.fromJson(o.toJson()); |
| 1256 checkApiEndpointHandler(od); |
| 1257 }); |
| 1258 }); |
| 1259 |
| 1260 |
| 1261 unittest.group("obj-schema-Application", () { |
| 1262 unittest.test("to-json--from-json", () { |
| 1263 var o = buildApplication(); |
| 1264 var od = new api.Application.fromJson(o.toJson()); |
| 1265 checkApplication(od); |
| 1266 }); |
| 1267 }); |
| 1268 |
| 1269 |
| 1270 unittest.group("obj-schema-AutomaticScaling", () { |
| 1271 unittest.test("to-json--from-json", () { |
| 1272 var o = buildAutomaticScaling(); |
| 1273 var od = new api.AutomaticScaling.fromJson(o.toJson()); |
| 1274 checkAutomaticScaling(od); |
| 1275 }); |
| 1276 }); |
| 1277 |
| 1278 |
| 1279 unittest.group("obj-schema-BasicScaling", () { |
| 1280 unittest.test("to-json--from-json", () { |
| 1281 var o = buildBasicScaling(); |
| 1282 var od = new api.BasicScaling.fromJson(o.toJson()); |
| 1283 checkBasicScaling(od); |
| 1284 }); |
| 1285 }); |
| 1286 |
| 1287 |
| 1288 unittest.group("obj-schema-ContainerInfo", () { |
| 1289 unittest.test("to-json--from-json", () { |
| 1290 var o = buildContainerInfo(); |
| 1291 var od = new api.ContainerInfo.fromJson(o.toJson()); |
| 1292 checkContainerInfo(od); |
| 1293 }); |
| 1294 }); |
| 1295 |
| 1296 |
| 1297 unittest.group("obj-schema-CpuUtilization", () { |
| 1298 unittest.test("to-json--from-json", () { |
| 1299 var o = buildCpuUtilization(); |
| 1300 var od = new api.CpuUtilization.fromJson(o.toJson()); |
| 1301 checkCpuUtilization(od); |
| 1302 }); |
| 1303 }); |
| 1304 |
| 1305 |
| 1306 unittest.group("obj-schema-Deployment", () { |
| 1307 unittest.test("to-json--from-json", () { |
| 1308 var o = buildDeployment(); |
| 1309 var od = new api.Deployment.fromJson(o.toJson()); |
| 1310 checkDeployment(od); |
| 1311 }); |
| 1312 }); |
| 1313 |
| 1314 |
| 1315 unittest.group("obj-schema-ErrorHandler", () { |
| 1316 unittest.test("to-json--from-json", () { |
| 1317 var o = buildErrorHandler(); |
| 1318 var od = new api.ErrorHandler.fromJson(o.toJson()); |
| 1319 checkErrorHandler(od); |
| 1320 }); |
| 1321 }); |
| 1322 |
| 1323 |
| 1324 unittest.group("obj-schema-Field", () { |
| 1325 unittest.test("to-json--from-json", () { |
| 1326 var o = buildField(); |
| 1327 var od = new api.Field.fromJson(o.toJson()); |
| 1328 checkField(od); |
| 1329 }); |
| 1330 }); |
| 1331 |
| 1332 |
| 1333 unittest.group("obj-schema-FileInfo", () { |
| 1334 unittest.test("to-json--from-json", () { |
| 1335 var o = buildFileInfo(); |
| 1336 var od = new api.FileInfo.fromJson(o.toJson()); |
| 1337 checkFileInfo(od); |
| 1338 }); |
| 1339 }); |
| 1340 |
| 1341 |
| 1342 unittest.group("obj-schema-HealthCheck", () { |
| 1343 unittest.test("to-json--from-json", () { |
| 1344 var o = buildHealthCheck(); |
| 1345 var od = new api.HealthCheck.fromJson(o.toJson()); |
| 1346 checkHealthCheck(od); |
| 1347 }); |
| 1348 }); |
| 1349 |
| 1350 |
| 1351 unittest.group("obj-schema-Library", () { |
| 1352 unittest.test("to-json--from-json", () { |
| 1353 var o = buildLibrary(); |
| 1354 var od = new api.Library.fromJson(o.toJson()); |
| 1355 checkLibrary(od); |
| 1356 }); |
| 1357 }); |
| 1358 |
| 1359 |
| 1360 unittest.group("obj-schema-ListModulesResponse", () { |
| 1361 unittest.test("to-json--from-json", () { |
| 1362 var o = buildListModulesResponse(); |
| 1363 var od = new api.ListModulesResponse.fromJson(o.toJson()); |
| 1364 checkListModulesResponse(od); |
| 1365 }); |
| 1366 }); |
| 1367 |
| 1368 |
| 1369 unittest.group("obj-schema-ListOperationsResponse", () { |
| 1370 unittest.test("to-json--from-json", () { |
| 1371 var o = buildListOperationsResponse(); |
| 1372 var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
| 1373 checkListOperationsResponse(od); |
| 1374 }); |
| 1375 }); |
| 1376 |
| 1377 |
| 1378 unittest.group("obj-schema-ListVersionsResponse", () { |
| 1379 unittest.test("to-json--from-json", () { |
| 1380 var o = buildListVersionsResponse(); |
| 1381 var od = new api.ListVersionsResponse.fromJson(o.toJson()); |
| 1382 checkListVersionsResponse(od); |
| 1383 }); |
| 1384 }); |
| 1385 |
| 1386 |
| 1387 unittest.group("obj-schema-ManualScaling", () { |
| 1388 unittest.test("to-json--from-json", () { |
| 1389 var o = buildManualScaling(); |
| 1390 var od = new api.ManualScaling.fromJson(o.toJson()); |
| 1391 checkManualScaling(od); |
| 1392 }); |
| 1393 }); |
| 1394 |
| 1395 |
| 1396 unittest.group("obj-schema-Module", () { |
| 1397 unittest.test("to-json--from-json", () { |
| 1398 var o = buildModule(); |
| 1399 var od = new api.Module.fromJson(o.toJson()); |
| 1400 checkModule(od); |
| 1401 }); |
| 1402 }); |
| 1403 |
| 1404 |
| 1405 unittest.group("obj-schema-Network", () { |
| 1406 unittest.test("to-json--from-json", () { |
| 1407 var o = buildNetwork(); |
| 1408 var od = new api.Network.fromJson(o.toJson()); |
| 1409 checkNetwork(od); |
| 1410 }); |
| 1411 }); |
| 1412 |
| 1413 |
| 1414 unittest.group("obj-schema-Operation", () { |
| 1415 unittest.test("to-json--from-json", () { |
| 1416 var o = buildOperation(); |
| 1417 var od = new api.Operation.fromJson(o.toJson()); |
| 1418 checkOperation(od); |
| 1419 }); |
| 1420 }); |
| 1421 |
| 1422 |
| 1423 unittest.group("obj-schema-OperationMetadata", () { |
| 1424 unittest.test("to-json--from-json", () { |
| 1425 var o = buildOperationMetadata(); |
| 1426 var od = new api.OperationMetadata.fromJson(o.toJson()); |
| 1427 checkOperationMetadata(od); |
| 1428 }); |
| 1429 }); |
| 1430 |
| 1431 |
| 1432 unittest.group("obj-schema-Option", () { |
| 1433 unittest.test("to-json--from-json", () { |
| 1434 var o = buildOption(); |
| 1435 var od = new api.Option.fromJson(o.toJson()); |
| 1436 checkOption(od); |
| 1437 }); |
| 1438 }); |
| 1439 |
| 1440 |
| 1441 unittest.group("obj-schema-Resources", () { |
| 1442 unittest.test("to-json--from-json", () { |
| 1443 var o = buildResources(); |
| 1444 var od = new api.Resources.fromJson(o.toJson()); |
| 1445 checkResources(od); |
| 1446 }); |
| 1447 }); |
| 1448 |
| 1449 |
| 1450 unittest.group("obj-schema-ScriptHandler", () { |
| 1451 unittest.test("to-json--from-json", () { |
| 1452 var o = buildScriptHandler(); |
| 1453 var od = new api.ScriptHandler.fromJson(o.toJson()); |
| 1454 checkScriptHandler(od); |
| 1455 }); |
| 1456 }); |
| 1457 |
| 1458 |
| 1459 unittest.group("obj-schema-SourceContext", () { |
| 1460 unittest.test("to-json--from-json", () { |
| 1461 var o = buildSourceContext(); |
| 1462 var od = new api.SourceContext.fromJson(o.toJson()); |
| 1463 checkSourceContext(od); |
| 1464 }); |
| 1465 }); |
| 1466 |
| 1467 |
| 1468 unittest.group("obj-schema-SourceReference", () { |
| 1469 unittest.test("to-json--from-json", () { |
| 1470 var o = buildSourceReference(); |
| 1471 var od = new api.SourceReference.fromJson(o.toJson()); |
| 1472 checkSourceReference(od); |
| 1473 }); |
| 1474 }); |
| 1475 |
| 1476 |
| 1477 unittest.group("obj-schema-StaticDirectoryHandler", () { |
| 1478 unittest.test("to-json--from-json", () { |
| 1479 var o = buildStaticDirectoryHandler(); |
| 1480 var od = new api.StaticDirectoryHandler.fromJson(o.toJson()); |
| 1481 checkStaticDirectoryHandler(od); |
| 1482 }); |
| 1483 }); |
| 1484 |
| 1485 |
| 1486 unittest.group("obj-schema-StaticFilesHandler", () { |
| 1487 unittest.test("to-json--from-json", () { |
| 1488 var o = buildStaticFilesHandler(); |
| 1489 var od = new api.StaticFilesHandler.fromJson(o.toJson()); |
| 1490 checkStaticFilesHandler(od); |
| 1491 }); |
| 1492 }); |
| 1493 |
| 1494 |
| 1495 unittest.group("obj-schema-Status", () { |
| 1496 unittest.test("to-json--from-json", () { |
| 1497 var o = buildStatus(); |
| 1498 var od = new api.Status.fromJson(o.toJson()); |
| 1499 checkStatus(od); |
| 1500 }); |
| 1501 }); |
| 1502 |
| 1503 |
| 1504 unittest.group("obj-schema-TrafficSplit", () { |
| 1505 unittest.test("to-json--from-json", () { |
| 1506 var o = buildTrafficSplit(); |
| 1507 var od = new api.TrafficSplit.fromJson(o.toJson()); |
| 1508 checkTrafficSplit(od); |
| 1509 }); |
| 1510 }); |
| 1511 |
| 1512 |
| 1513 unittest.group("obj-schema-Type", () { |
| 1514 unittest.test("to-json--from-json", () { |
| 1515 var o = buildType(); |
| 1516 var od = new api.Type.fromJson(o.toJson()); |
| 1517 checkType(od); |
| 1518 }); |
| 1519 }); |
| 1520 |
| 1521 |
| 1522 unittest.group("obj-schema-UrlDispatchRule", () { |
| 1523 unittest.test("to-json--from-json", () { |
| 1524 var o = buildUrlDispatchRule(); |
| 1525 var od = new api.UrlDispatchRule.fromJson(o.toJson()); |
| 1526 checkUrlDispatchRule(od); |
| 1527 }); |
| 1528 }); |
| 1529 |
| 1530 |
| 1531 unittest.group("obj-schema-UrlMap", () { |
| 1532 unittest.test("to-json--from-json", () { |
| 1533 var o = buildUrlMap(); |
| 1534 var od = new api.UrlMap.fromJson(o.toJson()); |
| 1535 checkUrlMap(od); |
| 1536 }); |
| 1537 }); |
| 1538 |
| 1539 |
| 1540 unittest.group("obj-schema-Version", () { |
| 1541 unittest.test("to-json--from-json", () { |
| 1542 var o = buildVersion(); |
| 1543 var od = new api.Version.fromJson(o.toJson()); |
| 1544 checkVersion(od); |
| 1545 }); |
| 1546 }); |
| 1547 |
| 1548 |
| 1549 unittest.group("resource-AppsResourceApi", () { |
| 1550 unittest.test("method--get", () { |
| 1551 |
| 1552 var mock = new HttpServerMock(); |
| 1553 api.AppsResourceApi res = new api.AppengineApi(mock).apps; |
| 1554 var arg_appsId = "foo"; |
| 1555 var arg_ensureResourcesExist = true; |
| 1556 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1557 var path = (req.url).path; |
| 1558 var pathOffset = 0; |
| 1559 var index; |
| 1560 var subPart; |
| 1561 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1562 pathOffset += 1; |
| 1563 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1564 pathOffset += 13; |
| 1565 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1566 pathOffset = path.length; |
| 1567 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1568 |
| 1569 var query = (req.url).query; |
| 1570 var queryOffset = 0; |
| 1571 var queryMap = {}; |
| 1572 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1573 parseBool(n) { |
| 1574 if (n == "true") return true; |
| 1575 if (n == "false") return false; |
| 1576 if (n == null) return null; |
| 1577 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1578 } |
| 1579 if (query.length > 0) { |
| 1580 for (var part in query.split("&")) { |
| 1581 var keyvalue = part.split("="); |
| 1582 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1583 } |
| 1584 } |
| 1585 unittest.expect(queryMap["ensureResourcesExist"].first, unittest.equals(
"$arg_ensureResourcesExist")); |
| 1586 |
| 1587 |
| 1588 var h = { |
| 1589 "content-type" : "application/json; charset=utf-8", |
| 1590 }; |
| 1591 var resp = convert.JSON.encode(buildApplication()); |
| 1592 return new async.Future.value(stringResponse(200, h, resp)); |
| 1593 }), true); |
| 1594 res.get(arg_appsId, ensureResourcesExist: arg_ensureResourcesExist).then(u
nittest.expectAsync(((api.Application response) { |
| 1595 checkApplication(response); |
| 1596 }))); |
| 1597 }); |
| 1598 |
| 1599 }); |
| 1600 |
| 1601 |
| 1602 unittest.group("resource-AppsModulesResourceApi", () { |
| 1603 unittest.test("method--delete", () { |
| 1604 |
| 1605 var mock = new HttpServerMock(); |
| 1606 api.AppsModulesResourceApi res = new api.AppengineApi(mock).apps.modules; |
| 1607 var arg_appsId = "foo"; |
| 1608 var arg_modulesId = "foo"; |
| 1609 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1610 var path = (req.url).path; |
| 1611 var pathOffset = 0; |
| 1612 var index; |
| 1613 var subPart; |
| 1614 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1615 pathOffset += 1; |
| 1616 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1617 pathOffset += 13; |
| 1618 index = path.indexOf("/modules/", pathOffset); |
| 1619 unittest.expect(index >= 0, unittest.isTrue); |
| 1620 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1621 pathOffset = index; |
| 1622 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1623 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1624 pathOffset += 9; |
| 1625 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1626 pathOffset = path.length; |
| 1627 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1628 |
| 1629 var query = (req.url).query; |
| 1630 var queryOffset = 0; |
| 1631 var queryMap = {}; |
| 1632 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1633 parseBool(n) { |
| 1634 if (n == "true") return true; |
| 1635 if (n == "false") return false; |
| 1636 if (n == null) return null; |
| 1637 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1638 } |
| 1639 if (query.length > 0) { |
| 1640 for (var part in query.split("&")) { |
| 1641 var keyvalue = part.split("="); |
| 1642 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1643 } |
| 1644 } |
| 1645 |
| 1646 |
| 1647 var h = { |
| 1648 "content-type" : "application/json; charset=utf-8", |
| 1649 }; |
| 1650 var resp = convert.JSON.encode(buildOperation()); |
| 1651 return new async.Future.value(stringResponse(200, h, resp)); |
| 1652 }), true); |
| 1653 res.delete(arg_appsId, arg_modulesId).then(unittest.expectAsync(((api.Oper
ation response) { |
| 1654 checkOperation(response); |
| 1655 }))); |
| 1656 }); |
| 1657 |
| 1658 unittest.test("method--get", () { |
| 1659 |
| 1660 var mock = new HttpServerMock(); |
| 1661 api.AppsModulesResourceApi res = new api.AppengineApi(mock).apps.modules; |
| 1662 var arg_appsId = "foo"; |
| 1663 var arg_modulesId = "foo"; |
| 1664 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1665 var path = (req.url).path; |
| 1666 var pathOffset = 0; |
| 1667 var index; |
| 1668 var subPart; |
| 1669 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1670 pathOffset += 1; |
| 1671 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1672 pathOffset += 13; |
| 1673 index = path.indexOf("/modules/", pathOffset); |
| 1674 unittest.expect(index >= 0, unittest.isTrue); |
| 1675 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1676 pathOffset = index; |
| 1677 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1678 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1679 pathOffset += 9; |
| 1680 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1681 pathOffset = path.length; |
| 1682 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1683 |
| 1684 var query = (req.url).query; |
| 1685 var queryOffset = 0; |
| 1686 var queryMap = {}; |
| 1687 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1688 parseBool(n) { |
| 1689 if (n == "true") return true; |
| 1690 if (n == "false") return false; |
| 1691 if (n == null) return null; |
| 1692 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1693 } |
| 1694 if (query.length > 0) { |
| 1695 for (var part in query.split("&")) { |
| 1696 var keyvalue = part.split("="); |
| 1697 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1698 } |
| 1699 } |
| 1700 |
| 1701 |
| 1702 var h = { |
| 1703 "content-type" : "application/json; charset=utf-8", |
| 1704 }; |
| 1705 var resp = convert.JSON.encode(buildModule()); |
| 1706 return new async.Future.value(stringResponse(200, h, resp)); |
| 1707 }), true); |
| 1708 res.get(arg_appsId, arg_modulesId).then(unittest.expectAsync(((api.Module
response) { |
| 1709 checkModule(response); |
| 1710 }))); |
| 1711 }); |
| 1712 |
| 1713 unittest.test("method--list", () { |
| 1714 |
| 1715 var mock = new HttpServerMock(); |
| 1716 api.AppsModulesResourceApi res = new api.AppengineApi(mock).apps.modules; |
| 1717 var arg_appsId = "foo"; |
| 1718 var arg_pageSize = 42; |
| 1719 var arg_pageToken = "foo"; |
| 1720 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1721 var path = (req.url).path; |
| 1722 var pathOffset = 0; |
| 1723 var index; |
| 1724 var subPart; |
| 1725 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1726 pathOffset += 1; |
| 1727 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1728 pathOffset += 13; |
| 1729 index = path.indexOf("/modules", pathOffset); |
| 1730 unittest.expect(index >= 0, unittest.isTrue); |
| 1731 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1732 pathOffset = index; |
| 1733 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1734 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/modules")); |
| 1735 pathOffset += 8; |
| 1736 |
| 1737 var query = (req.url).query; |
| 1738 var queryOffset = 0; |
| 1739 var queryMap = {}; |
| 1740 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1741 parseBool(n) { |
| 1742 if (n == "true") return true; |
| 1743 if (n == "false") return false; |
| 1744 if (n == null) return null; |
| 1745 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1746 } |
| 1747 if (query.length > 0) { |
| 1748 for (var part in query.split("&")) { |
| 1749 var keyvalue = part.split("="); |
| 1750 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1751 } |
| 1752 } |
| 1753 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1754 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1755 |
| 1756 |
| 1757 var h = { |
| 1758 "content-type" : "application/json; charset=utf-8", |
| 1759 }; |
| 1760 var resp = convert.JSON.encode(buildListModulesResponse()); |
| 1761 return new async.Future.value(stringResponse(200, h, resp)); |
| 1762 }), true); |
| 1763 res.list(arg_appsId, pageSize: arg_pageSize, pageToken: arg_pageToken).the
n(unittest.expectAsync(((api.ListModulesResponse response) { |
| 1764 checkListModulesResponse(response); |
| 1765 }))); |
| 1766 }); |
| 1767 |
| 1768 unittest.test("method--patch", () { |
| 1769 |
| 1770 var mock = new HttpServerMock(); |
| 1771 api.AppsModulesResourceApi res = new api.AppengineApi(mock).apps.modules; |
| 1772 var arg_request = buildModule(); |
| 1773 var arg_appsId = "foo"; |
| 1774 var arg_modulesId = "foo"; |
| 1775 var arg_mask = "foo"; |
| 1776 var arg_migrateTraffic = true; |
| 1777 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1778 var obj = new api.Module.fromJson(json); |
| 1779 checkModule(obj); |
| 1780 |
| 1781 var path = (req.url).path; |
| 1782 var pathOffset = 0; |
| 1783 var index; |
| 1784 var subPart; |
| 1785 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1786 pathOffset += 1; |
| 1787 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1788 pathOffset += 13; |
| 1789 index = path.indexOf("/modules/", pathOffset); |
| 1790 unittest.expect(index >= 0, unittest.isTrue); |
| 1791 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1792 pathOffset = index; |
| 1793 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1794 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1795 pathOffset += 9; |
| 1796 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1797 pathOffset = path.length; |
| 1798 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1799 |
| 1800 var query = (req.url).query; |
| 1801 var queryOffset = 0; |
| 1802 var queryMap = {}; |
| 1803 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1804 parseBool(n) { |
| 1805 if (n == "true") return true; |
| 1806 if (n == "false") return false; |
| 1807 if (n == null) return null; |
| 1808 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1809 } |
| 1810 if (query.length > 0) { |
| 1811 for (var part in query.split("&")) { |
| 1812 var keyvalue = part.split("="); |
| 1813 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1814 } |
| 1815 } |
| 1816 unittest.expect(queryMap["mask"].first, unittest.equals(arg_mask)); |
| 1817 unittest.expect(queryMap["migrateTraffic"].first, unittest.equals("$arg_
migrateTraffic")); |
| 1818 |
| 1819 |
| 1820 var h = { |
| 1821 "content-type" : "application/json; charset=utf-8", |
| 1822 }; |
| 1823 var resp = convert.JSON.encode(buildOperation()); |
| 1824 return new async.Future.value(stringResponse(200, h, resp)); |
| 1825 }), true); |
| 1826 res.patch(arg_request, arg_appsId, arg_modulesId, mask: arg_mask, migrateT
raffic: arg_migrateTraffic).then(unittest.expectAsync(((api.Operation response)
{ |
| 1827 checkOperation(response); |
| 1828 }))); |
| 1829 }); |
| 1830 |
| 1831 }); |
| 1832 |
| 1833 |
| 1834 unittest.group("resource-AppsModulesVersionsResourceApi", () { |
| 1835 unittest.test("method--create", () { |
| 1836 |
| 1837 var mock = new HttpServerMock(); |
| 1838 api.AppsModulesVersionsResourceApi res = new api.AppengineApi(mock).apps.m
odules.versions; |
| 1839 var arg_request = buildVersion(); |
| 1840 var arg_appsId = "foo"; |
| 1841 var arg_modulesId = "foo"; |
| 1842 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1843 var obj = new api.Version.fromJson(json); |
| 1844 checkVersion(obj); |
| 1845 |
| 1846 var path = (req.url).path; |
| 1847 var pathOffset = 0; |
| 1848 var index; |
| 1849 var subPart; |
| 1850 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1851 pathOffset += 1; |
| 1852 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1853 pathOffset += 13; |
| 1854 index = path.indexOf("/modules/", pathOffset); |
| 1855 unittest.expect(index >= 0, unittest.isTrue); |
| 1856 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1857 pathOffset = index; |
| 1858 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1859 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1860 pathOffset += 9; |
| 1861 index = path.indexOf("/versions", pathOffset); |
| 1862 unittest.expect(index >= 0, unittest.isTrue); |
| 1863 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1864 pathOffset = index; |
| 1865 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1866 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/versions")); |
| 1867 pathOffset += 9; |
| 1868 |
| 1869 var query = (req.url).query; |
| 1870 var queryOffset = 0; |
| 1871 var queryMap = {}; |
| 1872 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1873 parseBool(n) { |
| 1874 if (n == "true") return true; |
| 1875 if (n == "false") return false; |
| 1876 if (n == null) return null; |
| 1877 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1878 } |
| 1879 if (query.length > 0) { |
| 1880 for (var part in query.split("&")) { |
| 1881 var keyvalue = part.split("="); |
| 1882 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1883 } |
| 1884 } |
| 1885 |
| 1886 |
| 1887 var h = { |
| 1888 "content-type" : "application/json; charset=utf-8", |
| 1889 }; |
| 1890 var resp = convert.JSON.encode(buildOperation()); |
| 1891 return new async.Future.value(stringResponse(200, h, resp)); |
| 1892 }), true); |
| 1893 res.create(arg_request, arg_appsId, arg_modulesId).then(unittest.expectAsy
nc(((api.Operation response) { |
| 1894 checkOperation(response); |
| 1895 }))); |
| 1896 }); |
| 1897 |
| 1898 unittest.test("method--delete", () { |
| 1899 |
| 1900 var mock = new HttpServerMock(); |
| 1901 api.AppsModulesVersionsResourceApi res = new api.AppengineApi(mock).apps.m
odules.versions; |
| 1902 var arg_appsId = "foo"; |
| 1903 var arg_modulesId = "foo"; |
| 1904 var arg_versionsId = "foo"; |
| 1905 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1906 var path = (req.url).path; |
| 1907 var pathOffset = 0; |
| 1908 var index; |
| 1909 var subPart; |
| 1910 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1911 pathOffset += 1; |
| 1912 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1913 pathOffset += 13; |
| 1914 index = path.indexOf("/modules/", pathOffset); |
| 1915 unittest.expect(index >= 0, unittest.isTrue); |
| 1916 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1917 pathOffset = index; |
| 1918 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1919 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1920 pathOffset += 9; |
| 1921 index = path.indexOf("/versions/", pathOffset); |
| 1922 unittest.expect(index >= 0, unittest.isTrue); |
| 1923 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1924 pathOffset = index; |
| 1925 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1926 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/versions/")); |
| 1927 pathOffset += 10; |
| 1928 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1929 pathOffset = path.length; |
| 1930 unittest.expect(subPart, unittest.equals("$arg_versionsId")); |
| 1931 |
| 1932 var query = (req.url).query; |
| 1933 var queryOffset = 0; |
| 1934 var queryMap = {}; |
| 1935 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1936 parseBool(n) { |
| 1937 if (n == "true") return true; |
| 1938 if (n == "false") return false; |
| 1939 if (n == null) return null; |
| 1940 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1941 } |
| 1942 if (query.length > 0) { |
| 1943 for (var part in query.split("&")) { |
| 1944 var keyvalue = part.split("="); |
| 1945 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1946 } |
| 1947 } |
| 1948 |
| 1949 |
| 1950 var h = { |
| 1951 "content-type" : "application/json; charset=utf-8", |
| 1952 }; |
| 1953 var resp = convert.JSON.encode(buildOperation()); |
| 1954 return new async.Future.value(stringResponse(200, h, resp)); |
| 1955 }), true); |
| 1956 res.delete(arg_appsId, arg_modulesId, arg_versionsId).then(unittest.expect
Async(((api.Operation response) { |
| 1957 checkOperation(response); |
| 1958 }))); |
| 1959 }); |
| 1960 |
| 1961 unittest.test("method--get", () { |
| 1962 |
| 1963 var mock = new HttpServerMock(); |
| 1964 api.AppsModulesVersionsResourceApi res = new api.AppengineApi(mock).apps.m
odules.versions; |
| 1965 var arg_appsId = "foo"; |
| 1966 var arg_modulesId = "foo"; |
| 1967 var arg_versionsId = "foo"; |
| 1968 var arg_view = "foo"; |
| 1969 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1970 var path = (req.url).path; |
| 1971 var pathOffset = 0; |
| 1972 var index; |
| 1973 var subPart; |
| 1974 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1975 pathOffset += 1; |
| 1976 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 1977 pathOffset += 13; |
| 1978 index = path.indexOf("/modules/", pathOffset); |
| 1979 unittest.expect(index >= 0, unittest.isTrue); |
| 1980 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1981 pathOffset = index; |
| 1982 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 1983 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 1984 pathOffset += 9; |
| 1985 index = path.indexOf("/versions/", pathOffset); |
| 1986 unittest.expect(index >= 0, unittest.isTrue); |
| 1987 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1988 pathOffset = index; |
| 1989 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 1990 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/versions/")); |
| 1991 pathOffset += 10; |
| 1992 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1993 pathOffset = path.length; |
| 1994 unittest.expect(subPart, unittest.equals("$arg_versionsId")); |
| 1995 |
| 1996 var query = (req.url).query; |
| 1997 var queryOffset = 0; |
| 1998 var queryMap = {}; |
| 1999 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2000 parseBool(n) { |
| 2001 if (n == "true") return true; |
| 2002 if (n == "false") return false; |
| 2003 if (n == null) return null; |
| 2004 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2005 } |
| 2006 if (query.length > 0) { |
| 2007 for (var part in query.split("&")) { |
| 2008 var keyvalue = part.split("="); |
| 2009 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2010 } |
| 2011 } |
| 2012 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 2013 |
| 2014 |
| 2015 var h = { |
| 2016 "content-type" : "application/json; charset=utf-8", |
| 2017 }; |
| 2018 var resp = convert.JSON.encode(buildVersion()); |
| 2019 return new async.Future.value(stringResponse(200, h, resp)); |
| 2020 }), true); |
| 2021 res.get(arg_appsId, arg_modulesId, arg_versionsId, view: arg_view).then(un
ittest.expectAsync(((api.Version response) { |
| 2022 checkVersion(response); |
| 2023 }))); |
| 2024 }); |
| 2025 |
| 2026 unittest.test("method--list", () { |
| 2027 |
| 2028 var mock = new HttpServerMock(); |
| 2029 api.AppsModulesVersionsResourceApi res = new api.AppengineApi(mock).apps.m
odules.versions; |
| 2030 var arg_appsId = "foo"; |
| 2031 var arg_modulesId = "foo"; |
| 2032 var arg_view = "foo"; |
| 2033 var arg_pageSize = 42; |
| 2034 var arg_pageToken = "foo"; |
| 2035 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2036 var path = (req.url).path; |
| 2037 var pathOffset = 0; |
| 2038 var index; |
| 2039 var subPart; |
| 2040 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2041 pathOffset += 1; |
| 2042 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 2043 pathOffset += 13; |
| 2044 index = path.indexOf("/modules/", pathOffset); |
| 2045 unittest.expect(index >= 0, unittest.isTrue); |
| 2046 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2047 pathOffset = index; |
| 2048 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 2049 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/modules/")); |
| 2050 pathOffset += 9; |
| 2051 index = path.indexOf("/versions", pathOffset); |
| 2052 unittest.expect(index >= 0, unittest.isTrue); |
| 2053 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2054 pathOffset = index; |
| 2055 unittest.expect(subPart, unittest.equals("$arg_modulesId")); |
| 2056 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/versions")); |
| 2057 pathOffset += 9; |
| 2058 |
| 2059 var query = (req.url).query; |
| 2060 var queryOffset = 0; |
| 2061 var queryMap = {}; |
| 2062 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2063 parseBool(n) { |
| 2064 if (n == "true") return true; |
| 2065 if (n == "false") return false; |
| 2066 if (n == null) return null; |
| 2067 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2068 } |
| 2069 if (query.length > 0) { |
| 2070 for (var part in query.split("&")) { |
| 2071 var keyvalue = part.split("="); |
| 2072 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2073 } |
| 2074 } |
| 2075 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 2076 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 2077 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2078 |
| 2079 |
| 2080 var h = { |
| 2081 "content-type" : "application/json; charset=utf-8", |
| 2082 }; |
| 2083 var resp = convert.JSON.encode(buildListVersionsResponse()); |
| 2084 return new async.Future.value(stringResponse(200, h, resp)); |
| 2085 }), true); |
| 2086 res.list(arg_appsId, arg_modulesId, view: arg_view, pageSize: arg_pageSize
, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListVersionsResponse
response) { |
| 2087 checkListVersionsResponse(response); |
| 2088 }))); |
| 2089 }); |
| 2090 |
| 2091 }); |
| 2092 |
| 2093 |
| 2094 unittest.group("resource-AppsOperationsResourceApi", () { |
| 2095 unittest.test("method--get", () { |
| 2096 |
| 2097 var mock = new HttpServerMock(); |
| 2098 api.AppsOperationsResourceApi res = new api.AppengineApi(mock).apps.operat
ions; |
| 2099 var arg_appsId = "foo"; |
| 2100 var arg_operationsId = "foo"; |
| 2101 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2102 var path = (req.url).path; |
| 2103 var pathOffset = 0; |
| 2104 var index; |
| 2105 var subPart; |
| 2106 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2107 pathOffset += 1; |
| 2108 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 2109 pathOffset += 13; |
| 2110 index = path.indexOf("/operations/", pathOffset); |
| 2111 unittest.expect(index >= 0, unittest.isTrue); |
| 2112 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2113 pathOffset = index; |
| 2114 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 2115 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/operations/")); |
| 2116 pathOffset += 12; |
| 2117 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2118 pathOffset = path.length; |
| 2119 unittest.expect(subPart, unittest.equals("$arg_operationsId")); |
| 2120 |
| 2121 var query = (req.url).query; |
| 2122 var queryOffset = 0; |
| 2123 var queryMap = {}; |
| 2124 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2125 parseBool(n) { |
| 2126 if (n == "true") return true; |
| 2127 if (n == "false") return false; |
| 2128 if (n == null) return null; |
| 2129 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2130 } |
| 2131 if (query.length > 0) { |
| 2132 for (var part in query.split("&")) { |
| 2133 var keyvalue = part.split("="); |
| 2134 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2135 } |
| 2136 } |
| 2137 |
| 2138 |
| 2139 var h = { |
| 2140 "content-type" : "application/json; charset=utf-8", |
| 2141 }; |
| 2142 var resp = convert.JSON.encode(buildOperation()); |
| 2143 return new async.Future.value(stringResponse(200, h, resp)); |
| 2144 }), true); |
| 2145 res.get(arg_appsId, arg_operationsId).then(unittest.expectAsync(((api.Oper
ation response) { |
| 2146 checkOperation(response); |
| 2147 }))); |
| 2148 }); |
| 2149 |
| 2150 unittest.test("method--list", () { |
| 2151 |
| 2152 var mock = new HttpServerMock(); |
| 2153 api.AppsOperationsResourceApi res = new api.AppengineApi(mock).apps.operat
ions; |
| 2154 var arg_appsId = "foo"; |
| 2155 var arg_filter = "foo"; |
| 2156 var arg_pageSize = 42; |
| 2157 var arg_pageToken = "foo"; |
| 2158 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2159 var path = (req.url).path; |
| 2160 var pathOffset = 0; |
| 2161 var index; |
| 2162 var subPart; |
| 2163 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2164 pathOffset += 1; |
| 2165 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1beta4/apps/")); |
| 2166 pathOffset += 13; |
| 2167 index = path.indexOf("/operations", pathOffset); |
| 2168 unittest.expect(index >= 0, unittest.isTrue); |
| 2169 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2170 pathOffset = index; |
| 2171 unittest.expect(subPart, unittest.equals("$arg_appsId")); |
| 2172 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/operations")); |
| 2173 pathOffset += 11; |
| 2174 |
| 2175 var query = (req.url).query; |
| 2176 var queryOffset = 0; |
| 2177 var queryMap = {}; |
| 2178 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2179 parseBool(n) { |
| 2180 if (n == "true") return true; |
| 2181 if (n == "false") return false; |
| 2182 if (n == null) return null; |
| 2183 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2184 } |
| 2185 if (query.length > 0) { |
| 2186 for (var part in query.split("&")) { |
| 2187 var keyvalue = part.split("="); |
| 2188 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2189 } |
| 2190 } |
| 2191 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 2192 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 2193 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2194 |
| 2195 |
| 2196 var h = { |
| 2197 "content-type" : "application/json; charset=utf-8", |
| 2198 }; |
| 2199 var resp = convert.JSON.encode(buildListOperationsResponse()); |
| 2200 return new async.Future.value(stringResponse(200, h, resp)); |
| 2201 }), true); |
| 2202 res.list(arg_appsId, filter: arg_filter, pageSize: arg_pageSize, pageToken
: arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse response
) { |
| 2203 checkListOperationsResponse(response); |
| 2204 }))); |
| 2205 }); |
| 2206 |
| 2207 }); |
| 2208 |
| 2209 |
| 2210 } |
| 2211 |
OLD | NEW |