OLD | NEW |
(Empty) | |
| 1 library googleapis_beta.sqladmin.v1beta3.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_beta/common/common.dart' as common; |
| 12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; |
| 13 import '../common/common_internal_test.dart' as common_test; |
| 14 |
| 15 import 'package:googleapis_beta/sqladmin/v1beta3.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterBackupConfiguration = 0; |
| 20 buildBackupConfiguration() { |
| 21 var o = new api.BackupConfiguration(); |
| 22 buildCounterBackupConfiguration++; |
| 23 if (buildCounterBackupConfiguration < 3) { |
| 24 o.binaryLogEnabled = true; |
| 25 o.enabled = true; |
| 26 o.id = "foo"; |
| 27 o.kind = "foo"; |
| 28 o.startTime = "foo"; |
| 29 } |
| 30 buildCounterBackupConfiguration--; |
| 31 return o; |
| 32 } |
| 33 |
| 34 checkBackupConfiguration(api.BackupConfiguration o) { |
| 35 buildCounterBackupConfiguration++; |
| 36 if (buildCounterBackupConfiguration < 3) { |
| 37 unittest.expect(o.binaryLogEnabled, unittest.isTrue); |
| 38 unittest.expect(o.enabled, unittest.isTrue); |
| 39 unittest.expect(o.id, unittest.equals('foo')); |
| 40 unittest.expect(o.kind, unittest.equals('foo')); |
| 41 unittest.expect(o.startTime, unittest.equals('foo')); |
| 42 } |
| 43 buildCounterBackupConfiguration--; |
| 44 } |
| 45 |
| 46 core.int buildCounterBackupRun = 0; |
| 47 buildBackupRun() { |
| 48 var o = new api.BackupRun(); |
| 49 buildCounterBackupRun++; |
| 50 if (buildCounterBackupRun < 3) { |
| 51 o.backupConfiguration = "foo"; |
| 52 o.dueTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 53 o.endTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 54 o.enqueuedTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 55 o.error = buildOperationError(); |
| 56 o.instance = "foo"; |
| 57 o.kind = "foo"; |
| 58 o.startTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 59 o.status = "foo"; |
| 60 } |
| 61 buildCounterBackupRun--; |
| 62 return o; |
| 63 } |
| 64 |
| 65 checkBackupRun(api.BackupRun o) { |
| 66 buildCounterBackupRun++; |
| 67 if (buildCounterBackupRun < 3) { |
| 68 unittest.expect(o.backupConfiguration, unittest.equals('foo')); |
| 69 unittest.expect(o.dueTime, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); |
| 70 unittest.expect(o.endTime, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); |
| 71 unittest.expect(o.enqueuedTime, unittest.equals(core.DateTime.parse("2002-02
-27T14:01:02"))); |
| 72 checkOperationError(o.error); |
| 73 unittest.expect(o.instance, unittest.equals('foo')); |
| 74 unittest.expect(o.kind, unittest.equals('foo')); |
| 75 unittest.expect(o.startTime, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); |
| 76 unittest.expect(o.status, unittest.equals('foo')); |
| 77 } |
| 78 buildCounterBackupRun--; |
| 79 } |
| 80 |
| 81 buildUnnamed1033() { |
| 82 var o = new core.List<api.BackupRun>(); |
| 83 o.add(buildBackupRun()); |
| 84 o.add(buildBackupRun()); |
| 85 return o; |
| 86 } |
| 87 |
| 88 checkUnnamed1033(core.List<api.BackupRun> o) { |
| 89 unittest.expect(o, unittest.hasLength(2)); |
| 90 checkBackupRun(o[0]); |
| 91 checkBackupRun(o[1]); |
| 92 } |
| 93 |
| 94 core.int buildCounterBackupRunsListResponse = 0; |
| 95 buildBackupRunsListResponse() { |
| 96 var o = new api.BackupRunsListResponse(); |
| 97 buildCounterBackupRunsListResponse++; |
| 98 if (buildCounterBackupRunsListResponse < 3) { |
| 99 o.items = buildUnnamed1033(); |
| 100 o.kind = "foo"; |
| 101 o.nextPageToken = "foo"; |
| 102 } |
| 103 buildCounterBackupRunsListResponse--; |
| 104 return o; |
| 105 } |
| 106 |
| 107 checkBackupRunsListResponse(api.BackupRunsListResponse o) { |
| 108 buildCounterBackupRunsListResponse++; |
| 109 if (buildCounterBackupRunsListResponse < 3) { |
| 110 checkUnnamed1033(o.items); |
| 111 unittest.expect(o.kind, unittest.equals('foo')); |
| 112 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 113 } |
| 114 buildCounterBackupRunsListResponse--; |
| 115 } |
| 116 |
| 117 core.int buildCounterBinLogCoordinates = 0; |
| 118 buildBinLogCoordinates() { |
| 119 var o = new api.BinLogCoordinates(); |
| 120 buildCounterBinLogCoordinates++; |
| 121 if (buildCounterBinLogCoordinates < 3) { |
| 122 o.binLogFileName = "foo"; |
| 123 o.binLogPosition = "foo"; |
| 124 o.kind = "foo"; |
| 125 } |
| 126 buildCounterBinLogCoordinates--; |
| 127 return o; |
| 128 } |
| 129 |
| 130 checkBinLogCoordinates(api.BinLogCoordinates o) { |
| 131 buildCounterBinLogCoordinates++; |
| 132 if (buildCounterBinLogCoordinates < 3) { |
| 133 unittest.expect(o.binLogFileName, unittest.equals('foo')); |
| 134 unittest.expect(o.binLogPosition, unittest.equals('foo')); |
| 135 unittest.expect(o.kind, unittest.equals('foo')); |
| 136 } |
| 137 buildCounterBinLogCoordinates--; |
| 138 } |
| 139 |
| 140 core.int buildCounterCloneContext = 0; |
| 141 buildCloneContext() { |
| 142 var o = new api.CloneContext(); |
| 143 buildCounterCloneContext++; |
| 144 if (buildCounterCloneContext < 3) { |
| 145 o.binLogCoordinates = buildBinLogCoordinates(); |
| 146 o.destinationInstanceName = "foo"; |
| 147 o.kind = "foo"; |
| 148 o.sourceInstanceName = "foo"; |
| 149 } |
| 150 buildCounterCloneContext--; |
| 151 return o; |
| 152 } |
| 153 |
| 154 checkCloneContext(api.CloneContext o) { |
| 155 buildCounterCloneContext++; |
| 156 if (buildCounterCloneContext < 3) { |
| 157 checkBinLogCoordinates(o.binLogCoordinates); |
| 158 unittest.expect(o.destinationInstanceName, unittest.equals('foo')); |
| 159 unittest.expect(o.kind, unittest.equals('foo')); |
| 160 unittest.expect(o.sourceInstanceName, unittest.equals('foo')); |
| 161 } |
| 162 buildCounterCloneContext--; |
| 163 } |
| 164 |
| 165 core.int buildCounterDatabaseFlags = 0; |
| 166 buildDatabaseFlags() { |
| 167 var o = new api.DatabaseFlags(); |
| 168 buildCounterDatabaseFlags++; |
| 169 if (buildCounterDatabaseFlags < 3) { |
| 170 o.name = "foo"; |
| 171 o.value = "foo"; |
| 172 } |
| 173 buildCounterDatabaseFlags--; |
| 174 return o; |
| 175 } |
| 176 |
| 177 checkDatabaseFlags(api.DatabaseFlags o) { |
| 178 buildCounterDatabaseFlags++; |
| 179 if (buildCounterDatabaseFlags < 3) { |
| 180 unittest.expect(o.name, unittest.equals('foo')); |
| 181 unittest.expect(o.value, unittest.equals('foo')); |
| 182 } |
| 183 buildCounterDatabaseFlags--; |
| 184 } |
| 185 |
| 186 buildUnnamed1034() { |
| 187 var o = new core.List<api.IpMapping>(); |
| 188 o.add(buildIpMapping()); |
| 189 o.add(buildIpMapping()); |
| 190 return o; |
| 191 } |
| 192 |
| 193 checkUnnamed1034(core.List<api.IpMapping> o) { |
| 194 unittest.expect(o, unittest.hasLength(2)); |
| 195 checkIpMapping(o[0]); |
| 196 checkIpMapping(o[1]); |
| 197 } |
| 198 |
| 199 buildUnnamed1035() { |
| 200 var o = new core.List<core.String>(); |
| 201 o.add("foo"); |
| 202 o.add("foo"); |
| 203 return o; |
| 204 } |
| 205 |
| 206 checkUnnamed1035(core.List<core.String> o) { |
| 207 unittest.expect(o, unittest.hasLength(2)); |
| 208 unittest.expect(o[0], unittest.equals('foo')); |
| 209 unittest.expect(o[1], unittest.equals('foo')); |
| 210 } |
| 211 |
| 212 core.int buildCounterDatabaseInstance = 0; |
| 213 buildDatabaseInstance() { |
| 214 var o = new api.DatabaseInstance(); |
| 215 buildCounterDatabaseInstance++; |
| 216 if (buildCounterDatabaseInstance < 3) { |
| 217 o.currentDiskSize = "foo"; |
| 218 o.databaseVersion = "foo"; |
| 219 o.etag = "foo"; |
| 220 o.instance = "foo"; |
| 221 o.instanceType = "foo"; |
| 222 o.ipAddresses = buildUnnamed1034(); |
| 223 o.kind = "foo"; |
| 224 o.masterInstanceName = "foo"; |
| 225 o.maxDiskSize = "foo"; |
| 226 o.project = "foo"; |
| 227 o.region = "foo"; |
| 228 o.replicaNames = buildUnnamed1035(); |
| 229 o.serverCaCert = buildSslCert(); |
| 230 o.settings = buildSettings(); |
| 231 o.state = "foo"; |
| 232 } |
| 233 buildCounterDatabaseInstance--; |
| 234 return o; |
| 235 } |
| 236 |
| 237 checkDatabaseInstance(api.DatabaseInstance o) { |
| 238 buildCounterDatabaseInstance++; |
| 239 if (buildCounterDatabaseInstance < 3) { |
| 240 unittest.expect(o.currentDiskSize, unittest.equals('foo')); |
| 241 unittest.expect(o.databaseVersion, unittest.equals('foo')); |
| 242 unittest.expect(o.etag, unittest.equals('foo')); |
| 243 unittest.expect(o.instance, unittest.equals('foo')); |
| 244 unittest.expect(o.instanceType, unittest.equals('foo')); |
| 245 checkUnnamed1034(o.ipAddresses); |
| 246 unittest.expect(o.kind, unittest.equals('foo')); |
| 247 unittest.expect(o.masterInstanceName, unittest.equals('foo')); |
| 248 unittest.expect(o.maxDiskSize, unittest.equals('foo')); |
| 249 unittest.expect(o.project, unittest.equals('foo')); |
| 250 unittest.expect(o.region, unittest.equals('foo')); |
| 251 checkUnnamed1035(o.replicaNames); |
| 252 checkSslCert(o.serverCaCert); |
| 253 checkSettings(o.settings); |
| 254 unittest.expect(o.state, unittest.equals('foo')); |
| 255 } |
| 256 buildCounterDatabaseInstance--; |
| 257 } |
| 258 |
| 259 buildUnnamed1036() { |
| 260 var o = new core.List<core.String>(); |
| 261 o.add("foo"); |
| 262 o.add("foo"); |
| 263 return o; |
| 264 } |
| 265 |
| 266 checkUnnamed1036(core.List<core.String> o) { |
| 267 unittest.expect(o, unittest.hasLength(2)); |
| 268 unittest.expect(o[0], unittest.equals('foo')); |
| 269 unittest.expect(o[1], unittest.equals('foo')); |
| 270 } |
| 271 |
| 272 buildUnnamed1037() { |
| 273 var o = new core.List<core.String>(); |
| 274 o.add("foo"); |
| 275 o.add("foo"); |
| 276 return o; |
| 277 } |
| 278 |
| 279 checkUnnamed1037(core.List<core.String> o) { |
| 280 unittest.expect(o, unittest.hasLength(2)); |
| 281 unittest.expect(o[0], unittest.equals('foo')); |
| 282 unittest.expect(o[1], unittest.equals('foo')); |
| 283 } |
| 284 |
| 285 core.int buildCounterExportContext = 0; |
| 286 buildExportContext() { |
| 287 var o = new api.ExportContext(); |
| 288 buildCounterExportContext++; |
| 289 if (buildCounterExportContext < 3) { |
| 290 o.database = buildUnnamed1036(); |
| 291 o.kind = "foo"; |
| 292 o.table = buildUnnamed1037(); |
| 293 o.uri = "foo"; |
| 294 } |
| 295 buildCounterExportContext--; |
| 296 return o; |
| 297 } |
| 298 |
| 299 checkExportContext(api.ExportContext o) { |
| 300 buildCounterExportContext++; |
| 301 if (buildCounterExportContext < 3) { |
| 302 checkUnnamed1036(o.database); |
| 303 unittest.expect(o.kind, unittest.equals('foo')); |
| 304 checkUnnamed1037(o.table); |
| 305 unittest.expect(o.uri, unittest.equals('foo')); |
| 306 } |
| 307 buildCounterExportContext--; |
| 308 } |
| 309 |
| 310 buildUnnamed1038() { |
| 311 var o = new core.List<core.String>(); |
| 312 o.add("foo"); |
| 313 o.add("foo"); |
| 314 return o; |
| 315 } |
| 316 |
| 317 checkUnnamed1038(core.List<core.String> o) { |
| 318 unittest.expect(o, unittest.hasLength(2)); |
| 319 unittest.expect(o[0], unittest.equals('foo')); |
| 320 unittest.expect(o[1], unittest.equals('foo')); |
| 321 } |
| 322 |
| 323 buildUnnamed1039() { |
| 324 var o = new core.List<core.String>(); |
| 325 o.add("foo"); |
| 326 o.add("foo"); |
| 327 return o; |
| 328 } |
| 329 |
| 330 checkUnnamed1039(core.List<core.String> o) { |
| 331 unittest.expect(o, unittest.hasLength(2)); |
| 332 unittest.expect(o[0], unittest.equals('foo')); |
| 333 unittest.expect(o[1], unittest.equals('foo')); |
| 334 } |
| 335 |
| 336 core.int buildCounterFlag = 0; |
| 337 buildFlag() { |
| 338 var o = new api.Flag(); |
| 339 buildCounterFlag++; |
| 340 if (buildCounterFlag < 3) { |
| 341 o.allowedStringValues = buildUnnamed1038(); |
| 342 o.appliesTo = buildUnnamed1039(); |
| 343 o.kind = "foo"; |
| 344 o.maxValue = "foo"; |
| 345 o.minValue = "foo"; |
| 346 o.name = "foo"; |
| 347 o.type = "foo"; |
| 348 } |
| 349 buildCounterFlag--; |
| 350 return o; |
| 351 } |
| 352 |
| 353 checkFlag(api.Flag o) { |
| 354 buildCounterFlag++; |
| 355 if (buildCounterFlag < 3) { |
| 356 checkUnnamed1038(o.allowedStringValues); |
| 357 checkUnnamed1039(o.appliesTo); |
| 358 unittest.expect(o.kind, unittest.equals('foo')); |
| 359 unittest.expect(o.maxValue, unittest.equals('foo')); |
| 360 unittest.expect(o.minValue, unittest.equals('foo')); |
| 361 unittest.expect(o.name, unittest.equals('foo')); |
| 362 unittest.expect(o.type, unittest.equals('foo')); |
| 363 } |
| 364 buildCounterFlag--; |
| 365 } |
| 366 |
| 367 buildUnnamed1040() { |
| 368 var o = new core.List<api.Flag>(); |
| 369 o.add(buildFlag()); |
| 370 o.add(buildFlag()); |
| 371 return o; |
| 372 } |
| 373 |
| 374 checkUnnamed1040(core.List<api.Flag> o) { |
| 375 unittest.expect(o, unittest.hasLength(2)); |
| 376 checkFlag(o[0]); |
| 377 checkFlag(o[1]); |
| 378 } |
| 379 |
| 380 core.int buildCounterFlagsListResponse = 0; |
| 381 buildFlagsListResponse() { |
| 382 var o = new api.FlagsListResponse(); |
| 383 buildCounterFlagsListResponse++; |
| 384 if (buildCounterFlagsListResponse < 3) { |
| 385 o.items = buildUnnamed1040(); |
| 386 o.kind = "foo"; |
| 387 } |
| 388 buildCounterFlagsListResponse--; |
| 389 return o; |
| 390 } |
| 391 |
| 392 checkFlagsListResponse(api.FlagsListResponse o) { |
| 393 buildCounterFlagsListResponse++; |
| 394 if (buildCounterFlagsListResponse < 3) { |
| 395 checkUnnamed1040(o.items); |
| 396 unittest.expect(o.kind, unittest.equals('foo')); |
| 397 } |
| 398 buildCounterFlagsListResponse--; |
| 399 } |
| 400 |
| 401 buildUnnamed1041() { |
| 402 var o = new core.List<core.String>(); |
| 403 o.add("foo"); |
| 404 o.add("foo"); |
| 405 return o; |
| 406 } |
| 407 |
| 408 checkUnnamed1041(core.List<core.String> o) { |
| 409 unittest.expect(o, unittest.hasLength(2)); |
| 410 unittest.expect(o[0], unittest.equals('foo')); |
| 411 unittest.expect(o[1], unittest.equals('foo')); |
| 412 } |
| 413 |
| 414 core.int buildCounterImportContext = 0; |
| 415 buildImportContext() { |
| 416 var o = new api.ImportContext(); |
| 417 buildCounterImportContext++; |
| 418 if (buildCounterImportContext < 3) { |
| 419 o.database = "foo"; |
| 420 o.kind = "foo"; |
| 421 o.uri = buildUnnamed1041(); |
| 422 } |
| 423 buildCounterImportContext--; |
| 424 return o; |
| 425 } |
| 426 |
| 427 checkImportContext(api.ImportContext o) { |
| 428 buildCounterImportContext++; |
| 429 if (buildCounterImportContext < 3) { |
| 430 unittest.expect(o.database, unittest.equals('foo')); |
| 431 unittest.expect(o.kind, unittest.equals('foo')); |
| 432 checkUnnamed1041(o.uri); |
| 433 } |
| 434 buildCounterImportContext--; |
| 435 } |
| 436 |
| 437 buildUnnamed1042() { |
| 438 var o = new core.List<api.OperationError>(); |
| 439 o.add(buildOperationError()); |
| 440 o.add(buildOperationError()); |
| 441 return o; |
| 442 } |
| 443 |
| 444 checkUnnamed1042(core.List<api.OperationError> o) { |
| 445 unittest.expect(o, unittest.hasLength(2)); |
| 446 checkOperationError(o[0]); |
| 447 checkOperationError(o[1]); |
| 448 } |
| 449 |
| 450 core.int buildCounterInstanceOperation = 0; |
| 451 buildInstanceOperation() { |
| 452 var o = new api.InstanceOperation(); |
| 453 buildCounterInstanceOperation++; |
| 454 if (buildCounterInstanceOperation < 3) { |
| 455 o.endTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 456 o.enqueuedTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 457 o.error = buildUnnamed1042(); |
| 458 o.exportContext = buildExportContext(); |
| 459 o.importContext = buildImportContext(); |
| 460 o.instance = "foo"; |
| 461 o.kind = "foo"; |
| 462 o.operation = "foo"; |
| 463 o.operationType = "foo"; |
| 464 o.startTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 465 o.state = "foo"; |
| 466 o.userEmailAddress = "foo"; |
| 467 } |
| 468 buildCounterInstanceOperation--; |
| 469 return o; |
| 470 } |
| 471 |
| 472 checkInstanceOperation(api.InstanceOperation o) { |
| 473 buildCounterInstanceOperation++; |
| 474 if (buildCounterInstanceOperation < 3) { |
| 475 unittest.expect(o.endTime, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); |
| 476 unittest.expect(o.enqueuedTime, unittest.equals(core.DateTime.parse("2002-02
-27T14:01:02"))); |
| 477 checkUnnamed1042(o.error); |
| 478 checkExportContext(o.exportContext); |
| 479 checkImportContext(o.importContext); |
| 480 unittest.expect(o.instance, unittest.equals('foo')); |
| 481 unittest.expect(o.kind, unittest.equals('foo')); |
| 482 unittest.expect(o.operation, unittest.equals('foo')); |
| 483 unittest.expect(o.operationType, unittest.equals('foo')); |
| 484 unittest.expect(o.startTime, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); |
| 485 unittest.expect(o.state, unittest.equals('foo')); |
| 486 unittest.expect(o.userEmailAddress, unittest.equals('foo')); |
| 487 } |
| 488 buildCounterInstanceOperation--; |
| 489 } |
| 490 |
| 491 core.int buildCounterInstanceSetRootPasswordRequest = 0; |
| 492 buildInstanceSetRootPasswordRequest() { |
| 493 var o = new api.InstanceSetRootPasswordRequest(); |
| 494 buildCounterInstanceSetRootPasswordRequest++; |
| 495 if (buildCounterInstanceSetRootPasswordRequest < 3) { |
| 496 o.setRootPasswordContext = buildSetRootPasswordContext(); |
| 497 } |
| 498 buildCounterInstanceSetRootPasswordRequest--; |
| 499 return o; |
| 500 } |
| 501 |
| 502 checkInstanceSetRootPasswordRequest(api.InstanceSetRootPasswordRequest o) { |
| 503 buildCounterInstanceSetRootPasswordRequest++; |
| 504 if (buildCounterInstanceSetRootPasswordRequest < 3) { |
| 505 checkSetRootPasswordContext(o.setRootPasswordContext); |
| 506 } |
| 507 buildCounterInstanceSetRootPasswordRequest--; |
| 508 } |
| 509 |
| 510 core.int buildCounterInstancesCloneRequest = 0; |
| 511 buildInstancesCloneRequest() { |
| 512 var o = new api.InstancesCloneRequest(); |
| 513 buildCounterInstancesCloneRequest++; |
| 514 if (buildCounterInstancesCloneRequest < 3) { |
| 515 o.cloneContext = buildCloneContext(); |
| 516 } |
| 517 buildCounterInstancesCloneRequest--; |
| 518 return o; |
| 519 } |
| 520 |
| 521 checkInstancesCloneRequest(api.InstancesCloneRequest o) { |
| 522 buildCounterInstancesCloneRequest++; |
| 523 if (buildCounterInstancesCloneRequest < 3) { |
| 524 checkCloneContext(o.cloneContext); |
| 525 } |
| 526 buildCounterInstancesCloneRequest--; |
| 527 } |
| 528 |
| 529 core.int buildCounterInstancesCloneResponse = 0; |
| 530 buildInstancesCloneResponse() { |
| 531 var o = new api.InstancesCloneResponse(); |
| 532 buildCounterInstancesCloneResponse++; |
| 533 if (buildCounterInstancesCloneResponse < 3) { |
| 534 o.kind = "foo"; |
| 535 o.operation = "foo"; |
| 536 } |
| 537 buildCounterInstancesCloneResponse--; |
| 538 return o; |
| 539 } |
| 540 |
| 541 checkInstancesCloneResponse(api.InstancesCloneResponse o) { |
| 542 buildCounterInstancesCloneResponse++; |
| 543 if (buildCounterInstancesCloneResponse < 3) { |
| 544 unittest.expect(o.kind, unittest.equals('foo')); |
| 545 unittest.expect(o.operation, unittest.equals('foo')); |
| 546 } |
| 547 buildCounterInstancesCloneResponse--; |
| 548 } |
| 549 |
| 550 core.int buildCounterInstancesDeleteResponse = 0; |
| 551 buildInstancesDeleteResponse() { |
| 552 var o = new api.InstancesDeleteResponse(); |
| 553 buildCounterInstancesDeleteResponse++; |
| 554 if (buildCounterInstancesDeleteResponse < 3) { |
| 555 o.kind = "foo"; |
| 556 o.operation = "foo"; |
| 557 } |
| 558 buildCounterInstancesDeleteResponse--; |
| 559 return o; |
| 560 } |
| 561 |
| 562 checkInstancesDeleteResponse(api.InstancesDeleteResponse o) { |
| 563 buildCounterInstancesDeleteResponse++; |
| 564 if (buildCounterInstancesDeleteResponse < 3) { |
| 565 unittest.expect(o.kind, unittest.equals('foo')); |
| 566 unittest.expect(o.operation, unittest.equals('foo')); |
| 567 } |
| 568 buildCounterInstancesDeleteResponse--; |
| 569 } |
| 570 |
| 571 core.int buildCounterInstancesExportRequest = 0; |
| 572 buildInstancesExportRequest() { |
| 573 var o = new api.InstancesExportRequest(); |
| 574 buildCounterInstancesExportRequest++; |
| 575 if (buildCounterInstancesExportRequest < 3) { |
| 576 o.exportContext = buildExportContext(); |
| 577 } |
| 578 buildCounterInstancesExportRequest--; |
| 579 return o; |
| 580 } |
| 581 |
| 582 checkInstancesExportRequest(api.InstancesExportRequest o) { |
| 583 buildCounterInstancesExportRequest++; |
| 584 if (buildCounterInstancesExportRequest < 3) { |
| 585 checkExportContext(o.exportContext); |
| 586 } |
| 587 buildCounterInstancesExportRequest--; |
| 588 } |
| 589 |
| 590 core.int buildCounterInstancesExportResponse = 0; |
| 591 buildInstancesExportResponse() { |
| 592 var o = new api.InstancesExportResponse(); |
| 593 buildCounterInstancesExportResponse++; |
| 594 if (buildCounterInstancesExportResponse < 3) { |
| 595 o.kind = "foo"; |
| 596 o.operation = "foo"; |
| 597 } |
| 598 buildCounterInstancesExportResponse--; |
| 599 return o; |
| 600 } |
| 601 |
| 602 checkInstancesExportResponse(api.InstancesExportResponse o) { |
| 603 buildCounterInstancesExportResponse++; |
| 604 if (buildCounterInstancesExportResponse < 3) { |
| 605 unittest.expect(o.kind, unittest.equals('foo')); |
| 606 unittest.expect(o.operation, unittest.equals('foo')); |
| 607 } |
| 608 buildCounterInstancesExportResponse--; |
| 609 } |
| 610 |
| 611 core.int buildCounterInstancesImportRequest = 0; |
| 612 buildInstancesImportRequest() { |
| 613 var o = new api.InstancesImportRequest(); |
| 614 buildCounterInstancesImportRequest++; |
| 615 if (buildCounterInstancesImportRequest < 3) { |
| 616 o.importContext = buildImportContext(); |
| 617 } |
| 618 buildCounterInstancesImportRequest--; |
| 619 return o; |
| 620 } |
| 621 |
| 622 checkInstancesImportRequest(api.InstancesImportRequest o) { |
| 623 buildCounterInstancesImportRequest++; |
| 624 if (buildCounterInstancesImportRequest < 3) { |
| 625 checkImportContext(o.importContext); |
| 626 } |
| 627 buildCounterInstancesImportRequest--; |
| 628 } |
| 629 |
| 630 core.int buildCounterInstancesImportResponse = 0; |
| 631 buildInstancesImportResponse() { |
| 632 var o = new api.InstancesImportResponse(); |
| 633 buildCounterInstancesImportResponse++; |
| 634 if (buildCounterInstancesImportResponse < 3) { |
| 635 o.kind = "foo"; |
| 636 o.operation = "foo"; |
| 637 } |
| 638 buildCounterInstancesImportResponse--; |
| 639 return o; |
| 640 } |
| 641 |
| 642 checkInstancesImportResponse(api.InstancesImportResponse o) { |
| 643 buildCounterInstancesImportResponse++; |
| 644 if (buildCounterInstancesImportResponse < 3) { |
| 645 unittest.expect(o.kind, unittest.equals('foo')); |
| 646 unittest.expect(o.operation, unittest.equals('foo')); |
| 647 } |
| 648 buildCounterInstancesImportResponse--; |
| 649 } |
| 650 |
| 651 core.int buildCounterInstancesInsertResponse = 0; |
| 652 buildInstancesInsertResponse() { |
| 653 var o = new api.InstancesInsertResponse(); |
| 654 buildCounterInstancesInsertResponse++; |
| 655 if (buildCounterInstancesInsertResponse < 3) { |
| 656 o.kind = "foo"; |
| 657 o.operation = "foo"; |
| 658 } |
| 659 buildCounterInstancesInsertResponse--; |
| 660 return o; |
| 661 } |
| 662 |
| 663 checkInstancesInsertResponse(api.InstancesInsertResponse o) { |
| 664 buildCounterInstancesInsertResponse++; |
| 665 if (buildCounterInstancesInsertResponse < 3) { |
| 666 unittest.expect(o.kind, unittest.equals('foo')); |
| 667 unittest.expect(o.operation, unittest.equals('foo')); |
| 668 } |
| 669 buildCounterInstancesInsertResponse--; |
| 670 } |
| 671 |
| 672 buildUnnamed1043() { |
| 673 var o = new core.List<api.DatabaseInstance>(); |
| 674 o.add(buildDatabaseInstance()); |
| 675 o.add(buildDatabaseInstance()); |
| 676 return o; |
| 677 } |
| 678 |
| 679 checkUnnamed1043(core.List<api.DatabaseInstance> o) { |
| 680 unittest.expect(o, unittest.hasLength(2)); |
| 681 checkDatabaseInstance(o[0]); |
| 682 checkDatabaseInstance(o[1]); |
| 683 } |
| 684 |
| 685 core.int buildCounterInstancesListResponse = 0; |
| 686 buildInstancesListResponse() { |
| 687 var o = new api.InstancesListResponse(); |
| 688 buildCounterInstancesListResponse++; |
| 689 if (buildCounterInstancesListResponse < 3) { |
| 690 o.items = buildUnnamed1043(); |
| 691 o.kind = "foo"; |
| 692 o.nextPageToken = "foo"; |
| 693 } |
| 694 buildCounterInstancesListResponse--; |
| 695 return o; |
| 696 } |
| 697 |
| 698 checkInstancesListResponse(api.InstancesListResponse o) { |
| 699 buildCounterInstancesListResponse++; |
| 700 if (buildCounterInstancesListResponse < 3) { |
| 701 checkUnnamed1043(o.items); |
| 702 unittest.expect(o.kind, unittest.equals('foo')); |
| 703 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 704 } |
| 705 buildCounterInstancesListResponse--; |
| 706 } |
| 707 |
| 708 core.int buildCounterInstancesPromoteReplicaResponse = 0; |
| 709 buildInstancesPromoteReplicaResponse() { |
| 710 var o = new api.InstancesPromoteReplicaResponse(); |
| 711 buildCounterInstancesPromoteReplicaResponse++; |
| 712 if (buildCounterInstancesPromoteReplicaResponse < 3) { |
| 713 o.kind = "foo"; |
| 714 o.operation = "foo"; |
| 715 } |
| 716 buildCounterInstancesPromoteReplicaResponse--; |
| 717 return o; |
| 718 } |
| 719 |
| 720 checkInstancesPromoteReplicaResponse(api.InstancesPromoteReplicaResponse o) { |
| 721 buildCounterInstancesPromoteReplicaResponse++; |
| 722 if (buildCounterInstancesPromoteReplicaResponse < 3) { |
| 723 unittest.expect(o.kind, unittest.equals('foo')); |
| 724 unittest.expect(o.operation, unittest.equals('foo')); |
| 725 } |
| 726 buildCounterInstancesPromoteReplicaResponse--; |
| 727 } |
| 728 |
| 729 core.int buildCounterInstancesResetSslConfigResponse = 0; |
| 730 buildInstancesResetSslConfigResponse() { |
| 731 var o = new api.InstancesResetSslConfigResponse(); |
| 732 buildCounterInstancesResetSslConfigResponse++; |
| 733 if (buildCounterInstancesResetSslConfigResponse < 3) { |
| 734 o.kind = "foo"; |
| 735 o.operation = "foo"; |
| 736 } |
| 737 buildCounterInstancesResetSslConfigResponse--; |
| 738 return o; |
| 739 } |
| 740 |
| 741 checkInstancesResetSslConfigResponse(api.InstancesResetSslConfigResponse o) { |
| 742 buildCounterInstancesResetSslConfigResponse++; |
| 743 if (buildCounterInstancesResetSslConfigResponse < 3) { |
| 744 unittest.expect(o.kind, unittest.equals('foo')); |
| 745 unittest.expect(o.operation, unittest.equals('foo')); |
| 746 } |
| 747 buildCounterInstancesResetSslConfigResponse--; |
| 748 } |
| 749 |
| 750 core.int buildCounterInstancesRestartResponse = 0; |
| 751 buildInstancesRestartResponse() { |
| 752 var o = new api.InstancesRestartResponse(); |
| 753 buildCounterInstancesRestartResponse++; |
| 754 if (buildCounterInstancesRestartResponse < 3) { |
| 755 o.kind = "foo"; |
| 756 o.operation = "foo"; |
| 757 } |
| 758 buildCounterInstancesRestartResponse--; |
| 759 return o; |
| 760 } |
| 761 |
| 762 checkInstancesRestartResponse(api.InstancesRestartResponse o) { |
| 763 buildCounterInstancesRestartResponse++; |
| 764 if (buildCounterInstancesRestartResponse < 3) { |
| 765 unittest.expect(o.kind, unittest.equals('foo')); |
| 766 unittest.expect(o.operation, unittest.equals('foo')); |
| 767 } |
| 768 buildCounterInstancesRestartResponse--; |
| 769 } |
| 770 |
| 771 core.int buildCounterInstancesRestoreBackupResponse = 0; |
| 772 buildInstancesRestoreBackupResponse() { |
| 773 var o = new api.InstancesRestoreBackupResponse(); |
| 774 buildCounterInstancesRestoreBackupResponse++; |
| 775 if (buildCounterInstancesRestoreBackupResponse < 3) { |
| 776 o.kind = "foo"; |
| 777 o.operation = "foo"; |
| 778 } |
| 779 buildCounterInstancesRestoreBackupResponse--; |
| 780 return o; |
| 781 } |
| 782 |
| 783 checkInstancesRestoreBackupResponse(api.InstancesRestoreBackupResponse o) { |
| 784 buildCounterInstancesRestoreBackupResponse++; |
| 785 if (buildCounterInstancesRestoreBackupResponse < 3) { |
| 786 unittest.expect(o.kind, unittest.equals('foo')); |
| 787 unittest.expect(o.operation, unittest.equals('foo')); |
| 788 } |
| 789 buildCounterInstancesRestoreBackupResponse--; |
| 790 } |
| 791 |
| 792 core.int buildCounterInstancesSetRootPasswordResponse = 0; |
| 793 buildInstancesSetRootPasswordResponse() { |
| 794 var o = new api.InstancesSetRootPasswordResponse(); |
| 795 buildCounterInstancesSetRootPasswordResponse++; |
| 796 if (buildCounterInstancesSetRootPasswordResponse < 3) { |
| 797 o.kind = "foo"; |
| 798 o.operation = "foo"; |
| 799 } |
| 800 buildCounterInstancesSetRootPasswordResponse--; |
| 801 return o; |
| 802 } |
| 803 |
| 804 checkInstancesSetRootPasswordResponse(api.InstancesSetRootPasswordResponse o) { |
| 805 buildCounterInstancesSetRootPasswordResponse++; |
| 806 if (buildCounterInstancesSetRootPasswordResponse < 3) { |
| 807 unittest.expect(o.kind, unittest.equals('foo')); |
| 808 unittest.expect(o.operation, unittest.equals('foo')); |
| 809 } |
| 810 buildCounterInstancesSetRootPasswordResponse--; |
| 811 } |
| 812 |
| 813 core.int buildCounterInstancesUpdateResponse = 0; |
| 814 buildInstancesUpdateResponse() { |
| 815 var o = new api.InstancesUpdateResponse(); |
| 816 buildCounterInstancesUpdateResponse++; |
| 817 if (buildCounterInstancesUpdateResponse < 3) { |
| 818 o.kind = "foo"; |
| 819 o.operation = "foo"; |
| 820 } |
| 821 buildCounterInstancesUpdateResponse--; |
| 822 return o; |
| 823 } |
| 824 |
| 825 checkInstancesUpdateResponse(api.InstancesUpdateResponse o) { |
| 826 buildCounterInstancesUpdateResponse++; |
| 827 if (buildCounterInstancesUpdateResponse < 3) { |
| 828 unittest.expect(o.kind, unittest.equals('foo')); |
| 829 unittest.expect(o.operation, unittest.equals('foo')); |
| 830 } |
| 831 buildCounterInstancesUpdateResponse--; |
| 832 } |
| 833 |
| 834 buildUnnamed1044() { |
| 835 var o = new core.List<core.String>(); |
| 836 o.add("foo"); |
| 837 o.add("foo"); |
| 838 return o; |
| 839 } |
| 840 |
| 841 checkUnnamed1044(core.List<core.String> o) { |
| 842 unittest.expect(o, unittest.hasLength(2)); |
| 843 unittest.expect(o[0], unittest.equals('foo')); |
| 844 unittest.expect(o[1], unittest.equals('foo')); |
| 845 } |
| 846 |
| 847 core.int buildCounterIpConfiguration = 0; |
| 848 buildIpConfiguration() { |
| 849 var o = new api.IpConfiguration(); |
| 850 buildCounterIpConfiguration++; |
| 851 if (buildCounterIpConfiguration < 3) { |
| 852 o.authorizedNetworks = buildUnnamed1044(); |
| 853 o.enabled = true; |
| 854 o.requireSsl = true; |
| 855 } |
| 856 buildCounterIpConfiguration--; |
| 857 return o; |
| 858 } |
| 859 |
| 860 checkIpConfiguration(api.IpConfiguration o) { |
| 861 buildCounterIpConfiguration++; |
| 862 if (buildCounterIpConfiguration < 3) { |
| 863 checkUnnamed1044(o.authorizedNetworks); |
| 864 unittest.expect(o.enabled, unittest.isTrue); |
| 865 unittest.expect(o.requireSsl, unittest.isTrue); |
| 866 } |
| 867 buildCounterIpConfiguration--; |
| 868 } |
| 869 |
| 870 core.int buildCounterIpMapping = 0; |
| 871 buildIpMapping() { |
| 872 var o = new api.IpMapping(); |
| 873 buildCounterIpMapping++; |
| 874 if (buildCounterIpMapping < 3) { |
| 875 o.ipAddress = "foo"; |
| 876 o.timeToRetire = core.DateTime.parse("2002-02-27T14:01:02"); |
| 877 } |
| 878 buildCounterIpMapping--; |
| 879 return o; |
| 880 } |
| 881 |
| 882 checkIpMapping(api.IpMapping o) { |
| 883 buildCounterIpMapping++; |
| 884 if (buildCounterIpMapping < 3) { |
| 885 unittest.expect(o.ipAddress, unittest.equals('foo')); |
| 886 unittest.expect(o.timeToRetire, unittest.equals(core.DateTime.parse("2002-02
-27T14:01:02"))); |
| 887 } |
| 888 buildCounterIpMapping--; |
| 889 } |
| 890 |
| 891 core.int buildCounterLocationPreference = 0; |
| 892 buildLocationPreference() { |
| 893 var o = new api.LocationPreference(); |
| 894 buildCounterLocationPreference++; |
| 895 if (buildCounterLocationPreference < 3) { |
| 896 o.followGaeApplication = "foo"; |
| 897 o.kind = "foo"; |
| 898 o.zone = "foo"; |
| 899 } |
| 900 buildCounterLocationPreference--; |
| 901 return o; |
| 902 } |
| 903 |
| 904 checkLocationPreference(api.LocationPreference o) { |
| 905 buildCounterLocationPreference++; |
| 906 if (buildCounterLocationPreference < 3) { |
| 907 unittest.expect(o.followGaeApplication, unittest.equals('foo')); |
| 908 unittest.expect(o.kind, unittest.equals('foo')); |
| 909 unittest.expect(o.zone, unittest.equals('foo')); |
| 910 } |
| 911 buildCounterLocationPreference--; |
| 912 } |
| 913 |
| 914 core.int buildCounterOperationError = 0; |
| 915 buildOperationError() { |
| 916 var o = new api.OperationError(); |
| 917 buildCounterOperationError++; |
| 918 if (buildCounterOperationError < 3) { |
| 919 o.code = "foo"; |
| 920 o.kind = "foo"; |
| 921 } |
| 922 buildCounterOperationError--; |
| 923 return o; |
| 924 } |
| 925 |
| 926 checkOperationError(api.OperationError o) { |
| 927 buildCounterOperationError++; |
| 928 if (buildCounterOperationError < 3) { |
| 929 unittest.expect(o.code, unittest.equals('foo')); |
| 930 unittest.expect(o.kind, unittest.equals('foo')); |
| 931 } |
| 932 buildCounterOperationError--; |
| 933 } |
| 934 |
| 935 buildUnnamed1045() { |
| 936 var o = new core.List<api.InstanceOperation>(); |
| 937 o.add(buildInstanceOperation()); |
| 938 o.add(buildInstanceOperation()); |
| 939 return o; |
| 940 } |
| 941 |
| 942 checkUnnamed1045(core.List<api.InstanceOperation> o) { |
| 943 unittest.expect(o, unittest.hasLength(2)); |
| 944 checkInstanceOperation(o[0]); |
| 945 checkInstanceOperation(o[1]); |
| 946 } |
| 947 |
| 948 core.int buildCounterOperationsListResponse = 0; |
| 949 buildOperationsListResponse() { |
| 950 var o = new api.OperationsListResponse(); |
| 951 buildCounterOperationsListResponse++; |
| 952 if (buildCounterOperationsListResponse < 3) { |
| 953 o.items = buildUnnamed1045(); |
| 954 o.kind = "foo"; |
| 955 o.nextPageToken = "foo"; |
| 956 } |
| 957 buildCounterOperationsListResponse--; |
| 958 return o; |
| 959 } |
| 960 |
| 961 checkOperationsListResponse(api.OperationsListResponse o) { |
| 962 buildCounterOperationsListResponse++; |
| 963 if (buildCounterOperationsListResponse < 3) { |
| 964 checkUnnamed1045(o.items); |
| 965 unittest.expect(o.kind, unittest.equals('foo')); |
| 966 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 967 } |
| 968 buildCounterOperationsListResponse--; |
| 969 } |
| 970 |
| 971 core.int buildCounterSetRootPasswordContext = 0; |
| 972 buildSetRootPasswordContext() { |
| 973 var o = new api.SetRootPasswordContext(); |
| 974 buildCounterSetRootPasswordContext++; |
| 975 if (buildCounterSetRootPasswordContext < 3) { |
| 976 o.kind = "foo"; |
| 977 o.password = "foo"; |
| 978 } |
| 979 buildCounterSetRootPasswordContext--; |
| 980 return o; |
| 981 } |
| 982 |
| 983 checkSetRootPasswordContext(api.SetRootPasswordContext o) { |
| 984 buildCounterSetRootPasswordContext++; |
| 985 if (buildCounterSetRootPasswordContext < 3) { |
| 986 unittest.expect(o.kind, unittest.equals('foo')); |
| 987 unittest.expect(o.password, unittest.equals('foo')); |
| 988 } |
| 989 buildCounterSetRootPasswordContext--; |
| 990 } |
| 991 |
| 992 buildUnnamed1046() { |
| 993 var o = new core.List<core.String>(); |
| 994 o.add("foo"); |
| 995 o.add("foo"); |
| 996 return o; |
| 997 } |
| 998 |
| 999 checkUnnamed1046(core.List<core.String> o) { |
| 1000 unittest.expect(o, unittest.hasLength(2)); |
| 1001 unittest.expect(o[0], unittest.equals('foo')); |
| 1002 unittest.expect(o[1], unittest.equals('foo')); |
| 1003 } |
| 1004 |
| 1005 buildUnnamed1047() { |
| 1006 var o = new core.List<api.BackupConfiguration>(); |
| 1007 o.add(buildBackupConfiguration()); |
| 1008 o.add(buildBackupConfiguration()); |
| 1009 return o; |
| 1010 } |
| 1011 |
| 1012 checkUnnamed1047(core.List<api.BackupConfiguration> o) { |
| 1013 unittest.expect(o, unittest.hasLength(2)); |
| 1014 checkBackupConfiguration(o[0]); |
| 1015 checkBackupConfiguration(o[1]); |
| 1016 } |
| 1017 |
| 1018 buildUnnamed1048() { |
| 1019 var o = new core.List<api.DatabaseFlags>(); |
| 1020 o.add(buildDatabaseFlags()); |
| 1021 o.add(buildDatabaseFlags()); |
| 1022 return o; |
| 1023 } |
| 1024 |
| 1025 checkUnnamed1048(core.List<api.DatabaseFlags> o) { |
| 1026 unittest.expect(o, unittest.hasLength(2)); |
| 1027 checkDatabaseFlags(o[0]); |
| 1028 checkDatabaseFlags(o[1]); |
| 1029 } |
| 1030 |
| 1031 core.int buildCounterSettings = 0; |
| 1032 buildSettings() { |
| 1033 var o = new api.Settings(); |
| 1034 buildCounterSettings++; |
| 1035 if (buildCounterSettings < 3) { |
| 1036 o.activationPolicy = "foo"; |
| 1037 o.authorizedGaeApplications = buildUnnamed1046(); |
| 1038 o.backupConfiguration = buildUnnamed1047(); |
| 1039 o.databaseFlags = buildUnnamed1048(); |
| 1040 o.databaseReplicationEnabled = true; |
| 1041 o.ipConfiguration = buildIpConfiguration(); |
| 1042 o.kind = "foo"; |
| 1043 o.locationPreference = buildLocationPreference(); |
| 1044 o.pricingPlan = "foo"; |
| 1045 o.replicationType = "foo"; |
| 1046 o.settingsVersion = "foo"; |
| 1047 o.tier = "foo"; |
| 1048 } |
| 1049 buildCounterSettings--; |
| 1050 return o; |
| 1051 } |
| 1052 |
| 1053 checkSettings(api.Settings o) { |
| 1054 buildCounterSettings++; |
| 1055 if (buildCounterSettings < 3) { |
| 1056 unittest.expect(o.activationPolicy, unittest.equals('foo')); |
| 1057 checkUnnamed1046(o.authorizedGaeApplications); |
| 1058 checkUnnamed1047(o.backupConfiguration); |
| 1059 checkUnnamed1048(o.databaseFlags); |
| 1060 unittest.expect(o.databaseReplicationEnabled, unittest.isTrue); |
| 1061 checkIpConfiguration(o.ipConfiguration); |
| 1062 unittest.expect(o.kind, unittest.equals('foo')); |
| 1063 checkLocationPreference(o.locationPreference); |
| 1064 unittest.expect(o.pricingPlan, unittest.equals('foo')); |
| 1065 unittest.expect(o.replicationType, unittest.equals('foo')); |
| 1066 unittest.expect(o.settingsVersion, unittest.equals('foo')); |
| 1067 unittest.expect(o.tier, unittest.equals('foo')); |
| 1068 } |
| 1069 buildCounterSettings--; |
| 1070 } |
| 1071 |
| 1072 core.int buildCounterSslCert = 0; |
| 1073 buildSslCert() { |
| 1074 var o = new api.SslCert(); |
| 1075 buildCounterSslCert++; |
| 1076 if (buildCounterSslCert < 3) { |
| 1077 o.cert = "foo"; |
| 1078 o.certSerialNumber = "foo"; |
| 1079 o.commonName = "foo"; |
| 1080 o.createTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 1081 o.expirationTime = core.DateTime.parse("2002-02-27T14:01:02"); |
| 1082 o.instance = "foo"; |
| 1083 o.kind = "foo"; |
| 1084 o.sha1Fingerprint = "foo"; |
| 1085 } |
| 1086 buildCounterSslCert--; |
| 1087 return o; |
| 1088 } |
| 1089 |
| 1090 checkSslCert(api.SslCert o) { |
| 1091 buildCounterSslCert++; |
| 1092 if (buildCounterSslCert < 3) { |
| 1093 unittest.expect(o.cert, unittest.equals('foo')); |
| 1094 unittest.expect(o.certSerialNumber, unittest.equals('foo')); |
| 1095 unittest.expect(o.commonName, unittest.equals('foo')); |
| 1096 unittest.expect(o.createTime, unittest.equals(core.DateTime.parse("2002-02-2
7T14:01:02"))); |
| 1097 unittest.expect(o.expirationTime, unittest.equals(core.DateTime.parse("2002-
02-27T14:01:02"))); |
| 1098 unittest.expect(o.instance, unittest.equals('foo')); |
| 1099 unittest.expect(o.kind, unittest.equals('foo')); |
| 1100 unittest.expect(o.sha1Fingerprint, unittest.equals('foo')); |
| 1101 } |
| 1102 buildCounterSslCert--; |
| 1103 } |
| 1104 |
| 1105 core.int buildCounterSslCertDetail = 0; |
| 1106 buildSslCertDetail() { |
| 1107 var o = new api.SslCertDetail(); |
| 1108 buildCounterSslCertDetail++; |
| 1109 if (buildCounterSslCertDetail < 3) { |
| 1110 o.certInfo = buildSslCert(); |
| 1111 o.certPrivateKey = "foo"; |
| 1112 } |
| 1113 buildCounterSslCertDetail--; |
| 1114 return o; |
| 1115 } |
| 1116 |
| 1117 checkSslCertDetail(api.SslCertDetail o) { |
| 1118 buildCounterSslCertDetail++; |
| 1119 if (buildCounterSslCertDetail < 3) { |
| 1120 checkSslCert(o.certInfo); |
| 1121 unittest.expect(o.certPrivateKey, unittest.equals('foo')); |
| 1122 } |
| 1123 buildCounterSslCertDetail--; |
| 1124 } |
| 1125 |
| 1126 core.int buildCounterSslCertsDeleteResponse = 0; |
| 1127 buildSslCertsDeleteResponse() { |
| 1128 var o = new api.SslCertsDeleteResponse(); |
| 1129 buildCounterSslCertsDeleteResponse++; |
| 1130 if (buildCounterSslCertsDeleteResponse < 3) { |
| 1131 o.kind = "foo"; |
| 1132 o.operation = "foo"; |
| 1133 } |
| 1134 buildCounterSslCertsDeleteResponse--; |
| 1135 return o; |
| 1136 } |
| 1137 |
| 1138 checkSslCertsDeleteResponse(api.SslCertsDeleteResponse o) { |
| 1139 buildCounterSslCertsDeleteResponse++; |
| 1140 if (buildCounterSslCertsDeleteResponse < 3) { |
| 1141 unittest.expect(o.kind, unittest.equals('foo')); |
| 1142 unittest.expect(o.operation, unittest.equals('foo')); |
| 1143 } |
| 1144 buildCounterSslCertsDeleteResponse--; |
| 1145 } |
| 1146 |
| 1147 core.int buildCounterSslCertsInsertRequest = 0; |
| 1148 buildSslCertsInsertRequest() { |
| 1149 var o = new api.SslCertsInsertRequest(); |
| 1150 buildCounterSslCertsInsertRequest++; |
| 1151 if (buildCounterSslCertsInsertRequest < 3) { |
| 1152 o.commonName = "foo"; |
| 1153 } |
| 1154 buildCounterSslCertsInsertRequest--; |
| 1155 return o; |
| 1156 } |
| 1157 |
| 1158 checkSslCertsInsertRequest(api.SslCertsInsertRequest o) { |
| 1159 buildCounterSslCertsInsertRequest++; |
| 1160 if (buildCounterSslCertsInsertRequest < 3) { |
| 1161 unittest.expect(o.commonName, unittest.equals('foo')); |
| 1162 } |
| 1163 buildCounterSslCertsInsertRequest--; |
| 1164 } |
| 1165 |
| 1166 core.int buildCounterSslCertsInsertResponse = 0; |
| 1167 buildSslCertsInsertResponse() { |
| 1168 var o = new api.SslCertsInsertResponse(); |
| 1169 buildCounterSslCertsInsertResponse++; |
| 1170 if (buildCounterSslCertsInsertResponse < 3) { |
| 1171 o.clientCert = buildSslCertDetail(); |
| 1172 o.kind = "foo"; |
| 1173 o.serverCaCert = buildSslCert(); |
| 1174 } |
| 1175 buildCounterSslCertsInsertResponse--; |
| 1176 return o; |
| 1177 } |
| 1178 |
| 1179 checkSslCertsInsertResponse(api.SslCertsInsertResponse o) { |
| 1180 buildCounterSslCertsInsertResponse++; |
| 1181 if (buildCounterSslCertsInsertResponse < 3) { |
| 1182 checkSslCertDetail(o.clientCert); |
| 1183 unittest.expect(o.kind, unittest.equals('foo')); |
| 1184 checkSslCert(o.serverCaCert); |
| 1185 } |
| 1186 buildCounterSslCertsInsertResponse--; |
| 1187 } |
| 1188 |
| 1189 buildUnnamed1049() { |
| 1190 var o = new core.List<api.SslCert>(); |
| 1191 o.add(buildSslCert()); |
| 1192 o.add(buildSslCert()); |
| 1193 return o; |
| 1194 } |
| 1195 |
| 1196 checkUnnamed1049(core.List<api.SslCert> o) { |
| 1197 unittest.expect(o, unittest.hasLength(2)); |
| 1198 checkSslCert(o[0]); |
| 1199 checkSslCert(o[1]); |
| 1200 } |
| 1201 |
| 1202 core.int buildCounterSslCertsListResponse = 0; |
| 1203 buildSslCertsListResponse() { |
| 1204 var o = new api.SslCertsListResponse(); |
| 1205 buildCounterSslCertsListResponse++; |
| 1206 if (buildCounterSslCertsListResponse < 3) { |
| 1207 o.items = buildUnnamed1049(); |
| 1208 o.kind = "foo"; |
| 1209 } |
| 1210 buildCounterSslCertsListResponse--; |
| 1211 return o; |
| 1212 } |
| 1213 |
| 1214 checkSslCertsListResponse(api.SslCertsListResponse o) { |
| 1215 buildCounterSslCertsListResponse++; |
| 1216 if (buildCounterSslCertsListResponse < 3) { |
| 1217 checkUnnamed1049(o.items); |
| 1218 unittest.expect(o.kind, unittest.equals('foo')); |
| 1219 } |
| 1220 buildCounterSslCertsListResponse--; |
| 1221 } |
| 1222 |
| 1223 buildUnnamed1050() { |
| 1224 var o = new core.List<core.String>(); |
| 1225 o.add("foo"); |
| 1226 o.add("foo"); |
| 1227 return o; |
| 1228 } |
| 1229 |
| 1230 checkUnnamed1050(core.List<core.String> o) { |
| 1231 unittest.expect(o, unittest.hasLength(2)); |
| 1232 unittest.expect(o[0], unittest.equals('foo')); |
| 1233 unittest.expect(o[1], unittest.equals('foo')); |
| 1234 } |
| 1235 |
| 1236 core.int buildCounterTier = 0; |
| 1237 buildTier() { |
| 1238 var o = new api.Tier(); |
| 1239 buildCounterTier++; |
| 1240 if (buildCounterTier < 3) { |
| 1241 o.DiskQuota = "foo"; |
| 1242 o.RAM = "foo"; |
| 1243 o.kind = "foo"; |
| 1244 o.region = buildUnnamed1050(); |
| 1245 o.tier = "foo"; |
| 1246 } |
| 1247 buildCounterTier--; |
| 1248 return o; |
| 1249 } |
| 1250 |
| 1251 checkTier(api.Tier o) { |
| 1252 buildCounterTier++; |
| 1253 if (buildCounterTier < 3) { |
| 1254 unittest.expect(o.DiskQuota, unittest.equals('foo')); |
| 1255 unittest.expect(o.RAM, unittest.equals('foo')); |
| 1256 unittest.expect(o.kind, unittest.equals('foo')); |
| 1257 checkUnnamed1050(o.region); |
| 1258 unittest.expect(o.tier, unittest.equals('foo')); |
| 1259 } |
| 1260 buildCounterTier--; |
| 1261 } |
| 1262 |
| 1263 buildUnnamed1051() { |
| 1264 var o = new core.List<api.Tier>(); |
| 1265 o.add(buildTier()); |
| 1266 o.add(buildTier()); |
| 1267 return o; |
| 1268 } |
| 1269 |
| 1270 checkUnnamed1051(core.List<api.Tier> o) { |
| 1271 unittest.expect(o, unittest.hasLength(2)); |
| 1272 checkTier(o[0]); |
| 1273 checkTier(o[1]); |
| 1274 } |
| 1275 |
| 1276 core.int buildCounterTiersListResponse = 0; |
| 1277 buildTiersListResponse() { |
| 1278 var o = new api.TiersListResponse(); |
| 1279 buildCounterTiersListResponse++; |
| 1280 if (buildCounterTiersListResponse < 3) { |
| 1281 o.items = buildUnnamed1051(); |
| 1282 o.kind = "foo"; |
| 1283 } |
| 1284 buildCounterTiersListResponse--; |
| 1285 return o; |
| 1286 } |
| 1287 |
| 1288 checkTiersListResponse(api.TiersListResponse o) { |
| 1289 buildCounterTiersListResponse++; |
| 1290 if (buildCounterTiersListResponse < 3) { |
| 1291 checkUnnamed1051(o.items); |
| 1292 unittest.expect(o.kind, unittest.equals('foo')); |
| 1293 } |
| 1294 buildCounterTiersListResponse--; |
| 1295 } |
| 1296 |
| 1297 |
| 1298 main() { |
| 1299 unittest.group("obj-schema-BackupConfiguration", () { |
| 1300 unittest.test("to-json--from-json", () { |
| 1301 var o = buildBackupConfiguration(); |
| 1302 var od = new api.BackupConfiguration.fromJson(o.toJson()); |
| 1303 checkBackupConfiguration(od); |
| 1304 }); |
| 1305 }); |
| 1306 |
| 1307 |
| 1308 unittest.group("obj-schema-BackupRun", () { |
| 1309 unittest.test("to-json--from-json", () { |
| 1310 var o = buildBackupRun(); |
| 1311 var od = new api.BackupRun.fromJson(o.toJson()); |
| 1312 checkBackupRun(od); |
| 1313 }); |
| 1314 }); |
| 1315 |
| 1316 |
| 1317 unittest.group("obj-schema-BackupRunsListResponse", () { |
| 1318 unittest.test("to-json--from-json", () { |
| 1319 var o = buildBackupRunsListResponse(); |
| 1320 var od = new api.BackupRunsListResponse.fromJson(o.toJson()); |
| 1321 checkBackupRunsListResponse(od); |
| 1322 }); |
| 1323 }); |
| 1324 |
| 1325 |
| 1326 unittest.group("obj-schema-BinLogCoordinates", () { |
| 1327 unittest.test("to-json--from-json", () { |
| 1328 var o = buildBinLogCoordinates(); |
| 1329 var od = new api.BinLogCoordinates.fromJson(o.toJson()); |
| 1330 checkBinLogCoordinates(od); |
| 1331 }); |
| 1332 }); |
| 1333 |
| 1334 |
| 1335 unittest.group("obj-schema-CloneContext", () { |
| 1336 unittest.test("to-json--from-json", () { |
| 1337 var o = buildCloneContext(); |
| 1338 var od = new api.CloneContext.fromJson(o.toJson()); |
| 1339 checkCloneContext(od); |
| 1340 }); |
| 1341 }); |
| 1342 |
| 1343 |
| 1344 unittest.group("obj-schema-DatabaseFlags", () { |
| 1345 unittest.test("to-json--from-json", () { |
| 1346 var o = buildDatabaseFlags(); |
| 1347 var od = new api.DatabaseFlags.fromJson(o.toJson()); |
| 1348 checkDatabaseFlags(od); |
| 1349 }); |
| 1350 }); |
| 1351 |
| 1352 |
| 1353 unittest.group("obj-schema-DatabaseInstance", () { |
| 1354 unittest.test("to-json--from-json", () { |
| 1355 var o = buildDatabaseInstance(); |
| 1356 var od = new api.DatabaseInstance.fromJson(o.toJson()); |
| 1357 checkDatabaseInstance(od); |
| 1358 }); |
| 1359 }); |
| 1360 |
| 1361 |
| 1362 unittest.group("obj-schema-ExportContext", () { |
| 1363 unittest.test("to-json--from-json", () { |
| 1364 var o = buildExportContext(); |
| 1365 var od = new api.ExportContext.fromJson(o.toJson()); |
| 1366 checkExportContext(od); |
| 1367 }); |
| 1368 }); |
| 1369 |
| 1370 |
| 1371 unittest.group("obj-schema-Flag", () { |
| 1372 unittest.test("to-json--from-json", () { |
| 1373 var o = buildFlag(); |
| 1374 var od = new api.Flag.fromJson(o.toJson()); |
| 1375 checkFlag(od); |
| 1376 }); |
| 1377 }); |
| 1378 |
| 1379 |
| 1380 unittest.group("obj-schema-FlagsListResponse", () { |
| 1381 unittest.test("to-json--from-json", () { |
| 1382 var o = buildFlagsListResponse(); |
| 1383 var od = new api.FlagsListResponse.fromJson(o.toJson()); |
| 1384 checkFlagsListResponse(od); |
| 1385 }); |
| 1386 }); |
| 1387 |
| 1388 |
| 1389 unittest.group("obj-schema-ImportContext", () { |
| 1390 unittest.test("to-json--from-json", () { |
| 1391 var o = buildImportContext(); |
| 1392 var od = new api.ImportContext.fromJson(o.toJson()); |
| 1393 checkImportContext(od); |
| 1394 }); |
| 1395 }); |
| 1396 |
| 1397 |
| 1398 unittest.group("obj-schema-InstanceOperation", () { |
| 1399 unittest.test("to-json--from-json", () { |
| 1400 var o = buildInstanceOperation(); |
| 1401 var od = new api.InstanceOperation.fromJson(o.toJson()); |
| 1402 checkInstanceOperation(od); |
| 1403 }); |
| 1404 }); |
| 1405 |
| 1406 |
| 1407 unittest.group("obj-schema-InstanceSetRootPasswordRequest", () { |
| 1408 unittest.test("to-json--from-json", () { |
| 1409 var o = buildInstanceSetRootPasswordRequest(); |
| 1410 var od = new api.InstanceSetRootPasswordRequest.fromJson(o.toJson()); |
| 1411 checkInstanceSetRootPasswordRequest(od); |
| 1412 }); |
| 1413 }); |
| 1414 |
| 1415 |
| 1416 unittest.group("obj-schema-InstancesCloneRequest", () { |
| 1417 unittest.test("to-json--from-json", () { |
| 1418 var o = buildInstancesCloneRequest(); |
| 1419 var od = new api.InstancesCloneRequest.fromJson(o.toJson()); |
| 1420 checkInstancesCloneRequest(od); |
| 1421 }); |
| 1422 }); |
| 1423 |
| 1424 |
| 1425 unittest.group("obj-schema-InstancesCloneResponse", () { |
| 1426 unittest.test("to-json--from-json", () { |
| 1427 var o = buildInstancesCloneResponse(); |
| 1428 var od = new api.InstancesCloneResponse.fromJson(o.toJson()); |
| 1429 checkInstancesCloneResponse(od); |
| 1430 }); |
| 1431 }); |
| 1432 |
| 1433 |
| 1434 unittest.group("obj-schema-InstancesDeleteResponse", () { |
| 1435 unittest.test("to-json--from-json", () { |
| 1436 var o = buildInstancesDeleteResponse(); |
| 1437 var od = new api.InstancesDeleteResponse.fromJson(o.toJson()); |
| 1438 checkInstancesDeleteResponse(od); |
| 1439 }); |
| 1440 }); |
| 1441 |
| 1442 |
| 1443 unittest.group("obj-schema-InstancesExportRequest", () { |
| 1444 unittest.test("to-json--from-json", () { |
| 1445 var o = buildInstancesExportRequest(); |
| 1446 var od = new api.InstancesExportRequest.fromJson(o.toJson()); |
| 1447 checkInstancesExportRequest(od); |
| 1448 }); |
| 1449 }); |
| 1450 |
| 1451 |
| 1452 unittest.group("obj-schema-InstancesExportResponse", () { |
| 1453 unittest.test("to-json--from-json", () { |
| 1454 var o = buildInstancesExportResponse(); |
| 1455 var od = new api.InstancesExportResponse.fromJson(o.toJson()); |
| 1456 checkInstancesExportResponse(od); |
| 1457 }); |
| 1458 }); |
| 1459 |
| 1460 |
| 1461 unittest.group("obj-schema-InstancesImportRequest", () { |
| 1462 unittest.test("to-json--from-json", () { |
| 1463 var o = buildInstancesImportRequest(); |
| 1464 var od = new api.InstancesImportRequest.fromJson(o.toJson()); |
| 1465 checkInstancesImportRequest(od); |
| 1466 }); |
| 1467 }); |
| 1468 |
| 1469 |
| 1470 unittest.group("obj-schema-InstancesImportResponse", () { |
| 1471 unittest.test("to-json--from-json", () { |
| 1472 var o = buildInstancesImportResponse(); |
| 1473 var od = new api.InstancesImportResponse.fromJson(o.toJson()); |
| 1474 checkInstancesImportResponse(od); |
| 1475 }); |
| 1476 }); |
| 1477 |
| 1478 |
| 1479 unittest.group("obj-schema-InstancesInsertResponse", () { |
| 1480 unittest.test("to-json--from-json", () { |
| 1481 var o = buildInstancesInsertResponse(); |
| 1482 var od = new api.InstancesInsertResponse.fromJson(o.toJson()); |
| 1483 checkInstancesInsertResponse(od); |
| 1484 }); |
| 1485 }); |
| 1486 |
| 1487 |
| 1488 unittest.group("obj-schema-InstancesListResponse", () { |
| 1489 unittest.test("to-json--from-json", () { |
| 1490 var o = buildInstancesListResponse(); |
| 1491 var od = new api.InstancesListResponse.fromJson(o.toJson()); |
| 1492 checkInstancesListResponse(od); |
| 1493 }); |
| 1494 }); |
| 1495 |
| 1496 |
| 1497 unittest.group("obj-schema-InstancesPromoteReplicaResponse", () { |
| 1498 unittest.test("to-json--from-json", () { |
| 1499 var o = buildInstancesPromoteReplicaResponse(); |
| 1500 var od = new api.InstancesPromoteReplicaResponse.fromJson(o.toJson()); |
| 1501 checkInstancesPromoteReplicaResponse(od); |
| 1502 }); |
| 1503 }); |
| 1504 |
| 1505 |
| 1506 unittest.group("obj-schema-InstancesResetSslConfigResponse", () { |
| 1507 unittest.test("to-json--from-json", () { |
| 1508 var o = buildInstancesResetSslConfigResponse(); |
| 1509 var od = new api.InstancesResetSslConfigResponse.fromJson(o.toJson()); |
| 1510 checkInstancesResetSslConfigResponse(od); |
| 1511 }); |
| 1512 }); |
| 1513 |
| 1514 |
| 1515 unittest.group("obj-schema-InstancesRestartResponse", () { |
| 1516 unittest.test("to-json--from-json", () { |
| 1517 var o = buildInstancesRestartResponse(); |
| 1518 var od = new api.InstancesRestartResponse.fromJson(o.toJson()); |
| 1519 checkInstancesRestartResponse(od); |
| 1520 }); |
| 1521 }); |
| 1522 |
| 1523 |
| 1524 unittest.group("obj-schema-InstancesRestoreBackupResponse", () { |
| 1525 unittest.test("to-json--from-json", () { |
| 1526 var o = buildInstancesRestoreBackupResponse(); |
| 1527 var od = new api.InstancesRestoreBackupResponse.fromJson(o.toJson()); |
| 1528 checkInstancesRestoreBackupResponse(od); |
| 1529 }); |
| 1530 }); |
| 1531 |
| 1532 |
| 1533 unittest.group("obj-schema-InstancesSetRootPasswordResponse", () { |
| 1534 unittest.test("to-json--from-json", () { |
| 1535 var o = buildInstancesSetRootPasswordResponse(); |
| 1536 var od = new api.InstancesSetRootPasswordResponse.fromJson(o.toJson()); |
| 1537 checkInstancesSetRootPasswordResponse(od); |
| 1538 }); |
| 1539 }); |
| 1540 |
| 1541 |
| 1542 unittest.group("obj-schema-InstancesUpdateResponse", () { |
| 1543 unittest.test("to-json--from-json", () { |
| 1544 var o = buildInstancesUpdateResponse(); |
| 1545 var od = new api.InstancesUpdateResponse.fromJson(o.toJson()); |
| 1546 checkInstancesUpdateResponse(od); |
| 1547 }); |
| 1548 }); |
| 1549 |
| 1550 |
| 1551 unittest.group("obj-schema-IpConfiguration", () { |
| 1552 unittest.test("to-json--from-json", () { |
| 1553 var o = buildIpConfiguration(); |
| 1554 var od = new api.IpConfiguration.fromJson(o.toJson()); |
| 1555 checkIpConfiguration(od); |
| 1556 }); |
| 1557 }); |
| 1558 |
| 1559 |
| 1560 unittest.group("obj-schema-IpMapping", () { |
| 1561 unittest.test("to-json--from-json", () { |
| 1562 var o = buildIpMapping(); |
| 1563 var od = new api.IpMapping.fromJson(o.toJson()); |
| 1564 checkIpMapping(od); |
| 1565 }); |
| 1566 }); |
| 1567 |
| 1568 |
| 1569 unittest.group("obj-schema-LocationPreference", () { |
| 1570 unittest.test("to-json--from-json", () { |
| 1571 var o = buildLocationPreference(); |
| 1572 var od = new api.LocationPreference.fromJson(o.toJson()); |
| 1573 checkLocationPreference(od); |
| 1574 }); |
| 1575 }); |
| 1576 |
| 1577 |
| 1578 unittest.group("obj-schema-OperationError", () { |
| 1579 unittest.test("to-json--from-json", () { |
| 1580 var o = buildOperationError(); |
| 1581 var od = new api.OperationError.fromJson(o.toJson()); |
| 1582 checkOperationError(od); |
| 1583 }); |
| 1584 }); |
| 1585 |
| 1586 |
| 1587 unittest.group("obj-schema-OperationsListResponse", () { |
| 1588 unittest.test("to-json--from-json", () { |
| 1589 var o = buildOperationsListResponse(); |
| 1590 var od = new api.OperationsListResponse.fromJson(o.toJson()); |
| 1591 checkOperationsListResponse(od); |
| 1592 }); |
| 1593 }); |
| 1594 |
| 1595 |
| 1596 unittest.group("obj-schema-SetRootPasswordContext", () { |
| 1597 unittest.test("to-json--from-json", () { |
| 1598 var o = buildSetRootPasswordContext(); |
| 1599 var od = new api.SetRootPasswordContext.fromJson(o.toJson()); |
| 1600 checkSetRootPasswordContext(od); |
| 1601 }); |
| 1602 }); |
| 1603 |
| 1604 |
| 1605 unittest.group("obj-schema-Settings", () { |
| 1606 unittest.test("to-json--from-json", () { |
| 1607 var o = buildSettings(); |
| 1608 var od = new api.Settings.fromJson(o.toJson()); |
| 1609 checkSettings(od); |
| 1610 }); |
| 1611 }); |
| 1612 |
| 1613 |
| 1614 unittest.group("obj-schema-SslCert", () { |
| 1615 unittest.test("to-json--from-json", () { |
| 1616 var o = buildSslCert(); |
| 1617 var od = new api.SslCert.fromJson(o.toJson()); |
| 1618 checkSslCert(od); |
| 1619 }); |
| 1620 }); |
| 1621 |
| 1622 |
| 1623 unittest.group("obj-schema-SslCertDetail", () { |
| 1624 unittest.test("to-json--from-json", () { |
| 1625 var o = buildSslCertDetail(); |
| 1626 var od = new api.SslCertDetail.fromJson(o.toJson()); |
| 1627 checkSslCertDetail(od); |
| 1628 }); |
| 1629 }); |
| 1630 |
| 1631 |
| 1632 unittest.group("obj-schema-SslCertsDeleteResponse", () { |
| 1633 unittest.test("to-json--from-json", () { |
| 1634 var o = buildSslCertsDeleteResponse(); |
| 1635 var od = new api.SslCertsDeleteResponse.fromJson(o.toJson()); |
| 1636 checkSslCertsDeleteResponse(od); |
| 1637 }); |
| 1638 }); |
| 1639 |
| 1640 |
| 1641 unittest.group("obj-schema-SslCertsInsertRequest", () { |
| 1642 unittest.test("to-json--from-json", () { |
| 1643 var o = buildSslCertsInsertRequest(); |
| 1644 var od = new api.SslCertsInsertRequest.fromJson(o.toJson()); |
| 1645 checkSslCertsInsertRequest(od); |
| 1646 }); |
| 1647 }); |
| 1648 |
| 1649 |
| 1650 unittest.group("obj-schema-SslCertsInsertResponse", () { |
| 1651 unittest.test("to-json--from-json", () { |
| 1652 var o = buildSslCertsInsertResponse(); |
| 1653 var od = new api.SslCertsInsertResponse.fromJson(o.toJson()); |
| 1654 checkSslCertsInsertResponse(od); |
| 1655 }); |
| 1656 }); |
| 1657 |
| 1658 |
| 1659 unittest.group("obj-schema-SslCertsListResponse", () { |
| 1660 unittest.test("to-json--from-json", () { |
| 1661 var o = buildSslCertsListResponse(); |
| 1662 var od = new api.SslCertsListResponse.fromJson(o.toJson()); |
| 1663 checkSslCertsListResponse(od); |
| 1664 }); |
| 1665 }); |
| 1666 |
| 1667 |
| 1668 unittest.group("obj-schema-Tier", () { |
| 1669 unittest.test("to-json--from-json", () { |
| 1670 var o = buildTier(); |
| 1671 var od = new api.Tier.fromJson(o.toJson()); |
| 1672 checkTier(od); |
| 1673 }); |
| 1674 }); |
| 1675 |
| 1676 |
| 1677 unittest.group("obj-schema-TiersListResponse", () { |
| 1678 unittest.test("to-json--from-json", () { |
| 1679 var o = buildTiersListResponse(); |
| 1680 var od = new api.TiersListResponse.fromJson(o.toJson()); |
| 1681 checkTiersListResponse(od); |
| 1682 }); |
| 1683 }); |
| 1684 |
| 1685 |
| 1686 unittest.group("resource-BackupRunsResourceApi", () { |
| 1687 unittest.test("method--get", () { |
| 1688 |
| 1689 var mock = new common_test.HttpServerMock(); |
| 1690 api.BackupRunsResourceApi res = new api.SqladminApi(mock).backupRuns; |
| 1691 var arg_project = "foo"; |
| 1692 var arg_instance = "foo"; |
| 1693 var arg_backupConfiguration = "foo"; |
| 1694 var arg_dueTime = "foo"; |
| 1695 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1696 var path = (req.url).path; |
| 1697 var pathOffset = 0; |
| 1698 var index; |
| 1699 var subPart; |
| 1700 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1701 pathOffset += 13; |
| 1702 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 1703 pathOffset += 9; |
| 1704 index = path.indexOf("/instances/", pathOffset); |
| 1705 unittest.expect(index >= 0, unittest.isTrue); |
| 1706 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1707 pathOffset = index; |
| 1708 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 1709 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 1710 pathOffset += 11; |
| 1711 index = path.indexOf("/backupRuns/", pathOffset); |
| 1712 unittest.expect(index >= 0, unittest.isTrue); |
| 1713 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1714 pathOffset = index; |
| 1715 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 1716 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/backupRuns/")); |
| 1717 pathOffset += 12; |
| 1718 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1719 pathOffset = path.length; |
| 1720 unittest.expect(subPart, unittest.equals("$arg_backupConfiguration")); |
| 1721 |
| 1722 var query = (req.url).query; |
| 1723 var queryOffset = 0; |
| 1724 var queryMap = {}; |
| 1725 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1726 parseBool(n) { |
| 1727 if (n == "true") return true; |
| 1728 if (n == "false") return false; |
| 1729 if (n == null) return null; |
| 1730 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1731 } |
| 1732 if (query.length > 0) { |
| 1733 for (var part in query.split("&")) { |
| 1734 var keyvalue = part.split("="); |
| 1735 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1736 } |
| 1737 } |
| 1738 unittest.expect(queryMap["dueTime"].first, unittest.equals(arg_dueTime))
; |
| 1739 |
| 1740 |
| 1741 var h = { |
| 1742 "content-type" : "application/json; charset=utf-8", |
| 1743 }; |
| 1744 var resp = convert.JSON.encode(buildBackupRun()); |
| 1745 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1746 }), true); |
| 1747 res.get(arg_project, arg_instance, arg_backupConfiguration, arg_dueTime).t
hen(unittest.expectAsync(((api.BackupRun response) { |
| 1748 checkBackupRun(response); |
| 1749 }))); |
| 1750 }); |
| 1751 |
| 1752 unittest.test("method--list", () { |
| 1753 |
| 1754 var mock = new common_test.HttpServerMock(); |
| 1755 api.BackupRunsResourceApi res = new api.SqladminApi(mock).backupRuns; |
| 1756 var arg_project = "foo"; |
| 1757 var arg_instance = "foo"; |
| 1758 var arg_backupConfiguration = "foo"; |
| 1759 var arg_maxResults = 42; |
| 1760 var arg_pageToken = "foo"; |
| 1761 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1762 var path = (req.url).path; |
| 1763 var pathOffset = 0; |
| 1764 var index; |
| 1765 var subPart; |
| 1766 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1767 pathOffset += 13; |
| 1768 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 1769 pathOffset += 9; |
| 1770 index = path.indexOf("/instances/", pathOffset); |
| 1771 unittest.expect(index >= 0, unittest.isTrue); |
| 1772 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1773 pathOffset = index; |
| 1774 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 1775 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 1776 pathOffset += 11; |
| 1777 index = path.indexOf("/backupRuns", pathOffset); |
| 1778 unittest.expect(index >= 0, unittest.isTrue); |
| 1779 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1780 pathOffset = index; |
| 1781 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 1782 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/backupRuns")); |
| 1783 pathOffset += 11; |
| 1784 |
| 1785 var query = (req.url).query; |
| 1786 var queryOffset = 0; |
| 1787 var queryMap = {}; |
| 1788 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1789 parseBool(n) { |
| 1790 if (n == "true") return true; |
| 1791 if (n == "false") return false; |
| 1792 if (n == null) return null; |
| 1793 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1794 } |
| 1795 if (query.length > 0) { |
| 1796 for (var part in query.split("&")) { |
| 1797 var keyvalue = part.split("="); |
| 1798 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1799 } |
| 1800 } |
| 1801 unittest.expect(queryMap["backupConfiguration"].first, unittest.equals(a
rg_backupConfiguration)); |
| 1802 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1803 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1804 |
| 1805 |
| 1806 var h = { |
| 1807 "content-type" : "application/json; charset=utf-8", |
| 1808 }; |
| 1809 var resp = convert.JSON.encode(buildBackupRunsListResponse()); |
| 1810 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1811 }), true); |
| 1812 res.list(arg_project, arg_instance, arg_backupConfiguration, maxResults: a
rg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.BackupR
unsListResponse response) { |
| 1813 checkBackupRunsListResponse(response); |
| 1814 }))); |
| 1815 }); |
| 1816 |
| 1817 }); |
| 1818 |
| 1819 |
| 1820 unittest.group("resource-FlagsResourceApi", () { |
| 1821 unittest.test("method--list", () { |
| 1822 |
| 1823 var mock = new common_test.HttpServerMock(); |
| 1824 api.FlagsResourceApi res = new api.SqladminApi(mock).flags; |
| 1825 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1826 var path = (req.url).path; |
| 1827 var pathOffset = 0; |
| 1828 var index; |
| 1829 var subPart; |
| 1830 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1831 pathOffset += 13; |
| 1832 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("flags")); |
| 1833 pathOffset += 5; |
| 1834 |
| 1835 var query = (req.url).query; |
| 1836 var queryOffset = 0; |
| 1837 var queryMap = {}; |
| 1838 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1839 parseBool(n) { |
| 1840 if (n == "true") return true; |
| 1841 if (n == "false") return false; |
| 1842 if (n == null) return null; |
| 1843 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1844 } |
| 1845 if (query.length > 0) { |
| 1846 for (var part in query.split("&")) { |
| 1847 var keyvalue = part.split("="); |
| 1848 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1849 } |
| 1850 } |
| 1851 |
| 1852 |
| 1853 var h = { |
| 1854 "content-type" : "application/json; charset=utf-8", |
| 1855 }; |
| 1856 var resp = convert.JSON.encode(buildFlagsListResponse()); |
| 1857 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1858 }), true); |
| 1859 res.list().then(unittest.expectAsync(((api.FlagsListResponse response) { |
| 1860 checkFlagsListResponse(response); |
| 1861 }))); |
| 1862 }); |
| 1863 |
| 1864 }); |
| 1865 |
| 1866 |
| 1867 unittest.group("resource-InstancesResourceApi", () { |
| 1868 unittest.test("method--clone", () { |
| 1869 |
| 1870 var mock = new common_test.HttpServerMock(); |
| 1871 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 1872 var arg_request = buildInstancesCloneRequest(); |
| 1873 var arg_project = "foo"; |
| 1874 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1875 var obj = new api.InstancesCloneRequest.fromJson(json); |
| 1876 checkInstancesCloneRequest(obj); |
| 1877 |
| 1878 var path = (req.url).path; |
| 1879 var pathOffset = 0; |
| 1880 var index; |
| 1881 var subPart; |
| 1882 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1883 pathOffset += 13; |
| 1884 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 1885 pathOffset += 9; |
| 1886 index = path.indexOf("/instances/clone", pathOffset); |
| 1887 unittest.expect(index >= 0, unittest.isTrue); |
| 1888 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1889 pathOffset = index; |
| 1890 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 1891 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/instances/clone")); |
| 1892 pathOffset += 16; |
| 1893 |
| 1894 var query = (req.url).query; |
| 1895 var queryOffset = 0; |
| 1896 var queryMap = {}; |
| 1897 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1898 parseBool(n) { |
| 1899 if (n == "true") return true; |
| 1900 if (n == "false") return false; |
| 1901 if (n == null) return null; |
| 1902 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1903 } |
| 1904 if (query.length > 0) { |
| 1905 for (var part in query.split("&")) { |
| 1906 var keyvalue = part.split("="); |
| 1907 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1908 } |
| 1909 } |
| 1910 |
| 1911 |
| 1912 var h = { |
| 1913 "content-type" : "application/json; charset=utf-8", |
| 1914 }; |
| 1915 var resp = convert.JSON.encode(buildInstancesCloneResponse()); |
| 1916 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1917 }), true); |
| 1918 res.clone(arg_request, arg_project).then(unittest.expectAsync(((api.Instan
cesCloneResponse response) { |
| 1919 checkInstancesCloneResponse(response); |
| 1920 }))); |
| 1921 }); |
| 1922 |
| 1923 unittest.test("method--delete", () { |
| 1924 |
| 1925 var mock = new common_test.HttpServerMock(); |
| 1926 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 1927 var arg_project = "foo"; |
| 1928 var arg_instance = "foo"; |
| 1929 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1930 var path = (req.url).path; |
| 1931 var pathOffset = 0; |
| 1932 var index; |
| 1933 var subPart; |
| 1934 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1935 pathOffset += 13; |
| 1936 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 1937 pathOffset += 9; |
| 1938 index = path.indexOf("/instances/", pathOffset); |
| 1939 unittest.expect(index >= 0, unittest.isTrue); |
| 1940 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1941 pathOffset = index; |
| 1942 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 1943 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 1944 pathOffset += 11; |
| 1945 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1946 pathOffset = path.length; |
| 1947 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 1948 |
| 1949 var query = (req.url).query; |
| 1950 var queryOffset = 0; |
| 1951 var queryMap = {}; |
| 1952 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1953 parseBool(n) { |
| 1954 if (n == "true") return true; |
| 1955 if (n == "false") return false; |
| 1956 if (n == null) return null; |
| 1957 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1958 } |
| 1959 if (query.length > 0) { |
| 1960 for (var part in query.split("&")) { |
| 1961 var keyvalue = part.split("="); |
| 1962 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1963 } |
| 1964 } |
| 1965 |
| 1966 |
| 1967 var h = { |
| 1968 "content-type" : "application/json; charset=utf-8", |
| 1969 }; |
| 1970 var resp = convert.JSON.encode(buildInstancesDeleteResponse()); |
| 1971 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1972 }), true); |
| 1973 res.delete(arg_project, arg_instance).then(unittest.expectAsync(((api.Inst
ancesDeleteResponse response) { |
| 1974 checkInstancesDeleteResponse(response); |
| 1975 }))); |
| 1976 }); |
| 1977 |
| 1978 unittest.test("method--export", () { |
| 1979 |
| 1980 var mock = new common_test.HttpServerMock(); |
| 1981 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 1982 var arg_request = buildInstancesExportRequest(); |
| 1983 var arg_project = "foo"; |
| 1984 var arg_instance = "foo"; |
| 1985 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1986 var obj = new api.InstancesExportRequest.fromJson(json); |
| 1987 checkInstancesExportRequest(obj); |
| 1988 |
| 1989 var path = (req.url).path; |
| 1990 var pathOffset = 0; |
| 1991 var index; |
| 1992 var subPart; |
| 1993 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 1994 pathOffset += 13; |
| 1995 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 1996 pathOffset += 9; |
| 1997 index = path.indexOf("/instances/", pathOffset); |
| 1998 unittest.expect(index >= 0, unittest.isTrue); |
| 1999 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2000 pathOffset = index; |
| 2001 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2002 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2003 pathOffset += 11; |
| 2004 index = path.indexOf("/export", pathOffset); |
| 2005 unittest.expect(index >= 0, unittest.isTrue); |
| 2006 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2007 pathOffset = index; |
| 2008 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2009 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/export")); |
| 2010 pathOffset += 7; |
| 2011 |
| 2012 var query = (req.url).query; |
| 2013 var queryOffset = 0; |
| 2014 var queryMap = {}; |
| 2015 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2016 parseBool(n) { |
| 2017 if (n == "true") return true; |
| 2018 if (n == "false") return false; |
| 2019 if (n == null) return null; |
| 2020 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2021 } |
| 2022 if (query.length > 0) { |
| 2023 for (var part in query.split("&")) { |
| 2024 var keyvalue = part.split("="); |
| 2025 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2026 } |
| 2027 } |
| 2028 |
| 2029 |
| 2030 var h = { |
| 2031 "content-type" : "application/json; charset=utf-8", |
| 2032 }; |
| 2033 var resp = convert.JSON.encode(buildInstancesExportResponse()); |
| 2034 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2035 }), true); |
| 2036 res.export(arg_request, arg_project, arg_instance).then(unittest.expectAsy
nc(((api.InstancesExportResponse response) { |
| 2037 checkInstancesExportResponse(response); |
| 2038 }))); |
| 2039 }); |
| 2040 |
| 2041 unittest.test("method--get", () { |
| 2042 |
| 2043 var mock = new common_test.HttpServerMock(); |
| 2044 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2045 var arg_project = "foo"; |
| 2046 var arg_instance = "foo"; |
| 2047 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2048 var path = (req.url).path; |
| 2049 var pathOffset = 0; |
| 2050 var index; |
| 2051 var subPart; |
| 2052 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2053 pathOffset += 13; |
| 2054 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2055 pathOffset += 9; |
| 2056 index = path.indexOf("/instances/", pathOffset); |
| 2057 unittest.expect(index >= 0, unittest.isTrue); |
| 2058 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2059 pathOffset = index; |
| 2060 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2061 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2062 pathOffset += 11; |
| 2063 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2064 pathOffset = path.length; |
| 2065 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2066 |
| 2067 var query = (req.url).query; |
| 2068 var queryOffset = 0; |
| 2069 var queryMap = {}; |
| 2070 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2071 parseBool(n) { |
| 2072 if (n == "true") return true; |
| 2073 if (n == "false") return false; |
| 2074 if (n == null) return null; |
| 2075 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2076 } |
| 2077 if (query.length > 0) { |
| 2078 for (var part in query.split("&")) { |
| 2079 var keyvalue = part.split("="); |
| 2080 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2081 } |
| 2082 } |
| 2083 |
| 2084 |
| 2085 var h = { |
| 2086 "content-type" : "application/json; charset=utf-8", |
| 2087 }; |
| 2088 var resp = convert.JSON.encode(buildDatabaseInstance()); |
| 2089 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2090 }), true); |
| 2091 res.get(arg_project, arg_instance).then(unittest.expectAsync(((api.Databas
eInstance response) { |
| 2092 checkDatabaseInstance(response); |
| 2093 }))); |
| 2094 }); |
| 2095 |
| 2096 unittest.test("method--import", () { |
| 2097 |
| 2098 var mock = new common_test.HttpServerMock(); |
| 2099 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2100 var arg_request = buildInstancesImportRequest(); |
| 2101 var arg_project = "foo"; |
| 2102 var arg_instance = "foo"; |
| 2103 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2104 var obj = new api.InstancesImportRequest.fromJson(json); |
| 2105 checkInstancesImportRequest(obj); |
| 2106 |
| 2107 var path = (req.url).path; |
| 2108 var pathOffset = 0; |
| 2109 var index; |
| 2110 var subPart; |
| 2111 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2112 pathOffset += 13; |
| 2113 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2114 pathOffset += 9; |
| 2115 index = path.indexOf("/instances/", pathOffset); |
| 2116 unittest.expect(index >= 0, unittest.isTrue); |
| 2117 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2118 pathOffset = index; |
| 2119 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2120 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2121 pathOffset += 11; |
| 2122 index = path.indexOf("/import", pathOffset); |
| 2123 unittest.expect(index >= 0, unittest.isTrue); |
| 2124 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2125 pathOffset = index; |
| 2126 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2127 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/import")); |
| 2128 pathOffset += 7; |
| 2129 |
| 2130 var query = (req.url).query; |
| 2131 var queryOffset = 0; |
| 2132 var queryMap = {}; |
| 2133 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2134 parseBool(n) { |
| 2135 if (n == "true") return true; |
| 2136 if (n == "false") return false; |
| 2137 if (n == null) return null; |
| 2138 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2139 } |
| 2140 if (query.length > 0) { |
| 2141 for (var part in query.split("&")) { |
| 2142 var keyvalue = part.split("="); |
| 2143 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2144 } |
| 2145 } |
| 2146 |
| 2147 |
| 2148 var h = { |
| 2149 "content-type" : "application/json; charset=utf-8", |
| 2150 }; |
| 2151 var resp = convert.JSON.encode(buildInstancesImportResponse()); |
| 2152 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2153 }), true); |
| 2154 res.import(arg_request, arg_project, arg_instance).then(unittest.expectAsy
nc(((api.InstancesImportResponse response) { |
| 2155 checkInstancesImportResponse(response); |
| 2156 }))); |
| 2157 }); |
| 2158 |
| 2159 unittest.test("method--insert", () { |
| 2160 |
| 2161 var mock = new common_test.HttpServerMock(); |
| 2162 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2163 var arg_request = buildDatabaseInstance(); |
| 2164 var arg_project = "foo"; |
| 2165 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2166 var obj = new api.DatabaseInstance.fromJson(json); |
| 2167 checkDatabaseInstance(obj); |
| 2168 |
| 2169 var path = (req.url).path; |
| 2170 var pathOffset = 0; |
| 2171 var index; |
| 2172 var subPart; |
| 2173 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2174 pathOffset += 13; |
| 2175 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2176 pathOffset += 9; |
| 2177 index = path.indexOf("/instances", pathOffset); |
| 2178 unittest.expect(index >= 0, unittest.isTrue); |
| 2179 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2180 pathOffset = index; |
| 2181 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2182 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/instances")); |
| 2183 pathOffset += 10; |
| 2184 |
| 2185 var query = (req.url).query; |
| 2186 var queryOffset = 0; |
| 2187 var queryMap = {}; |
| 2188 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2189 parseBool(n) { |
| 2190 if (n == "true") return true; |
| 2191 if (n == "false") return false; |
| 2192 if (n == null) return null; |
| 2193 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2194 } |
| 2195 if (query.length > 0) { |
| 2196 for (var part in query.split("&")) { |
| 2197 var keyvalue = part.split("="); |
| 2198 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2199 } |
| 2200 } |
| 2201 |
| 2202 |
| 2203 var h = { |
| 2204 "content-type" : "application/json; charset=utf-8", |
| 2205 }; |
| 2206 var resp = convert.JSON.encode(buildInstancesInsertResponse()); |
| 2207 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2208 }), true); |
| 2209 res.insert(arg_request, arg_project).then(unittest.expectAsync(((api.Insta
ncesInsertResponse response) { |
| 2210 checkInstancesInsertResponse(response); |
| 2211 }))); |
| 2212 }); |
| 2213 |
| 2214 unittest.test("method--list", () { |
| 2215 |
| 2216 var mock = new common_test.HttpServerMock(); |
| 2217 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2218 var arg_project = "foo"; |
| 2219 var arg_maxResults = 42; |
| 2220 var arg_pageToken = "foo"; |
| 2221 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2222 var path = (req.url).path; |
| 2223 var pathOffset = 0; |
| 2224 var index; |
| 2225 var subPart; |
| 2226 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2227 pathOffset += 13; |
| 2228 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2229 pathOffset += 9; |
| 2230 index = path.indexOf("/instances", pathOffset); |
| 2231 unittest.expect(index >= 0, unittest.isTrue); |
| 2232 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2233 pathOffset = index; |
| 2234 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2235 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/instances")); |
| 2236 pathOffset += 10; |
| 2237 |
| 2238 var query = (req.url).query; |
| 2239 var queryOffset = 0; |
| 2240 var queryMap = {}; |
| 2241 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2242 parseBool(n) { |
| 2243 if (n == "true") return true; |
| 2244 if (n == "false") return false; |
| 2245 if (n == null) return null; |
| 2246 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2247 } |
| 2248 if (query.length > 0) { |
| 2249 for (var part in query.split("&")) { |
| 2250 var keyvalue = part.split("="); |
| 2251 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2252 } |
| 2253 } |
| 2254 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 2255 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2256 |
| 2257 |
| 2258 var h = { |
| 2259 "content-type" : "application/json; charset=utf-8", |
| 2260 }; |
| 2261 var resp = convert.JSON.encode(buildInstancesListResponse()); |
| 2262 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2263 }), true); |
| 2264 res.list(arg_project, maxResults: arg_maxResults, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.InstancesListResponse response) { |
| 2265 checkInstancesListResponse(response); |
| 2266 }))); |
| 2267 }); |
| 2268 |
| 2269 unittest.test("method--patch", () { |
| 2270 |
| 2271 var mock = new common_test.HttpServerMock(); |
| 2272 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2273 var arg_request = buildDatabaseInstance(); |
| 2274 var arg_project = "foo"; |
| 2275 var arg_instance = "foo"; |
| 2276 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2277 var obj = new api.DatabaseInstance.fromJson(json); |
| 2278 checkDatabaseInstance(obj); |
| 2279 |
| 2280 var path = (req.url).path; |
| 2281 var pathOffset = 0; |
| 2282 var index; |
| 2283 var subPart; |
| 2284 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2285 pathOffset += 13; |
| 2286 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2287 pathOffset += 9; |
| 2288 index = path.indexOf("/instances/", pathOffset); |
| 2289 unittest.expect(index >= 0, unittest.isTrue); |
| 2290 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2291 pathOffset = index; |
| 2292 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2293 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2294 pathOffset += 11; |
| 2295 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2296 pathOffset = path.length; |
| 2297 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2298 |
| 2299 var query = (req.url).query; |
| 2300 var queryOffset = 0; |
| 2301 var queryMap = {}; |
| 2302 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2303 parseBool(n) { |
| 2304 if (n == "true") return true; |
| 2305 if (n == "false") return false; |
| 2306 if (n == null) return null; |
| 2307 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2308 } |
| 2309 if (query.length > 0) { |
| 2310 for (var part in query.split("&")) { |
| 2311 var keyvalue = part.split("="); |
| 2312 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2313 } |
| 2314 } |
| 2315 |
| 2316 |
| 2317 var h = { |
| 2318 "content-type" : "application/json; charset=utf-8", |
| 2319 }; |
| 2320 var resp = convert.JSON.encode(buildInstancesUpdateResponse()); |
| 2321 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2322 }), true); |
| 2323 res.patch(arg_request, arg_project, arg_instance).then(unittest.expectAsyn
c(((api.InstancesUpdateResponse response) { |
| 2324 checkInstancesUpdateResponse(response); |
| 2325 }))); |
| 2326 }); |
| 2327 |
| 2328 unittest.test("method--promoteReplica", () { |
| 2329 |
| 2330 var mock = new common_test.HttpServerMock(); |
| 2331 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2332 var arg_project = "foo"; |
| 2333 var arg_instance = "foo"; |
| 2334 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2335 var path = (req.url).path; |
| 2336 var pathOffset = 0; |
| 2337 var index; |
| 2338 var subPart; |
| 2339 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2340 pathOffset += 13; |
| 2341 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2342 pathOffset += 9; |
| 2343 index = path.indexOf("/instances/", pathOffset); |
| 2344 unittest.expect(index >= 0, unittest.isTrue); |
| 2345 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2346 pathOffset = index; |
| 2347 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2348 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2349 pathOffset += 11; |
| 2350 index = path.indexOf("/promoteReplica", pathOffset); |
| 2351 unittest.expect(index >= 0, unittest.isTrue); |
| 2352 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2353 pathOffset = index; |
| 2354 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2355 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/promoteReplica")); |
| 2356 pathOffset += 15; |
| 2357 |
| 2358 var query = (req.url).query; |
| 2359 var queryOffset = 0; |
| 2360 var queryMap = {}; |
| 2361 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2362 parseBool(n) { |
| 2363 if (n == "true") return true; |
| 2364 if (n == "false") return false; |
| 2365 if (n == null) return null; |
| 2366 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2367 } |
| 2368 if (query.length > 0) { |
| 2369 for (var part in query.split("&")) { |
| 2370 var keyvalue = part.split("="); |
| 2371 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2372 } |
| 2373 } |
| 2374 |
| 2375 |
| 2376 var h = { |
| 2377 "content-type" : "application/json; charset=utf-8", |
| 2378 }; |
| 2379 var resp = convert.JSON.encode(buildInstancesPromoteReplicaResponse()); |
| 2380 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2381 }), true); |
| 2382 res.promoteReplica(arg_project, arg_instance).then(unittest.expectAsync(((
api.InstancesPromoteReplicaResponse response) { |
| 2383 checkInstancesPromoteReplicaResponse(response); |
| 2384 }))); |
| 2385 }); |
| 2386 |
| 2387 unittest.test("method--resetSslConfig", () { |
| 2388 |
| 2389 var mock = new common_test.HttpServerMock(); |
| 2390 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2391 var arg_project = "foo"; |
| 2392 var arg_instance = "foo"; |
| 2393 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2394 var path = (req.url).path; |
| 2395 var pathOffset = 0; |
| 2396 var index; |
| 2397 var subPart; |
| 2398 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2399 pathOffset += 13; |
| 2400 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2401 pathOffset += 9; |
| 2402 index = path.indexOf("/instances/", pathOffset); |
| 2403 unittest.expect(index >= 0, unittest.isTrue); |
| 2404 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2405 pathOffset = index; |
| 2406 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2407 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2408 pathOffset += 11; |
| 2409 index = path.indexOf("/resetSslConfig", pathOffset); |
| 2410 unittest.expect(index >= 0, unittest.isTrue); |
| 2411 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2412 pathOffset = index; |
| 2413 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2414 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/resetSslConfig")); |
| 2415 pathOffset += 15; |
| 2416 |
| 2417 var query = (req.url).query; |
| 2418 var queryOffset = 0; |
| 2419 var queryMap = {}; |
| 2420 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2421 parseBool(n) { |
| 2422 if (n == "true") return true; |
| 2423 if (n == "false") return false; |
| 2424 if (n == null) return null; |
| 2425 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2426 } |
| 2427 if (query.length > 0) { |
| 2428 for (var part in query.split("&")) { |
| 2429 var keyvalue = part.split("="); |
| 2430 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2431 } |
| 2432 } |
| 2433 |
| 2434 |
| 2435 var h = { |
| 2436 "content-type" : "application/json; charset=utf-8", |
| 2437 }; |
| 2438 var resp = convert.JSON.encode(buildInstancesResetSslConfigResponse()); |
| 2439 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2440 }), true); |
| 2441 res.resetSslConfig(arg_project, arg_instance).then(unittest.expectAsync(((
api.InstancesResetSslConfigResponse response) { |
| 2442 checkInstancesResetSslConfigResponse(response); |
| 2443 }))); |
| 2444 }); |
| 2445 |
| 2446 unittest.test("method--restart", () { |
| 2447 |
| 2448 var mock = new common_test.HttpServerMock(); |
| 2449 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2450 var arg_project = "foo"; |
| 2451 var arg_instance = "foo"; |
| 2452 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2453 var path = (req.url).path; |
| 2454 var pathOffset = 0; |
| 2455 var index; |
| 2456 var subPart; |
| 2457 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2458 pathOffset += 13; |
| 2459 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2460 pathOffset += 9; |
| 2461 index = path.indexOf("/instances/", pathOffset); |
| 2462 unittest.expect(index >= 0, unittest.isTrue); |
| 2463 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2464 pathOffset = index; |
| 2465 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2466 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2467 pathOffset += 11; |
| 2468 index = path.indexOf("/restart", pathOffset); |
| 2469 unittest.expect(index >= 0, unittest.isTrue); |
| 2470 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2471 pathOffset = index; |
| 2472 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2473 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/restart")); |
| 2474 pathOffset += 8; |
| 2475 |
| 2476 var query = (req.url).query; |
| 2477 var queryOffset = 0; |
| 2478 var queryMap = {}; |
| 2479 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2480 parseBool(n) { |
| 2481 if (n == "true") return true; |
| 2482 if (n == "false") return false; |
| 2483 if (n == null) return null; |
| 2484 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2485 } |
| 2486 if (query.length > 0) { |
| 2487 for (var part in query.split("&")) { |
| 2488 var keyvalue = part.split("="); |
| 2489 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2490 } |
| 2491 } |
| 2492 |
| 2493 |
| 2494 var h = { |
| 2495 "content-type" : "application/json; charset=utf-8", |
| 2496 }; |
| 2497 var resp = convert.JSON.encode(buildInstancesRestartResponse()); |
| 2498 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2499 }), true); |
| 2500 res.restart(arg_project, arg_instance).then(unittest.expectAsync(((api.Ins
tancesRestartResponse response) { |
| 2501 checkInstancesRestartResponse(response); |
| 2502 }))); |
| 2503 }); |
| 2504 |
| 2505 unittest.test("method--restoreBackup", () { |
| 2506 |
| 2507 var mock = new common_test.HttpServerMock(); |
| 2508 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2509 var arg_project = "foo"; |
| 2510 var arg_instance = "foo"; |
| 2511 var arg_backupConfiguration = "foo"; |
| 2512 var arg_dueTime = "foo"; |
| 2513 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2514 var path = (req.url).path; |
| 2515 var pathOffset = 0; |
| 2516 var index; |
| 2517 var subPart; |
| 2518 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2519 pathOffset += 13; |
| 2520 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2521 pathOffset += 9; |
| 2522 index = path.indexOf("/instances/", pathOffset); |
| 2523 unittest.expect(index >= 0, unittest.isTrue); |
| 2524 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2525 pathOffset = index; |
| 2526 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2527 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2528 pathOffset += 11; |
| 2529 index = path.indexOf("/restoreBackup", pathOffset); |
| 2530 unittest.expect(index >= 0, unittest.isTrue); |
| 2531 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2532 pathOffset = index; |
| 2533 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2534 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/restoreBackup")); |
| 2535 pathOffset += 14; |
| 2536 |
| 2537 var query = (req.url).query; |
| 2538 var queryOffset = 0; |
| 2539 var queryMap = {}; |
| 2540 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2541 parseBool(n) { |
| 2542 if (n == "true") return true; |
| 2543 if (n == "false") return false; |
| 2544 if (n == null) return null; |
| 2545 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2546 } |
| 2547 if (query.length > 0) { |
| 2548 for (var part in query.split("&")) { |
| 2549 var keyvalue = part.split("="); |
| 2550 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2551 } |
| 2552 } |
| 2553 unittest.expect(queryMap["backupConfiguration"].first, unittest.equals(a
rg_backupConfiguration)); |
| 2554 unittest.expect(queryMap["dueTime"].first, unittest.equals(arg_dueTime))
; |
| 2555 |
| 2556 |
| 2557 var h = { |
| 2558 "content-type" : "application/json; charset=utf-8", |
| 2559 }; |
| 2560 var resp = convert.JSON.encode(buildInstancesRestoreBackupResponse()); |
| 2561 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2562 }), true); |
| 2563 res.restoreBackup(arg_project, arg_instance, arg_backupConfiguration, arg_
dueTime).then(unittest.expectAsync(((api.InstancesRestoreBackupResponse response
) { |
| 2564 checkInstancesRestoreBackupResponse(response); |
| 2565 }))); |
| 2566 }); |
| 2567 |
| 2568 unittest.test("method--setRootPassword", () { |
| 2569 |
| 2570 var mock = new common_test.HttpServerMock(); |
| 2571 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2572 var arg_request = buildInstanceSetRootPasswordRequest(); |
| 2573 var arg_project = "foo"; |
| 2574 var arg_instance = "foo"; |
| 2575 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2576 var obj = new api.InstanceSetRootPasswordRequest.fromJson(json); |
| 2577 checkInstanceSetRootPasswordRequest(obj); |
| 2578 |
| 2579 var path = (req.url).path; |
| 2580 var pathOffset = 0; |
| 2581 var index; |
| 2582 var subPart; |
| 2583 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2584 pathOffset += 13; |
| 2585 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2586 pathOffset += 9; |
| 2587 index = path.indexOf("/instances/", pathOffset); |
| 2588 unittest.expect(index >= 0, unittest.isTrue); |
| 2589 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2590 pathOffset = index; |
| 2591 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2592 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2593 pathOffset += 11; |
| 2594 index = path.indexOf("/setRootPassword", pathOffset); |
| 2595 unittest.expect(index >= 0, unittest.isTrue); |
| 2596 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2597 pathOffset = index; |
| 2598 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2599 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/setRootPassword")); |
| 2600 pathOffset += 16; |
| 2601 |
| 2602 var query = (req.url).query; |
| 2603 var queryOffset = 0; |
| 2604 var queryMap = {}; |
| 2605 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2606 parseBool(n) { |
| 2607 if (n == "true") return true; |
| 2608 if (n == "false") return false; |
| 2609 if (n == null) return null; |
| 2610 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2611 } |
| 2612 if (query.length > 0) { |
| 2613 for (var part in query.split("&")) { |
| 2614 var keyvalue = part.split("="); |
| 2615 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2616 } |
| 2617 } |
| 2618 |
| 2619 |
| 2620 var h = { |
| 2621 "content-type" : "application/json; charset=utf-8", |
| 2622 }; |
| 2623 var resp = convert.JSON.encode(buildInstancesSetRootPasswordResponse()); |
| 2624 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2625 }), true); |
| 2626 res.setRootPassword(arg_request, arg_project, arg_instance).then(unittest.
expectAsync(((api.InstancesSetRootPasswordResponse response) { |
| 2627 checkInstancesSetRootPasswordResponse(response); |
| 2628 }))); |
| 2629 }); |
| 2630 |
| 2631 unittest.test("method--update", () { |
| 2632 |
| 2633 var mock = new common_test.HttpServerMock(); |
| 2634 api.InstancesResourceApi res = new api.SqladminApi(mock).instances; |
| 2635 var arg_request = buildDatabaseInstance(); |
| 2636 var arg_project = "foo"; |
| 2637 var arg_instance = "foo"; |
| 2638 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2639 var obj = new api.DatabaseInstance.fromJson(json); |
| 2640 checkDatabaseInstance(obj); |
| 2641 |
| 2642 var path = (req.url).path; |
| 2643 var pathOffset = 0; |
| 2644 var index; |
| 2645 var subPart; |
| 2646 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2647 pathOffset += 13; |
| 2648 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2649 pathOffset += 9; |
| 2650 index = path.indexOf("/instances/", pathOffset); |
| 2651 unittest.expect(index >= 0, unittest.isTrue); |
| 2652 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2653 pathOffset = index; |
| 2654 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2655 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2656 pathOffset += 11; |
| 2657 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2658 pathOffset = path.length; |
| 2659 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2660 |
| 2661 var query = (req.url).query; |
| 2662 var queryOffset = 0; |
| 2663 var queryMap = {}; |
| 2664 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2665 parseBool(n) { |
| 2666 if (n == "true") return true; |
| 2667 if (n == "false") return false; |
| 2668 if (n == null) return null; |
| 2669 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2670 } |
| 2671 if (query.length > 0) { |
| 2672 for (var part in query.split("&")) { |
| 2673 var keyvalue = part.split("="); |
| 2674 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2675 } |
| 2676 } |
| 2677 |
| 2678 |
| 2679 var h = { |
| 2680 "content-type" : "application/json; charset=utf-8", |
| 2681 }; |
| 2682 var resp = convert.JSON.encode(buildInstancesUpdateResponse()); |
| 2683 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2684 }), true); |
| 2685 res.update(arg_request, arg_project, arg_instance).then(unittest.expectAsy
nc(((api.InstancesUpdateResponse response) { |
| 2686 checkInstancesUpdateResponse(response); |
| 2687 }))); |
| 2688 }); |
| 2689 |
| 2690 }); |
| 2691 |
| 2692 |
| 2693 unittest.group("resource-OperationsResourceApi", () { |
| 2694 unittest.test("method--get", () { |
| 2695 |
| 2696 var mock = new common_test.HttpServerMock(); |
| 2697 api.OperationsResourceApi res = new api.SqladminApi(mock).operations; |
| 2698 var arg_project = "foo"; |
| 2699 var arg_instance = "foo"; |
| 2700 var arg_operation = "foo"; |
| 2701 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2702 var path = (req.url).path; |
| 2703 var pathOffset = 0; |
| 2704 var index; |
| 2705 var subPart; |
| 2706 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2707 pathOffset += 13; |
| 2708 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2709 pathOffset += 9; |
| 2710 index = path.indexOf("/instances/", pathOffset); |
| 2711 unittest.expect(index >= 0, unittest.isTrue); |
| 2712 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2713 pathOffset = index; |
| 2714 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2715 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2716 pathOffset += 11; |
| 2717 index = path.indexOf("/operations/", pathOffset); |
| 2718 unittest.expect(index >= 0, unittest.isTrue); |
| 2719 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2720 pathOffset = index; |
| 2721 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2722 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/operations/")); |
| 2723 pathOffset += 12; |
| 2724 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2725 pathOffset = path.length; |
| 2726 unittest.expect(subPart, unittest.equals("$arg_operation")); |
| 2727 |
| 2728 var query = (req.url).query; |
| 2729 var queryOffset = 0; |
| 2730 var queryMap = {}; |
| 2731 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2732 parseBool(n) { |
| 2733 if (n == "true") return true; |
| 2734 if (n == "false") return false; |
| 2735 if (n == null) return null; |
| 2736 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2737 } |
| 2738 if (query.length > 0) { |
| 2739 for (var part in query.split("&")) { |
| 2740 var keyvalue = part.split("="); |
| 2741 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2742 } |
| 2743 } |
| 2744 |
| 2745 |
| 2746 var h = { |
| 2747 "content-type" : "application/json; charset=utf-8", |
| 2748 }; |
| 2749 var resp = convert.JSON.encode(buildInstanceOperation()); |
| 2750 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2751 }), true); |
| 2752 res.get(arg_project, arg_instance, arg_operation).then(unittest.expectAsyn
c(((api.InstanceOperation response) { |
| 2753 checkInstanceOperation(response); |
| 2754 }))); |
| 2755 }); |
| 2756 |
| 2757 unittest.test("method--list", () { |
| 2758 |
| 2759 var mock = new common_test.HttpServerMock(); |
| 2760 api.OperationsResourceApi res = new api.SqladminApi(mock).operations; |
| 2761 var arg_project = "foo"; |
| 2762 var arg_instance = "foo"; |
| 2763 var arg_maxResults = 42; |
| 2764 var arg_pageToken = "foo"; |
| 2765 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2766 var path = (req.url).path; |
| 2767 var pathOffset = 0; |
| 2768 var index; |
| 2769 var subPart; |
| 2770 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2771 pathOffset += 13; |
| 2772 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2773 pathOffset += 9; |
| 2774 index = path.indexOf("/instances/", pathOffset); |
| 2775 unittest.expect(index >= 0, unittest.isTrue); |
| 2776 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2777 pathOffset = index; |
| 2778 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2779 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2780 pathOffset += 11; |
| 2781 index = path.indexOf("/operations", pathOffset); |
| 2782 unittest.expect(index >= 0, unittest.isTrue); |
| 2783 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2784 pathOffset = index; |
| 2785 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2786 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/operations")); |
| 2787 pathOffset += 11; |
| 2788 |
| 2789 var query = (req.url).query; |
| 2790 var queryOffset = 0; |
| 2791 var queryMap = {}; |
| 2792 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2793 parseBool(n) { |
| 2794 if (n == "true") return true; |
| 2795 if (n == "false") return false; |
| 2796 if (n == null) return null; |
| 2797 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2798 } |
| 2799 if (query.length > 0) { |
| 2800 for (var part in query.split("&")) { |
| 2801 var keyvalue = part.split("="); |
| 2802 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2803 } |
| 2804 } |
| 2805 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 2806 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2807 |
| 2808 |
| 2809 var h = { |
| 2810 "content-type" : "application/json; charset=utf-8", |
| 2811 }; |
| 2812 var resp = convert.JSON.encode(buildOperationsListResponse()); |
| 2813 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2814 }), true); |
| 2815 res.list(arg_project, arg_instance, maxResults: arg_maxResults, pageToken:
arg_pageToken).then(unittest.expectAsync(((api.OperationsListResponse response)
{ |
| 2816 checkOperationsListResponse(response); |
| 2817 }))); |
| 2818 }); |
| 2819 |
| 2820 }); |
| 2821 |
| 2822 |
| 2823 unittest.group("resource-SslCertsResourceApi", () { |
| 2824 unittest.test("method--delete", () { |
| 2825 |
| 2826 var mock = new common_test.HttpServerMock(); |
| 2827 api.SslCertsResourceApi res = new api.SqladminApi(mock).sslCerts; |
| 2828 var arg_project = "foo"; |
| 2829 var arg_instance = "foo"; |
| 2830 var arg_sha1Fingerprint = "foo"; |
| 2831 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2832 var path = (req.url).path; |
| 2833 var pathOffset = 0; |
| 2834 var index; |
| 2835 var subPart; |
| 2836 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2837 pathOffset += 13; |
| 2838 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2839 pathOffset += 9; |
| 2840 index = path.indexOf("/instances/", pathOffset); |
| 2841 unittest.expect(index >= 0, unittest.isTrue); |
| 2842 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2843 pathOffset = index; |
| 2844 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2845 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2846 pathOffset += 11; |
| 2847 index = path.indexOf("/sslCerts/", pathOffset); |
| 2848 unittest.expect(index >= 0, unittest.isTrue); |
| 2849 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2850 pathOffset = index; |
| 2851 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2852 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/sslCerts/")); |
| 2853 pathOffset += 10; |
| 2854 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2855 pathOffset = path.length; |
| 2856 unittest.expect(subPart, unittest.equals("$arg_sha1Fingerprint")); |
| 2857 |
| 2858 var query = (req.url).query; |
| 2859 var queryOffset = 0; |
| 2860 var queryMap = {}; |
| 2861 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2862 parseBool(n) { |
| 2863 if (n == "true") return true; |
| 2864 if (n == "false") return false; |
| 2865 if (n == null) return null; |
| 2866 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2867 } |
| 2868 if (query.length > 0) { |
| 2869 for (var part in query.split("&")) { |
| 2870 var keyvalue = part.split("="); |
| 2871 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2872 } |
| 2873 } |
| 2874 |
| 2875 |
| 2876 var h = { |
| 2877 "content-type" : "application/json; charset=utf-8", |
| 2878 }; |
| 2879 var resp = convert.JSON.encode(buildSslCertsDeleteResponse()); |
| 2880 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2881 }), true); |
| 2882 res.delete(arg_project, arg_instance, arg_sha1Fingerprint).then(unittest.e
xpectAsync(((api.SslCertsDeleteResponse response) { |
| 2883 checkSslCertsDeleteResponse(response); |
| 2884 }))); |
| 2885 }); |
| 2886 |
| 2887 unittest.test("method--get", () { |
| 2888 |
| 2889 var mock = new common_test.HttpServerMock(); |
| 2890 api.SslCertsResourceApi res = new api.SqladminApi(mock).sslCerts; |
| 2891 var arg_project = "foo"; |
| 2892 var arg_instance = "foo"; |
| 2893 var arg_sha1Fingerprint = "foo"; |
| 2894 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2895 var path = (req.url).path; |
| 2896 var pathOffset = 0; |
| 2897 var index; |
| 2898 var subPart; |
| 2899 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2900 pathOffset += 13; |
| 2901 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2902 pathOffset += 9; |
| 2903 index = path.indexOf("/instances/", pathOffset); |
| 2904 unittest.expect(index >= 0, unittest.isTrue); |
| 2905 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2906 pathOffset = index; |
| 2907 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2908 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2909 pathOffset += 11; |
| 2910 index = path.indexOf("/sslCerts/", pathOffset); |
| 2911 unittest.expect(index >= 0, unittest.isTrue); |
| 2912 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2913 pathOffset = index; |
| 2914 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2915 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/sslCerts/")); |
| 2916 pathOffset += 10; |
| 2917 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 2918 pathOffset = path.length; |
| 2919 unittest.expect(subPart, unittest.equals("$arg_sha1Fingerprint")); |
| 2920 |
| 2921 var query = (req.url).query; |
| 2922 var queryOffset = 0; |
| 2923 var queryMap = {}; |
| 2924 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2925 parseBool(n) { |
| 2926 if (n == "true") return true; |
| 2927 if (n == "false") return false; |
| 2928 if (n == null) return null; |
| 2929 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2930 } |
| 2931 if (query.length > 0) { |
| 2932 for (var part in query.split("&")) { |
| 2933 var keyvalue = part.split("="); |
| 2934 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2935 } |
| 2936 } |
| 2937 |
| 2938 |
| 2939 var h = { |
| 2940 "content-type" : "application/json; charset=utf-8", |
| 2941 }; |
| 2942 var resp = convert.JSON.encode(buildSslCert()); |
| 2943 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 2944 }), true); |
| 2945 res.get(arg_project, arg_instance, arg_sha1Fingerprint).then(unittest.expe
ctAsync(((api.SslCert response) { |
| 2946 checkSslCert(response); |
| 2947 }))); |
| 2948 }); |
| 2949 |
| 2950 unittest.test("method--insert", () { |
| 2951 |
| 2952 var mock = new common_test.HttpServerMock(); |
| 2953 api.SslCertsResourceApi res = new api.SqladminApi(mock).sslCerts; |
| 2954 var arg_request = buildSslCertsInsertRequest(); |
| 2955 var arg_project = "foo"; |
| 2956 var arg_instance = "foo"; |
| 2957 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2958 var obj = new api.SslCertsInsertRequest.fromJson(json); |
| 2959 checkSslCertsInsertRequest(obj); |
| 2960 |
| 2961 var path = (req.url).path; |
| 2962 var pathOffset = 0; |
| 2963 var index; |
| 2964 var subPart; |
| 2965 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 2966 pathOffset += 13; |
| 2967 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 2968 pathOffset += 9; |
| 2969 index = path.indexOf("/instances/", pathOffset); |
| 2970 unittest.expect(index >= 0, unittest.isTrue); |
| 2971 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2972 pathOffset = index; |
| 2973 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 2974 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 2975 pathOffset += 11; |
| 2976 index = path.indexOf("/sslCerts", pathOffset); |
| 2977 unittest.expect(index >= 0, unittest.isTrue); |
| 2978 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 2979 pathOffset = index; |
| 2980 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 2981 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/sslCerts")); |
| 2982 pathOffset += 9; |
| 2983 |
| 2984 var query = (req.url).query; |
| 2985 var queryOffset = 0; |
| 2986 var queryMap = {}; |
| 2987 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2988 parseBool(n) { |
| 2989 if (n == "true") return true; |
| 2990 if (n == "false") return false; |
| 2991 if (n == null) return null; |
| 2992 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2993 } |
| 2994 if (query.length > 0) { |
| 2995 for (var part in query.split("&")) { |
| 2996 var keyvalue = part.split("="); |
| 2997 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2998 } |
| 2999 } |
| 3000 |
| 3001 |
| 3002 var h = { |
| 3003 "content-type" : "application/json; charset=utf-8", |
| 3004 }; |
| 3005 var resp = convert.JSON.encode(buildSslCertsInsertResponse()); |
| 3006 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3007 }), true); |
| 3008 res.insert(arg_request, arg_project, arg_instance).then(unittest.expectAsy
nc(((api.SslCertsInsertResponse response) { |
| 3009 checkSslCertsInsertResponse(response); |
| 3010 }))); |
| 3011 }); |
| 3012 |
| 3013 unittest.test("method--list", () { |
| 3014 |
| 3015 var mock = new common_test.HttpServerMock(); |
| 3016 api.SslCertsResourceApi res = new api.SqladminApi(mock).sslCerts; |
| 3017 var arg_project = "foo"; |
| 3018 var arg_instance = "foo"; |
| 3019 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3020 var path = (req.url).path; |
| 3021 var pathOffset = 0; |
| 3022 var index; |
| 3023 var subPart; |
| 3024 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 3025 pathOffset += 13; |
| 3026 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 3027 pathOffset += 9; |
| 3028 index = path.indexOf("/instances/", pathOffset); |
| 3029 unittest.expect(index >= 0, unittest.isTrue); |
| 3030 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3031 pathOffset = index; |
| 3032 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 3033 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/instances/")); |
| 3034 pathOffset += 11; |
| 3035 index = path.indexOf("/sslCerts", pathOffset); |
| 3036 unittest.expect(index >= 0, unittest.isTrue); |
| 3037 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3038 pathOffset = index; |
| 3039 unittest.expect(subPart, unittest.equals("$arg_instance")); |
| 3040 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/sslCerts")); |
| 3041 pathOffset += 9; |
| 3042 |
| 3043 var query = (req.url).query; |
| 3044 var queryOffset = 0; |
| 3045 var queryMap = {}; |
| 3046 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3047 parseBool(n) { |
| 3048 if (n == "true") return true; |
| 3049 if (n == "false") return false; |
| 3050 if (n == null) return null; |
| 3051 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3052 } |
| 3053 if (query.length > 0) { |
| 3054 for (var part in query.split("&")) { |
| 3055 var keyvalue = part.split("="); |
| 3056 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3057 } |
| 3058 } |
| 3059 |
| 3060 |
| 3061 var h = { |
| 3062 "content-type" : "application/json; charset=utf-8", |
| 3063 }; |
| 3064 var resp = convert.JSON.encode(buildSslCertsListResponse()); |
| 3065 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3066 }), true); |
| 3067 res.list(arg_project, arg_instance).then(unittest.expectAsync(((api.SslCer
tsListResponse response) { |
| 3068 checkSslCertsListResponse(response); |
| 3069 }))); |
| 3070 }); |
| 3071 |
| 3072 }); |
| 3073 |
| 3074 |
| 3075 unittest.group("resource-TiersResourceApi", () { |
| 3076 unittest.test("method--list", () { |
| 3077 |
| 3078 var mock = new common_test.HttpServerMock(); |
| 3079 api.TiersResourceApi res = new api.SqladminApi(mock).tiers; |
| 3080 var arg_project = "foo"; |
| 3081 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 3082 var path = (req.url).path; |
| 3083 var pathOffset = 0; |
| 3084 var index; |
| 3085 var subPart; |
| 3086 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/sql/v1beta3/")); |
| 3087 pathOffset += 13; |
| 3088 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("projects/")); |
| 3089 pathOffset += 9; |
| 3090 index = path.indexOf("/tiers", pathOffset); |
| 3091 unittest.expect(index >= 0, unittest.isTrue); |
| 3092 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 3093 pathOffset = index; |
| 3094 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 3095 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/tiers")); |
| 3096 pathOffset += 6; |
| 3097 |
| 3098 var query = (req.url).query; |
| 3099 var queryOffset = 0; |
| 3100 var queryMap = {}; |
| 3101 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 3102 parseBool(n) { |
| 3103 if (n == "true") return true; |
| 3104 if (n == "false") return false; |
| 3105 if (n == null) return null; |
| 3106 throw new core.ArgumentError("Invalid boolean: $n"); |
| 3107 } |
| 3108 if (query.length > 0) { |
| 3109 for (var part in query.split("&")) { |
| 3110 var keyvalue = part.split("="); |
| 3111 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 3112 } |
| 3113 } |
| 3114 |
| 3115 |
| 3116 var h = { |
| 3117 "content-type" : "application/json; charset=utf-8", |
| 3118 }; |
| 3119 var resp = convert.JSON.encode(buildTiersListResponse()); |
| 3120 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 3121 }), true); |
| 3122 res.list(arg_project).then(unittest.expectAsync(((api.TiersListResponse re
sponse) { |
| 3123 checkTiersListResponse(response); |
| 3124 }))); |
| 3125 }); |
| 3126 |
| 3127 }); |
| 3128 |
| 3129 |
| 3130 } |
| 3131 |
OLD | NEW |