OLD | NEW |
(Empty) | |
| 1 library googleapis_beta.dlp.v2beta1.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/dlp/v2beta1.dart' as api; |
| 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 53 |
| 54 core.int buildCounterCancelOperationRequest = 0; |
| 55 buildCancelOperationRequest() { |
| 56 var o = new api.CancelOperationRequest(); |
| 57 buildCounterCancelOperationRequest++; |
| 58 if (buildCounterCancelOperationRequest < 3) { |
| 59 } |
| 60 buildCounterCancelOperationRequest--; |
| 61 return o; |
| 62 } |
| 63 |
| 64 checkCancelOperationRequest(api.CancelOperationRequest o) { |
| 65 buildCounterCancelOperationRequest++; |
| 66 if (buildCounterCancelOperationRequest < 3) { |
| 67 } |
| 68 buildCounterCancelOperationRequest--; |
| 69 } |
| 70 |
| 71 core.int buildCounterCategoryDescription = 0; |
| 72 buildCategoryDescription() { |
| 73 var o = new api.CategoryDescription(); |
| 74 buildCounterCategoryDescription++; |
| 75 if (buildCounterCategoryDescription < 3) { |
| 76 o.displayName = "foo"; |
| 77 o.name = "foo"; |
| 78 } |
| 79 buildCounterCategoryDescription--; |
| 80 return o; |
| 81 } |
| 82 |
| 83 checkCategoryDescription(api.CategoryDescription o) { |
| 84 buildCounterCategoryDescription++; |
| 85 if (buildCounterCategoryDescription < 3) { |
| 86 unittest.expect(o.displayName, unittest.equals('foo')); |
| 87 unittest.expect(o.name, unittest.equals('foo')); |
| 88 } |
| 89 buildCounterCategoryDescription--; |
| 90 } |
| 91 |
| 92 core.int buildCounterCloudStorageKey = 0; |
| 93 buildCloudStorageKey() { |
| 94 var o = new api.CloudStorageKey(); |
| 95 buildCounterCloudStorageKey++; |
| 96 if (buildCounterCloudStorageKey < 3) { |
| 97 o.filePath = "foo"; |
| 98 o.startOffset = "foo"; |
| 99 } |
| 100 buildCounterCloudStorageKey--; |
| 101 return o; |
| 102 } |
| 103 |
| 104 checkCloudStorageKey(api.CloudStorageKey o) { |
| 105 buildCounterCloudStorageKey++; |
| 106 if (buildCounterCloudStorageKey < 3) { |
| 107 unittest.expect(o.filePath, unittest.equals('foo')); |
| 108 unittest.expect(o.startOffset, unittest.equals('foo')); |
| 109 } |
| 110 buildCounterCloudStorageKey--; |
| 111 } |
| 112 |
| 113 core.int buildCounterCloudStorageOptions = 0; |
| 114 buildCloudStorageOptions() { |
| 115 var o = new api.CloudStorageOptions(); |
| 116 buildCounterCloudStorageOptions++; |
| 117 if (buildCounterCloudStorageOptions < 3) { |
| 118 o.fileSet = buildFileSet(); |
| 119 } |
| 120 buildCounterCloudStorageOptions--; |
| 121 return o; |
| 122 } |
| 123 |
| 124 checkCloudStorageOptions(api.CloudStorageOptions o) { |
| 125 buildCounterCloudStorageOptions++; |
| 126 if (buildCounterCloudStorageOptions < 3) { |
| 127 checkFileSet(o.fileSet); |
| 128 } |
| 129 buildCounterCloudStorageOptions--; |
| 130 } |
| 131 |
| 132 core.int buildCounterContentItem = 0; |
| 133 buildContentItem() { |
| 134 var o = new api.ContentItem(); |
| 135 buildCounterContentItem++; |
| 136 if (buildCounterContentItem < 3) { |
| 137 o.data = "foo"; |
| 138 o.type = "foo"; |
| 139 o.value = "foo"; |
| 140 } |
| 141 buildCounterContentItem--; |
| 142 return o; |
| 143 } |
| 144 |
| 145 checkContentItem(api.ContentItem o) { |
| 146 buildCounterContentItem++; |
| 147 if (buildCounterContentItem < 3) { |
| 148 unittest.expect(o.data, unittest.equals('foo')); |
| 149 unittest.expect(o.type, unittest.equals('foo')); |
| 150 unittest.expect(o.value, unittest.equals('foo')); |
| 151 } |
| 152 buildCounterContentItem--; |
| 153 } |
| 154 |
| 155 core.int buildCounterCreateInspectOperationRequest = 0; |
| 156 buildCreateInspectOperationRequest() { |
| 157 var o = new api.CreateInspectOperationRequest(); |
| 158 buildCounterCreateInspectOperationRequest++; |
| 159 if (buildCounterCreateInspectOperationRequest < 3) { |
| 160 o.inspectConfig = buildInspectConfig(); |
| 161 o.storageConfig = buildStorageConfig(); |
| 162 } |
| 163 buildCounterCreateInspectOperationRequest--; |
| 164 return o; |
| 165 } |
| 166 |
| 167 checkCreateInspectOperationRequest(api.CreateInspectOperationRequest o) { |
| 168 buildCounterCreateInspectOperationRequest++; |
| 169 if (buildCounterCreateInspectOperationRequest < 3) { |
| 170 checkInspectConfig(o.inspectConfig); |
| 171 checkStorageConfig(o.storageConfig); |
| 172 } |
| 173 buildCounterCreateInspectOperationRequest--; |
| 174 } |
| 175 |
| 176 core.int buildCounterDatastoreKey = 0; |
| 177 buildDatastoreKey() { |
| 178 var o = new api.DatastoreKey(); |
| 179 buildCounterDatastoreKey++; |
| 180 if (buildCounterDatastoreKey < 3) { |
| 181 o.entityKey = buildKey(); |
| 182 } |
| 183 buildCounterDatastoreKey--; |
| 184 return o; |
| 185 } |
| 186 |
| 187 checkDatastoreKey(api.DatastoreKey o) { |
| 188 buildCounterDatastoreKey++; |
| 189 if (buildCounterDatastoreKey < 3) { |
| 190 checkKey(o.entityKey); |
| 191 } |
| 192 buildCounterDatastoreKey--; |
| 193 } |
| 194 |
| 195 buildUnnamed3326() { |
| 196 var o = new core.List<api.Projection>(); |
| 197 o.add(buildProjection()); |
| 198 o.add(buildProjection()); |
| 199 return o; |
| 200 } |
| 201 |
| 202 checkUnnamed3326(core.List<api.Projection> o) { |
| 203 unittest.expect(o, unittest.hasLength(2)); |
| 204 checkProjection(o[0]); |
| 205 checkProjection(o[1]); |
| 206 } |
| 207 |
| 208 core.int buildCounterDatastoreOptions = 0; |
| 209 buildDatastoreOptions() { |
| 210 var o = new api.DatastoreOptions(); |
| 211 buildCounterDatastoreOptions++; |
| 212 if (buildCounterDatastoreOptions < 3) { |
| 213 o.kind = buildKindExpression(); |
| 214 o.partitionId = buildPartitionId(); |
| 215 o.projection = buildUnnamed3326(); |
| 216 } |
| 217 buildCounterDatastoreOptions--; |
| 218 return o; |
| 219 } |
| 220 |
| 221 checkDatastoreOptions(api.DatastoreOptions o) { |
| 222 buildCounterDatastoreOptions++; |
| 223 if (buildCounterDatastoreOptions < 3) { |
| 224 checkKindExpression(o.kind); |
| 225 checkPartitionId(o.partitionId); |
| 226 checkUnnamed3326(o.projection); |
| 227 } |
| 228 buildCounterDatastoreOptions--; |
| 229 } |
| 230 |
| 231 core.int buildCounterEmpty = 0; |
| 232 buildEmpty() { |
| 233 var o = new api.Empty(); |
| 234 buildCounterEmpty++; |
| 235 if (buildCounterEmpty < 3) { |
| 236 } |
| 237 buildCounterEmpty--; |
| 238 return o; |
| 239 } |
| 240 |
| 241 checkEmpty(api.Empty o) { |
| 242 buildCounterEmpty++; |
| 243 if (buildCounterEmpty < 3) { |
| 244 } |
| 245 buildCounterEmpty--; |
| 246 } |
| 247 |
| 248 core.int buildCounterFieldId = 0; |
| 249 buildFieldId() { |
| 250 var o = new api.FieldId(); |
| 251 buildCounterFieldId++; |
| 252 if (buildCounterFieldId < 3) { |
| 253 o.columnName = "foo"; |
| 254 } |
| 255 buildCounterFieldId--; |
| 256 return o; |
| 257 } |
| 258 |
| 259 checkFieldId(api.FieldId o) { |
| 260 buildCounterFieldId++; |
| 261 if (buildCounterFieldId < 3) { |
| 262 unittest.expect(o.columnName, unittest.equals('foo')); |
| 263 } |
| 264 buildCounterFieldId--; |
| 265 } |
| 266 |
| 267 core.int buildCounterFileSet = 0; |
| 268 buildFileSet() { |
| 269 var o = new api.FileSet(); |
| 270 buildCounterFileSet++; |
| 271 if (buildCounterFileSet < 3) { |
| 272 o.url = "foo"; |
| 273 } |
| 274 buildCounterFileSet--; |
| 275 return o; |
| 276 } |
| 277 |
| 278 checkFileSet(api.FileSet o) { |
| 279 buildCounterFileSet++; |
| 280 if (buildCounterFileSet < 3) { |
| 281 unittest.expect(o.url, unittest.equals('foo')); |
| 282 } |
| 283 buildCounterFileSet--; |
| 284 } |
| 285 |
| 286 core.int buildCounterFinding = 0; |
| 287 buildFinding() { |
| 288 var o = new api.Finding(); |
| 289 buildCounterFinding++; |
| 290 if (buildCounterFinding < 3) { |
| 291 o.createTime = "foo"; |
| 292 o.infoType = buildInfoType(); |
| 293 o.likelihood = "foo"; |
| 294 o.location = buildLocation(); |
| 295 o.quote = "foo"; |
| 296 } |
| 297 buildCounterFinding--; |
| 298 return o; |
| 299 } |
| 300 |
| 301 checkFinding(api.Finding o) { |
| 302 buildCounterFinding++; |
| 303 if (buildCounterFinding < 3) { |
| 304 unittest.expect(o.createTime, unittest.equals('foo')); |
| 305 checkInfoType(o.infoType); |
| 306 unittest.expect(o.likelihood, unittest.equals('foo')); |
| 307 checkLocation(o.location); |
| 308 unittest.expect(o.quote, unittest.equals('foo')); |
| 309 } |
| 310 buildCounterFinding--; |
| 311 } |
| 312 |
| 313 core.int buildCounterImageLocation = 0; |
| 314 buildImageLocation() { |
| 315 var o = new api.ImageLocation(); |
| 316 buildCounterImageLocation++; |
| 317 if (buildCounterImageLocation < 3) { |
| 318 o.height = 42; |
| 319 o.left = 42; |
| 320 o.top = 42; |
| 321 o.width = 42; |
| 322 } |
| 323 buildCounterImageLocation--; |
| 324 return o; |
| 325 } |
| 326 |
| 327 checkImageLocation(api.ImageLocation o) { |
| 328 buildCounterImageLocation++; |
| 329 if (buildCounterImageLocation < 3) { |
| 330 unittest.expect(o.height, unittest.equals(42)); |
| 331 unittest.expect(o.left, unittest.equals(42)); |
| 332 unittest.expect(o.top, unittest.equals(42)); |
| 333 unittest.expect(o.width, unittest.equals(42)); |
| 334 } |
| 335 buildCounterImageLocation--; |
| 336 } |
| 337 |
| 338 core.int buildCounterInfoType = 0; |
| 339 buildInfoType() { |
| 340 var o = new api.InfoType(); |
| 341 buildCounterInfoType++; |
| 342 if (buildCounterInfoType < 3) { |
| 343 o.name = "foo"; |
| 344 } |
| 345 buildCounterInfoType--; |
| 346 return o; |
| 347 } |
| 348 |
| 349 checkInfoType(api.InfoType o) { |
| 350 buildCounterInfoType++; |
| 351 if (buildCounterInfoType < 3) { |
| 352 unittest.expect(o.name, unittest.equals('foo')); |
| 353 } |
| 354 buildCounterInfoType--; |
| 355 } |
| 356 |
| 357 buildUnnamed3327() { |
| 358 var o = new core.List<api.CategoryDescription>(); |
| 359 o.add(buildCategoryDescription()); |
| 360 o.add(buildCategoryDescription()); |
| 361 return o; |
| 362 } |
| 363 |
| 364 checkUnnamed3327(core.List<api.CategoryDescription> o) { |
| 365 unittest.expect(o, unittest.hasLength(2)); |
| 366 checkCategoryDescription(o[0]); |
| 367 checkCategoryDescription(o[1]); |
| 368 } |
| 369 |
| 370 core.int buildCounterInfoTypeDescription = 0; |
| 371 buildInfoTypeDescription() { |
| 372 var o = new api.InfoTypeDescription(); |
| 373 buildCounterInfoTypeDescription++; |
| 374 if (buildCounterInfoTypeDescription < 3) { |
| 375 o.categories = buildUnnamed3327(); |
| 376 o.displayName = "foo"; |
| 377 o.name = "foo"; |
| 378 } |
| 379 buildCounterInfoTypeDescription--; |
| 380 return o; |
| 381 } |
| 382 |
| 383 checkInfoTypeDescription(api.InfoTypeDescription o) { |
| 384 buildCounterInfoTypeDescription++; |
| 385 if (buildCounterInfoTypeDescription < 3) { |
| 386 checkUnnamed3327(o.categories); |
| 387 unittest.expect(o.displayName, unittest.equals('foo')); |
| 388 unittest.expect(o.name, unittest.equals('foo')); |
| 389 } |
| 390 buildCounterInfoTypeDescription--; |
| 391 } |
| 392 |
| 393 buildUnnamed3328() { |
| 394 var o = new core.List<api.InfoType>(); |
| 395 o.add(buildInfoType()); |
| 396 o.add(buildInfoType()); |
| 397 return o; |
| 398 } |
| 399 |
| 400 checkUnnamed3328(core.List<api.InfoType> o) { |
| 401 unittest.expect(o, unittest.hasLength(2)); |
| 402 checkInfoType(o[0]); |
| 403 checkInfoType(o[1]); |
| 404 } |
| 405 |
| 406 core.int buildCounterInspectConfig = 0; |
| 407 buildInspectConfig() { |
| 408 var o = new api.InspectConfig(); |
| 409 buildCounterInspectConfig++; |
| 410 if (buildCounterInspectConfig < 3) { |
| 411 o.excludeTypes = true; |
| 412 o.includeQuote = true; |
| 413 o.infoTypes = buildUnnamed3328(); |
| 414 o.maxFindings = 42; |
| 415 o.minLikelihood = "foo"; |
| 416 } |
| 417 buildCounterInspectConfig--; |
| 418 return o; |
| 419 } |
| 420 |
| 421 checkInspectConfig(api.InspectConfig o) { |
| 422 buildCounterInspectConfig++; |
| 423 if (buildCounterInspectConfig < 3) { |
| 424 unittest.expect(o.excludeTypes, unittest.isTrue); |
| 425 unittest.expect(o.includeQuote, unittest.isTrue); |
| 426 checkUnnamed3328(o.infoTypes); |
| 427 unittest.expect(o.maxFindings, unittest.equals(42)); |
| 428 unittest.expect(o.minLikelihood, unittest.equals('foo')); |
| 429 } |
| 430 buildCounterInspectConfig--; |
| 431 } |
| 432 |
| 433 buildUnnamed3329() { |
| 434 var o = new core.List<api.ContentItem>(); |
| 435 o.add(buildContentItem()); |
| 436 o.add(buildContentItem()); |
| 437 return o; |
| 438 } |
| 439 |
| 440 checkUnnamed3329(core.List<api.ContentItem> o) { |
| 441 unittest.expect(o, unittest.hasLength(2)); |
| 442 checkContentItem(o[0]); |
| 443 checkContentItem(o[1]); |
| 444 } |
| 445 |
| 446 core.int buildCounterInspectContentRequest = 0; |
| 447 buildInspectContentRequest() { |
| 448 var o = new api.InspectContentRequest(); |
| 449 buildCounterInspectContentRequest++; |
| 450 if (buildCounterInspectContentRequest < 3) { |
| 451 o.inspectConfig = buildInspectConfig(); |
| 452 o.items = buildUnnamed3329(); |
| 453 } |
| 454 buildCounterInspectContentRequest--; |
| 455 return o; |
| 456 } |
| 457 |
| 458 checkInspectContentRequest(api.InspectContentRequest o) { |
| 459 buildCounterInspectContentRequest++; |
| 460 if (buildCounterInspectContentRequest < 3) { |
| 461 checkInspectConfig(o.inspectConfig); |
| 462 checkUnnamed3329(o.items); |
| 463 } |
| 464 buildCounterInspectContentRequest--; |
| 465 } |
| 466 |
| 467 buildUnnamed3330() { |
| 468 var o = new core.List<api.InspectResult>(); |
| 469 o.add(buildInspectResult()); |
| 470 o.add(buildInspectResult()); |
| 471 return o; |
| 472 } |
| 473 |
| 474 checkUnnamed3330(core.List<api.InspectResult> o) { |
| 475 unittest.expect(o, unittest.hasLength(2)); |
| 476 checkInspectResult(o[0]); |
| 477 checkInspectResult(o[1]); |
| 478 } |
| 479 |
| 480 core.int buildCounterInspectContentResponse = 0; |
| 481 buildInspectContentResponse() { |
| 482 var o = new api.InspectContentResponse(); |
| 483 buildCounterInspectContentResponse++; |
| 484 if (buildCounterInspectContentResponse < 3) { |
| 485 o.results = buildUnnamed3330(); |
| 486 } |
| 487 buildCounterInspectContentResponse--; |
| 488 return o; |
| 489 } |
| 490 |
| 491 checkInspectContentResponse(api.InspectContentResponse o) { |
| 492 buildCounterInspectContentResponse++; |
| 493 if (buildCounterInspectContentResponse < 3) { |
| 494 checkUnnamed3330(o.results); |
| 495 } |
| 496 buildCounterInspectContentResponse--; |
| 497 } |
| 498 |
| 499 buildUnnamed3331() { |
| 500 var o = new core.List<api.Finding>(); |
| 501 o.add(buildFinding()); |
| 502 o.add(buildFinding()); |
| 503 return o; |
| 504 } |
| 505 |
| 506 checkUnnamed3331(core.List<api.Finding> o) { |
| 507 unittest.expect(o, unittest.hasLength(2)); |
| 508 checkFinding(o[0]); |
| 509 checkFinding(o[1]); |
| 510 } |
| 511 |
| 512 core.int buildCounterInspectResult = 0; |
| 513 buildInspectResult() { |
| 514 var o = new api.InspectResult(); |
| 515 buildCounterInspectResult++; |
| 516 if (buildCounterInspectResult < 3) { |
| 517 o.findings = buildUnnamed3331(); |
| 518 o.findingsTruncated = true; |
| 519 } |
| 520 buildCounterInspectResult--; |
| 521 return o; |
| 522 } |
| 523 |
| 524 checkInspectResult(api.InspectResult o) { |
| 525 buildCounterInspectResult++; |
| 526 if (buildCounterInspectResult < 3) { |
| 527 checkUnnamed3331(o.findings); |
| 528 unittest.expect(o.findingsTruncated, unittest.isTrue); |
| 529 } |
| 530 buildCounterInspectResult--; |
| 531 } |
| 532 |
| 533 buildUnnamed3332() { |
| 534 var o = new core.List<api.PathElement>(); |
| 535 o.add(buildPathElement()); |
| 536 o.add(buildPathElement()); |
| 537 return o; |
| 538 } |
| 539 |
| 540 checkUnnamed3332(core.List<api.PathElement> o) { |
| 541 unittest.expect(o, unittest.hasLength(2)); |
| 542 checkPathElement(o[0]); |
| 543 checkPathElement(o[1]); |
| 544 } |
| 545 |
| 546 core.int buildCounterKey = 0; |
| 547 buildKey() { |
| 548 var o = new api.Key(); |
| 549 buildCounterKey++; |
| 550 if (buildCounterKey < 3) { |
| 551 o.partitionId = buildPartitionId(); |
| 552 o.path = buildUnnamed3332(); |
| 553 } |
| 554 buildCounterKey--; |
| 555 return o; |
| 556 } |
| 557 |
| 558 checkKey(api.Key o) { |
| 559 buildCounterKey++; |
| 560 if (buildCounterKey < 3) { |
| 561 checkPartitionId(o.partitionId); |
| 562 checkUnnamed3332(o.path); |
| 563 } |
| 564 buildCounterKey--; |
| 565 } |
| 566 |
| 567 core.int buildCounterKindExpression = 0; |
| 568 buildKindExpression() { |
| 569 var o = new api.KindExpression(); |
| 570 buildCounterKindExpression++; |
| 571 if (buildCounterKindExpression < 3) { |
| 572 o.name = "foo"; |
| 573 } |
| 574 buildCounterKindExpression--; |
| 575 return o; |
| 576 } |
| 577 |
| 578 checkKindExpression(api.KindExpression o) { |
| 579 buildCounterKindExpression++; |
| 580 if (buildCounterKindExpression < 3) { |
| 581 unittest.expect(o.name, unittest.equals('foo')); |
| 582 } |
| 583 buildCounterKindExpression--; |
| 584 } |
| 585 |
| 586 buildUnnamed3333() { |
| 587 var o = new core.List<api.InfoTypeDescription>(); |
| 588 o.add(buildInfoTypeDescription()); |
| 589 o.add(buildInfoTypeDescription()); |
| 590 return o; |
| 591 } |
| 592 |
| 593 checkUnnamed3333(core.List<api.InfoTypeDescription> o) { |
| 594 unittest.expect(o, unittest.hasLength(2)); |
| 595 checkInfoTypeDescription(o[0]); |
| 596 checkInfoTypeDescription(o[1]); |
| 597 } |
| 598 |
| 599 core.int buildCounterListInfoTypesResponse = 0; |
| 600 buildListInfoTypesResponse() { |
| 601 var o = new api.ListInfoTypesResponse(); |
| 602 buildCounterListInfoTypesResponse++; |
| 603 if (buildCounterListInfoTypesResponse < 3) { |
| 604 o.infoTypes = buildUnnamed3333(); |
| 605 } |
| 606 buildCounterListInfoTypesResponse--; |
| 607 return o; |
| 608 } |
| 609 |
| 610 checkListInfoTypesResponse(api.ListInfoTypesResponse o) { |
| 611 buildCounterListInfoTypesResponse++; |
| 612 if (buildCounterListInfoTypesResponse < 3) { |
| 613 checkUnnamed3333(o.infoTypes); |
| 614 } |
| 615 buildCounterListInfoTypesResponse--; |
| 616 } |
| 617 |
| 618 core.int buildCounterListInspectFindingsResponse = 0; |
| 619 buildListInspectFindingsResponse() { |
| 620 var o = new api.ListInspectFindingsResponse(); |
| 621 buildCounterListInspectFindingsResponse++; |
| 622 if (buildCounterListInspectFindingsResponse < 3) { |
| 623 o.nextPageToken = "foo"; |
| 624 o.result = buildInspectResult(); |
| 625 } |
| 626 buildCounterListInspectFindingsResponse--; |
| 627 return o; |
| 628 } |
| 629 |
| 630 checkListInspectFindingsResponse(api.ListInspectFindingsResponse o) { |
| 631 buildCounterListInspectFindingsResponse++; |
| 632 if (buildCounterListInspectFindingsResponse < 3) { |
| 633 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 634 checkInspectResult(o.result); |
| 635 } |
| 636 buildCounterListInspectFindingsResponse--; |
| 637 } |
| 638 |
| 639 buildUnnamed3334() { |
| 640 var o = new core.List<api.Operation>(); |
| 641 o.add(buildOperation()); |
| 642 o.add(buildOperation()); |
| 643 return o; |
| 644 } |
| 645 |
| 646 checkUnnamed3334(core.List<api.Operation> o) { |
| 647 unittest.expect(o, unittest.hasLength(2)); |
| 648 checkOperation(o[0]); |
| 649 checkOperation(o[1]); |
| 650 } |
| 651 |
| 652 core.int buildCounterListOperationsResponse = 0; |
| 653 buildListOperationsResponse() { |
| 654 var o = new api.ListOperationsResponse(); |
| 655 buildCounterListOperationsResponse++; |
| 656 if (buildCounterListOperationsResponse < 3) { |
| 657 o.nextPageToken = "foo"; |
| 658 o.operations = buildUnnamed3334(); |
| 659 } |
| 660 buildCounterListOperationsResponse--; |
| 661 return o; |
| 662 } |
| 663 |
| 664 checkListOperationsResponse(api.ListOperationsResponse o) { |
| 665 buildCounterListOperationsResponse++; |
| 666 if (buildCounterListOperationsResponse < 3) { |
| 667 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 668 checkUnnamed3334(o.operations); |
| 669 } |
| 670 buildCounterListOperationsResponse--; |
| 671 } |
| 672 |
| 673 buildUnnamed3335() { |
| 674 var o = new core.List<api.CategoryDescription>(); |
| 675 o.add(buildCategoryDescription()); |
| 676 o.add(buildCategoryDescription()); |
| 677 return o; |
| 678 } |
| 679 |
| 680 checkUnnamed3335(core.List<api.CategoryDescription> o) { |
| 681 unittest.expect(o, unittest.hasLength(2)); |
| 682 checkCategoryDescription(o[0]); |
| 683 checkCategoryDescription(o[1]); |
| 684 } |
| 685 |
| 686 core.int buildCounterListRootCategoriesResponse = 0; |
| 687 buildListRootCategoriesResponse() { |
| 688 var o = new api.ListRootCategoriesResponse(); |
| 689 buildCounterListRootCategoriesResponse++; |
| 690 if (buildCounterListRootCategoriesResponse < 3) { |
| 691 o.categories = buildUnnamed3335(); |
| 692 } |
| 693 buildCounterListRootCategoriesResponse--; |
| 694 return o; |
| 695 } |
| 696 |
| 697 checkListRootCategoriesResponse(api.ListRootCategoriesResponse o) { |
| 698 buildCounterListRootCategoriesResponse++; |
| 699 if (buildCounterListRootCategoriesResponse < 3) { |
| 700 checkUnnamed3335(o.categories); |
| 701 } |
| 702 buildCounterListRootCategoriesResponse--; |
| 703 } |
| 704 |
| 705 buildUnnamed3336() { |
| 706 var o = new core.List<api.ImageLocation>(); |
| 707 o.add(buildImageLocation()); |
| 708 o.add(buildImageLocation()); |
| 709 return o; |
| 710 } |
| 711 |
| 712 checkUnnamed3336(core.List<api.ImageLocation> o) { |
| 713 unittest.expect(o, unittest.hasLength(2)); |
| 714 checkImageLocation(o[0]); |
| 715 checkImageLocation(o[1]); |
| 716 } |
| 717 |
| 718 core.int buildCounterLocation = 0; |
| 719 buildLocation() { |
| 720 var o = new api.Location(); |
| 721 buildCounterLocation++; |
| 722 if (buildCounterLocation < 3) { |
| 723 o.byteRange = buildRange(); |
| 724 o.codepointRange = buildRange(); |
| 725 o.fieldId = buildFieldId(); |
| 726 o.imageBoxes = buildUnnamed3336(); |
| 727 o.recordKey = buildRecordKey(); |
| 728 } |
| 729 buildCounterLocation--; |
| 730 return o; |
| 731 } |
| 732 |
| 733 checkLocation(api.Location o) { |
| 734 buildCounterLocation++; |
| 735 if (buildCounterLocation < 3) { |
| 736 checkRange(o.byteRange); |
| 737 checkRange(o.codepointRange); |
| 738 checkFieldId(o.fieldId); |
| 739 checkUnnamed3336(o.imageBoxes); |
| 740 checkRecordKey(o.recordKey); |
| 741 } |
| 742 buildCounterLocation--; |
| 743 } |
| 744 |
| 745 buildUnnamed3337() { |
| 746 var o = new core.Map<core.String, core.Object>(); |
| 747 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 748 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 749 return o; |
| 750 } |
| 751 |
| 752 checkUnnamed3337(core.Map<core.String, core.Object> o) { |
| 753 unittest.expect(o, unittest.hasLength(2)); |
| 754 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')); |
| 755 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')); |
| 756 } |
| 757 |
| 758 buildUnnamed3338() { |
| 759 var o = new core.Map<core.String, core.Object>(); |
| 760 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 761 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 762 return o; |
| 763 } |
| 764 |
| 765 checkUnnamed3338(core.Map<core.String, core.Object> o) { |
| 766 unittest.expect(o, unittest.hasLength(2)); |
| 767 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); |
| 768 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
| 769 } |
| 770 |
| 771 core.int buildCounterOperation = 0; |
| 772 buildOperation() { |
| 773 var o = new api.Operation(); |
| 774 buildCounterOperation++; |
| 775 if (buildCounterOperation < 3) { |
| 776 o.done = true; |
| 777 o.error = buildStatus(); |
| 778 o.metadata = buildUnnamed3337(); |
| 779 o.name = "foo"; |
| 780 o.response = buildUnnamed3338(); |
| 781 } |
| 782 buildCounterOperation--; |
| 783 return o; |
| 784 } |
| 785 |
| 786 checkOperation(api.Operation o) { |
| 787 buildCounterOperation++; |
| 788 if (buildCounterOperation < 3) { |
| 789 unittest.expect(o.done, unittest.isTrue); |
| 790 checkStatus(o.error); |
| 791 checkUnnamed3337(o.metadata); |
| 792 unittest.expect(o.name, unittest.equals('foo')); |
| 793 checkUnnamed3338(o.response); |
| 794 } |
| 795 buildCounterOperation--; |
| 796 } |
| 797 |
| 798 core.int buildCounterPartitionId = 0; |
| 799 buildPartitionId() { |
| 800 var o = new api.PartitionId(); |
| 801 buildCounterPartitionId++; |
| 802 if (buildCounterPartitionId < 3) { |
| 803 o.databaseId = "foo"; |
| 804 o.namespaceId = "foo"; |
| 805 o.projectId = "foo"; |
| 806 } |
| 807 buildCounterPartitionId--; |
| 808 return o; |
| 809 } |
| 810 |
| 811 checkPartitionId(api.PartitionId o) { |
| 812 buildCounterPartitionId++; |
| 813 if (buildCounterPartitionId < 3) { |
| 814 unittest.expect(o.databaseId, unittest.equals('foo')); |
| 815 unittest.expect(o.namespaceId, unittest.equals('foo')); |
| 816 unittest.expect(o.projectId, unittest.equals('foo')); |
| 817 } |
| 818 buildCounterPartitionId--; |
| 819 } |
| 820 |
| 821 core.int buildCounterPathElement = 0; |
| 822 buildPathElement() { |
| 823 var o = new api.PathElement(); |
| 824 buildCounterPathElement++; |
| 825 if (buildCounterPathElement < 3) { |
| 826 o.id = "foo"; |
| 827 o.kind = "foo"; |
| 828 o.name = "foo"; |
| 829 } |
| 830 buildCounterPathElement--; |
| 831 return o; |
| 832 } |
| 833 |
| 834 checkPathElement(api.PathElement o) { |
| 835 buildCounterPathElement++; |
| 836 if (buildCounterPathElement < 3) { |
| 837 unittest.expect(o.id, unittest.equals('foo')); |
| 838 unittest.expect(o.kind, unittest.equals('foo')); |
| 839 unittest.expect(o.name, unittest.equals('foo')); |
| 840 } |
| 841 buildCounterPathElement--; |
| 842 } |
| 843 |
| 844 core.int buildCounterProjection = 0; |
| 845 buildProjection() { |
| 846 var o = new api.Projection(); |
| 847 buildCounterProjection++; |
| 848 if (buildCounterProjection < 3) { |
| 849 o.property = buildPropertyReference(); |
| 850 } |
| 851 buildCounterProjection--; |
| 852 return o; |
| 853 } |
| 854 |
| 855 checkProjection(api.Projection o) { |
| 856 buildCounterProjection++; |
| 857 if (buildCounterProjection < 3) { |
| 858 checkPropertyReference(o.property); |
| 859 } |
| 860 buildCounterProjection--; |
| 861 } |
| 862 |
| 863 core.int buildCounterPropertyReference = 0; |
| 864 buildPropertyReference() { |
| 865 var o = new api.PropertyReference(); |
| 866 buildCounterPropertyReference++; |
| 867 if (buildCounterPropertyReference < 3) { |
| 868 o.name = "foo"; |
| 869 } |
| 870 buildCounterPropertyReference--; |
| 871 return o; |
| 872 } |
| 873 |
| 874 checkPropertyReference(api.PropertyReference o) { |
| 875 buildCounterPropertyReference++; |
| 876 if (buildCounterPropertyReference < 3) { |
| 877 unittest.expect(o.name, unittest.equals('foo')); |
| 878 } |
| 879 buildCounterPropertyReference--; |
| 880 } |
| 881 |
| 882 core.int buildCounterRange = 0; |
| 883 buildRange() { |
| 884 var o = new api.Range(); |
| 885 buildCounterRange++; |
| 886 if (buildCounterRange < 3) { |
| 887 o.end = "foo"; |
| 888 o.start = "foo"; |
| 889 } |
| 890 buildCounterRange--; |
| 891 return o; |
| 892 } |
| 893 |
| 894 checkRange(api.Range o) { |
| 895 buildCounterRange++; |
| 896 if (buildCounterRange < 3) { |
| 897 unittest.expect(o.end, unittest.equals('foo')); |
| 898 unittest.expect(o.start, unittest.equals('foo')); |
| 899 } |
| 900 buildCounterRange--; |
| 901 } |
| 902 |
| 903 core.int buildCounterRecordKey = 0; |
| 904 buildRecordKey() { |
| 905 var o = new api.RecordKey(); |
| 906 buildCounterRecordKey++; |
| 907 if (buildCounterRecordKey < 3) { |
| 908 o.cloudStorageKey = buildCloudStorageKey(); |
| 909 o.datastoreKey = buildDatastoreKey(); |
| 910 } |
| 911 buildCounterRecordKey--; |
| 912 return o; |
| 913 } |
| 914 |
| 915 checkRecordKey(api.RecordKey o) { |
| 916 buildCounterRecordKey++; |
| 917 if (buildCounterRecordKey < 3) { |
| 918 checkCloudStorageKey(o.cloudStorageKey); |
| 919 checkDatastoreKey(o.datastoreKey); |
| 920 } |
| 921 buildCounterRecordKey--; |
| 922 } |
| 923 |
| 924 buildUnnamed3339() { |
| 925 var o = new core.List<api.ContentItem>(); |
| 926 o.add(buildContentItem()); |
| 927 o.add(buildContentItem()); |
| 928 return o; |
| 929 } |
| 930 |
| 931 checkUnnamed3339(core.List<api.ContentItem> o) { |
| 932 unittest.expect(o, unittest.hasLength(2)); |
| 933 checkContentItem(o[0]); |
| 934 checkContentItem(o[1]); |
| 935 } |
| 936 |
| 937 buildUnnamed3340() { |
| 938 var o = new core.List<api.ReplaceConfig>(); |
| 939 o.add(buildReplaceConfig()); |
| 940 o.add(buildReplaceConfig()); |
| 941 return o; |
| 942 } |
| 943 |
| 944 checkUnnamed3340(core.List<api.ReplaceConfig> o) { |
| 945 unittest.expect(o, unittest.hasLength(2)); |
| 946 checkReplaceConfig(o[0]); |
| 947 checkReplaceConfig(o[1]); |
| 948 } |
| 949 |
| 950 core.int buildCounterRedactContentRequest = 0; |
| 951 buildRedactContentRequest() { |
| 952 var o = new api.RedactContentRequest(); |
| 953 buildCounterRedactContentRequest++; |
| 954 if (buildCounterRedactContentRequest < 3) { |
| 955 o.inspectConfig = buildInspectConfig(); |
| 956 o.items = buildUnnamed3339(); |
| 957 o.replaceConfigs = buildUnnamed3340(); |
| 958 } |
| 959 buildCounterRedactContentRequest--; |
| 960 return o; |
| 961 } |
| 962 |
| 963 checkRedactContentRequest(api.RedactContentRequest o) { |
| 964 buildCounterRedactContentRequest++; |
| 965 if (buildCounterRedactContentRequest < 3) { |
| 966 checkInspectConfig(o.inspectConfig); |
| 967 checkUnnamed3339(o.items); |
| 968 checkUnnamed3340(o.replaceConfigs); |
| 969 } |
| 970 buildCounterRedactContentRequest--; |
| 971 } |
| 972 |
| 973 buildUnnamed3341() { |
| 974 var o = new core.List<api.ContentItem>(); |
| 975 o.add(buildContentItem()); |
| 976 o.add(buildContentItem()); |
| 977 return o; |
| 978 } |
| 979 |
| 980 checkUnnamed3341(core.List<api.ContentItem> o) { |
| 981 unittest.expect(o, unittest.hasLength(2)); |
| 982 checkContentItem(o[0]); |
| 983 checkContentItem(o[1]); |
| 984 } |
| 985 |
| 986 core.int buildCounterRedactContentResponse = 0; |
| 987 buildRedactContentResponse() { |
| 988 var o = new api.RedactContentResponse(); |
| 989 buildCounterRedactContentResponse++; |
| 990 if (buildCounterRedactContentResponse < 3) { |
| 991 o.items = buildUnnamed3341(); |
| 992 } |
| 993 buildCounterRedactContentResponse--; |
| 994 return o; |
| 995 } |
| 996 |
| 997 checkRedactContentResponse(api.RedactContentResponse o) { |
| 998 buildCounterRedactContentResponse++; |
| 999 if (buildCounterRedactContentResponse < 3) { |
| 1000 checkUnnamed3341(o.items); |
| 1001 } |
| 1002 buildCounterRedactContentResponse--; |
| 1003 } |
| 1004 |
| 1005 core.int buildCounterReplaceConfig = 0; |
| 1006 buildReplaceConfig() { |
| 1007 var o = new api.ReplaceConfig(); |
| 1008 buildCounterReplaceConfig++; |
| 1009 if (buildCounterReplaceConfig < 3) { |
| 1010 o.infoType = buildInfoType(); |
| 1011 o.replaceWith = "foo"; |
| 1012 } |
| 1013 buildCounterReplaceConfig--; |
| 1014 return o; |
| 1015 } |
| 1016 |
| 1017 checkReplaceConfig(api.ReplaceConfig o) { |
| 1018 buildCounterReplaceConfig++; |
| 1019 if (buildCounterReplaceConfig < 3) { |
| 1020 checkInfoType(o.infoType); |
| 1021 unittest.expect(o.replaceWith, unittest.equals('foo')); |
| 1022 } |
| 1023 buildCounterReplaceConfig--; |
| 1024 } |
| 1025 |
| 1026 buildUnnamed3342() { |
| 1027 var o = new core.Map<core.String, core.Object>(); |
| 1028 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 1029 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 1030 return o; |
| 1031 } |
| 1032 |
| 1033 checkUnnamed3342(core.Map<core.String, core.Object> o) { |
| 1034 unittest.expect(o, unittest.hasLength(2)); |
| 1035 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
| 1036 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
| 1037 } |
| 1038 |
| 1039 buildUnnamed3343() { |
| 1040 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 1041 o.add(buildUnnamed3342()); |
| 1042 o.add(buildUnnamed3342()); |
| 1043 return o; |
| 1044 } |
| 1045 |
| 1046 checkUnnamed3343(core.List<core.Map<core.String, core.Object>> o) { |
| 1047 unittest.expect(o, unittest.hasLength(2)); |
| 1048 checkUnnamed3342(o[0]); |
| 1049 checkUnnamed3342(o[1]); |
| 1050 } |
| 1051 |
| 1052 core.int buildCounterStatus = 0; |
| 1053 buildStatus() { |
| 1054 var o = new api.Status(); |
| 1055 buildCounterStatus++; |
| 1056 if (buildCounterStatus < 3) { |
| 1057 o.code = 42; |
| 1058 o.details = buildUnnamed3343(); |
| 1059 o.message = "foo"; |
| 1060 } |
| 1061 buildCounterStatus--; |
| 1062 return o; |
| 1063 } |
| 1064 |
| 1065 checkStatus(api.Status o) { |
| 1066 buildCounterStatus++; |
| 1067 if (buildCounterStatus < 3) { |
| 1068 unittest.expect(o.code, unittest.equals(42)); |
| 1069 checkUnnamed3343(o.details); |
| 1070 unittest.expect(o.message, unittest.equals('foo')); |
| 1071 } |
| 1072 buildCounterStatus--; |
| 1073 } |
| 1074 |
| 1075 core.int buildCounterStorageConfig = 0; |
| 1076 buildStorageConfig() { |
| 1077 var o = new api.StorageConfig(); |
| 1078 buildCounterStorageConfig++; |
| 1079 if (buildCounterStorageConfig < 3) { |
| 1080 o.cloudStorageOptions = buildCloudStorageOptions(); |
| 1081 o.datastoreOptions = buildDatastoreOptions(); |
| 1082 } |
| 1083 buildCounterStorageConfig--; |
| 1084 return o; |
| 1085 } |
| 1086 |
| 1087 checkStorageConfig(api.StorageConfig o) { |
| 1088 buildCounterStorageConfig++; |
| 1089 if (buildCounterStorageConfig < 3) { |
| 1090 checkCloudStorageOptions(o.cloudStorageOptions); |
| 1091 checkDatastoreOptions(o.datastoreOptions); |
| 1092 } |
| 1093 buildCounterStorageConfig--; |
| 1094 } |
| 1095 |
| 1096 |
| 1097 main() { |
| 1098 unittest.group("obj-schema-CancelOperationRequest", () { |
| 1099 unittest.test("to-json--from-json", () { |
| 1100 var o = buildCancelOperationRequest(); |
| 1101 var od = new api.CancelOperationRequest.fromJson(o.toJson()); |
| 1102 checkCancelOperationRequest(od); |
| 1103 }); |
| 1104 }); |
| 1105 |
| 1106 |
| 1107 unittest.group("obj-schema-CategoryDescription", () { |
| 1108 unittest.test("to-json--from-json", () { |
| 1109 var o = buildCategoryDescription(); |
| 1110 var od = new api.CategoryDescription.fromJson(o.toJson()); |
| 1111 checkCategoryDescription(od); |
| 1112 }); |
| 1113 }); |
| 1114 |
| 1115 |
| 1116 unittest.group("obj-schema-CloudStorageKey", () { |
| 1117 unittest.test("to-json--from-json", () { |
| 1118 var o = buildCloudStorageKey(); |
| 1119 var od = new api.CloudStorageKey.fromJson(o.toJson()); |
| 1120 checkCloudStorageKey(od); |
| 1121 }); |
| 1122 }); |
| 1123 |
| 1124 |
| 1125 unittest.group("obj-schema-CloudStorageOptions", () { |
| 1126 unittest.test("to-json--from-json", () { |
| 1127 var o = buildCloudStorageOptions(); |
| 1128 var od = new api.CloudStorageOptions.fromJson(o.toJson()); |
| 1129 checkCloudStorageOptions(od); |
| 1130 }); |
| 1131 }); |
| 1132 |
| 1133 |
| 1134 unittest.group("obj-schema-ContentItem", () { |
| 1135 unittest.test("to-json--from-json", () { |
| 1136 var o = buildContentItem(); |
| 1137 var od = new api.ContentItem.fromJson(o.toJson()); |
| 1138 checkContentItem(od); |
| 1139 }); |
| 1140 }); |
| 1141 |
| 1142 |
| 1143 unittest.group("obj-schema-CreateInspectOperationRequest", () { |
| 1144 unittest.test("to-json--from-json", () { |
| 1145 var o = buildCreateInspectOperationRequest(); |
| 1146 var od = new api.CreateInspectOperationRequest.fromJson(o.toJson()); |
| 1147 checkCreateInspectOperationRequest(od); |
| 1148 }); |
| 1149 }); |
| 1150 |
| 1151 |
| 1152 unittest.group("obj-schema-DatastoreKey", () { |
| 1153 unittest.test("to-json--from-json", () { |
| 1154 var o = buildDatastoreKey(); |
| 1155 var od = new api.DatastoreKey.fromJson(o.toJson()); |
| 1156 checkDatastoreKey(od); |
| 1157 }); |
| 1158 }); |
| 1159 |
| 1160 |
| 1161 unittest.group("obj-schema-DatastoreOptions", () { |
| 1162 unittest.test("to-json--from-json", () { |
| 1163 var o = buildDatastoreOptions(); |
| 1164 var od = new api.DatastoreOptions.fromJson(o.toJson()); |
| 1165 checkDatastoreOptions(od); |
| 1166 }); |
| 1167 }); |
| 1168 |
| 1169 |
| 1170 unittest.group("obj-schema-Empty", () { |
| 1171 unittest.test("to-json--from-json", () { |
| 1172 var o = buildEmpty(); |
| 1173 var od = new api.Empty.fromJson(o.toJson()); |
| 1174 checkEmpty(od); |
| 1175 }); |
| 1176 }); |
| 1177 |
| 1178 |
| 1179 unittest.group("obj-schema-FieldId", () { |
| 1180 unittest.test("to-json--from-json", () { |
| 1181 var o = buildFieldId(); |
| 1182 var od = new api.FieldId.fromJson(o.toJson()); |
| 1183 checkFieldId(od); |
| 1184 }); |
| 1185 }); |
| 1186 |
| 1187 |
| 1188 unittest.group("obj-schema-FileSet", () { |
| 1189 unittest.test("to-json--from-json", () { |
| 1190 var o = buildFileSet(); |
| 1191 var od = new api.FileSet.fromJson(o.toJson()); |
| 1192 checkFileSet(od); |
| 1193 }); |
| 1194 }); |
| 1195 |
| 1196 |
| 1197 unittest.group("obj-schema-Finding", () { |
| 1198 unittest.test("to-json--from-json", () { |
| 1199 var o = buildFinding(); |
| 1200 var od = new api.Finding.fromJson(o.toJson()); |
| 1201 checkFinding(od); |
| 1202 }); |
| 1203 }); |
| 1204 |
| 1205 |
| 1206 unittest.group("obj-schema-ImageLocation", () { |
| 1207 unittest.test("to-json--from-json", () { |
| 1208 var o = buildImageLocation(); |
| 1209 var od = new api.ImageLocation.fromJson(o.toJson()); |
| 1210 checkImageLocation(od); |
| 1211 }); |
| 1212 }); |
| 1213 |
| 1214 |
| 1215 unittest.group("obj-schema-InfoType", () { |
| 1216 unittest.test("to-json--from-json", () { |
| 1217 var o = buildInfoType(); |
| 1218 var od = new api.InfoType.fromJson(o.toJson()); |
| 1219 checkInfoType(od); |
| 1220 }); |
| 1221 }); |
| 1222 |
| 1223 |
| 1224 unittest.group("obj-schema-InfoTypeDescription", () { |
| 1225 unittest.test("to-json--from-json", () { |
| 1226 var o = buildInfoTypeDescription(); |
| 1227 var od = new api.InfoTypeDescription.fromJson(o.toJson()); |
| 1228 checkInfoTypeDescription(od); |
| 1229 }); |
| 1230 }); |
| 1231 |
| 1232 |
| 1233 unittest.group("obj-schema-InspectConfig", () { |
| 1234 unittest.test("to-json--from-json", () { |
| 1235 var o = buildInspectConfig(); |
| 1236 var od = new api.InspectConfig.fromJson(o.toJson()); |
| 1237 checkInspectConfig(od); |
| 1238 }); |
| 1239 }); |
| 1240 |
| 1241 |
| 1242 unittest.group("obj-schema-InspectContentRequest", () { |
| 1243 unittest.test("to-json--from-json", () { |
| 1244 var o = buildInspectContentRequest(); |
| 1245 var od = new api.InspectContentRequest.fromJson(o.toJson()); |
| 1246 checkInspectContentRequest(od); |
| 1247 }); |
| 1248 }); |
| 1249 |
| 1250 |
| 1251 unittest.group("obj-schema-InspectContentResponse", () { |
| 1252 unittest.test("to-json--from-json", () { |
| 1253 var o = buildInspectContentResponse(); |
| 1254 var od = new api.InspectContentResponse.fromJson(o.toJson()); |
| 1255 checkInspectContentResponse(od); |
| 1256 }); |
| 1257 }); |
| 1258 |
| 1259 |
| 1260 unittest.group("obj-schema-InspectResult", () { |
| 1261 unittest.test("to-json--from-json", () { |
| 1262 var o = buildInspectResult(); |
| 1263 var od = new api.InspectResult.fromJson(o.toJson()); |
| 1264 checkInspectResult(od); |
| 1265 }); |
| 1266 }); |
| 1267 |
| 1268 |
| 1269 unittest.group("obj-schema-Key", () { |
| 1270 unittest.test("to-json--from-json", () { |
| 1271 var o = buildKey(); |
| 1272 var od = new api.Key.fromJson(o.toJson()); |
| 1273 checkKey(od); |
| 1274 }); |
| 1275 }); |
| 1276 |
| 1277 |
| 1278 unittest.group("obj-schema-KindExpression", () { |
| 1279 unittest.test("to-json--from-json", () { |
| 1280 var o = buildKindExpression(); |
| 1281 var od = new api.KindExpression.fromJson(o.toJson()); |
| 1282 checkKindExpression(od); |
| 1283 }); |
| 1284 }); |
| 1285 |
| 1286 |
| 1287 unittest.group("obj-schema-ListInfoTypesResponse", () { |
| 1288 unittest.test("to-json--from-json", () { |
| 1289 var o = buildListInfoTypesResponse(); |
| 1290 var od = new api.ListInfoTypesResponse.fromJson(o.toJson()); |
| 1291 checkListInfoTypesResponse(od); |
| 1292 }); |
| 1293 }); |
| 1294 |
| 1295 |
| 1296 unittest.group("obj-schema-ListInspectFindingsResponse", () { |
| 1297 unittest.test("to-json--from-json", () { |
| 1298 var o = buildListInspectFindingsResponse(); |
| 1299 var od = new api.ListInspectFindingsResponse.fromJson(o.toJson()); |
| 1300 checkListInspectFindingsResponse(od); |
| 1301 }); |
| 1302 }); |
| 1303 |
| 1304 |
| 1305 unittest.group("obj-schema-ListOperationsResponse", () { |
| 1306 unittest.test("to-json--from-json", () { |
| 1307 var o = buildListOperationsResponse(); |
| 1308 var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
| 1309 checkListOperationsResponse(od); |
| 1310 }); |
| 1311 }); |
| 1312 |
| 1313 |
| 1314 unittest.group("obj-schema-ListRootCategoriesResponse", () { |
| 1315 unittest.test("to-json--from-json", () { |
| 1316 var o = buildListRootCategoriesResponse(); |
| 1317 var od = new api.ListRootCategoriesResponse.fromJson(o.toJson()); |
| 1318 checkListRootCategoriesResponse(od); |
| 1319 }); |
| 1320 }); |
| 1321 |
| 1322 |
| 1323 unittest.group("obj-schema-Location", () { |
| 1324 unittest.test("to-json--from-json", () { |
| 1325 var o = buildLocation(); |
| 1326 var od = new api.Location.fromJson(o.toJson()); |
| 1327 checkLocation(od); |
| 1328 }); |
| 1329 }); |
| 1330 |
| 1331 |
| 1332 unittest.group("obj-schema-Operation", () { |
| 1333 unittest.test("to-json--from-json", () { |
| 1334 var o = buildOperation(); |
| 1335 var od = new api.Operation.fromJson(o.toJson()); |
| 1336 checkOperation(od); |
| 1337 }); |
| 1338 }); |
| 1339 |
| 1340 |
| 1341 unittest.group("obj-schema-PartitionId", () { |
| 1342 unittest.test("to-json--from-json", () { |
| 1343 var o = buildPartitionId(); |
| 1344 var od = new api.PartitionId.fromJson(o.toJson()); |
| 1345 checkPartitionId(od); |
| 1346 }); |
| 1347 }); |
| 1348 |
| 1349 |
| 1350 unittest.group("obj-schema-PathElement", () { |
| 1351 unittest.test("to-json--from-json", () { |
| 1352 var o = buildPathElement(); |
| 1353 var od = new api.PathElement.fromJson(o.toJson()); |
| 1354 checkPathElement(od); |
| 1355 }); |
| 1356 }); |
| 1357 |
| 1358 |
| 1359 unittest.group("obj-schema-Projection", () { |
| 1360 unittest.test("to-json--from-json", () { |
| 1361 var o = buildProjection(); |
| 1362 var od = new api.Projection.fromJson(o.toJson()); |
| 1363 checkProjection(od); |
| 1364 }); |
| 1365 }); |
| 1366 |
| 1367 |
| 1368 unittest.group("obj-schema-PropertyReference", () { |
| 1369 unittest.test("to-json--from-json", () { |
| 1370 var o = buildPropertyReference(); |
| 1371 var od = new api.PropertyReference.fromJson(o.toJson()); |
| 1372 checkPropertyReference(od); |
| 1373 }); |
| 1374 }); |
| 1375 |
| 1376 |
| 1377 unittest.group("obj-schema-Range", () { |
| 1378 unittest.test("to-json--from-json", () { |
| 1379 var o = buildRange(); |
| 1380 var od = new api.Range.fromJson(o.toJson()); |
| 1381 checkRange(od); |
| 1382 }); |
| 1383 }); |
| 1384 |
| 1385 |
| 1386 unittest.group("obj-schema-RecordKey", () { |
| 1387 unittest.test("to-json--from-json", () { |
| 1388 var o = buildRecordKey(); |
| 1389 var od = new api.RecordKey.fromJson(o.toJson()); |
| 1390 checkRecordKey(od); |
| 1391 }); |
| 1392 }); |
| 1393 |
| 1394 |
| 1395 unittest.group("obj-schema-RedactContentRequest", () { |
| 1396 unittest.test("to-json--from-json", () { |
| 1397 var o = buildRedactContentRequest(); |
| 1398 var od = new api.RedactContentRequest.fromJson(o.toJson()); |
| 1399 checkRedactContentRequest(od); |
| 1400 }); |
| 1401 }); |
| 1402 |
| 1403 |
| 1404 unittest.group("obj-schema-RedactContentResponse", () { |
| 1405 unittest.test("to-json--from-json", () { |
| 1406 var o = buildRedactContentResponse(); |
| 1407 var od = new api.RedactContentResponse.fromJson(o.toJson()); |
| 1408 checkRedactContentResponse(od); |
| 1409 }); |
| 1410 }); |
| 1411 |
| 1412 |
| 1413 unittest.group("obj-schema-ReplaceConfig", () { |
| 1414 unittest.test("to-json--from-json", () { |
| 1415 var o = buildReplaceConfig(); |
| 1416 var od = new api.ReplaceConfig.fromJson(o.toJson()); |
| 1417 checkReplaceConfig(od); |
| 1418 }); |
| 1419 }); |
| 1420 |
| 1421 |
| 1422 unittest.group("obj-schema-Status", () { |
| 1423 unittest.test("to-json--from-json", () { |
| 1424 var o = buildStatus(); |
| 1425 var od = new api.Status.fromJson(o.toJson()); |
| 1426 checkStatus(od); |
| 1427 }); |
| 1428 }); |
| 1429 |
| 1430 |
| 1431 unittest.group("obj-schema-StorageConfig", () { |
| 1432 unittest.test("to-json--from-json", () { |
| 1433 var o = buildStorageConfig(); |
| 1434 var od = new api.StorageConfig.fromJson(o.toJson()); |
| 1435 checkStorageConfig(od); |
| 1436 }); |
| 1437 }); |
| 1438 |
| 1439 |
| 1440 unittest.group("resource-ContentResourceApi", () { |
| 1441 unittest.test("method--inspect", () { |
| 1442 |
| 1443 var mock = new HttpServerMock(); |
| 1444 api.ContentResourceApi res = new api.DlpApi(mock).content; |
| 1445 var arg_request = buildInspectContentRequest(); |
| 1446 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1447 var obj = new api.InspectContentRequest.fromJson(json); |
| 1448 checkInspectContentRequest(obj); |
| 1449 |
| 1450 var path = (req.url).path; |
| 1451 var pathOffset = 0; |
| 1452 var index; |
| 1453 var subPart; |
| 1454 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1455 pathOffset += 1; |
| 1456 unittest.expect(path.substring(pathOffset, pathOffset + 23), unittest.eq
uals("v2beta1/content:inspect")); |
| 1457 pathOffset += 23; |
| 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 |
| 1476 |
| 1477 var h = { |
| 1478 "content-type" : "application/json; charset=utf-8", |
| 1479 }; |
| 1480 var resp = convert.JSON.encode(buildInspectContentResponse()); |
| 1481 return new async.Future.value(stringResponse(200, h, resp)); |
| 1482 }), true); |
| 1483 res.inspect(arg_request).then(unittest.expectAsync(((api.InspectContentRes
ponse response) { |
| 1484 checkInspectContentResponse(response); |
| 1485 }))); |
| 1486 }); |
| 1487 |
| 1488 unittest.test("method--redact", () { |
| 1489 |
| 1490 var mock = new HttpServerMock(); |
| 1491 api.ContentResourceApi res = new api.DlpApi(mock).content; |
| 1492 var arg_request = buildRedactContentRequest(); |
| 1493 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1494 var obj = new api.RedactContentRequest.fromJson(json); |
| 1495 checkRedactContentRequest(obj); |
| 1496 |
| 1497 var path = (req.url).path; |
| 1498 var pathOffset = 0; |
| 1499 var index; |
| 1500 var subPart; |
| 1501 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1502 pathOffset += 1; |
| 1503 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2beta1/content:redact")); |
| 1504 pathOffset += 22; |
| 1505 |
| 1506 var query = (req.url).query; |
| 1507 var queryOffset = 0; |
| 1508 var queryMap = {}; |
| 1509 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1510 parseBool(n) { |
| 1511 if (n == "true") return true; |
| 1512 if (n == "false") return false; |
| 1513 if (n == null) return null; |
| 1514 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1515 } |
| 1516 if (query.length > 0) { |
| 1517 for (var part in query.split("&")) { |
| 1518 var keyvalue = part.split("="); |
| 1519 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1520 } |
| 1521 } |
| 1522 |
| 1523 |
| 1524 var h = { |
| 1525 "content-type" : "application/json; charset=utf-8", |
| 1526 }; |
| 1527 var resp = convert.JSON.encode(buildRedactContentResponse()); |
| 1528 return new async.Future.value(stringResponse(200, h, resp)); |
| 1529 }), true); |
| 1530 res.redact(arg_request).then(unittest.expectAsync(((api.RedactContentRespo
nse response) { |
| 1531 checkRedactContentResponse(response); |
| 1532 }))); |
| 1533 }); |
| 1534 |
| 1535 }); |
| 1536 |
| 1537 |
| 1538 unittest.group("resource-InspectOperationsResourceApi", () { |
| 1539 unittest.test("method--cancel", () { |
| 1540 |
| 1541 var mock = new HttpServerMock(); |
| 1542 api.InspectOperationsResourceApi res = new api.DlpApi(mock).inspect.operat
ions; |
| 1543 var arg_request = buildCancelOperationRequest(); |
| 1544 var arg_name = "foo"; |
| 1545 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1546 var obj = new api.CancelOperationRequest.fromJson(json); |
| 1547 checkCancelOperationRequest(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("v2beta1/")); |
| 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(buildEmpty()); |
| 1581 return new async.Future.value(stringResponse(200, h, resp)); |
| 1582 }), true); |
| 1583 res.cancel(arg_request, arg_name).then(unittest.expectAsync(((api.Empty re
sponse) { |
| 1584 checkEmpty(response); |
| 1585 }))); |
| 1586 }); |
| 1587 |
| 1588 unittest.test("method--create", () { |
| 1589 |
| 1590 var mock = new HttpServerMock(); |
| 1591 api.InspectOperationsResourceApi res = new api.DlpApi(mock).inspect.operat
ions; |
| 1592 var arg_request = buildCreateInspectOperationRequest(); |
| 1593 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1594 var obj = new api.CreateInspectOperationRequest.fromJson(json); |
| 1595 checkCreateInspectOperationRequest(obj); |
| 1596 |
| 1597 var path = (req.url).path; |
| 1598 var pathOffset = 0; |
| 1599 var index; |
| 1600 var subPart; |
| 1601 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1602 pathOffset += 1; |
| 1603 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("v2beta1/inspect/operations")); |
| 1604 pathOffset += 26; |
| 1605 |
| 1606 var query = (req.url).query; |
| 1607 var queryOffset = 0; |
| 1608 var queryMap = {}; |
| 1609 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1610 parseBool(n) { |
| 1611 if (n == "true") return true; |
| 1612 if (n == "false") return false; |
| 1613 if (n == null) return null; |
| 1614 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1615 } |
| 1616 if (query.length > 0) { |
| 1617 for (var part in query.split("&")) { |
| 1618 var keyvalue = part.split("="); |
| 1619 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1620 } |
| 1621 } |
| 1622 |
| 1623 |
| 1624 var h = { |
| 1625 "content-type" : "application/json; charset=utf-8", |
| 1626 }; |
| 1627 var resp = convert.JSON.encode(buildOperation()); |
| 1628 return new async.Future.value(stringResponse(200, h, resp)); |
| 1629 }), true); |
| 1630 res.create(arg_request).then(unittest.expectAsync(((api.Operation response
) { |
| 1631 checkOperation(response); |
| 1632 }))); |
| 1633 }); |
| 1634 |
| 1635 unittest.test("method--delete", () { |
| 1636 |
| 1637 var mock = new HttpServerMock(); |
| 1638 api.InspectOperationsResourceApi res = new api.DlpApi(mock).inspect.operat
ions; |
| 1639 var arg_name = "foo"; |
| 1640 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1641 var path = (req.url).path; |
| 1642 var pathOffset = 0; |
| 1643 var index; |
| 1644 var subPart; |
| 1645 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1646 pathOffset += 1; |
| 1647 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1648 pathOffset += 8; |
| 1649 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1650 |
| 1651 var query = (req.url).query; |
| 1652 var queryOffset = 0; |
| 1653 var queryMap = {}; |
| 1654 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1655 parseBool(n) { |
| 1656 if (n == "true") return true; |
| 1657 if (n == "false") return false; |
| 1658 if (n == null) return null; |
| 1659 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1660 } |
| 1661 if (query.length > 0) { |
| 1662 for (var part in query.split("&")) { |
| 1663 var keyvalue = part.split("="); |
| 1664 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1665 } |
| 1666 } |
| 1667 |
| 1668 |
| 1669 var h = { |
| 1670 "content-type" : "application/json; charset=utf-8", |
| 1671 }; |
| 1672 var resp = convert.JSON.encode(buildEmpty()); |
| 1673 return new async.Future.value(stringResponse(200, h, resp)); |
| 1674 }), true); |
| 1675 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) { |
| 1676 checkEmpty(response); |
| 1677 }))); |
| 1678 }); |
| 1679 |
| 1680 unittest.test("method--get", () { |
| 1681 |
| 1682 var mock = new HttpServerMock(); |
| 1683 api.InspectOperationsResourceApi res = new api.DlpApi(mock).inspect.operat
ions; |
| 1684 var arg_name = "foo"; |
| 1685 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1686 var path = (req.url).path; |
| 1687 var pathOffset = 0; |
| 1688 var index; |
| 1689 var subPart; |
| 1690 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1691 pathOffset += 1; |
| 1692 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1693 pathOffset += 8; |
| 1694 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1695 |
| 1696 var query = (req.url).query; |
| 1697 var queryOffset = 0; |
| 1698 var queryMap = {}; |
| 1699 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1700 parseBool(n) { |
| 1701 if (n == "true") return true; |
| 1702 if (n == "false") return false; |
| 1703 if (n == null) return null; |
| 1704 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1705 } |
| 1706 if (query.length > 0) { |
| 1707 for (var part in query.split("&")) { |
| 1708 var keyvalue = part.split("="); |
| 1709 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1710 } |
| 1711 } |
| 1712 |
| 1713 |
| 1714 var h = { |
| 1715 "content-type" : "application/json; charset=utf-8", |
| 1716 }; |
| 1717 var resp = convert.JSON.encode(buildOperation()); |
| 1718 return new async.Future.value(stringResponse(200, h, resp)); |
| 1719 }), true); |
| 1720 res.get(arg_name).then(unittest.expectAsync(((api.Operation response) { |
| 1721 checkOperation(response); |
| 1722 }))); |
| 1723 }); |
| 1724 |
| 1725 unittest.test("method--list", () { |
| 1726 |
| 1727 var mock = new HttpServerMock(); |
| 1728 api.InspectOperationsResourceApi res = new api.DlpApi(mock).inspect.operat
ions; |
| 1729 var arg_name = "foo"; |
| 1730 var arg_pageSize = 42; |
| 1731 var arg_filter = "foo"; |
| 1732 var arg_pageToken = "foo"; |
| 1733 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1734 var path = (req.url).path; |
| 1735 var pathOffset = 0; |
| 1736 var index; |
| 1737 var subPart; |
| 1738 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1739 pathOffset += 1; |
| 1740 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1741 pathOffset += 8; |
| 1742 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1743 |
| 1744 var query = (req.url).query; |
| 1745 var queryOffset = 0; |
| 1746 var queryMap = {}; |
| 1747 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1748 parseBool(n) { |
| 1749 if (n == "true") return true; |
| 1750 if (n == "false") return false; |
| 1751 if (n == null) return null; |
| 1752 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1753 } |
| 1754 if (query.length > 0) { |
| 1755 for (var part in query.split("&")) { |
| 1756 var keyvalue = part.split("="); |
| 1757 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1758 } |
| 1759 } |
| 1760 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1761 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 1762 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1763 |
| 1764 |
| 1765 var h = { |
| 1766 "content-type" : "application/json; charset=utf-8", |
| 1767 }; |
| 1768 var resp = convert.JSON.encode(buildListOperationsResponse()); |
| 1769 return new async.Future.value(stringResponse(200, h, resp)); |
| 1770 }), true); |
| 1771 res.list(arg_name, pageSize: arg_pageSize, filter: arg_filter, pageToken:
arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse response)
{ |
| 1772 checkListOperationsResponse(response); |
| 1773 }))); |
| 1774 }); |
| 1775 |
| 1776 }); |
| 1777 |
| 1778 |
| 1779 unittest.group("resource-InspectResultsFindingsResourceApi", () { |
| 1780 unittest.test("method--list", () { |
| 1781 |
| 1782 var mock = new HttpServerMock(); |
| 1783 api.InspectResultsFindingsResourceApi res = new api.DlpApi(mock).inspect.r
esults.findings; |
| 1784 var arg_name = "foo"; |
| 1785 var arg_pageToken = "foo"; |
| 1786 var arg_pageSize = 42; |
| 1787 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1788 var path = (req.url).path; |
| 1789 var pathOffset = 0; |
| 1790 var index; |
| 1791 var subPart; |
| 1792 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1793 pathOffset += 1; |
| 1794 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1795 pathOffset += 8; |
| 1796 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1797 |
| 1798 var query = (req.url).query; |
| 1799 var queryOffset = 0; |
| 1800 var queryMap = {}; |
| 1801 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1802 parseBool(n) { |
| 1803 if (n == "true") return true; |
| 1804 if (n == "false") return false; |
| 1805 if (n == null) return null; |
| 1806 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1807 } |
| 1808 if (query.length > 0) { |
| 1809 for (var part in query.split("&")) { |
| 1810 var keyvalue = part.split("="); |
| 1811 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1812 } |
| 1813 } |
| 1814 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1815 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1816 |
| 1817 |
| 1818 var h = { |
| 1819 "content-type" : "application/json; charset=utf-8", |
| 1820 }; |
| 1821 var resp = convert.JSON.encode(buildListInspectFindingsResponse()); |
| 1822 return new async.Future.value(stringResponse(200, h, resp)); |
| 1823 }), true); |
| 1824 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize).then(
unittest.expectAsync(((api.ListInspectFindingsResponse response) { |
| 1825 checkListInspectFindingsResponse(response); |
| 1826 }))); |
| 1827 }); |
| 1828 |
| 1829 }); |
| 1830 |
| 1831 |
| 1832 unittest.group("resource-RootCategoriesResourceApi", () { |
| 1833 unittest.test("method--list", () { |
| 1834 |
| 1835 var mock = new HttpServerMock(); |
| 1836 api.RootCategoriesResourceApi res = new api.DlpApi(mock).rootCategories; |
| 1837 var arg_languageCode = "foo"; |
| 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 + 22), unittest.eq
uals("v2beta1/rootCategories")); |
| 1846 pathOffset += 22; |
| 1847 |
| 1848 var query = (req.url).query; |
| 1849 var queryOffset = 0; |
| 1850 var queryMap = {}; |
| 1851 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1852 parseBool(n) { |
| 1853 if (n == "true") return true; |
| 1854 if (n == "false") return false; |
| 1855 if (n == null) return null; |
| 1856 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1857 } |
| 1858 if (query.length > 0) { |
| 1859 for (var part in query.split("&")) { |
| 1860 var keyvalue = part.split("="); |
| 1861 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1862 } |
| 1863 } |
| 1864 unittest.expect(queryMap["languageCode"].first, unittest.equals(arg_lang
uageCode)); |
| 1865 |
| 1866 |
| 1867 var h = { |
| 1868 "content-type" : "application/json; charset=utf-8", |
| 1869 }; |
| 1870 var resp = convert.JSON.encode(buildListRootCategoriesResponse()); |
| 1871 return new async.Future.value(stringResponse(200, h, resp)); |
| 1872 }), true); |
| 1873 res.list(languageCode: arg_languageCode).then(unittest.expectAsync(((api.L
istRootCategoriesResponse response) { |
| 1874 checkListRootCategoriesResponse(response); |
| 1875 }))); |
| 1876 }); |
| 1877 |
| 1878 }); |
| 1879 |
| 1880 |
| 1881 unittest.group("resource-RootCategoriesInfoTypesResourceApi", () { |
| 1882 unittest.test("method--list", () { |
| 1883 |
| 1884 var mock = new HttpServerMock(); |
| 1885 api.RootCategoriesInfoTypesResourceApi res = new api.DlpApi(mock).rootCate
gories.infoTypes; |
| 1886 var arg_category = "foo"; |
| 1887 var arg_languageCode = "foo"; |
| 1888 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1889 var path = (req.url).path; |
| 1890 var pathOffset = 0; |
| 1891 var index; |
| 1892 var subPart; |
| 1893 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1894 pathOffset += 1; |
| 1895 unittest.expect(path.substring(pathOffset, pathOffset + 23), unittest.eq
uals("v2beta1/rootCategories/")); |
| 1896 pathOffset += 23; |
| 1897 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1898 |
| 1899 var query = (req.url).query; |
| 1900 var queryOffset = 0; |
| 1901 var queryMap = {}; |
| 1902 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1903 parseBool(n) { |
| 1904 if (n == "true") return true; |
| 1905 if (n == "false") return false; |
| 1906 if (n == null) return null; |
| 1907 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1908 } |
| 1909 if (query.length > 0) { |
| 1910 for (var part in query.split("&")) { |
| 1911 var keyvalue = part.split("="); |
| 1912 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1913 } |
| 1914 } |
| 1915 unittest.expect(queryMap["languageCode"].first, unittest.equals(arg_lang
uageCode)); |
| 1916 |
| 1917 |
| 1918 var h = { |
| 1919 "content-type" : "application/json; charset=utf-8", |
| 1920 }; |
| 1921 var resp = convert.JSON.encode(buildListInfoTypesResponse()); |
| 1922 return new async.Future.value(stringResponse(200, h, resp)); |
| 1923 }), true); |
| 1924 res.list(arg_category, languageCode: arg_languageCode).then(unittest.expec
tAsync(((api.ListInfoTypesResponse response) { |
| 1925 checkListInfoTypesResponse(response); |
| 1926 }))); |
| 1927 }); |
| 1928 |
| 1929 }); |
| 1930 |
| 1931 |
| 1932 } |
| 1933 |
OLD | NEW |