| OLD | NEW |
| (Empty) |
| 1 library googleapis_beta.cloudkms.v1beta1.test; | |
| 2 | |
| 3 import "dart:core" as core; | |
| 4 import "dart:collection" as collection; | |
| 5 import "dart:async" as async; | |
| 6 import "dart:convert" as convert; | |
| 7 | |
| 8 import 'package:http/http.dart' as http; | |
| 9 import 'package:http/testing.dart' as http_testing; | |
| 10 import 'package:unittest/unittest.dart' as unittest; | |
| 11 | |
| 12 import 'package:googleapis_beta/cloudkms/v1beta1.dart' as api; | |
| 13 | |
| 14 class HttpServerMock extends http.BaseClient { | |
| 15 core.Function _callback; | |
| 16 core.bool _expectJson; | |
| 17 | |
| 18 void register(core.Function callback, core.bool expectJson) { | |
| 19 _callback = callback; | |
| 20 _expectJson = expectJson; | |
| 21 } | |
| 22 | |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | |
| 24 if (_expectJson) { | |
| 25 return request.finalize() | |
| 26 .transform(convert.UTF8.decoder) | |
| 27 .join('') | |
| 28 .then((core.String jsonString) { | |
| 29 if (jsonString.isEmpty) { | |
| 30 return _callback(request, null); | |
| 31 } else { | |
| 32 return _callback(request, convert.JSON.decode(jsonString)); | |
| 33 } | |
| 34 }); | |
| 35 } else { | |
| 36 var stream = request.finalize(); | |
| 37 if (stream == null) { | |
| 38 return _callback(request, []); | |
| 39 } else { | |
| 40 return stream.toBytes().then((data) { | |
| 41 return _callback(request, data); | |
| 42 }); | |
| 43 } | |
| 44 } | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 http.StreamedResponse stringResponse( | |
| 49 core.int status, core.Map headers, core.String body) { | |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | |
| 52 } | |
| 53 | |
| 54 buildUnnamed3320() { | |
| 55 var o = new core.List<api.AuditLogConfig>(); | |
| 56 o.add(buildAuditLogConfig()); | |
| 57 o.add(buildAuditLogConfig()); | |
| 58 return o; | |
| 59 } | |
| 60 | |
| 61 checkUnnamed3320(core.List<api.AuditLogConfig> o) { | |
| 62 unittest.expect(o, unittest.hasLength(2)); | |
| 63 checkAuditLogConfig(o[0]); | |
| 64 checkAuditLogConfig(o[1]); | |
| 65 } | |
| 66 | |
| 67 buildUnnamed3321() { | |
| 68 var o = new core.List<core.String>(); | |
| 69 o.add("foo"); | |
| 70 o.add("foo"); | |
| 71 return o; | |
| 72 } | |
| 73 | |
| 74 checkUnnamed3321(core.List<core.String> o) { | |
| 75 unittest.expect(o, unittest.hasLength(2)); | |
| 76 unittest.expect(o[0], unittest.equals('foo')); | |
| 77 unittest.expect(o[1], unittest.equals('foo')); | |
| 78 } | |
| 79 | |
| 80 core.int buildCounterAuditConfig = 0; | |
| 81 buildAuditConfig() { | |
| 82 var o = new api.AuditConfig(); | |
| 83 buildCounterAuditConfig++; | |
| 84 if (buildCounterAuditConfig < 3) { | |
| 85 o.auditLogConfigs = buildUnnamed3320(); | |
| 86 o.exemptedMembers = buildUnnamed3321(); | |
| 87 o.service = "foo"; | |
| 88 } | |
| 89 buildCounterAuditConfig--; | |
| 90 return o; | |
| 91 } | |
| 92 | |
| 93 checkAuditConfig(api.AuditConfig o) { | |
| 94 buildCounterAuditConfig++; | |
| 95 if (buildCounterAuditConfig < 3) { | |
| 96 checkUnnamed3320(o.auditLogConfigs); | |
| 97 checkUnnamed3321(o.exemptedMembers); | |
| 98 unittest.expect(o.service, unittest.equals('foo')); | |
| 99 } | |
| 100 buildCounterAuditConfig--; | |
| 101 } | |
| 102 | |
| 103 buildUnnamed3322() { | |
| 104 var o = new core.List<core.String>(); | |
| 105 o.add("foo"); | |
| 106 o.add("foo"); | |
| 107 return o; | |
| 108 } | |
| 109 | |
| 110 checkUnnamed3322(core.List<core.String> o) { | |
| 111 unittest.expect(o, unittest.hasLength(2)); | |
| 112 unittest.expect(o[0], unittest.equals('foo')); | |
| 113 unittest.expect(o[1], unittest.equals('foo')); | |
| 114 } | |
| 115 | |
| 116 core.int buildCounterAuditLogConfig = 0; | |
| 117 buildAuditLogConfig() { | |
| 118 var o = new api.AuditLogConfig(); | |
| 119 buildCounterAuditLogConfig++; | |
| 120 if (buildCounterAuditLogConfig < 3) { | |
| 121 o.exemptedMembers = buildUnnamed3322(); | |
| 122 o.logType = "foo"; | |
| 123 } | |
| 124 buildCounterAuditLogConfig--; | |
| 125 return o; | |
| 126 } | |
| 127 | |
| 128 checkAuditLogConfig(api.AuditLogConfig o) { | |
| 129 buildCounterAuditLogConfig++; | |
| 130 if (buildCounterAuditLogConfig < 3) { | |
| 131 checkUnnamed3322(o.exemptedMembers); | |
| 132 unittest.expect(o.logType, unittest.equals('foo')); | |
| 133 } | |
| 134 buildCounterAuditLogConfig--; | |
| 135 } | |
| 136 | |
| 137 buildUnnamed3323() { | |
| 138 var o = new core.List<core.String>(); | |
| 139 o.add("foo"); | |
| 140 o.add("foo"); | |
| 141 return o; | |
| 142 } | |
| 143 | |
| 144 checkUnnamed3323(core.List<core.String> o) { | |
| 145 unittest.expect(o, unittest.hasLength(2)); | |
| 146 unittest.expect(o[0], unittest.equals('foo')); | |
| 147 unittest.expect(o[1], unittest.equals('foo')); | |
| 148 } | |
| 149 | |
| 150 core.int buildCounterBinding = 0; | |
| 151 buildBinding() { | |
| 152 var o = new api.Binding(); | |
| 153 buildCounterBinding++; | |
| 154 if (buildCounterBinding < 3) { | |
| 155 o.members = buildUnnamed3323(); | |
| 156 o.role = "foo"; | |
| 157 } | |
| 158 buildCounterBinding--; | |
| 159 return o; | |
| 160 } | |
| 161 | |
| 162 checkBinding(api.Binding o) { | |
| 163 buildCounterBinding++; | |
| 164 if (buildCounterBinding < 3) { | |
| 165 checkUnnamed3323(o.members); | |
| 166 unittest.expect(o.role, unittest.equals('foo')); | |
| 167 } | |
| 168 buildCounterBinding--; | |
| 169 } | |
| 170 | |
| 171 core.int buildCounterCloudAuditOptions = 0; | |
| 172 buildCloudAuditOptions() { | |
| 173 var o = new api.CloudAuditOptions(); | |
| 174 buildCounterCloudAuditOptions++; | |
| 175 if (buildCounterCloudAuditOptions < 3) { | |
| 176 } | |
| 177 buildCounterCloudAuditOptions--; | |
| 178 return o; | |
| 179 } | |
| 180 | |
| 181 checkCloudAuditOptions(api.CloudAuditOptions o) { | |
| 182 buildCounterCloudAuditOptions++; | |
| 183 if (buildCounterCloudAuditOptions < 3) { | |
| 184 } | |
| 185 buildCounterCloudAuditOptions--; | |
| 186 } | |
| 187 | |
| 188 buildUnnamed3324() { | |
| 189 var o = new core.List<core.String>(); | |
| 190 o.add("foo"); | |
| 191 o.add("foo"); | |
| 192 return o; | |
| 193 } | |
| 194 | |
| 195 checkUnnamed3324(core.List<core.String> o) { | |
| 196 unittest.expect(o, unittest.hasLength(2)); | |
| 197 unittest.expect(o[0], unittest.equals('foo')); | |
| 198 unittest.expect(o[1], unittest.equals('foo')); | |
| 199 } | |
| 200 | |
| 201 core.int buildCounterCondition = 0; | |
| 202 buildCondition() { | |
| 203 var o = new api.Condition(); | |
| 204 buildCounterCondition++; | |
| 205 if (buildCounterCondition < 3) { | |
| 206 o.iam = "foo"; | |
| 207 o.op = "foo"; | |
| 208 o.svc = "foo"; | |
| 209 o.sys = "foo"; | |
| 210 o.value = "foo"; | |
| 211 o.values = buildUnnamed3324(); | |
| 212 } | |
| 213 buildCounterCondition--; | |
| 214 return o; | |
| 215 } | |
| 216 | |
| 217 checkCondition(api.Condition o) { | |
| 218 buildCounterCondition++; | |
| 219 if (buildCounterCondition < 3) { | |
| 220 unittest.expect(o.iam, unittest.equals('foo')); | |
| 221 unittest.expect(o.op, unittest.equals('foo')); | |
| 222 unittest.expect(o.svc, unittest.equals('foo')); | |
| 223 unittest.expect(o.sys, unittest.equals('foo')); | |
| 224 unittest.expect(o.value, unittest.equals('foo')); | |
| 225 checkUnnamed3324(o.values); | |
| 226 } | |
| 227 buildCounterCondition--; | |
| 228 } | |
| 229 | |
| 230 core.int buildCounterCounterOptions = 0; | |
| 231 buildCounterOptions() { | |
| 232 var o = new api.CounterOptions(); | |
| 233 buildCounterCounterOptions++; | |
| 234 if (buildCounterCounterOptions < 3) { | |
| 235 o.field = "foo"; | |
| 236 o.metric = "foo"; | |
| 237 } | |
| 238 buildCounterCounterOptions--; | |
| 239 return o; | |
| 240 } | |
| 241 | |
| 242 checkCounterOptions(api.CounterOptions o) { | |
| 243 buildCounterCounterOptions++; | |
| 244 if (buildCounterCounterOptions < 3) { | |
| 245 unittest.expect(o.field, unittest.equals('foo')); | |
| 246 unittest.expect(o.metric, unittest.equals('foo')); | |
| 247 } | |
| 248 buildCounterCounterOptions--; | |
| 249 } | |
| 250 | |
| 251 core.int buildCounterCryptoKey = 0; | |
| 252 buildCryptoKey() { | |
| 253 var o = new api.CryptoKey(); | |
| 254 buildCounterCryptoKey++; | |
| 255 if (buildCounterCryptoKey < 3) { | |
| 256 o.createTime = "foo"; | |
| 257 o.name = "foo"; | |
| 258 o.nextRotationTime = "foo"; | |
| 259 o.primary = buildCryptoKeyVersion(); | |
| 260 o.purpose = "foo"; | |
| 261 o.rotationPeriod = "foo"; | |
| 262 } | |
| 263 buildCounterCryptoKey--; | |
| 264 return o; | |
| 265 } | |
| 266 | |
| 267 checkCryptoKey(api.CryptoKey o) { | |
| 268 buildCounterCryptoKey++; | |
| 269 if (buildCounterCryptoKey < 3) { | |
| 270 unittest.expect(o.createTime, unittest.equals('foo')); | |
| 271 unittest.expect(o.name, unittest.equals('foo')); | |
| 272 unittest.expect(o.nextRotationTime, unittest.equals('foo')); | |
| 273 checkCryptoKeyVersion(o.primary); | |
| 274 unittest.expect(o.purpose, unittest.equals('foo')); | |
| 275 unittest.expect(o.rotationPeriod, unittest.equals('foo')); | |
| 276 } | |
| 277 buildCounterCryptoKey--; | |
| 278 } | |
| 279 | |
| 280 core.int buildCounterCryptoKeyVersion = 0; | |
| 281 buildCryptoKeyVersion() { | |
| 282 var o = new api.CryptoKeyVersion(); | |
| 283 buildCounterCryptoKeyVersion++; | |
| 284 if (buildCounterCryptoKeyVersion < 3) { | |
| 285 o.createTime = "foo"; | |
| 286 o.destroyEventTime = "foo"; | |
| 287 o.destroyTime = "foo"; | |
| 288 o.name = "foo"; | |
| 289 o.state = "foo"; | |
| 290 } | |
| 291 buildCounterCryptoKeyVersion--; | |
| 292 return o; | |
| 293 } | |
| 294 | |
| 295 checkCryptoKeyVersion(api.CryptoKeyVersion o) { | |
| 296 buildCounterCryptoKeyVersion++; | |
| 297 if (buildCounterCryptoKeyVersion < 3) { | |
| 298 unittest.expect(o.createTime, unittest.equals('foo')); | |
| 299 unittest.expect(o.destroyEventTime, unittest.equals('foo')); | |
| 300 unittest.expect(o.destroyTime, unittest.equals('foo')); | |
| 301 unittest.expect(o.name, unittest.equals('foo')); | |
| 302 unittest.expect(o.state, unittest.equals('foo')); | |
| 303 } | |
| 304 buildCounterCryptoKeyVersion--; | |
| 305 } | |
| 306 | |
| 307 core.int buildCounterDataAccessOptions = 0; | |
| 308 buildDataAccessOptions() { | |
| 309 var o = new api.DataAccessOptions(); | |
| 310 buildCounterDataAccessOptions++; | |
| 311 if (buildCounterDataAccessOptions < 3) { | |
| 312 } | |
| 313 buildCounterDataAccessOptions--; | |
| 314 return o; | |
| 315 } | |
| 316 | |
| 317 checkDataAccessOptions(api.DataAccessOptions o) { | |
| 318 buildCounterDataAccessOptions++; | |
| 319 if (buildCounterDataAccessOptions < 3) { | |
| 320 } | |
| 321 buildCounterDataAccessOptions--; | |
| 322 } | |
| 323 | |
| 324 core.int buildCounterDecryptRequest = 0; | |
| 325 buildDecryptRequest() { | |
| 326 var o = new api.DecryptRequest(); | |
| 327 buildCounterDecryptRequest++; | |
| 328 if (buildCounterDecryptRequest < 3) { | |
| 329 o.additionalAuthenticatedData = "foo"; | |
| 330 o.ciphertext = "foo"; | |
| 331 } | |
| 332 buildCounterDecryptRequest--; | |
| 333 return o; | |
| 334 } | |
| 335 | |
| 336 checkDecryptRequest(api.DecryptRequest o) { | |
| 337 buildCounterDecryptRequest++; | |
| 338 if (buildCounterDecryptRequest < 3) { | |
| 339 unittest.expect(o.additionalAuthenticatedData, unittest.equals('foo')); | |
| 340 unittest.expect(o.ciphertext, unittest.equals('foo')); | |
| 341 } | |
| 342 buildCounterDecryptRequest--; | |
| 343 } | |
| 344 | |
| 345 core.int buildCounterDecryptResponse = 0; | |
| 346 buildDecryptResponse() { | |
| 347 var o = new api.DecryptResponse(); | |
| 348 buildCounterDecryptResponse++; | |
| 349 if (buildCounterDecryptResponse < 3) { | |
| 350 o.plaintext = "foo"; | |
| 351 } | |
| 352 buildCounterDecryptResponse--; | |
| 353 return o; | |
| 354 } | |
| 355 | |
| 356 checkDecryptResponse(api.DecryptResponse o) { | |
| 357 buildCounterDecryptResponse++; | |
| 358 if (buildCounterDecryptResponse < 3) { | |
| 359 unittest.expect(o.plaintext, unittest.equals('foo')); | |
| 360 } | |
| 361 buildCounterDecryptResponse--; | |
| 362 } | |
| 363 | |
| 364 core.int buildCounterDestroyCryptoKeyVersionRequest = 0; | |
| 365 buildDestroyCryptoKeyVersionRequest() { | |
| 366 var o = new api.DestroyCryptoKeyVersionRequest(); | |
| 367 buildCounterDestroyCryptoKeyVersionRequest++; | |
| 368 if (buildCounterDestroyCryptoKeyVersionRequest < 3) { | |
| 369 } | |
| 370 buildCounterDestroyCryptoKeyVersionRequest--; | |
| 371 return o; | |
| 372 } | |
| 373 | |
| 374 checkDestroyCryptoKeyVersionRequest(api.DestroyCryptoKeyVersionRequest o) { | |
| 375 buildCounterDestroyCryptoKeyVersionRequest++; | |
| 376 if (buildCounterDestroyCryptoKeyVersionRequest < 3) { | |
| 377 } | |
| 378 buildCounterDestroyCryptoKeyVersionRequest--; | |
| 379 } | |
| 380 | |
| 381 core.int buildCounterEncryptRequest = 0; | |
| 382 buildEncryptRequest() { | |
| 383 var o = new api.EncryptRequest(); | |
| 384 buildCounterEncryptRequest++; | |
| 385 if (buildCounterEncryptRequest < 3) { | |
| 386 o.additionalAuthenticatedData = "foo"; | |
| 387 o.plaintext = "foo"; | |
| 388 } | |
| 389 buildCounterEncryptRequest--; | |
| 390 return o; | |
| 391 } | |
| 392 | |
| 393 checkEncryptRequest(api.EncryptRequest o) { | |
| 394 buildCounterEncryptRequest++; | |
| 395 if (buildCounterEncryptRequest < 3) { | |
| 396 unittest.expect(o.additionalAuthenticatedData, unittest.equals('foo')); | |
| 397 unittest.expect(o.plaintext, unittest.equals('foo')); | |
| 398 } | |
| 399 buildCounterEncryptRequest--; | |
| 400 } | |
| 401 | |
| 402 core.int buildCounterEncryptResponse = 0; | |
| 403 buildEncryptResponse() { | |
| 404 var o = new api.EncryptResponse(); | |
| 405 buildCounterEncryptResponse++; | |
| 406 if (buildCounterEncryptResponse < 3) { | |
| 407 o.ciphertext = "foo"; | |
| 408 o.name = "foo"; | |
| 409 } | |
| 410 buildCounterEncryptResponse--; | |
| 411 return o; | |
| 412 } | |
| 413 | |
| 414 checkEncryptResponse(api.EncryptResponse o) { | |
| 415 buildCounterEncryptResponse++; | |
| 416 if (buildCounterEncryptResponse < 3) { | |
| 417 unittest.expect(o.ciphertext, unittest.equals('foo')); | |
| 418 unittest.expect(o.name, unittest.equals('foo')); | |
| 419 } | |
| 420 buildCounterEncryptResponse--; | |
| 421 } | |
| 422 | |
| 423 core.int buildCounterKeyRing = 0; | |
| 424 buildKeyRing() { | |
| 425 var o = new api.KeyRing(); | |
| 426 buildCounterKeyRing++; | |
| 427 if (buildCounterKeyRing < 3) { | |
| 428 o.createTime = "foo"; | |
| 429 o.name = "foo"; | |
| 430 } | |
| 431 buildCounterKeyRing--; | |
| 432 return o; | |
| 433 } | |
| 434 | |
| 435 checkKeyRing(api.KeyRing o) { | |
| 436 buildCounterKeyRing++; | |
| 437 if (buildCounterKeyRing < 3) { | |
| 438 unittest.expect(o.createTime, unittest.equals('foo')); | |
| 439 unittest.expect(o.name, unittest.equals('foo')); | |
| 440 } | |
| 441 buildCounterKeyRing--; | |
| 442 } | |
| 443 | |
| 444 buildUnnamed3325() { | |
| 445 var o = new core.List<api.CryptoKeyVersion>(); | |
| 446 o.add(buildCryptoKeyVersion()); | |
| 447 o.add(buildCryptoKeyVersion()); | |
| 448 return o; | |
| 449 } | |
| 450 | |
| 451 checkUnnamed3325(core.List<api.CryptoKeyVersion> o) { | |
| 452 unittest.expect(o, unittest.hasLength(2)); | |
| 453 checkCryptoKeyVersion(o[0]); | |
| 454 checkCryptoKeyVersion(o[1]); | |
| 455 } | |
| 456 | |
| 457 core.int buildCounterListCryptoKeyVersionsResponse = 0; | |
| 458 buildListCryptoKeyVersionsResponse() { | |
| 459 var o = new api.ListCryptoKeyVersionsResponse(); | |
| 460 buildCounterListCryptoKeyVersionsResponse++; | |
| 461 if (buildCounterListCryptoKeyVersionsResponse < 3) { | |
| 462 o.cryptoKeyVersions = buildUnnamed3325(); | |
| 463 o.nextPageToken = "foo"; | |
| 464 o.totalSize = 42; | |
| 465 } | |
| 466 buildCounterListCryptoKeyVersionsResponse--; | |
| 467 return o; | |
| 468 } | |
| 469 | |
| 470 checkListCryptoKeyVersionsResponse(api.ListCryptoKeyVersionsResponse o) { | |
| 471 buildCounterListCryptoKeyVersionsResponse++; | |
| 472 if (buildCounterListCryptoKeyVersionsResponse < 3) { | |
| 473 checkUnnamed3325(o.cryptoKeyVersions); | |
| 474 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
| 475 unittest.expect(o.totalSize, unittest.equals(42)); | |
| 476 } | |
| 477 buildCounterListCryptoKeyVersionsResponse--; | |
| 478 } | |
| 479 | |
| 480 buildUnnamed3326() { | |
| 481 var o = new core.List<api.CryptoKey>(); | |
| 482 o.add(buildCryptoKey()); | |
| 483 o.add(buildCryptoKey()); | |
| 484 return o; | |
| 485 } | |
| 486 | |
| 487 checkUnnamed3326(core.List<api.CryptoKey> o) { | |
| 488 unittest.expect(o, unittest.hasLength(2)); | |
| 489 checkCryptoKey(o[0]); | |
| 490 checkCryptoKey(o[1]); | |
| 491 } | |
| 492 | |
| 493 core.int buildCounterListCryptoKeysResponse = 0; | |
| 494 buildListCryptoKeysResponse() { | |
| 495 var o = new api.ListCryptoKeysResponse(); | |
| 496 buildCounterListCryptoKeysResponse++; | |
| 497 if (buildCounterListCryptoKeysResponse < 3) { | |
| 498 o.cryptoKeys = buildUnnamed3326(); | |
| 499 o.nextPageToken = "foo"; | |
| 500 o.totalSize = 42; | |
| 501 } | |
| 502 buildCounterListCryptoKeysResponse--; | |
| 503 return o; | |
| 504 } | |
| 505 | |
| 506 checkListCryptoKeysResponse(api.ListCryptoKeysResponse o) { | |
| 507 buildCounterListCryptoKeysResponse++; | |
| 508 if (buildCounterListCryptoKeysResponse < 3) { | |
| 509 checkUnnamed3326(o.cryptoKeys); | |
| 510 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
| 511 unittest.expect(o.totalSize, unittest.equals(42)); | |
| 512 } | |
| 513 buildCounterListCryptoKeysResponse--; | |
| 514 } | |
| 515 | |
| 516 buildUnnamed3327() { | |
| 517 var o = new core.List<api.KeyRing>(); | |
| 518 o.add(buildKeyRing()); | |
| 519 o.add(buildKeyRing()); | |
| 520 return o; | |
| 521 } | |
| 522 | |
| 523 checkUnnamed3327(core.List<api.KeyRing> o) { | |
| 524 unittest.expect(o, unittest.hasLength(2)); | |
| 525 checkKeyRing(o[0]); | |
| 526 checkKeyRing(o[1]); | |
| 527 } | |
| 528 | |
| 529 core.int buildCounterListKeyRingsResponse = 0; | |
| 530 buildListKeyRingsResponse() { | |
| 531 var o = new api.ListKeyRingsResponse(); | |
| 532 buildCounterListKeyRingsResponse++; | |
| 533 if (buildCounterListKeyRingsResponse < 3) { | |
| 534 o.keyRings = buildUnnamed3327(); | |
| 535 o.nextPageToken = "foo"; | |
| 536 o.totalSize = 42; | |
| 537 } | |
| 538 buildCounterListKeyRingsResponse--; | |
| 539 return o; | |
| 540 } | |
| 541 | |
| 542 checkListKeyRingsResponse(api.ListKeyRingsResponse o) { | |
| 543 buildCounterListKeyRingsResponse++; | |
| 544 if (buildCounterListKeyRingsResponse < 3) { | |
| 545 checkUnnamed3327(o.keyRings); | |
| 546 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
| 547 unittest.expect(o.totalSize, unittest.equals(42)); | |
| 548 } | |
| 549 buildCounterListKeyRingsResponse--; | |
| 550 } | |
| 551 | |
| 552 buildUnnamed3328() { | |
| 553 var o = new core.List<api.Location>(); | |
| 554 o.add(buildLocation()); | |
| 555 o.add(buildLocation()); | |
| 556 return o; | |
| 557 } | |
| 558 | |
| 559 checkUnnamed3328(core.List<api.Location> o) { | |
| 560 unittest.expect(o, unittest.hasLength(2)); | |
| 561 checkLocation(o[0]); | |
| 562 checkLocation(o[1]); | |
| 563 } | |
| 564 | |
| 565 core.int buildCounterListLocationsResponse = 0; | |
| 566 buildListLocationsResponse() { | |
| 567 var o = new api.ListLocationsResponse(); | |
| 568 buildCounterListLocationsResponse++; | |
| 569 if (buildCounterListLocationsResponse < 3) { | |
| 570 o.locations = buildUnnamed3328(); | |
| 571 o.nextPageToken = "foo"; | |
| 572 } | |
| 573 buildCounterListLocationsResponse--; | |
| 574 return o; | |
| 575 } | |
| 576 | |
| 577 checkListLocationsResponse(api.ListLocationsResponse o) { | |
| 578 buildCounterListLocationsResponse++; | |
| 579 if (buildCounterListLocationsResponse < 3) { | |
| 580 checkUnnamed3328(o.locations); | |
| 581 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
| 582 } | |
| 583 buildCounterListLocationsResponse--; | |
| 584 } | |
| 585 | |
| 586 buildUnnamed3329() { | |
| 587 var o = new core.Map<core.String, core.String>(); | |
| 588 o["x"] = "foo"; | |
| 589 o["y"] = "foo"; | |
| 590 return o; | |
| 591 } | |
| 592 | |
| 593 checkUnnamed3329(core.Map<core.String, core.String> o) { | |
| 594 unittest.expect(o, unittest.hasLength(2)); | |
| 595 unittest.expect(o["x"], unittest.equals('foo')); | |
| 596 unittest.expect(o["y"], unittest.equals('foo')); | |
| 597 } | |
| 598 | |
| 599 buildUnnamed3330() { | |
| 600 var o = new core.Map<core.String, core.Object>(); | |
| 601 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
| 602 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
| 603 return o; | |
| 604 } | |
| 605 | |
| 606 checkUnnamed3330(core.Map<core.String, core.Object> o) { | |
| 607 unittest.expect(o, unittest.hasLength(2)); | |
| 608 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | |
| 609 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | |
| 610 } | |
| 611 | |
| 612 core.int buildCounterLocation = 0; | |
| 613 buildLocation() { | |
| 614 var o = new api.Location(); | |
| 615 buildCounterLocation++; | |
| 616 if (buildCounterLocation < 3) { | |
| 617 o.labels = buildUnnamed3329(); | |
| 618 o.locationId = "foo"; | |
| 619 o.metadata = buildUnnamed3330(); | |
| 620 o.name = "foo"; | |
| 621 } | |
| 622 buildCounterLocation--; | |
| 623 return o; | |
| 624 } | |
| 625 | |
| 626 checkLocation(api.Location o) { | |
| 627 buildCounterLocation++; | |
| 628 if (buildCounterLocation < 3) { | |
| 629 checkUnnamed3329(o.labels); | |
| 630 unittest.expect(o.locationId, unittest.equals('foo')); | |
| 631 checkUnnamed3330(o.metadata); | |
| 632 unittest.expect(o.name, unittest.equals('foo')); | |
| 633 } | |
| 634 buildCounterLocation--; | |
| 635 } | |
| 636 | |
| 637 core.int buildCounterLogConfig = 0; | |
| 638 buildLogConfig() { | |
| 639 var o = new api.LogConfig(); | |
| 640 buildCounterLogConfig++; | |
| 641 if (buildCounterLogConfig < 3) { | |
| 642 o.cloudAudit = buildCloudAuditOptions(); | |
| 643 o.counter = buildCounterOptions(); | |
| 644 o.dataAccess = buildDataAccessOptions(); | |
| 645 } | |
| 646 buildCounterLogConfig--; | |
| 647 return o; | |
| 648 } | |
| 649 | |
| 650 checkLogConfig(api.LogConfig o) { | |
| 651 buildCounterLogConfig++; | |
| 652 if (buildCounterLogConfig < 3) { | |
| 653 checkCloudAuditOptions(o.cloudAudit); | |
| 654 checkCounterOptions(o.counter); | |
| 655 checkDataAccessOptions(o.dataAccess); | |
| 656 } | |
| 657 buildCounterLogConfig--; | |
| 658 } | |
| 659 | |
| 660 buildUnnamed3331() { | |
| 661 var o = new core.List<api.AuditConfig>(); | |
| 662 o.add(buildAuditConfig()); | |
| 663 o.add(buildAuditConfig()); | |
| 664 return o; | |
| 665 } | |
| 666 | |
| 667 checkUnnamed3331(core.List<api.AuditConfig> o) { | |
| 668 unittest.expect(o, unittest.hasLength(2)); | |
| 669 checkAuditConfig(o[0]); | |
| 670 checkAuditConfig(o[1]); | |
| 671 } | |
| 672 | |
| 673 buildUnnamed3332() { | |
| 674 var o = new core.List<api.Binding>(); | |
| 675 o.add(buildBinding()); | |
| 676 o.add(buildBinding()); | |
| 677 return o; | |
| 678 } | |
| 679 | |
| 680 checkUnnamed3332(core.List<api.Binding> o) { | |
| 681 unittest.expect(o, unittest.hasLength(2)); | |
| 682 checkBinding(o[0]); | |
| 683 checkBinding(o[1]); | |
| 684 } | |
| 685 | |
| 686 buildUnnamed3333() { | |
| 687 var o = new core.List<api.Rule>(); | |
| 688 o.add(buildRule()); | |
| 689 o.add(buildRule()); | |
| 690 return o; | |
| 691 } | |
| 692 | |
| 693 checkUnnamed3333(core.List<api.Rule> o) { | |
| 694 unittest.expect(o, unittest.hasLength(2)); | |
| 695 checkRule(o[0]); | |
| 696 checkRule(o[1]); | |
| 697 } | |
| 698 | |
| 699 core.int buildCounterPolicy = 0; | |
| 700 buildPolicy() { | |
| 701 var o = new api.Policy(); | |
| 702 buildCounterPolicy++; | |
| 703 if (buildCounterPolicy < 3) { | |
| 704 o.auditConfigs = buildUnnamed3331(); | |
| 705 o.bindings = buildUnnamed3332(); | |
| 706 o.etag = "foo"; | |
| 707 o.iamOwned = true; | |
| 708 o.rules = buildUnnamed3333(); | |
| 709 o.version = 42; | |
| 710 } | |
| 711 buildCounterPolicy--; | |
| 712 return o; | |
| 713 } | |
| 714 | |
| 715 checkPolicy(api.Policy o) { | |
| 716 buildCounterPolicy++; | |
| 717 if (buildCounterPolicy < 3) { | |
| 718 checkUnnamed3331(o.auditConfigs); | |
| 719 checkUnnamed3332(o.bindings); | |
| 720 unittest.expect(o.etag, unittest.equals('foo')); | |
| 721 unittest.expect(o.iamOwned, unittest.isTrue); | |
| 722 checkUnnamed3333(o.rules); | |
| 723 unittest.expect(o.version, unittest.equals(42)); | |
| 724 } | |
| 725 buildCounterPolicy--; | |
| 726 } | |
| 727 | |
| 728 core.int buildCounterRestoreCryptoKeyVersionRequest = 0; | |
| 729 buildRestoreCryptoKeyVersionRequest() { | |
| 730 var o = new api.RestoreCryptoKeyVersionRequest(); | |
| 731 buildCounterRestoreCryptoKeyVersionRequest++; | |
| 732 if (buildCounterRestoreCryptoKeyVersionRequest < 3) { | |
| 733 } | |
| 734 buildCounterRestoreCryptoKeyVersionRequest--; | |
| 735 return o; | |
| 736 } | |
| 737 | |
| 738 checkRestoreCryptoKeyVersionRequest(api.RestoreCryptoKeyVersionRequest o) { | |
| 739 buildCounterRestoreCryptoKeyVersionRequest++; | |
| 740 if (buildCounterRestoreCryptoKeyVersionRequest < 3) { | |
| 741 } | |
| 742 buildCounterRestoreCryptoKeyVersionRequest--; | |
| 743 } | |
| 744 | |
| 745 buildUnnamed3334() { | |
| 746 var o = new core.List<api.Condition>(); | |
| 747 o.add(buildCondition()); | |
| 748 o.add(buildCondition()); | |
| 749 return o; | |
| 750 } | |
| 751 | |
| 752 checkUnnamed3334(core.List<api.Condition> o) { | |
| 753 unittest.expect(o, unittest.hasLength(2)); | |
| 754 checkCondition(o[0]); | |
| 755 checkCondition(o[1]); | |
| 756 } | |
| 757 | |
| 758 buildUnnamed3335() { | |
| 759 var o = new core.List<core.String>(); | |
| 760 o.add("foo"); | |
| 761 o.add("foo"); | |
| 762 return o; | |
| 763 } | |
| 764 | |
| 765 checkUnnamed3335(core.List<core.String> o) { | |
| 766 unittest.expect(o, unittest.hasLength(2)); | |
| 767 unittest.expect(o[0], unittest.equals('foo')); | |
| 768 unittest.expect(o[1], unittest.equals('foo')); | |
| 769 } | |
| 770 | |
| 771 buildUnnamed3336() { | |
| 772 var o = new core.List<api.LogConfig>(); | |
| 773 o.add(buildLogConfig()); | |
| 774 o.add(buildLogConfig()); | |
| 775 return o; | |
| 776 } | |
| 777 | |
| 778 checkUnnamed3336(core.List<api.LogConfig> o) { | |
| 779 unittest.expect(o, unittest.hasLength(2)); | |
| 780 checkLogConfig(o[0]); | |
| 781 checkLogConfig(o[1]); | |
| 782 } | |
| 783 | |
| 784 buildUnnamed3337() { | |
| 785 var o = new core.List<core.String>(); | |
| 786 o.add("foo"); | |
| 787 o.add("foo"); | |
| 788 return o; | |
| 789 } | |
| 790 | |
| 791 checkUnnamed3337(core.List<core.String> o) { | |
| 792 unittest.expect(o, unittest.hasLength(2)); | |
| 793 unittest.expect(o[0], unittest.equals('foo')); | |
| 794 unittest.expect(o[1], unittest.equals('foo')); | |
| 795 } | |
| 796 | |
| 797 buildUnnamed3338() { | |
| 798 var o = new core.List<core.String>(); | |
| 799 o.add("foo"); | |
| 800 o.add("foo"); | |
| 801 return o; | |
| 802 } | |
| 803 | |
| 804 checkUnnamed3338(core.List<core.String> o) { | |
| 805 unittest.expect(o, unittest.hasLength(2)); | |
| 806 unittest.expect(o[0], unittest.equals('foo')); | |
| 807 unittest.expect(o[1], unittest.equals('foo')); | |
| 808 } | |
| 809 | |
| 810 core.int buildCounterRule = 0; | |
| 811 buildRule() { | |
| 812 var o = new api.Rule(); | |
| 813 buildCounterRule++; | |
| 814 if (buildCounterRule < 3) { | |
| 815 o.action = "foo"; | |
| 816 o.conditions = buildUnnamed3334(); | |
| 817 o.description = "foo"; | |
| 818 o.in_ = buildUnnamed3335(); | |
| 819 o.logConfig = buildUnnamed3336(); | |
| 820 o.notIn = buildUnnamed3337(); | |
| 821 o.permissions = buildUnnamed3338(); | |
| 822 } | |
| 823 buildCounterRule--; | |
| 824 return o; | |
| 825 } | |
| 826 | |
| 827 checkRule(api.Rule o) { | |
| 828 buildCounterRule++; | |
| 829 if (buildCounterRule < 3) { | |
| 830 unittest.expect(o.action, unittest.equals('foo')); | |
| 831 checkUnnamed3334(o.conditions); | |
| 832 unittest.expect(o.description, unittest.equals('foo')); | |
| 833 checkUnnamed3335(o.in_); | |
| 834 checkUnnamed3336(o.logConfig); | |
| 835 checkUnnamed3337(o.notIn); | |
| 836 checkUnnamed3338(o.permissions); | |
| 837 } | |
| 838 buildCounterRule--; | |
| 839 } | |
| 840 | |
| 841 core.int buildCounterSetIamPolicyRequest = 0; | |
| 842 buildSetIamPolicyRequest() { | |
| 843 var o = new api.SetIamPolicyRequest(); | |
| 844 buildCounterSetIamPolicyRequest++; | |
| 845 if (buildCounterSetIamPolicyRequest < 3) { | |
| 846 o.policy = buildPolicy(); | |
| 847 o.updateMask = "foo"; | |
| 848 } | |
| 849 buildCounterSetIamPolicyRequest--; | |
| 850 return o; | |
| 851 } | |
| 852 | |
| 853 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | |
| 854 buildCounterSetIamPolicyRequest++; | |
| 855 if (buildCounterSetIamPolicyRequest < 3) { | |
| 856 checkPolicy(o.policy); | |
| 857 unittest.expect(o.updateMask, unittest.equals('foo')); | |
| 858 } | |
| 859 buildCounterSetIamPolicyRequest--; | |
| 860 } | |
| 861 | |
| 862 buildUnnamed3339() { | |
| 863 var o = new core.List<core.String>(); | |
| 864 o.add("foo"); | |
| 865 o.add("foo"); | |
| 866 return o; | |
| 867 } | |
| 868 | |
| 869 checkUnnamed3339(core.List<core.String> o) { | |
| 870 unittest.expect(o, unittest.hasLength(2)); | |
| 871 unittest.expect(o[0], unittest.equals('foo')); | |
| 872 unittest.expect(o[1], unittest.equals('foo')); | |
| 873 } | |
| 874 | |
| 875 core.int buildCounterTestIamPermissionsRequest = 0; | |
| 876 buildTestIamPermissionsRequest() { | |
| 877 var o = new api.TestIamPermissionsRequest(); | |
| 878 buildCounterTestIamPermissionsRequest++; | |
| 879 if (buildCounterTestIamPermissionsRequest < 3) { | |
| 880 o.permissions = buildUnnamed3339(); | |
| 881 } | |
| 882 buildCounterTestIamPermissionsRequest--; | |
| 883 return o; | |
| 884 } | |
| 885 | |
| 886 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | |
| 887 buildCounterTestIamPermissionsRequest++; | |
| 888 if (buildCounterTestIamPermissionsRequest < 3) { | |
| 889 checkUnnamed3339(o.permissions); | |
| 890 } | |
| 891 buildCounterTestIamPermissionsRequest--; | |
| 892 } | |
| 893 | |
| 894 buildUnnamed3340() { | |
| 895 var o = new core.List<core.String>(); | |
| 896 o.add("foo"); | |
| 897 o.add("foo"); | |
| 898 return o; | |
| 899 } | |
| 900 | |
| 901 checkUnnamed3340(core.List<core.String> o) { | |
| 902 unittest.expect(o, unittest.hasLength(2)); | |
| 903 unittest.expect(o[0], unittest.equals('foo')); | |
| 904 unittest.expect(o[1], unittest.equals('foo')); | |
| 905 } | |
| 906 | |
| 907 core.int buildCounterTestIamPermissionsResponse = 0; | |
| 908 buildTestIamPermissionsResponse() { | |
| 909 var o = new api.TestIamPermissionsResponse(); | |
| 910 buildCounterTestIamPermissionsResponse++; | |
| 911 if (buildCounterTestIamPermissionsResponse < 3) { | |
| 912 o.permissions = buildUnnamed3340(); | |
| 913 } | |
| 914 buildCounterTestIamPermissionsResponse--; | |
| 915 return o; | |
| 916 } | |
| 917 | |
| 918 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | |
| 919 buildCounterTestIamPermissionsResponse++; | |
| 920 if (buildCounterTestIamPermissionsResponse < 3) { | |
| 921 checkUnnamed3340(o.permissions); | |
| 922 } | |
| 923 buildCounterTestIamPermissionsResponse--; | |
| 924 } | |
| 925 | |
| 926 core.int buildCounterUpdateCryptoKeyPrimaryVersionRequest = 0; | |
| 927 buildUpdateCryptoKeyPrimaryVersionRequest() { | |
| 928 var o = new api.UpdateCryptoKeyPrimaryVersionRequest(); | |
| 929 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; | |
| 930 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { | |
| 931 o.cryptoKeyVersionId = "foo"; | |
| 932 } | |
| 933 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; | |
| 934 return o; | |
| 935 } | |
| 936 | |
| 937 checkUpdateCryptoKeyPrimaryVersionRequest(api.UpdateCryptoKeyPrimaryVersionReque
st o) { | |
| 938 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; | |
| 939 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { | |
| 940 unittest.expect(o.cryptoKeyVersionId, unittest.equals('foo')); | |
| 941 } | |
| 942 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; | |
| 943 } | |
| 944 | |
| 945 | |
| 946 main() { | |
| 947 unittest.group("obj-schema-AuditConfig", () { | |
| 948 unittest.test("to-json--from-json", () { | |
| 949 var o = buildAuditConfig(); | |
| 950 var od = new api.AuditConfig.fromJson(o.toJson()); | |
| 951 checkAuditConfig(od); | |
| 952 }); | |
| 953 }); | |
| 954 | |
| 955 | |
| 956 unittest.group("obj-schema-AuditLogConfig", () { | |
| 957 unittest.test("to-json--from-json", () { | |
| 958 var o = buildAuditLogConfig(); | |
| 959 var od = new api.AuditLogConfig.fromJson(o.toJson()); | |
| 960 checkAuditLogConfig(od); | |
| 961 }); | |
| 962 }); | |
| 963 | |
| 964 | |
| 965 unittest.group("obj-schema-Binding", () { | |
| 966 unittest.test("to-json--from-json", () { | |
| 967 var o = buildBinding(); | |
| 968 var od = new api.Binding.fromJson(o.toJson()); | |
| 969 checkBinding(od); | |
| 970 }); | |
| 971 }); | |
| 972 | |
| 973 | |
| 974 unittest.group("obj-schema-CloudAuditOptions", () { | |
| 975 unittest.test("to-json--from-json", () { | |
| 976 var o = buildCloudAuditOptions(); | |
| 977 var od = new api.CloudAuditOptions.fromJson(o.toJson()); | |
| 978 checkCloudAuditOptions(od); | |
| 979 }); | |
| 980 }); | |
| 981 | |
| 982 | |
| 983 unittest.group("obj-schema-Condition", () { | |
| 984 unittest.test("to-json--from-json", () { | |
| 985 var o = buildCondition(); | |
| 986 var od = new api.Condition.fromJson(o.toJson()); | |
| 987 checkCondition(od); | |
| 988 }); | |
| 989 }); | |
| 990 | |
| 991 | |
| 992 unittest.group("obj-schema-CounterOptions", () { | |
| 993 unittest.test("to-json--from-json", () { | |
| 994 var o = buildCounterOptions(); | |
| 995 var od = new api.CounterOptions.fromJson(o.toJson()); | |
| 996 checkCounterOptions(od); | |
| 997 }); | |
| 998 }); | |
| 999 | |
| 1000 | |
| 1001 unittest.group("obj-schema-CryptoKey", () { | |
| 1002 unittest.test("to-json--from-json", () { | |
| 1003 var o = buildCryptoKey(); | |
| 1004 var od = new api.CryptoKey.fromJson(o.toJson()); | |
| 1005 checkCryptoKey(od); | |
| 1006 }); | |
| 1007 }); | |
| 1008 | |
| 1009 | |
| 1010 unittest.group("obj-schema-CryptoKeyVersion", () { | |
| 1011 unittest.test("to-json--from-json", () { | |
| 1012 var o = buildCryptoKeyVersion(); | |
| 1013 var od = new api.CryptoKeyVersion.fromJson(o.toJson()); | |
| 1014 checkCryptoKeyVersion(od); | |
| 1015 }); | |
| 1016 }); | |
| 1017 | |
| 1018 | |
| 1019 unittest.group("obj-schema-DataAccessOptions", () { | |
| 1020 unittest.test("to-json--from-json", () { | |
| 1021 var o = buildDataAccessOptions(); | |
| 1022 var od = new api.DataAccessOptions.fromJson(o.toJson()); | |
| 1023 checkDataAccessOptions(od); | |
| 1024 }); | |
| 1025 }); | |
| 1026 | |
| 1027 | |
| 1028 unittest.group("obj-schema-DecryptRequest", () { | |
| 1029 unittest.test("to-json--from-json", () { | |
| 1030 var o = buildDecryptRequest(); | |
| 1031 var od = new api.DecryptRequest.fromJson(o.toJson()); | |
| 1032 checkDecryptRequest(od); | |
| 1033 }); | |
| 1034 }); | |
| 1035 | |
| 1036 | |
| 1037 unittest.group("obj-schema-DecryptResponse", () { | |
| 1038 unittest.test("to-json--from-json", () { | |
| 1039 var o = buildDecryptResponse(); | |
| 1040 var od = new api.DecryptResponse.fromJson(o.toJson()); | |
| 1041 checkDecryptResponse(od); | |
| 1042 }); | |
| 1043 }); | |
| 1044 | |
| 1045 | |
| 1046 unittest.group("obj-schema-DestroyCryptoKeyVersionRequest", () { | |
| 1047 unittest.test("to-json--from-json", () { | |
| 1048 var o = buildDestroyCryptoKeyVersionRequest(); | |
| 1049 var od = new api.DestroyCryptoKeyVersionRequest.fromJson(o.toJson()); | |
| 1050 checkDestroyCryptoKeyVersionRequest(od); | |
| 1051 }); | |
| 1052 }); | |
| 1053 | |
| 1054 | |
| 1055 unittest.group("obj-schema-EncryptRequest", () { | |
| 1056 unittest.test("to-json--from-json", () { | |
| 1057 var o = buildEncryptRequest(); | |
| 1058 var od = new api.EncryptRequest.fromJson(o.toJson()); | |
| 1059 checkEncryptRequest(od); | |
| 1060 }); | |
| 1061 }); | |
| 1062 | |
| 1063 | |
| 1064 unittest.group("obj-schema-EncryptResponse", () { | |
| 1065 unittest.test("to-json--from-json", () { | |
| 1066 var o = buildEncryptResponse(); | |
| 1067 var od = new api.EncryptResponse.fromJson(o.toJson()); | |
| 1068 checkEncryptResponse(od); | |
| 1069 }); | |
| 1070 }); | |
| 1071 | |
| 1072 | |
| 1073 unittest.group("obj-schema-KeyRing", () { | |
| 1074 unittest.test("to-json--from-json", () { | |
| 1075 var o = buildKeyRing(); | |
| 1076 var od = new api.KeyRing.fromJson(o.toJson()); | |
| 1077 checkKeyRing(od); | |
| 1078 }); | |
| 1079 }); | |
| 1080 | |
| 1081 | |
| 1082 unittest.group("obj-schema-ListCryptoKeyVersionsResponse", () { | |
| 1083 unittest.test("to-json--from-json", () { | |
| 1084 var o = buildListCryptoKeyVersionsResponse(); | |
| 1085 var od = new api.ListCryptoKeyVersionsResponse.fromJson(o.toJson()); | |
| 1086 checkListCryptoKeyVersionsResponse(od); | |
| 1087 }); | |
| 1088 }); | |
| 1089 | |
| 1090 | |
| 1091 unittest.group("obj-schema-ListCryptoKeysResponse", () { | |
| 1092 unittest.test("to-json--from-json", () { | |
| 1093 var o = buildListCryptoKeysResponse(); | |
| 1094 var od = new api.ListCryptoKeysResponse.fromJson(o.toJson()); | |
| 1095 checkListCryptoKeysResponse(od); | |
| 1096 }); | |
| 1097 }); | |
| 1098 | |
| 1099 | |
| 1100 unittest.group("obj-schema-ListKeyRingsResponse", () { | |
| 1101 unittest.test("to-json--from-json", () { | |
| 1102 var o = buildListKeyRingsResponse(); | |
| 1103 var od = new api.ListKeyRingsResponse.fromJson(o.toJson()); | |
| 1104 checkListKeyRingsResponse(od); | |
| 1105 }); | |
| 1106 }); | |
| 1107 | |
| 1108 | |
| 1109 unittest.group("obj-schema-ListLocationsResponse", () { | |
| 1110 unittest.test("to-json--from-json", () { | |
| 1111 var o = buildListLocationsResponse(); | |
| 1112 var od = new api.ListLocationsResponse.fromJson(o.toJson()); | |
| 1113 checkListLocationsResponse(od); | |
| 1114 }); | |
| 1115 }); | |
| 1116 | |
| 1117 | |
| 1118 unittest.group("obj-schema-Location", () { | |
| 1119 unittest.test("to-json--from-json", () { | |
| 1120 var o = buildLocation(); | |
| 1121 var od = new api.Location.fromJson(o.toJson()); | |
| 1122 checkLocation(od); | |
| 1123 }); | |
| 1124 }); | |
| 1125 | |
| 1126 | |
| 1127 unittest.group("obj-schema-LogConfig", () { | |
| 1128 unittest.test("to-json--from-json", () { | |
| 1129 var o = buildLogConfig(); | |
| 1130 var od = new api.LogConfig.fromJson(o.toJson()); | |
| 1131 checkLogConfig(od); | |
| 1132 }); | |
| 1133 }); | |
| 1134 | |
| 1135 | |
| 1136 unittest.group("obj-schema-Policy", () { | |
| 1137 unittest.test("to-json--from-json", () { | |
| 1138 var o = buildPolicy(); | |
| 1139 var od = new api.Policy.fromJson(o.toJson()); | |
| 1140 checkPolicy(od); | |
| 1141 }); | |
| 1142 }); | |
| 1143 | |
| 1144 | |
| 1145 unittest.group("obj-schema-RestoreCryptoKeyVersionRequest", () { | |
| 1146 unittest.test("to-json--from-json", () { | |
| 1147 var o = buildRestoreCryptoKeyVersionRequest(); | |
| 1148 var od = new api.RestoreCryptoKeyVersionRequest.fromJson(o.toJson()); | |
| 1149 checkRestoreCryptoKeyVersionRequest(od); | |
| 1150 }); | |
| 1151 }); | |
| 1152 | |
| 1153 | |
| 1154 unittest.group("obj-schema-Rule", () { | |
| 1155 unittest.test("to-json--from-json", () { | |
| 1156 var o = buildRule(); | |
| 1157 var od = new api.Rule.fromJson(o.toJson()); | |
| 1158 checkRule(od); | |
| 1159 }); | |
| 1160 }); | |
| 1161 | |
| 1162 | |
| 1163 unittest.group("obj-schema-SetIamPolicyRequest", () { | |
| 1164 unittest.test("to-json--from-json", () { | |
| 1165 var o = buildSetIamPolicyRequest(); | |
| 1166 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); | |
| 1167 checkSetIamPolicyRequest(od); | |
| 1168 }); | |
| 1169 }); | |
| 1170 | |
| 1171 | |
| 1172 unittest.group("obj-schema-TestIamPermissionsRequest", () { | |
| 1173 unittest.test("to-json--from-json", () { | |
| 1174 var o = buildTestIamPermissionsRequest(); | |
| 1175 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); | |
| 1176 checkTestIamPermissionsRequest(od); | |
| 1177 }); | |
| 1178 }); | |
| 1179 | |
| 1180 | |
| 1181 unittest.group("obj-schema-TestIamPermissionsResponse", () { | |
| 1182 unittest.test("to-json--from-json", () { | |
| 1183 var o = buildTestIamPermissionsResponse(); | |
| 1184 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); | |
| 1185 checkTestIamPermissionsResponse(od); | |
| 1186 }); | |
| 1187 }); | |
| 1188 | |
| 1189 | |
| 1190 unittest.group("obj-schema-UpdateCryptoKeyPrimaryVersionRequest", () { | |
| 1191 unittest.test("to-json--from-json", () { | |
| 1192 var o = buildUpdateCryptoKeyPrimaryVersionRequest(); | |
| 1193 var od = new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(o.toJson())
; | |
| 1194 checkUpdateCryptoKeyPrimaryVersionRequest(od); | |
| 1195 }); | |
| 1196 }); | |
| 1197 | |
| 1198 | |
| 1199 unittest.group("resource-ProjectsLocationsResourceApi", () { | |
| 1200 unittest.test("method--get", () { | |
| 1201 | |
| 1202 var mock = new HttpServerMock(); | |
| 1203 api.ProjectsLocationsResourceApi res = new api.CloudkmsApi(mock).projects.
locations; | |
| 1204 var arg_name = "foo"; | |
| 1205 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1206 var path = (req.url).path; | |
| 1207 var pathOffset = 0; | |
| 1208 var index; | |
| 1209 var subPart; | |
| 1210 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1211 pathOffset += 1; | |
| 1212 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1213 pathOffset += 8; | |
| 1214 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1215 | |
| 1216 var query = (req.url).query; | |
| 1217 var queryOffset = 0; | |
| 1218 var queryMap = {}; | |
| 1219 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1220 parseBool(n) { | |
| 1221 if (n == "true") return true; | |
| 1222 if (n == "false") return false; | |
| 1223 if (n == null) return null; | |
| 1224 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1225 } | |
| 1226 if (query.length > 0) { | |
| 1227 for (var part in query.split("&")) { | |
| 1228 var keyvalue = part.split("="); | |
| 1229 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1230 } | |
| 1231 } | |
| 1232 | |
| 1233 | |
| 1234 var h = { | |
| 1235 "content-type" : "application/json; charset=utf-8", | |
| 1236 }; | |
| 1237 var resp = convert.JSON.encode(buildLocation()); | |
| 1238 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1239 }), true); | |
| 1240 res.get(arg_name).then(unittest.expectAsync(((api.Location response) { | |
| 1241 checkLocation(response); | |
| 1242 }))); | |
| 1243 }); | |
| 1244 | |
| 1245 unittest.test("method--list", () { | |
| 1246 | |
| 1247 var mock = new HttpServerMock(); | |
| 1248 api.ProjectsLocationsResourceApi res = new api.CloudkmsApi(mock).projects.
locations; | |
| 1249 var arg_name = "foo"; | |
| 1250 var arg_pageToken = "foo"; | |
| 1251 var arg_pageSize = 42; | |
| 1252 var arg_filter = "foo"; | |
| 1253 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1254 var path = (req.url).path; | |
| 1255 var pathOffset = 0; | |
| 1256 var index; | |
| 1257 var subPart; | |
| 1258 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1259 pathOffset += 1; | |
| 1260 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1261 pathOffset += 8; | |
| 1262 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1263 | |
| 1264 var query = (req.url).query; | |
| 1265 var queryOffset = 0; | |
| 1266 var queryMap = {}; | |
| 1267 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1268 parseBool(n) { | |
| 1269 if (n == "true") return true; | |
| 1270 if (n == "false") return false; | |
| 1271 if (n == null) return null; | |
| 1272 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1273 } | |
| 1274 if (query.length > 0) { | |
| 1275 for (var part in query.split("&")) { | |
| 1276 var keyvalue = part.split("="); | |
| 1277 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1278 } | |
| 1279 } | |
| 1280 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 1281 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
| 1282 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | |
| 1283 | |
| 1284 | |
| 1285 var h = { | |
| 1286 "content-type" : "application/json; charset=utf-8", | |
| 1287 }; | |
| 1288 var resp = convert.JSON.encode(buildListLocationsResponse()); | |
| 1289 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1290 }), true); | |
| 1291 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte
r: arg_filter).then(unittest.expectAsync(((api.ListLocationsResponse response) { | |
| 1292 checkListLocationsResponse(response); | |
| 1293 }))); | |
| 1294 }); | |
| 1295 | |
| 1296 }); | |
| 1297 | |
| 1298 | |
| 1299 unittest.group("resource-ProjectsLocationsKeyRingsResourceApi", () { | |
| 1300 unittest.test("method--create", () { | |
| 1301 | |
| 1302 var mock = new HttpServerMock(); | |
| 1303 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1304 var arg_request = buildKeyRing(); | |
| 1305 var arg_parent = "foo"; | |
| 1306 var arg_keyRingId = "foo"; | |
| 1307 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1308 var obj = new api.KeyRing.fromJson(json); | |
| 1309 checkKeyRing(obj); | |
| 1310 | |
| 1311 var path = (req.url).path; | |
| 1312 var pathOffset = 0; | |
| 1313 var index; | |
| 1314 var subPart; | |
| 1315 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1316 pathOffset += 1; | |
| 1317 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1318 pathOffset += 8; | |
| 1319 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1320 | |
| 1321 var query = (req.url).query; | |
| 1322 var queryOffset = 0; | |
| 1323 var queryMap = {}; | |
| 1324 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1325 parseBool(n) { | |
| 1326 if (n == "true") return true; | |
| 1327 if (n == "false") return false; | |
| 1328 if (n == null) return null; | |
| 1329 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1330 } | |
| 1331 if (query.length > 0) { | |
| 1332 for (var part in query.split("&")) { | |
| 1333 var keyvalue = part.split("="); | |
| 1334 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1335 } | |
| 1336 } | |
| 1337 unittest.expect(queryMap["keyRingId"].first, unittest.equals(arg_keyRing
Id)); | |
| 1338 | |
| 1339 | |
| 1340 var h = { | |
| 1341 "content-type" : "application/json; charset=utf-8", | |
| 1342 }; | |
| 1343 var resp = convert.JSON.encode(buildKeyRing()); | |
| 1344 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1345 }), true); | |
| 1346 res.create(arg_request, arg_parent, keyRingId: arg_keyRingId).then(unittes
t.expectAsync(((api.KeyRing response) { | |
| 1347 checkKeyRing(response); | |
| 1348 }))); | |
| 1349 }); | |
| 1350 | |
| 1351 unittest.test("method--get", () { | |
| 1352 | |
| 1353 var mock = new HttpServerMock(); | |
| 1354 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1355 var arg_name = "foo"; | |
| 1356 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1357 var path = (req.url).path; | |
| 1358 var pathOffset = 0; | |
| 1359 var index; | |
| 1360 var subPart; | |
| 1361 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1362 pathOffset += 1; | |
| 1363 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1364 pathOffset += 8; | |
| 1365 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1366 | |
| 1367 var query = (req.url).query; | |
| 1368 var queryOffset = 0; | |
| 1369 var queryMap = {}; | |
| 1370 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1371 parseBool(n) { | |
| 1372 if (n == "true") return true; | |
| 1373 if (n == "false") return false; | |
| 1374 if (n == null) return null; | |
| 1375 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1376 } | |
| 1377 if (query.length > 0) { | |
| 1378 for (var part in query.split("&")) { | |
| 1379 var keyvalue = part.split("="); | |
| 1380 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1381 } | |
| 1382 } | |
| 1383 | |
| 1384 | |
| 1385 var h = { | |
| 1386 "content-type" : "application/json; charset=utf-8", | |
| 1387 }; | |
| 1388 var resp = convert.JSON.encode(buildKeyRing()); | |
| 1389 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1390 }), true); | |
| 1391 res.get(arg_name).then(unittest.expectAsync(((api.KeyRing response) { | |
| 1392 checkKeyRing(response); | |
| 1393 }))); | |
| 1394 }); | |
| 1395 | |
| 1396 unittest.test("method--getIamPolicy", () { | |
| 1397 | |
| 1398 var mock = new HttpServerMock(); | |
| 1399 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1400 var arg_resource = "foo"; | |
| 1401 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1402 var path = (req.url).path; | |
| 1403 var pathOffset = 0; | |
| 1404 var index; | |
| 1405 var subPart; | |
| 1406 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1407 pathOffset += 1; | |
| 1408 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1409 pathOffset += 8; | |
| 1410 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1411 | |
| 1412 var query = (req.url).query; | |
| 1413 var queryOffset = 0; | |
| 1414 var queryMap = {}; | |
| 1415 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1416 parseBool(n) { | |
| 1417 if (n == "true") return true; | |
| 1418 if (n == "false") return false; | |
| 1419 if (n == null) return null; | |
| 1420 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1421 } | |
| 1422 if (query.length > 0) { | |
| 1423 for (var part in query.split("&")) { | |
| 1424 var keyvalue = part.split("="); | |
| 1425 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1426 } | |
| 1427 } | |
| 1428 | |
| 1429 | |
| 1430 var h = { | |
| 1431 "content-type" : "application/json; charset=utf-8", | |
| 1432 }; | |
| 1433 var resp = convert.JSON.encode(buildPolicy()); | |
| 1434 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1435 }), true); | |
| 1436 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { | |
| 1437 checkPolicy(response); | |
| 1438 }))); | |
| 1439 }); | |
| 1440 | |
| 1441 unittest.test("method--list", () { | |
| 1442 | |
| 1443 var mock = new HttpServerMock(); | |
| 1444 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1445 var arg_parent = "foo"; | |
| 1446 var arg_pageToken = "foo"; | |
| 1447 var arg_pageSize = 42; | |
| 1448 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1449 var path = (req.url).path; | |
| 1450 var pathOffset = 0; | |
| 1451 var index; | |
| 1452 var subPart; | |
| 1453 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1454 pathOffset += 1; | |
| 1455 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1456 pathOffset += 8; | |
| 1457 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1458 | |
| 1459 var query = (req.url).query; | |
| 1460 var queryOffset = 0; | |
| 1461 var queryMap = {}; | |
| 1462 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1463 parseBool(n) { | |
| 1464 if (n == "true") return true; | |
| 1465 if (n == "false") return false; | |
| 1466 if (n == null) return null; | |
| 1467 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1468 } | |
| 1469 if (query.length > 0) { | |
| 1470 for (var part in query.split("&")) { | |
| 1471 var keyvalue = part.split("="); | |
| 1472 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1473 } | |
| 1474 } | |
| 1475 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 1476 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
| 1477 | |
| 1478 | |
| 1479 var h = { | |
| 1480 "content-type" : "application/json; charset=utf-8", | |
| 1481 }; | |
| 1482 var resp = convert.JSON.encode(buildListKeyRingsResponse()); | |
| 1483 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1484 }), true); | |
| 1485 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.ListKeyRingsResponse response) { | |
| 1486 checkListKeyRingsResponse(response); | |
| 1487 }))); | |
| 1488 }); | |
| 1489 | |
| 1490 unittest.test("method--setIamPolicy", () { | |
| 1491 | |
| 1492 var mock = new HttpServerMock(); | |
| 1493 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1494 var arg_request = buildSetIamPolicyRequest(); | |
| 1495 var arg_resource = "foo"; | |
| 1496 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1497 var obj = new api.SetIamPolicyRequest.fromJson(json); | |
| 1498 checkSetIamPolicyRequest(obj); | |
| 1499 | |
| 1500 var path = (req.url).path; | |
| 1501 var pathOffset = 0; | |
| 1502 var index; | |
| 1503 var subPart; | |
| 1504 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1505 pathOffset += 1; | |
| 1506 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1507 pathOffset += 8; | |
| 1508 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1509 | |
| 1510 var query = (req.url).query; | |
| 1511 var queryOffset = 0; | |
| 1512 var queryMap = {}; | |
| 1513 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1514 parseBool(n) { | |
| 1515 if (n == "true") return true; | |
| 1516 if (n == "false") return false; | |
| 1517 if (n == null) return null; | |
| 1518 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1519 } | |
| 1520 if (query.length > 0) { | |
| 1521 for (var part in query.split("&")) { | |
| 1522 var keyvalue = part.split("="); | |
| 1523 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1524 } | |
| 1525 } | |
| 1526 | |
| 1527 | |
| 1528 var h = { | |
| 1529 "content-type" : "application/json; charset=utf-8", | |
| 1530 }; | |
| 1531 var resp = convert.JSON.encode(buildPolicy()); | |
| 1532 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1533 }), true); | |
| 1534 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((ap
i.Policy response) { | |
| 1535 checkPolicy(response); | |
| 1536 }))); | |
| 1537 }); | |
| 1538 | |
| 1539 unittest.test("method--testIamPermissions", () { | |
| 1540 | |
| 1541 var mock = new HttpServerMock(); | |
| 1542 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | |
| 1543 var arg_request = buildTestIamPermissionsRequest(); | |
| 1544 var arg_resource = "foo"; | |
| 1545 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1546 var obj = new api.TestIamPermissionsRequest.fromJson(json); | |
| 1547 checkTestIamPermissionsRequest(obj); | |
| 1548 | |
| 1549 var path = (req.url).path; | |
| 1550 var pathOffset = 0; | |
| 1551 var index; | |
| 1552 var subPart; | |
| 1553 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1554 pathOffset += 1; | |
| 1555 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1556 pathOffset += 8; | |
| 1557 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1558 | |
| 1559 var query = (req.url).query; | |
| 1560 var queryOffset = 0; | |
| 1561 var queryMap = {}; | |
| 1562 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1563 parseBool(n) { | |
| 1564 if (n == "true") return true; | |
| 1565 if (n == "false") return false; | |
| 1566 if (n == null) return null; | |
| 1567 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1568 } | |
| 1569 if (query.length > 0) { | |
| 1570 for (var part in query.split("&")) { | |
| 1571 var keyvalue = part.split("="); | |
| 1572 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1573 } | |
| 1574 } | |
| 1575 | |
| 1576 | |
| 1577 var h = { | |
| 1578 "content-type" : "application/json; charset=utf-8", | |
| 1579 }; | |
| 1580 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | |
| 1581 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1582 }), true); | |
| 1583 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c(((api.TestIamPermissionsResponse response) { | |
| 1584 checkTestIamPermissionsResponse(response); | |
| 1585 }))); | |
| 1586 }); | |
| 1587 | |
| 1588 }); | |
| 1589 | |
| 1590 | |
| 1591 unittest.group("resource-ProjectsLocationsKeyRingsCryptoKeysResourceApi", () { | |
| 1592 unittest.test("method--create", () { | |
| 1593 | |
| 1594 var mock = new HttpServerMock(); | |
| 1595 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1596 var arg_request = buildCryptoKey(); | |
| 1597 var arg_parent = "foo"; | |
| 1598 var arg_cryptoKeyId = "foo"; | |
| 1599 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1600 var obj = new api.CryptoKey.fromJson(json); | |
| 1601 checkCryptoKey(obj); | |
| 1602 | |
| 1603 var path = (req.url).path; | |
| 1604 var pathOffset = 0; | |
| 1605 var index; | |
| 1606 var subPart; | |
| 1607 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1608 pathOffset += 1; | |
| 1609 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1610 pathOffset += 8; | |
| 1611 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1612 | |
| 1613 var query = (req.url).query; | |
| 1614 var queryOffset = 0; | |
| 1615 var queryMap = {}; | |
| 1616 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1617 parseBool(n) { | |
| 1618 if (n == "true") return true; | |
| 1619 if (n == "false") return false; | |
| 1620 if (n == null) return null; | |
| 1621 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1622 } | |
| 1623 if (query.length > 0) { | |
| 1624 for (var part in query.split("&")) { | |
| 1625 var keyvalue = part.split("="); | |
| 1626 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1627 } | |
| 1628 } | |
| 1629 unittest.expect(queryMap["cryptoKeyId"].first, unittest.equals(arg_crypt
oKeyId)); | |
| 1630 | |
| 1631 | |
| 1632 var h = { | |
| 1633 "content-type" : "application/json; charset=utf-8", | |
| 1634 }; | |
| 1635 var resp = convert.JSON.encode(buildCryptoKey()); | |
| 1636 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1637 }), true); | |
| 1638 res.create(arg_request, arg_parent, cryptoKeyId: arg_cryptoKeyId).then(uni
ttest.expectAsync(((api.CryptoKey response) { | |
| 1639 checkCryptoKey(response); | |
| 1640 }))); | |
| 1641 }); | |
| 1642 | |
| 1643 unittest.test("method--decrypt", () { | |
| 1644 | |
| 1645 var mock = new HttpServerMock(); | |
| 1646 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1647 var arg_request = buildDecryptRequest(); | |
| 1648 var arg_name = "foo"; | |
| 1649 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1650 var obj = new api.DecryptRequest.fromJson(json); | |
| 1651 checkDecryptRequest(obj); | |
| 1652 | |
| 1653 var path = (req.url).path; | |
| 1654 var pathOffset = 0; | |
| 1655 var index; | |
| 1656 var subPart; | |
| 1657 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1658 pathOffset += 1; | |
| 1659 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1660 pathOffset += 8; | |
| 1661 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1662 | |
| 1663 var query = (req.url).query; | |
| 1664 var queryOffset = 0; | |
| 1665 var queryMap = {}; | |
| 1666 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1667 parseBool(n) { | |
| 1668 if (n == "true") return true; | |
| 1669 if (n == "false") return false; | |
| 1670 if (n == null) return null; | |
| 1671 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1672 } | |
| 1673 if (query.length > 0) { | |
| 1674 for (var part in query.split("&")) { | |
| 1675 var keyvalue = part.split("="); | |
| 1676 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1677 } | |
| 1678 } | |
| 1679 | |
| 1680 | |
| 1681 var h = { | |
| 1682 "content-type" : "application/json; charset=utf-8", | |
| 1683 }; | |
| 1684 var resp = convert.JSON.encode(buildDecryptResponse()); | |
| 1685 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1686 }), true); | |
| 1687 res.decrypt(arg_request, arg_name).then(unittest.expectAsync(((api.Decrypt
Response response) { | |
| 1688 checkDecryptResponse(response); | |
| 1689 }))); | |
| 1690 }); | |
| 1691 | |
| 1692 unittest.test("method--encrypt", () { | |
| 1693 | |
| 1694 var mock = new HttpServerMock(); | |
| 1695 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1696 var arg_request = buildEncryptRequest(); | |
| 1697 var arg_name = "foo"; | |
| 1698 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1699 var obj = new api.EncryptRequest.fromJson(json); | |
| 1700 checkEncryptRequest(obj); | |
| 1701 | |
| 1702 var path = (req.url).path; | |
| 1703 var pathOffset = 0; | |
| 1704 var index; | |
| 1705 var subPart; | |
| 1706 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1707 pathOffset += 1; | |
| 1708 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1709 pathOffset += 8; | |
| 1710 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1711 | |
| 1712 var query = (req.url).query; | |
| 1713 var queryOffset = 0; | |
| 1714 var queryMap = {}; | |
| 1715 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1716 parseBool(n) { | |
| 1717 if (n == "true") return true; | |
| 1718 if (n == "false") return false; | |
| 1719 if (n == null) return null; | |
| 1720 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1721 } | |
| 1722 if (query.length > 0) { | |
| 1723 for (var part in query.split("&")) { | |
| 1724 var keyvalue = part.split("="); | |
| 1725 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1726 } | |
| 1727 } | |
| 1728 | |
| 1729 | |
| 1730 var h = { | |
| 1731 "content-type" : "application/json; charset=utf-8", | |
| 1732 }; | |
| 1733 var resp = convert.JSON.encode(buildEncryptResponse()); | |
| 1734 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1735 }), true); | |
| 1736 res.encrypt(arg_request, arg_name).then(unittest.expectAsync(((api.Encrypt
Response response) { | |
| 1737 checkEncryptResponse(response); | |
| 1738 }))); | |
| 1739 }); | |
| 1740 | |
| 1741 unittest.test("method--get", () { | |
| 1742 | |
| 1743 var mock = new HttpServerMock(); | |
| 1744 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1745 var arg_name = "foo"; | |
| 1746 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1747 var path = (req.url).path; | |
| 1748 var pathOffset = 0; | |
| 1749 var index; | |
| 1750 var subPart; | |
| 1751 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1752 pathOffset += 1; | |
| 1753 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1754 pathOffset += 8; | |
| 1755 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1756 | |
| 1757 var query = (req.url).query; | |
| 1758 var queryOffset = 0; | |
| 1759 var queryMap = {}; | |
| 1760 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1761 parseBool(n) { | |
| 1762 if (n == "true") return true; | |
| 1763 if (n == "false") return false; | |
| 1764 if (n == null) return null; | |
| 1765 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1766 } | |
| 1767 if (query.length > 0) { | |
| 1768 for (var part in query.split("&")) { | |
| 1769 var keyvalue = part.split("="); | |
| 1770 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1771 } | |
| 1772 } | |
| 1773 | |
| 1774 | |
| 1775 var h = { | |
| 1776 "content-type" : "application/json; charset=utf-8", | |
| 1777 }; | |
| 1778 var resp = convert.JSON.encode(buildCryptoKey()); | |
| 1779 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1780 }), true); | |
| 1781 res.get(arg_name).then(unittest.expectAsync(((api.CryptoKey response) { | |
| 1782 checkCryptoKey(response); | |
| 1783 }))); | |
| 1784 }); | |
| 1785 | |
| 1786 unittest.test("method--getIamPolicy", () { | |
| 1787 | |
| 1788 var mock = new HttpServerMock(); | |
| 1789 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1790 var arg_resource = "foo"; | |
| 1791 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1792 var path = (req.url).path; | |
| 1793 var pathOffset = 0; | |
| 1794 var index; | |
| 1795 var subPart; | |
| 1796 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1797 pathOffset += 1; | |
| 1798 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1799 pathOffset += 8; | |
| 1800 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1801 | |
| 1802 var query = (req.url).query; | |
| 1803 var queryOffset = 0; | |
| 1804 var queryMap = {}; | |
| 1805 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1806 parseBool(n) { | |
| 1807 if (n == "true") return true; | |
| 1808 if (n == "false") return false; | |
| 1809 if (n == null) return null; | |
| 1810 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1811 } | |
| 1812 if (query.length > 0) { | |
| 1813 for (var part in query.split("&")) { | |
| 1814 var keyvalue = part.split("="); | |
| 1815 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1816 } | |
| 1817 } | |
| 1818 | |
| 1819 | |
| 1820 var h = { | |
| 1821 "content-type" : "application/json; charset=utf-8", | |
| 1822 }; | |
| 1823 var resp = convert.JSON.encode(buildPolicy()); | |
| 1824 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1825 }), true); | |
| 1826 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { | |
| 1827 checkPolicy(response); | |
| 1828 }))); | |
| 1829 }); | |
| 1830 | |
| 1831 unittest.test("method--list", () { | |
| 1832 | |
| 1833 var mock = new HttpServerMock(); | |
| 1834 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1835 var arg_parent = "foo"; | |
| 1836 var arg_pageToken = "foo"; | |
| 1837 var arg_pageSize = 42; | |
| 1838 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1839 var path = (req.url).path; | |
| 1840 var pathOffset = 0; | |
| 1841 var index; | |
| 1842 var subPart; | |
| 1843 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1844 pathOffset += 1; | |
| 1845 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1846 pathOffset += 8; | |
| 1847 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1848 | |
| 1849 var query = (req.url).query; | |
| 1850 var queryOffset = 0; | |
| 1851 var queryMap = {}; | |
| 1852 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1853 parseBool(n) { | |
| 1854 if (n == "true") return true; | |
| 1855 if (n == "false") return false; | |
| 1856 if (n == null) return null; | |
| 1857 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1858 } | |
| 1859 if (query.length > 0) { | |
| 1860 for (var part in query.split("&")) { | |
| 1861 var keyvalue = part.split("="); | |
| 1862 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1863 } | |
| 1864 } | |
| 1865 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 1866 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
| 1867 | |
| 1868 | |
| 1869 var h = { | |
| 1870 "content-type" : "application/json; charset=utf-8", | |
| 1871 }; | |
| 1872 var resp = convert.JSON.encode(buildListCryptoKeysResponse()); | |
| 1873 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1874 }), true); | |
| 1875 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.ListCryptoKeysResponse response) { | |
| 1876 checkListCryptoKeysResponse(response); | |
| 1877 }))); | |
| 1878 }); | |
| 1879 | |
| 1880 unittest.test("method--patch", () { | |
| 1881 | |
| 1882 var mock = new HttpServerMock(); | |
| 1883 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1884 var arg_request = buildCryptoKey(); | |
| 1885 var arg_name = "foo"; | |
| 1886 var arg_updateMask = "foo"; | |
| 1887 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1888 var obj = new api.CryptoKey.fromJson(json); | |
| 1889 checkCryptoKey(obj); | |
| 1890 | |
| 1891 var path = (req.url).path; | |
| 1892 var pathOffset = 0; | |
| 1893 var index; | |
| 1894 var subPart; | |
| 1895 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1896 pathOffset += 1; | |
| 1897 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1898 pathOffset += 8; | |
| 1899 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1900 | |
| 1901 var query = (req.url).query; | |
| 1902 var queryOffset = 0; | |
| 1903 var queryMap = {}; | |
| 1904 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1905 parseBool(n) { | |
| 1906 if (n == "true") return true; | |
| 1907 if (n == "false") return false; | |
| 1908 if (n == null) return null; | |
| 1909 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1910 } | |
| 1911 if (query.length > 0) { | |
| 1912 for (var part in query.split("&")) { | |
| 1913 var keyvalue = part.split("="); | |
| 1914 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1915 } | |
| 1916 } | |
| 1917 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); | |
| 1918 | |
| 1919 | |
| 1920 var h = { | |
| 1921 "content-type" : "application/json; charset=utf-8", | |
| 1922 }; | |
| 1923 var resp = convert.JSON.encode(buildCryptoKey()); | |
| 1924 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1925 }), true); | |
| 1926 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync(((api.CryptoKey response) { | |
| 1927 checkCryptoKey(response); | |
| 1928 }))); | |
| 1929 }); | |
| 1930 | |
| 1931 unittest.test("method--setIamPolicy", () { | |
| 1932 | |
| 1933 var mock = new HttpServerMock(); | |
| 1934 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1935 var arg_request = buildSetIamPolicyRequest(); | |
| 1936 var arg_resource = "foo"; | |
| 1937 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1938 var obj = new api.SetIamPolicyRequest.fromJson(json); | |
| 1939 checkSetIamPolicyRequest(obj); | |
| 1940 | |
| 1941 var path = (req.url).path; | |
| 1942 var pathOffset = 0; | |
| 1943 var index; | |
| 1944 var subPart; | |
| 1945 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1946 pathOffset += 1; | |
| 1947 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1948 pathOffset += 8; | |
| 1949 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1950 | |
| 1951 var query = (req.url).query; | |
| 1952 var queryOffset = 0; | |
| 1953 var queryMap = {}; | |
| 1954 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 1955 parseBool(n) { | |
| 1956 if (n == "true") return true; | |
| 1957 if (n == "false") return false; | |
| 1958 if (n == null) return null; | |
| 1959 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 1960 } | |
| 1961 if (query.length > 0) { | |
| 1962 for (var part in query.split("&")) { | |
| 1963 var keyvalue = part.split("="); | |
| 1964 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 1965 } | |
| 1966 } | |
| 1967 | |
| 1968 | |
| 1969 var h = { | |
| 1970 "content-type" : "application/json; charset=utf-8", | |
| 1971 }; | |
| 1972 var resp = convert.JSON.encode(buildPolicy()); | |
| 1973 return new async.Future.value(stringResponse(200, h, resp)); | |
| 1974 }), true); | |
| 1975 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((ap
i.Policy response) { | |
| 1976 checkPolicy(response); | |
| 1977 }))); | |
| 1978 }); | |
| 1979 | |
| 1980 unittest.test("method--testIamPermissions", () { | |
| 1981 | |
| 1982 var mock = new HttpServerMock(); | |
| 1983 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 1984 var arg_request = buildTestIamPermissionsRequest(); | |
| 1985 var arg_resource = "foo"; | |
| 1986 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 1987 var obj = new api.TestIamPermissionsRequest.fromJson(json); | |
| 1988 checkTestIamPermissionsRequest(obj); | |
| 1989 | |
| 1990 var path = (req.url).path; | |
| 1991 var pathOffset = 0; | |
| 1992 var index; | |
| 1993 var subPart; | |
| 1994 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 1995 pathOffset += 1; | |
| 1996 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 1997 pathOffset += 8; | |
| 1998 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 1999 | |
| 2000 var query = (req.url).query; | |
| 2001 var queryOffset = 0; | |
| 2002 var queryMap = {}; | |
| 2003 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2004 parseBool(n) { | |
| 2005 if (n == "true") return true; | |
| 2006 if (n == "false") return false; | |
| 2007 if (n == null) return null; | |
| 2008 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2009 } | |
| 2010 if (query.length > 0) { | |
| 2011 for (var part in query.split("&")) { | |
| 2012 var keyvalue = part.split("="); | |
| 2013 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2014 } | |
| 2015 } | |
| 2016 | |
| 2017 | |
| 2018 var h = { | |
| 2019 "content-type" : "application/json; charset=utf-8", | |
| 2020 }; | |
| 2021 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | |
| 2022 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2023 }), true); | |
| 2024 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c(((api.TestIamPermissionsResponse response) { | |
| 2025 checkTestIamPermissionsResponse(response); | |
| 2026 }))); | |
| 2027 }); | |
| 2028 | |
| 2029 unittest.test("method--updatePrimaryVersion", () { | |
| 2030 | |
| 2031 var mock = new HttpServerMock(); | |
| 2032 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | |
| 2033 var arg_request = buildUpdateCryptoKeyPrimaryVersionRequest(); | |
| 2034 var arg_name = "foo"; | |
| 2035 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2036 var obj = new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(json); | |
| 2037 checkUpdateCryptoKeyPrimaryVersionRequest(obj); | |
| 2038 | |
| 2039 var path = (req.url).path; | |
| 2040 var pathOffset = 0; | |
| 2041 var index; | |
| 2042 var subPart; | |
| 2043 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2044 pathOffset += 1; | |
| 2045 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2046 pathOffset += 8; | |
| 2047 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2048 | |
| 2049 var query = (req.url).query; | |
| 2050 var queryOffset = 0; | |
| 2051 var queryMap = {}; | |
| 2052 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2053 parseBool(n) { | |
| 2054 if (n == "true") return true; | |
| 2055 if (n == "false") return false; | |
| 2056 if (n == null) return null; | |
| 2057 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2058 } | |
| 2059 if (query.length > 0) { | |
| 2060 for (var part in query.split("&")) { | |
| 2061 var keyvalue = part.split("="); | |
| 2062 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2063 } | |
| 2064 } | |
| 2065 | |
| 2066 | |
| 2067 var h = { | |
| 2068 "content-type" : "application/json; charset=utf-8", | |
| 2069 }; | |
| 2070 var resp = convert.JSON.encode(buildCryptoKey()); | |
| 2071 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2072 }), true); | |
| 2073 res.updatePrimaryVersion(arg_request, arg_name).then(unittest.expectAsync(
((api.CryptoKey response) { | |
| 2074 checkCryptoKey(response); | |
| 2075 }))); | |
| 2076 }); | |
| 2077 | |
| 2078 }); | |
| 2079 | |
| 2080 | |
| 2081 unittest.group("resource-ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsR
esourceApi", () { | |
| 2082 unittest.test("method--create", () { | |
| 2083 | |
| 2084 var mock = new HttpServerMock(); | |
| 2085 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2086 var arg_request = buildCryptoKeyVersion(); | |
| 2087 var arg_parent = "foo"; | |
| 2088 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2089 var obj = new api.CryptoKeyVersion.fromJson(json); | |
| 2090 checkCryptoKeyVersion(obj); | |
| 2091 | |
| 2092 var path = (req.url).path; | |
| 2093 var pathOffset = 0; | |
| 2094 var index; | |
| 2095 var subPart; | |
| 2096 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2097 pathOffset += 1; | |
| 2098 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2099 pathOffset += 8; | |
| 2100 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2101 | |
| 2102 var query = (req.url).query; | |
| 2103 var queryOffset = 0; | |
| 2104 var queryMap = {}; | |
| 2105 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2106 parseBool(n) { | |
| 2107 if (n == "true") return true; | |
| 2108 if (n == "false") return false; | |
| 2109 if (n == null) return null; | |
| 2110 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2111 } | |
| 2112 if (query.length > 0) { | |
| 2113 for (var part in query.split("&")) { | |
| 2114 var keyvalue = part.split("="); | |
| 2115 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2116 } | |
| 2117 } | |
| 2118 | |
| 2119 | |
| 2120 var h = { | |
| 2121 "content-type" : "application/json; charset=utf-8", | |
| 2122 }; | |
| 2123 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | |
| 2124 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2125 }), true); | |
| 2126 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Crypto
KeyVersion response) { | |
| 2127 checkCryptoKeyVersion(response); | |
| 2128 }))); | |
| 2129 }); | |
| 2130 | |
| 2131 unittest.test("method--destroy", () { | |
| 2132 | |
| 2133 var mock = new HttpServerMock(); | |
| 2134 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2135 var arg_request = buildDestroyCryptoKeyVersionRequest(); | |
| 2136 var arg_name = "foo"; | |
| 2137 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2138 var obj = new api.DestroyCryptoKeyVersionRequest.fromJson(json); | |
| 2139 checkDestroyCryptoKeyVersionRequest(obj); | |
| 2140 | |
| 2141 var path = (req.url).path; | |
| 2142 var pathOffset = 0; | |
| 2143 var index; | |
| 2144 var subPart; | |
| 2145 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2146 pathOffset += 1; | |
| 2147 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2148 pathOffset += 8; | |
| 2149 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2150 | |
| 2151 var query = (req.url).query; | |
| 2152 var queryOffset = 0; | |
| 2153 var queryMap = {}; | |
| 2154 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2155 parseBool(n) { | |
| 2156 if (n == "true") return true; | |
| 2157 if (n == "false") return false; | |
| 2158 if (n == null) return null; | |
| 2159 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2160 } | |
| 2161 if (query.length > 0) { | |
| 2162 for (var part in query.split("&")) { | |
| 2163 var keyvalue = part.split("="); | |
| 2164 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2165 } | |
| 2166 } | |
| 2167 | |
| 2168 | |
| 2169 var h = { | |
| 2170 "content-type" : "application/json; charset=utf-8", | |
| 2171 }; | |
| 2172 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | |
| 2173 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2174 }), true); | |
| 2175 res.destroy(arg_request, arg_name).then(unittest.expectAsync(((api.CryptoK
eyVersion response) { | |
| 2176 checkCryptoKeyVersion(response); | |
| 2177 }))); | |
| 2178 }); | |
| 2179 | |
| 2180 unittest.test("method--get", () { | |
| 2181 | |
| 2182 var mock = new HttpServerMock(); | |
| 2183 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2184 var arg_name = "foo"; | |
| 2185 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2186 var path = (req.url).path; | |
| 2187 var pathOffset = 0; | |
| 2188 var index; | |
| 2189 var subPart; | |
| 2190 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2191 pathOffset += 1; | |
| 2192 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2193 pathOffset += 8; | |
| 2194 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2195 | |
| 2196 var query = (req.url).query; | |
| 2197 var queryOffset = 0; | |
| 2198 var queryMap = {}; | |
| 2199 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2200 parseBool(n) { | |
| 2201 if (n == "true") return true; | |
| 2202 if (n == "false") return false; | |
| 2203 if (n == null) return null; | |
| 2204 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2205 } | |
| 2206 if (query.length > 0) { | |
| 2207 for (var part in query.split("&")) { | |
| 2208 var keyvalue = part.split("="); | |
| 2209 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2210 } | |
| 2211 } | |
| 2212 | |
| 2213 | |
| 2214 var h = { | |
| 2215 "content-type" : "application/json; charset=utf-8", | |
| 2216 }; | |
| 2217 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | |
| 2218 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2219 }), true); | |
| 2220 res.get(arg_name).then(unittest.expectAsync(((api.CryptoKeyVersion respons
e) { | |
| 2221 checkCryptoKeyVersion(response); | |
| 2222 }))); | |
| 2223 }); | |
| 2224 | |
| 2225 unittest.test("method--list", () { | |
| 2226 | |
| 2227 var mock = new HttpServerMock(); | |
| 2228 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2229 var arg_parent = "foo"; | |
| 2230 var arg_pageToken = "foo"; | |
| 2231 var arg_pageSize = 42; | |
| 2232 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2233 var path = (req.url).path; | |
| 2234 var pathOffset = 0; | |
| 2235 var index; | |
| 2236 var subPart; | |
| 2237 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2238 pathOffset += 1; | |
| 2239 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2240 pathOffset += 8; | |
| 2241 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2242 | |
| 2243 var query = (req.url).query; | |
| 2244 var queryOffset = 0; | |
| 2245 var queryMap = {}; | |
| 2246 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2247 parseBool(n) { | |
| 2248 if (n == "true") return true; | |
| 2249 if (n == "false") return false; | |
| 2250 if (n == null) return null; | |
| 2251 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2252 } | |
| 2253 if (query.length > 0) { | |
| 2254 for (var part in query.split("&")) { | |
| 2255 var keyvalue = part.split("="); | |
| 2256 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2257 } | |
| 2258 } | |
| 2259 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 2260 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
| 2261 | |
| 2262 | |
| 2263 var h = { | |
| 2264 "content-type" : "application/json; charset=utf-8", | |
| 2265 }; | |
| 2266 var resp = convert.JSON.encode(buildListCryptoKeyVersionsResponse()); | |
| 2267 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2268 }), true); | |
| 2269 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.ListCryptoKeyVersionsResponse response) { | |
| 2270 checkListCryptoKeyVersionsResponse(response); | |
| 2271 }))); | |
| 2272 }); | |
| 2273 | |
| 2274 unittest.test("method--patch", () { | |
| 2275 | |
| 2276 var mock = new HttpServerMock(); | |
| 2277 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2278 var arg_request = buildCryptoKeyVersion(); | |
| 2279 var arg_name = "foo"; | |
| 2280 var arg_updateMask = "foo"; | |
| 2281 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2282 var obj = new api.CryptoKeyVersion.fromJson(json); | |
| 2283 checkCryptoKeyVersion(obj); | |
| 2284 | |
| 2285 var path = (req.url).path; | |
| 2286 var pathOffset = 0; | |
| 2287 var index; | |
| 2288 var subPart; | |
| 2289 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2290 pathOffset += 1; | |
| 2291 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2292 pathOffset += 8; | |
| 2293 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2294 | |
| 2295 var query = (req.url).query; | |
| 2296 var queryOffset = 0; | |
| 2297 var queryMap = {}; | |
| 2298 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2299 parseBool(n) { | |
| 2300 if (n == "true") return true; | |
| 2301 if (n == "false") return false; | |
| 2302 if (n == null) return null; | |
| 2303 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2304 } | |
| 2305 if (query.length > 0) { | |
| 2306 for (var part in query.split("&")) { | |
| 2307 var keyvalue = part.split("="); | |
| 2308 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2309 } | |
| 2310 } | |
| 2311 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); | |
| 2312 | |
| 2313 | |
| 2314 var h = { | |
| 2315 "content-type" : "application/json; charset=utf-8", | |
| 2316 }; | |
| 2317 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | |
| 2318 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2319 }), true); | |
| 2320 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync(((api.CryptoKeyVersion response) { | |
| 2321 checkCryptoKeyVersion(response); | |
| 2322 }))); | |
| 2323 }); | |
| 2324 | |
| 2325 unittest.test("method--restore", () { | |
| 2326 | |
| 2327 var mock = new HttpServerMock(); | |
| 2328 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | |
| 2329 var arg_request = buildRestoreCryptoKeyVersionRequest(); | |
| 2330 var arg_name = "foo"; | |
| 2331 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 2332 var obj = new api.RestoreCryptoKeyVersionRequest.fromJson(json); | |
| 2333 checkRestoreCryptoKeyVersionRequest(obj); | |
| 2334 | |
| 2335 var path = (req.url).path; | |
| 2336 var pathOffset = 0; | |
| 2337 var index; | |
| 2338 var subPart; | |
| 2339 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 2340 pathOffset += 1; | |
| 2341 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
| 2342 pathOffset += 8; | |
| 2343 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
| 2344 | |
| 2345 var query = (req.url).query; | |
| 2346 var queryOffset = 0; | |
| 2347 var queryMap = {}; | |
| 2348 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 2349 parseBool(n) { | |
| 2350 if (n == "true") return true; | |
| 2351 if (n == "false") return false; | |
| 2352 if (n == null) return null; | |
| 2353 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 2354 } | |
| 2355 if (query.length > 0) { | |
| 2356 for (var part in query.split("&")) { | |
| 2357 var keyvalue = part.split("="); | |
| 2358 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 2359 } | |
| 2360 } | |
| 2361 | |
| 2362 | |
| 2363 var h = { | |
| 2364 "content-type" : "application/json; charset=utf-8", | |
| 2365 }; | |
| 2366 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | |
| 2367 return new async.Future.value(stringResponse(200, h, resp)); | |
| 2368 }), true); | |
| 2369 res.restore(arg_request, arg_name).then(unittest.expectAsync(((api.CryptoK
eyVersion response) { | |
| 2370 checkCryptoKeyVersion(response); | |
| 2371 }))); | |
| 2372 }); | |
| 2373 | |
| 2374 }); | |
| 2375 | |
| 2376 | |
| 2377 } | |
| 2378 | |
| OLD | NEW |