OLD | NEW |
(Empty) | |
| 1 library googleapis.cloudresourcemanager.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:test/test.dart' as unittest; |
| 11 |
| 12 import 'package:googleapis/cloudresourcemanager/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<core.String, core.String> headers, core.String bod
y) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 53 |
| 54 buildUnnamed120() { |
| 55 var o = new core.List<api.AuditLogConfig>(); |
| 56 o.add(buildAuditLogConfig()); |
| 57 o.add(buildAuditLogConfig()); |
| 58 return o; |
| 59 } |
| 60 |
| 61 checkUnnamed120(core.List<api.AuditLogConfig> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); |
| 63 checkAuditLogConfig(o[0]); |
| 64 checkAuditLogConfig(o[1]); |
| 65 } |
| 66 |
| 67 core.int buildCounterAuditConfig = 0; |
| 68 buildAuditConfig() { |
| 69 var o = new api.AuditConfig(); |
| 70 buildCounterAuditConfig++; |
| 71 if (buildCounterAuditConfig < 3) { |
| 72 o.auditLogConfigs = buildUnnamed120(); |
| 73 o.service = "foo"; |
| 74 } |
| 75 buildCounterAuditConfig--; |
| 76 return o; |
| 77 } |
| 78 |
| 79 checkAuditConfig(api.AuditConfig o) { |
| 80 buildCounterAuditConfig++; |
| 81 if (buildCounterAuditConfig < 3) { |
| 82 checkUnnamed120(o.auditLogConfigs); |
| 83 unittest.expect(o.service, unittest.equals('foo')); |
| 84 } |
| 85 buildCounterAuditConfig--; |
| 86 } |
| 87 |
| 88 buildUnnamed121() { |
| 89 var o = new core.List<core.String>(); |
| 90 o.add("foo"); |
| 91 o.add("foo"); |
| 92 return o; |
| 93 } |
| 94 |
| 95 checkUnnamed121(core.List<core.String> o) { |
| 96 unittest.expect(o, unittest.hasLength(2)); |
| 97 unittest.expect(o[0], unittest.equals('foo')); |
| 98 unittest.expect(o[1], unittest.equals('foo')); |
| 99 } |
| 100 |
| 101 core.int buildCounterAuditLogConfig = 0; |
| 102 buildAuditLogConfig() { |
| 103 var o = new api.AuditLogConfig(); |
| 104 buildCounterAuditLogConfig++; |
| 105 if (buildCounterAuditLogConfig < 3) { |
| 106 o.exemptedMembers = buildUnnamed121(); |
| 107 o.logType = "foo"; |
| 108 } |
| 109 buildCounterAuditLogConfig--; |
| 110 return o; |
| 111 } |
| 112 |
| 113 checkAuditLogConfig(api.AuditLogConfig o) { |
| 114 buildCounterAuditLogConfig++; |
| 115 if (buildCounterAuditLogConfig < 3) { |
| 116 checkUnnamed121(o.exemptedMembers); |
| 117 unittest.expect(o.logType, unittest.equals('foo')); |
| 118 } |
| 119 buildCounterAuditLogConfig--; |
| 120 } |
| 121 |
| 122 buildUnnamed122() { |
| 123 var o = new core.List<core.String>(); |
| 124 o.add("foo"); |
| 125 o.add("foo"); |
| 126 return o; |
| 127 } |
| 128 |
| 129 checkUnnamed122(core.List<core.String> o) { |
| 130 unittest.expect(o, unittest.hasLength(2)); |
| 131 unittest.expect(o[0], unittest.equals('foo')); |
| 132 unittest.expect(o[1], unittest.equals('foo')); |
| 133 } |
| 134 |
| 135 core.int buildCounterBinding = 0; |
| 136 buildBinding() { |
| 137 var o = new api.Binding(); |
| 138 buildCounterBinding++; |
| 139 if (buildCounterBinding < 3) { |
| 140 o.members = buildUnnamed122(); |
| 141 o.role = "foo"; |
| 142 } |
| 143 buildCounterBinding--; |
| 144 return o; |
| 145 } |
| 146 |
| 147 checkBinding(api.Binding o) { |
| 148 buildCounterBinding++; |
| 149 if (buildCounterBinding < 3) { |
| 150 checkUnnamed122(o.members); |
| 151 unittest.expect(o.role, unittest.equals('foo')); |
| 152 } |
| 153 buildCounterBinding--; |
| 154 } |
| 155 |
| 156 core.int buildCounterFolder = 0; |
| 157 buildFolder() { |
| 158 var o = new api.Folder(); |
| 159 buildCounterFolder++; |
| 160 if (buildCounterFolder < 3) { |
| 161 o.createTime = "foo"; |
| 162 o.displayName = "foo"; |
| 163 o.lifecycleState = "foo"; |
| 164 o.name = "foo"; |
| 165 o.parent = "foo"; |
| 166 } |
| 167 buildCounterFolder--; |
| 168 return o; |
| 169 } |
| 170 |
| 171 checkFolder(api.Folder o) { |
| 172 buildCounterFolder++; |
| 173 if (buildCounterFolder < 3) { |
| 174 unittest.expect(o.createTime, unittest.equals('foo')); |
| 175 unittest.expect(o.displayName, unittest.equals('foo')); |
| 176 unittest.expect(o.lifecycleState, unittest.equals('foo')); |
| 177 unittest.expect(o.name, unittest.equals('foo')); |
| 178 unittest.expect(o.parent, unittest.equals('foo')); |
| 179 } |
| 180 buildCounterFolder--; |
| 181 } |
| 182 |
| 183 core.int buildCounterFolderOperation = 0; |
| 184 buildFolderOperation() { |
| 185 var o = new api.FolderOperation(); |
| 186 buildCounterFolderOperation++; |
| 187 if (buildCounterFolderOperation < 3) { |
| 188 o.destinationParent = "foo"; |
| 189 o.displayName = "foo"; |
| 190 o.operationType = "foo"; |
| 191 o.sourceParent = "foo"; |
| 192 } |
| 193 buildCounterFolderOperation--; |
| 194 return o; |
| 195 } |
| 196 |
| 197 checkFolderOperation(api.FolderOperation o) { |
| 198 buildCounterFolderOperation++; |
| 199 if (buildCounterFolderOperation < 3) { |
| 200 unittest.expect(o.destinationParent, unittest.equals('foo')); |
| 201 unittest.expect(o.displayName, unittest.equals('foo')); |
| 202 unittest.expect(o.operationType, unittest.equals('foo')); |
| 203 unittest.expect(o.sourceParent, unittest.equals('foo')); |
| 204 } |
| 205 buildCounterFolderOperation--; |
| 206 } |
| 207 |
| 208 core.int buildCounterFolderOperationError = 0; |
| 209 buildFolderOperationError() { |
| 210 var o = new api.FolderOperationError(); |
| 211 buildCounterFolderOperationError++; |
| 212 if (buildCounterFolderOperationError < 3) { |
| 213 o.errorMessageId = "foo"; |
| 214 } |
| 215 buildCounterFolderOperationError--; |
| 216 return o; |
| 217 } |
| 218 |
| 219 checkFolderOperationError(api.FolderOperationError o) { |
| 220 buildCounterFolderOperationError++; |
| 221 if (buildCounterFolderOperationError < 3) { |
| 222 unittest.expect(o.errorMessageId, unittest.equals('foo')); |
| 223 } |
| 224 buildCounterFolderOperationError--; |
| 225 } |
| 226 |
| 227 core.int buildCounterGetIamPolicyRequest = 0; |
| 228 buildGetIamPolicyRequest() { |
| 229 var o = new api.GetIamPolicyRequest(); |
| 230 buildCounterGetIamPolicyRequest++; |
| 231 if (buildCounterGetIamPolicyRequest < 3) { |
| 232 } |
| 233 buildCounterGetIamPolicyRequest--; |
| 234 return o; |
| 235 } |
| 236 |
| 237 checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
| 238 buildCounterGetIamPolicyRequest++; |
| 239 if (buildCounterGetIamPolicyRequest < 3) { |
| 240 } |
| 241 buildCounterGetIamPolicyRequest--; |
| 242 } |
| 243 |
| 244 buildUnnamed123() { |
| 245 var o = new core.List<api.Folder>(); |
| 246 o.add(buildFolder()); |
| 247 o.add(buildFolder()); |
| 248 return o; |
| 249 } |
| 250 |
| 251 checkUnnamed123(core.List<api.Folder> o) { |
| 252 unittest.expect(o, unittest.hasLength(2)); |
| 253 checkFolder(o[0]); |
| 254 checkFolder(o[1]); |
| 255 } |
| 256 |
| 257 core.int buildCounterListFoldersResponse = 0; |
| 258 buildListFoldersResponse() { |
| 259 var o = new api.ListFoldersResponse(); |
| 260 buildCounterListFoldersResponse++; |
| 261 if (buildCounterListFoldersResponse < 3) { |
| 262 o.folders = buildUnnamed123(); |
| 263 o.nextPageToken = "foo"; |
| 264 } |
| 265 buildCounterListFoldersResponse--; |
| 266 return o; |
| 267 } |
| 268 |
| 269 checkListFoldersResponse(api.ListFoldersResponse o) { |
| 270 buildCounterListFoldersResponse++; |
| 271 if (buildCounterListFoldersResponse < 3) { |
| 272 checkUnnamed123(o.folders); |
| 273 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 274 } |
| 275 buildCounterListFoldersResponse--; |
| 276 } |
| 277 |
| 278 core.int buildCounterMoveFolderRequest = 0; |
| 279 buildMoveFolderRequest() { |
| 280 var o = new api.MoveFolderRequest(); |
| 281 buildCounterMoveFolderRequest++; |
| 282 if (buildCounterMoveFolderRequest < 3) { |
| 283 o.destinationParent = "foo"; |
| 284 } |
| 285 buildCounterMoveFolderRequest--; |
| 286 return o; |
| 287 } |
| 288 |
| 289 checkMoveFolderRequest(api.MoveFolderRequest o) { |
| 290 buildCounterMoveFolderRequest++; |
| 291 if (buildCounterMoveFolderRequest < 3) { |
| 292 unittest.expect(o.destinationParent, unittest.equals('foo')); |
| 293 } |
| 294 buildCounterMoveFolderRequest--; |
| 295 } |
| 296 |
| 297 buildUnnamed124() { |
| 298 var o = new core.Map<core.String, core.Object>(); |
| 299 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 300 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 301 return o; |
| 302 } |
| 303 |
| 304 checkUnnamed124(core.Map<core.String, core.Object> o) { |
| 305 unittest.expect(o, unittest.hasLength(2)); |
| 306 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')); |
| 307 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')); |
| 308 } |
| 309 |
| 310 buildUnnamed125() { |
| 311 var o = new core.Map<core.String, core.Object>(); |
| 312 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 313 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 314 return o; |
| 315 } |
| 316 |
| 317 checkUnnamed125(core.Map<core.String, core.Object> o) { |
| 318 unittest.expect(o, unittest.hasLength(2)); |
| 319 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')); |
| 320 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')); |
| 321 } |
| 322 |
| 323 core.int buildCounterOperation = 0; |
| 324 buildOperation() { |
| 325 var o = new api.Operation(); |
| 326 buildCounterOperation++; |
| 327 if (buildCounterOperation < 3) { |
| 328 o.done = true; |
| 329 o.error = buildStatus(); |
| 330 o.metadata = buildUnnamed124(); |
| 331 o.name = "foo"; |
| 332 o.response = buildUnnamed125(); |
| 333 } |
| 334 buildCounterOperation--; |
| 335 return o; |
| 336 } |
| 337 |
| 338 checkOperation(api.Operation o) { |
| 339 buildCounterOperation++; |
| 340 if (buildCounterOperation < 3) { |
| 341 unittest.expect(o.done, unittest.isTrue); |
| 342 checkStatus(o.error); |
| 343 checkUnnamed124(o.metadata); |
| 344 unittest.expect(o.name, unittest.equals('foo')); |
| 345 checkUnnamed125(o.response); |
| 346 } |
| 347 buildCounterOperation--; |
| 348 } |
| 349 |
| 350 buildUnnamed126() { |
| 351 var o = new core.List<api.AuditConfig>(); |
| 352 o.add(buildAuditConfig()); |
| 353 o.add(buildAuditConfig()); |
| 354 return o; |
| 355 } |
| 356 |
| 357 checkUnnamed126(core.List<api.AuditConfig> o) { |
| 358 unittest.expect(o, unittest.hasLength(2)); |
| 359 checkAuditConfig(o[0]); |
| 360 checkAuditConfig(o[1]); |
| 361 } |
| 362 |
| 363 buildUnnamed127() { |
| 364 var o = new core.List<api.Binding>(); |
| 365 o.add(buildBinding()); |
| 366 o.add(buildBinding()); |
| 367 return o; |
| 368 } |
| 369 |
| 370 checkUnnamed127(core.List<api.Binding> o) { |
| 371 unittest.expect(o, unittest.hasLength(2)); |
| 372 checkBinding(o[0]); |
| 373 checkBinding(o[1]); |
| 374 } |
| 375 |
| 376 core.int buildCounterPolicy = 0; |
| 377 buildPolicy() { |
| 378 var o = new api.Policy(); |
| 379 buildCounterPolicy++; |
| 380 if (buildCounterPolicy < 3) { |
| 381 o.auditConfigs = buildUnnamed126(); |
| 382 o.bindings = buildUnnamed127(); |
| 383 o.etag = "foo"; |
| 384 o.version = 42; |
| 385 } |
| 386 buildCounterPolicy--; |
| 387 return o; |
| 388 } |
| 389 |
| 390 checkPolicy(api.Policy o) { |
| 391 buildCounterPolicy++; |
| 392 if (buildCounterPolicy < 3) { |
| 393 checkUnnamed126(o.auditConfigs); |
| 394 checkUnnamed127(o.bindings); |
| 395 unittest.expect(o.etag, unittest.equals('foo')); |
| 396 unittest.expect(o.version, unittest.equals(42)); |
| 397 } |
| 398 buildCounterPolicy--; |
| 399 } |
| 400 |
| 401 core.int buildCounterProjectCreationStatus = 0; |
| 402 buildProjectCreationStatus() { |
| 403 var o = new api.ProjectCreationStatus(); |
| 404 buildCounterProjectCreationStatus++; |
| 405 if (buildCounterProjectCreationStatus < 3) { |
| 406 o.createTime = "foo"; |
| 407 o.gettable = true; |
| 408 o.ready = true; |
| 409 } |
| 410 buildCounterProjectCreationStatus--; |
| 411 return o; |
| 412 } |
| 413 |
| 414 checkProjectCreationStatus(api.ProjectCreationStatus o) { |
| 415 buildCounterProjectCreationStatus++; |
| 416 if (buildCounterProjectCreationStatus < 3) { |
| 417 unittest.expect(o.createTime, unittest.equals('foo')); |
| 418 unittest.expect(o.gettable, unittest.isTrue); |
| 419 unittest.expect(o.ready, unittest.isTrue); |
| 420 } |
| 421 buildCounterProjectCreationStatus--; |
| 422 } |
| 423 |
| 424 core.int buildCounterSearchFoldersRequest = 0; |
| 425 buildSearchFoldersRequest() { |
| 426 var o = new api.SearchFoldersRequest(); |
| 427 buildCounterSearchFoldersRequest++; |
| 428 if (buildCounterSearchFoldersRequest < 3) { |
| 429 o.pageSize = 42; |
| 430 o.pageToken = "foo"; |
| 431 o.query = "foo"; |
| 432 } |
| 433 buildCounterSearchFoldersRequest--; |
| 434 return o; |
| 435 } |
| 436 |
| 437 checkSearchFoldersRequest(api.SearchFoldersRequest o) { |
| 438 buildCounterSearchFoldersRequest++; |
| 439 if (buildCounterSearchFoldersRequest < 3) { |
| 440 unittest.expect(o.pageSize, unittest.equals(42)); |
| 441 unittest.expect(o.pageToken, unittest.equals('foo')); |
| 442 unittest.expect(o.query, unittest.equals('foo')); |
| 443 } |
| 444 buildCounterSearchFoldersRequest--; |
| 445 } |
| 446 |
| 447 buildUnnamed128() { |
| 448 var o = new core.List<api.Folder>(); |
| 449 o.add(buildFolder()); |
| 450 o.add(buildFolder()); |
| 451 return o; |
| 452 } |
| 453 |
| 454 checkUnnamed128(core.List<api.Folder> o) { |
| 455 unittest.expect(o, unittest.hasLength(2)); |
| 456 checkFolder(o[0]); |
| 457 checkFolder(o[1]); |
| 458 } |
| 459 |
| 460 core.int buildCounterSearchFoldersResponse = 0; |
| 461 buildSearchFoldersResponse() { |
| 462 var o = new api.SearchFoldersResponse(); |
| 463 buildCounterSearchFoldersResponse++; |
| 464 if (buildCounterSearchFoldersResponse < 3) { |
| 465 o.folders = buildUnnamed128(); |
| 466 o.nextPageToken = "foo"; |
| 467 } |
| 468 buildCounterSearchFoldersResponse--; |
| 469 return o; |
| 470 } |
| 471 |
| 472 checkSearchFoldersResponse(api.SearchFoldersResponse o) { |
| 473 buildCounterSearchFoldersResponse++; |
| 474 if (buildCounterSearchFoldersResponse < 3) { |
| 475 checkUnnamed128(o.folders); |
| 476 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 477 } |
| 478 buildCounterSearchFoldersResponse--; |
| 479 } |
| 480 |
| 481 core.int buildCounterSetIamPolicyRequest = 0; |
| 482 buildSetIamPolicyRequest() { |
| 483 var o = new api.SetIamPolicyRequest(); |
| 484 buildCounterSetIamPolicyRequest++; |
| 485 if (buildCounterSetIamPolicyRequest < 3) { |
| 486 o.policy = buildPolicy(); |
| 487 o.updateMask = "foo"; |
| 488 } |
| 489 buildCounterSetIamPolicyRequest--; |
| 490 return o; |
| 491 } |
| 492 |
| 493 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| 494 buildCounterSetIamPolicyRequest++; |
| 495 if (buildCounterSetIamPolicyRequest < 3) { |
| 496 checkPolicy(o.policy); |
| 497 unittest.expect(o.updateMask, unittest.equals('foo')); |
| 498 } |
| 499 buildCounterSetIamPolicyRequest--; |
| 500 } |
| 501 |
| 502 buildUnnamed129() { |
| 503 var o = new core.Map<core.String, core.Object>(); |
| 504 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 505 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 506 return o; |
| 507 } |
| 508 |
| 509 checkUnnamed129(core.Map<core.String, core.Object> o) { |
| 510 unittest.expect(o, unittest.hasLength(2)); |
| 511 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')); |
| 512 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')); |
| 513 } |
| 514 |
| 515 buildUnnamed130() { |
| 516 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 517 o.add(buildUnnamed129()); |
| 518 o.add(buildUnnamed129()); |
| 519 return o; |
| 520 } |
| 521 |
| 522 checkUnnamed130(core.List<core.Map<core.String, core.Object>> o) { |
| 523 unittest.expect(o, unittest.hasLength(2)); |
| 524 checkUnnamed129(o[0]); |
| 525 checkUnnamed129(o[1]); |
| 526 } |
| 527 |
| 528 core.int buildCounterStatus = 0; |
| 529 buildStatus() { |
| 530 var o = new api.Status(); |
| 531 buildCounterStatus++; |
| 532 if (buildCounterStatus < 3) { |
| 533 o.code = 42; |
| 534 o.details = buildUnnamed130(); |
| 535 o.message = "foo"; |
| 536 } |
| 537 buildCounterStatus--; |
| 538 return o; |
| 539 } |
| 540 |
| 541 checkStatus(api.Status o) { |
| 542 buildCounterStatus++; |
| 543 if (buildCounterStatus < 3) { |
| 544 unittest.expect(o.code, unittest.equals(42)); |
| 545 checkUnnamed130(o.details); |
| 546 unittest.expect(o.message, unittest.equals('foo')); |
| 547 } |
| 548 buildCounterStatus--; |
| 549 } |
| 550 |
| 551 buildUnnamed131() { |
| 552 var o = new core.List<core.String>(); |
| 553 o.add("foo"); |
| 554 o.add("foo"); |
| 555 return o; |
| 556 } |
| 557 |
| 558 checkUnnamed131(core.List<core.String> o) { |
| 559 unittest.expect(o, unittest.hasLength(2)); |
| 560 unittest.expect(o[0], unittest.equals('foo')); |
| 561 unittest.expect(o[1], unittest.equals('foo')); |
| 562 } |
| 563 |
| 564 core.int buildCounterTestIamPermissionsRequest = 0; |
| 565 buildTestIamPermissionsRequest() { |
| 566 var o = new api.TestIamPermissionsRequest(); |
| 567 buildCounterTestIamPermissionsRequest++; |
| 568 if (buildCounterTestIamPermissionsRequest < 3) { |
| 569 o.permissions = buildUnnamed131(); |
| 570 } |
| 571 buildCounterTestIamPermissionsRequest--; |
| 572 return o; |
| 573 } |
| 574 |
| 575 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| 576 buildCounterTestIamPermissionsRequest++; |
| 577 if (buildCounterTestIamPermissionsRequest < 3) { |
| 578 checkUnnamed131(o.permissions); |
| 579 } |
| 580 buildCounterTestIamPermissionsRequest--; |
| 581 } |
| 582 |
| 583 buildUnnamed132() { |
| 584 var o = new core.List<core.String>(); |
| 585 o.add("foo"); |
| 586 o.add("foo"); |
| 587 return o; |
| 588 } |
| 589 |
| 590 checkUnnamed132(core.List<core.String> o) { |
| 591 unittest.expect(o, unittest.hasLength(2)); |
| 592 unittest.expect(o[0], unittest.equals('foo')); |
| 593 unittest.expect(o[1], unittest.equals('foo')); |
| 594 } |
| 595 |
| 596 core.int buildCounterTestIamPermissionsResponse = 0; |
| 597 buildTestIamPermissionsResponse() { |
| 598 var o = new api.TestIamPermissionsResponse(); |
| 599 buildCounterTestIamPermissionsResponse++; |
| 600 if (buildCounterTestIamPermissionsResponse < 3) { |
| 601 o.permissions = buildUnnamed132(); |
| 602 } |
| 603 buildCounterTestIamPermissionsResponse--; |
| 604 return o; |
| 605 } |
| 606 |
| 607 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| 608 buildCounterTestIamPermissionsResponse++; |
| 609 if (buildCounterTestIamPermissionsResponse < 3) { |
| 610 checkUnnamed132(o.permissions); |
| 611 } |
| 612 buildCounterTestIamPermissionsResponse--; |
| 613 } |
| 614 |
| 615 core.int buildCounterUndeleteFolderRequest = 0; |
| 616 buildUndeleteFolderRequest() { |
| 617 var o = new api.UndeleteFolderRequest(); |
| 618 buildCounterUndeleteFolderRequest++; |
| 619 if (buildCounterUndeleteFolderRequest < 3) { |
| 620 } |
| 621 buildCounterUndeleteFolderRequest--; |
| 622 return o; |
| 623 } |
| 624 |
| 625 checkUndeleteFolderRequest(api.UndeleteFolderRequest o) { |
| 626 buildCounterUndeleteFolderRequest++; |
| 627 if (buildCounterUndeleteFolderRequest < 3) { |
| 628 } |
| 629 buildCounterUndeleteFolderRequest--; |
| 630 } |
| 631 |
| 632 |
| 633 main() { |
| 634 unittest.group("obj-schema-AuditConfig", () { |
| 635 unittest.test("to-json--from-json", () { |
| 636 var o = buildAuditConfig(); |
| 637 var od = new api.AuditConfig.fromJson(o.toJson()); |
| 638 checkAuditConfig(od); |
| 639 }); |
| 640 }); |
| 641 |
| 642 |
| 643 unittest.group("obj-schema-AuditLogConfig", () { |
| 644 unittest.test("to-json--from-json", () { |
| 645 var o = buildAuditLogConfig(); |
| 646 var od = new api.AuditLogConfig.fromJson(o.toJson()); |
| 647 checkAuditLogConfig(od); |
| 648 }); |
| 649 }); |
| 650 |
| 651 |
| 652 unittest.group("obj-schema-Binding", () { |
| 653 unittest.test("to-json--from-json", () { |
| 654 var o = buildBinding(); |
| 655 var od = new api.Binding.fromJson(o.toJson()); |
| 656 checkBinding(od); |
| 657 }); |
| 658 }); |
| 659 |
| 660 |
| 661 unittest.group("obj-schema-Folder", () { |
| 662 unittest.test("to-json--from-json", () { |
| 663 var o = buildFolder(); |
| 664 var od = new api.Folder.fromJson(o.toJson()); |
| 665 checkFolder(od); |
| 666 }); |
| 667 }); |
| 668 |
| 669 |
| 670 unittest.group("obj-schema-FolderOperation", () { |
| 671 unittest.test("to-json--from-json", () { |
| 672 var o = buildFolderOperation(); |
| 673 var od = new api.FolderOperation.fromJson(o.toJson()); |
| 674 checkFolderOperation(od); |
| 675 }); |
| 676 }); |
| 677 |
| 678 |
| 679 unittest.group("obj-schema-FolderOperationError", () { |
| 680 unittest.test("to-json--from-json", () { |
| 681 var o = buildFolderOperationError(); |
| 682 var od = new api.FolderOperationError.fromJson(o.toJson()); |
| 683 checkFolderOperationError(od); |
| 684 }); |
| 685 }); |
| 686 |
| 687 |
| 688 unittest.group("obj-schema-GetIamPolicyRequest", () { |
| 689 unittest.test("to-json--from-json", () { |
| 690 var o = buildGetIamPolicyRequest(); |
| 691 var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
| 692 checkGetIamPolicyRequest(od); |
| 693 }); |
| 694 }); |
| 695 |
| 696 |
| 697 unittest.group("obj-schema-ListFoldersResponse", () { |
| 698 unittest.test("to-json--from-json", () { |
| 699 var o = buildListFoldersResponse(); |
| 700 var od = new api.ListFoldersResponse.fromJson(o.toJson()); |
| 701 checkListFoldersResponse(od); |
| 702 }); |
| 703 }); |
| 704 |
| 705 |
| 706 unittest.group("obj-schema-MoveFolderRequest", () { |
| 707 unittest.test("to-json--from-json", () { |
| 708 var o = buildMoveFolderRequest(); |
| 709 var od = new api.MoveFolderRequest.fromJson(o.toJson()); |
| 710 checkMoveFolderRequest(od); |
| 711 }); |
| 712 }); |
| 713 |
| 714 |
| 715 unittest.group("obj-schema-Operation", () { |
| 716 unittest.test("to-json--from-json", () { |
| 717 var o = buildOperation(); |
| 718 var od = new api.Operation.fromJson(o.toJson()); |
| 719 checkOperation(od); |
| 720 }); |
| 721 }); |
| 722 |
| 723 |
| 724 unittest.group("obj-schema-Policy", () { |
| 725 unittest.test("to-json--from-json", () { |
| 726 var o = buildPolicy(); |
| 727 var od = new api.Policy.fromJson(o.toJson()); |
| 728 checkPolicy(od); |
| 729 }); |
| 730 }); |
| 731 |
| 732 |
| 733 unittest.group("obj-schema-ProjectCreationStatus", () { |
| 734 unittest.test("to-json--from-json", () { |
| 735 var o = buildProjectCreationStatus(); |
| 736 var od = new api.ProjectCreationStatus.fromJson(o.toJson()); |
| 737 checkProjectCreationStatus(od); |
| 738 }); |
| 739 }); |
| 740 |
| 741 |
| 742 unittest.group("obj-schema-SearchFoldersRequest", () { |
| 743 unittest.test("to-json--from-json", () { |
| 744 var o = buildSearchFoldersRequest(); |
| 745 var od = new api.SearchFoldersRequest.fromJson(o.toJson()); |
| 746 checkSearchFoldersRequest(od); |
| 747 }); |
| 748 }); |
| 749 |
| 750 |
| 751 unittest.group("obj-schema-SearchFoldersResponse", () { |
| 752 unittest.test("to-json--from-json", () { |
| 753 var o = buildSearchFoldersResponse(); |
| 754 var od = new api.SearchFoldersResponse.fromJson(o.toJson()); |
| 755 checkSearchFoldersResponse(od); |
| 756 }); |
| 757 }); |
| 758 |
| 759 |
| 760 unittest.group("obj-schema-SetIamPolicyRequest", () { |
| 761 unittest.test("to-json--from-json", () { |
| 762 var o = buildSetIamPolicyRequest(); |
| 763 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
| 764 checkSetIamPolicyRequest(od); |
| 765 }); |
| 766 }); |
| 767 |
| 768 |
| 769 unittest.group("obj-schema-Status", () { |
| 770 unittest.test("to-json--from-json", () { |
| 771 var o = buildStatus(); |
| 772 var od = new api.Status.fromJson(o.toJson()); |
| 773 checkStatus(od); |
| 774 }); |
| 775 }); |
| 776 |
| 777 |
| 778 unittest.group("obj-schema-TestIamPermissionsRequest", () { |
| 779 unittest.test("to-json--from-json", () { |
| 780 var o = buildTestIamPermissionsRequest(); |
| 781 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
| 782 checkTestIamPermissionsRequest(od); |
| 783 }); |
| 784 }); |
| 785 |
| 786 |
| 787 unittest.group("obj-schema-TestIamPermissionsResponse", () { |
| 788 unittest.test("to-json--from-json", () { |
| 789 var o = buildTestIamPermissionsResponse(); |
| 790 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
| 791 checkTestIamPermissionsResponse(od); |
| 792 }); |
| 793 }); |
| 794 |
| 795 |
| 796 unittest.group("obj-schema-UndeleteFolderRequest", () { |
| 797 unittest.test("to-json--from-json", () { |
| 798 var o = buildUndeleteFolderRequest(); |
| 799 var od = new api.UndeleteFolderRequest.fromJson(o.toJson()); |
| 800 checkUndeleteFolderRequest(od); |
| 801 }); |
| 802 }); |
| 803 |
| 804 |
| 805 unittest.group("resource-FoldersResourceApi", () { |
| 806 unittest.test("method--create", () { |
| 807 |
| 808 var mock = new HttpServerMock(); |
| 809 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 810 var arg_request = buildFolder(); |
| 811 var arg_parent = "foo"; |
| 812 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 813 var obj = new api.Folder.fromJson(json); |
| 814 checkFolder(obj); |
| 815 |
| 816 var path = (req.url).path; |
| 817 var pathOffset = 0; |
| 818 var index; |
| 819 var subPart; |
| 820 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 821 pathOffset += 1; |
| 822 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v2beta1/folders")); |
| 823 pathOffset += 15; |
| 824 |
| 825 var query = (req.url).query; |
| 826 var queryOffset = 0; |
| 827 var queryMap = {}; |
| 828 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 829 parseBool(n) { |
| 830 if (n == "true") return true; |
| 831 if (n == "false") return false; |
| 832 if (n == null) return null; |
| 833 throw new core.ArgumentError("Invalid boolean: $n"); |
| 834 } |
| 835 if (query.length > 0) { |
| 836 for (var part in query.split("&")) { |
| 837 var keyvalue = part.split("="); |
| 838 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 839 } |
| 840 } |
| 841 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
| 842 |
| 843 |
| 844 var h = { |
| 845 "content-type" : "application/json; charset=utf-8", |
| 846 }; |
| 847 var resp = convert.JSON.encode(buildOperation()); |
| 848 return new async.Future.value(stringResponse(200, h, resp)); |
| 849 }), true); |
| 850 res.create(arg_request, parent: arg_parent).then(unittest.expectAsync1(((a
pi.Operation response) { |
| 851 checkOperation(response); |
| 852 }))); |
| 853 }); |
| 854 |
| 855 unittest.test("method--delete", () { |
| 856 |
| 857 var mock = new HttpServerMock(); |
| 858 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 859 var arg_name = "foo"; |
| 860 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 861 var path = (req.url).path; |
| 862 var pathOffset = 0; |
| 863 var index; |
| 864 var subPart; |
| 865 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 866 pathOffset += 1; |
| 867 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 868 pathOffset += 8; |
| 869 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 870 |
| 871 var query = (req.url).query; |
| 872 var queryOffset = 0; |
| 873 var queryMap = {}; |
| 874 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 875 parseBool(n) { |
| 876 if (n == "true") return true; |
| 877 if (n == "false") return false; |
| 878 if (n == null) return null; |
| 879 throw new core.ArgumentError("Invalid boolean: $n"); |
| 880 } |
| 881 if (query.length > 0) { |
| 882 for (var part in query.split("&")) { |
| 883 var keyvalue = part.split("="); |
| 884 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 885 } |
| 886 } |
| 887 |
| 888 |
| 889 var h = { |
| 890 "content-type" : "application/json; charset=utf-8", |
| 891 }; |
| 892 var resp = convert.JSON.encode(buildFolder()); |
| 893 return new async.Future.value(stringResponse(200, h, resp)); |
| 894 }), true); |
| 895 res.delete(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
| 896 checkFolder(response); |
| 897 }))); |
| 898 }); |
| 899 |
| 900 unittest.test("method--get", () { |
| 901 |
| 902 var mock = new HttpServerMock(); |
| 903 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 904 var arg_name = "foo"; |
| 905 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 906 var path = (req.url).path; |
| 907 var pathOffset = 0; |
| 908 var index; |
| 909 var subPart; |
| 910 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 911 pathOffset += 1; |
| 912 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 913 pathOffset += 8; |
| 914 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 915 |
| 916 var query = (req.url).query; |
| 917 var queryOffset = 0; |
| 918 var queryMap = {}; |
| 919 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 920 parseBool(n) { |
| 921 if (n == "true") return true; |
| 922 if (n == "false") return false; |
| 923 if (n == null) return null; |
| 924 throw new core.ArgumentError("Invalid boolean: $n"); |
| 925 } |
| 926 if (query.length > 0) { |
| 927 for (var part in query.split("&")) { |
| 928 var keyvalue = part.split("="); |
| 929 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 930 } |
| 931 } |
| 932 |
| 933 |
| 934 var h = { |
| 935 "content-type" : "application/json; charset=utf-8", |
| 936 }; |
| 937 var resp = convert.JSON.encode(buildFolder()); |
| 938 return new async.Future.value(stringResponse(200, h, resp)); |
| 939 }), true); |
| 940 res.get(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
| 941 checkFolder(response); |
| 942 }))); |
| 943 }); |
| 944 |
| 945 unittest.test("method--getIamPolicy", () { |
| 946 |
| 947 var mock = new HttpServerMock(); |
| 948 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 949 var arg_request = buildGetIamPolicyRequest(); |
| 950 var arg_resource = "foo"; |
| 951 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 952 var obj = new api.GetIamPolicyRequest.fromJson(json); |
| 953 checkGetIamPolicyRequest(obj); |
| 954 |
| 955 var path = (req.url).path; |
| 956 var pathOffset = 0; |
| 957 var index; |
| 958 var subPart; |
| 959 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 960 pathOffset += 1; |
| 961 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 962 pathOffset += 8; |
| 963 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 964 |
| 965 var query = (req.url).query; |
| 966 var queryOffset = 0; |
| 967 var queryMap = {}; |
| 968 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 969 parseBool(n) { |
| 970 if (n == "true") return true; |
| 971 if (n == "false") return false; |
| 972 if (n == null) return null; |
| 973 throw new core.ArgumentError("Invalid boolean: $n"); |
| 974 } |
| 975 if (query.length > 0) { |
| 976 for (var part in query.split("&")) { |
| 977 var keyvalue = part.split("="); |
| 978 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 979 } |
| 980 } |
| 981 |
| 982 |
| 983 var h = { |
| 984 "content-type" : "application/json; charset=utf-8", |
| 985 }; |
| 986 var resp = convert.JSON.encode(buildPolicy()); |
| 987 return new async.Future.value(stringResponse(200, h, resp)); |
| 988 }), true); |
| 989 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { |
| 990 checkPolicy(response); |
| 991 }))); |
| 992 }); |
| 993 |
| 994 unittest.test("method--list", () { |
| 995 |
| 996 var mock = new HttpServerMock(); |
| 997 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 998 var arg_showDeleted = true; |
| 999 var arg_pageToken = "foo"; |
| 1000 var arg_pageSize = 42; |
| 1001 var arg_parent = "foo"; |
| 1002 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1003 var path = (req.url).path; |
| 1004 var pathOffset = 0; |
| 1005 var index; |
| 1006 var subPart; |
| 1007 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1008 pathOffset += 1; |
| 1009 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v2beta1/folders")); |
| 1010 pathOffset += 15; |
| 1011 |
| 1012 var query = (req.url).query; |
| 1013 var queryOffset = 0; |
| 1014 var queryMap = {}; |
| 1015 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1016 parseBool(n) { |
| 1017 if (n == "true") return true; |
| 1018 if (n == "false") return false; |
| 1019 if (n == null) return null; |
| 1020 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1021 } |
| 1022 if (query.length > 0) { |
| 1023 for (var part in query.split("&")) { |
| 1024 var keyvalue = part.split("="); |
| 1025 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1026 } |
| 1027 } |
| 1028 unittest.expect(queryMap["showDeleted"].first, unittest.equals("$arg_sho
wDeleted")); |
| 1029 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1030 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1031 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
| 1032 |
| 1033 |
| 1034 var h = { |
| 1035 "content-type" : "application/json; charset=utf-8", |
| 1036 }; |
| 1037 var resp = convert.JSON.encode(buildListFoldersResponse()); |
| 1038 return new async.Future.value(stringResponse(200, h, resp)); |
| 1039 }), true); |
| 1040 res.list(showDeleted: arg_showDeleted, pageToken: arg_pageToken, pageSize:
arg_pageSize, parent: arg_parent).then(unittest.expectAsync1(((api.ListFoldersR
esponse response) { |
| 1041 checkListFoldersResponse(response); |
| 1042 }))); |
| 1043 }); |
| 1044 |
| 1045 unittest.test("method--move", () { |
| 1046 |
| 1047 var mock = new HttpServerMock(); |
| 1048 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1049 var arg_request = buildMoveFolderRequest(); |
| 1050 var arg_name = "foo"; |
| 1051 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1052 var obj = new api.MoveFolderRequest.fromJson(json); |
| 1053 checkMoveFolderRequest(obj); |
| 1054 |
| 1055 var path = (req.url).path; |
| 1056 var pathOffset = 0; |
| 1057 var index; |
| 1058 var subPart; |
| 1059 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1060 pathOffset += 1; |
| 1061 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1062 pathOffset += 8; |
| 1063 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1064 |
| 1065 var query = (req.url).query; |
| 1066 var queryOffset = 0; |
| 1067 var queryMap = {}; |
| 1068 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1069 parseBool(n) { |
| 1070 if (n == "true") return true; |
| 1071 if (n == "false") return false; |
| 1072 if (n == null) return null; |
| 1073 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1074 } |
| 1075 if (query.length > 0) { |
| 1076 for (var part in query.split("&")) { |
| 1077 var keyvalue = part.split("="); |
| 1078 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1079 } |
| 1080 } |
| 1081 |
| 1082 |
| 1083 var h = { |
| 1084 "content-type" : "application/json; charset=utf-8", |
| 1085 }; |
| 1086 var resp = convert.JSON.encode(buildOperation()); |
| 1087 return new async.Future.value(stringResponse(200, h, resp)); |
| 1088 }), true); |
| 1089 res.move(arg_request, arg_name).then(unittest.expectAsync1(((api.Operation
response) { |
| 1090 checkOperation(response); |
| 1091 }))); |
| 1092 }); |
| 1093 |
| 1094 unittest.test("method--patch", () { |
| 1095 |
| 1096 var mock = new HttpServerMock(); |
| 1097 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1098 var arg_request = buildFolder(); |
| 1099 var arg_name = "foo"; |
| 1100 var arg_updateMask = "foo"; |
| 1101 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1102 var obj = new api.Folder.fromJson(json); |
| 1103 checkFolder(obj); |
| 1104 |
| 1105 var path = (req.url).path; |
| 1106 var pathOffset = 0; |
| 1107 var index; |
| 1108 var subPart; |
| 1109 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1110 pathOffset += 1; |
| 1111 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1112 pathOffset += 8; |
| 1113 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1114 |
| 1115 var query = (req.url).query; |
| 1116 var queryOffset = 0; |
| 1117 var queryMap = {}; |
| 1118 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1119 parseBool(n) { |
| 1120 if (n == "true") return true; |
| 1121 if (n == "false") return false; |
| 1122 if (n == null) return null; |
| 1123 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1124 } |
| 1125 if (query.length > 0) { |
| 1126 for (var part in query.split("&")) { |
| 1127 var keyvalue = part.split("="); |
| 1128 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1129 } |
| 1130 } |
| 1131 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); |
| 1132 |
| 1133 |
| 1134 var h = { |
| 1135 "content-type" : "application/json; charset=utf-8", |
| 1136 }; |
| 1137 var resp = convert.JSON.encode(buildFolder()); |
| 1138 return new async.Future.value(stringResponse(200, h, resp)); |
| 1139 }), true); |
| 1140 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync1(((api.Folder response) { |
| 1141 checkFolder(response); |
| 1142 }))); |
| 1143 }); |
| 1144 |
| 1145 unittest.test("method--search", () { |
| 1146 |
| 1147 var mock = new HttpServerMock(); |
| 1148 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1149 var arg_request = buildSearchFoldersRequest(); |
| 1150 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1151 var obj = new api.SearchFoldersRequest.fromJson(json); |
| 1152 checkSearchFoldersRequest(obj); |
| 1153 |
| 1154 var path = (req.url).path; |
| 1155 var pathOffset = 0; |
| 1156 var index; |
| 1157 var subPart; |
| 1158 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1159 pathOffset += 1; |
| 1160 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2beta1/folders:search")); |
| 1161 pathOffset += 22; |
| 1162 |
| 1163 var query = (req.url).query; |
| 1164 var queryOffset = 0; |
| 1165 var queryMap = {}; |
| 1166 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1167 parseBool(n) { |
| 1168 if (n == "true") return true; |
| 1169 if (n == "false") return false; |
| 1170 if (n == null) return null; |
| 1171 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1172 } |
| 1173 if (query.length > 0) { |
| 1174 for (var part in query.split("&")) { |
| 1175 var keyvalue = part.split("="); |
| 1176 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1177 } |
| 1178 } |
| 1179 |
| 1180 |
| 1181 var h = { |
| 1182 "content-type" : "application/json; charset=utf-8", |
| 1183 }; |
| 1184 var resp = convert.JSON.encode(buildSearchFoldersResponse()); |
| 1185 return new async.Future.value(stringResponse(200, h, resp)); |
| 1186 }), true); |
| 1187 res.search(arg_request).then(unittest.expectAsync1(((api.SearchFoldersResp
onse response) { |
| 1188 checkSearchFoldersResponse(response); |
| 1189 }))); |
| 1190 }); |
| 1191 |
| 1192 unittest.test("method--setIamPolicy", () { |
| 1193 |
| 1194 var mock = new HttpServerMock(); |
| 1195 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1196 var arg_request = buildSetIamPolicyRequest(); |
| 1197 var arg_resource = "foo"; |
| 1198 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1199 var obj = new api.SetIamPolicyRequest.fromJson(json); |
| 1200 checkSetIamPolicyRequest(obj); |
| 1201 |
| 1202 var path = (req.url).path; |
| 1203 var pathOffset = 0; |
| 1204 var index; |
| 1205 var subPart; |
| 1206 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1207 pathOffset += 1; |
| 1208 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1209 pathOffset += 8; |
| 1210 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1211 |
| 1212 var query = (req.url).query; |
| 1213 var queryOffset = 0; |
| 1214 var queryMap = {}; |
| 1215 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1216 parseBool(n) { |
| 1217 if (n == "true") return true; |
| 1218 if (n == "false") return false; |
| 1219 if (n == null) return null; |
| 1220 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1221 } |
| 1222 if (query.length > 0) { |
| 1223 for (var part in query.split("&")) { |
| 1224 var keyvalue = part.split("="); |
| 1225 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1226 } |
| 1227 } |
| 1228 |
| 1229 |
| 1230 var h = { |
| 1231 "content-type" : "application/json; charset=utf-8", |
| 1232 }; |
| 1233 var resp = convert.JSON.encode(buildPolicy()); |
| 1234 return new async.Future.value(stringResponse(200, h, resp)); |
| 1235 }), true); |
| 1236 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { |
| 1237 checkPolicy(response); |
| 1238 }))); |
| 1239 }); |
| 1240 |
| 1241 unittest.test("method--testIamPermissions", () { |
| 1242 |
| 1243 var mock = new HttpServerMock(); |
| 1244 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1245 var arg_request = buildTestIamPermissionsRequest(); |
| 1246 var arg_resource = "foo"; |
| 1247 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1248 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
| 1249 checkTestIamPermissionsRequest(obj); |
| 1250 |
| 1251 var path = (req.url).path; |
| 1252 var pathOffset = 0; |
| 1253 var index; |
| 1254 var subPart; |
| 1255 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1256 pathOffset += 1; |
| 1257 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1258 pathOffset += 8; |
| 1259 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1260 |
| 1261 var query = (req.url).query; |
| 1262 var queryOffset = 0; |
| 1263 var queryMap = {}; |
| 1264 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1265 parseBool(n) { |
| 1266 if (n == "true") return true; |
| 1267 if (n == "false") return false; |
| 1268 if (n == null) return null; |
| 1269 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1270 } |
| 1271 if (query.length > 0) { |
| 1272 for (var part in query.split("&")) { |
| 1273 var keyvalue = part.split("="); |
| 1274 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1275 } |
| 1276 } |
| 1277 |
| 1278 |
| 1279 var h = { |
| 1280 "content-type" : "application/json; charset=utf-8", |
| 1281 }; |
| 1282 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
| 1283 return new async.Future.value(stringResponse(200, h, resp)); |
| 1284 }), true); |
| 1285 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { |
| 1286 checkTestIamPermissionsResponse(response); |
| 1287 }))); |
| 1288 }); |
| 1289 |
| 1290 unittest.test("method--undelete", () { |
| 1291 |
| 1292 var mock = new HttpServerMock(); |
| 1293 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; |
| 1294 var arg_request = buildUndeleteFolderRequest(); |
| 1295 var arg_name = "foo"; |
| 1296 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1297 var obj = new api.UndeleteFolderRequest.fromJson(json); |
| 1298 checkUndeleteFolderRequest(obj); |
| 1299 |
| 1300 var path = (req.url).path; |
| 1301 var pathOffset = 0; |
| 1302 var index; |
| 1303 var subPart; |
| 1304 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1305 pathOffset += 1; |
| 1306 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); |
| 1307 pathOffset += 8; |
| 1308 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1309 |
| 1310 var query = (req.url).query; |
| 1311 var queryOffset = 0; |
| 1312 var queryMap = {}; |
| 1313 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1314 parseBool(n) { |
| 1315 if (n == "true") return true; |
| 1316 if (n == "false") return false; |
| 1317 if (n == null) return null; |
| 1318 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1319 } |
| 1320 if (query.length > 0) { |
| 1321 for (var part in query.split("&")) { |
| 1322 var keyvalue = part.split("="); |
| 1323 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1324 } |
| 1325 } |
| 1326 |
| 1327 |
| 1328 var h = { |
| 1329 "content-type" : "application/json; charset=utf-8", |
| 1330 }; |
| 1331 var resp = convert.JSON.encode(buildFolder()); |
| 1332 return new async.Future.value(stringResponse(200, h, resp)); |
| 1333 }), true); |
| 1334 res.undelete(arg_request, arg_name).then(unittest.expectAsync1(((api.Folde
r response) { |
| 1335 checkFolder(response); |
| 1336 }))); |
| 1337 }); |
| 1338 |
| 1339 }); |
| 1340 |
| 1341 |
| 1342 } |
| 1343 |
OLD | NEW |