OLD | NEW |
(Empty) | |
| 1 library googleapis.discovery.v1.test; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; |
| 11 import 'package:googleapis/common/common.dart' as common; |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; |
| 13 import '../common/common_internal_test.dart' as common_test; |
| 14 |
| 15 import 'package:googleapis/discovery/v1.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterDirectoryListItemsIcons = 0; |
| 20 buildDirectoryListItemsIcons() { |
| 21 var o = new api.DirectoryListItemsIcons(); |
| 22 buildCounterDirectoryListItemsIcons++; |
| 23 if (buildCounterDirectoryListItemsIcons < 3) { |
| 24 o.x16 = "foo"; |
| 25 o.x32 = "foo"; |
| 26 } |
| 27 buildCounterDirectoryListItemsIcons--; |
| 28 return o; |
| 29 } |
| 30 |
| 31 checkDirectoryListItemsIcons(api.DirectoryListItemsIcons o) { |
| 32 buildCounterDirectoryListItemsIcons++; |
| 33 if (buildCounterDirectoryListItemsIcons < 3) { |
| 34 unittest.expect(o.x16, unittest.equals('foo')); |
| 35 unittest.expect(o.x32, unittest.equals('foo')); |
| 36 } |
| 37 buildCounterDirectoryListItemsIcons--; |
| 38 } |
| 39 |
| 40 buildUnnamed299() { |
| 41 var o = new core.List<core.String>(); |
| 42 o.add("foo"); |
| 43 o.add("foo"); |
| 44 return o; |
| 45 } |
| 46 |
| 47 checkUnnamed299(core.List<core.String> o) { |
| 48 unittest.expect(o, unittest.hasLength(2)); |
| 49 unittest.expect(o[0], unittest.equals('foo')); |
| 50 unittest.expect(o[1], unittest.equals('foo')); |
| 51 } |
| 52 |
| 53 core.int buildCounterDirectoryListItems = 0; |
| 54 buildDirectoryListItems() { |
| 55 var o = new api.DirectoryListItems(); |
| 56 buildCounterDirectoryListItems++; |
| 57 if (buildCounterDirectoryListItems < 3) { |
| 58 o.description = "foo"; |
| 59 o.discoveryLink = "foo"; |
| 60 o.discoveryRestUrl = "foo"; |
| 61 o.documentationLink = "foo"; |
| 62 o.icons = buildDirectoryListItemsIcons(); |
| 63 o.id = "foo"; |
| 64 o.kind = "foo"; |
| 65 o.labels = buildUnnamed299(); |
| 66 o.name = "foo"; |
| 67 o.preferred = true; |
| 68 o.title = "foo"; |
| 69 o.version = "foo"; |
| 70 } |
| 71 buildCounterDirectoryListItems--; |
| 72 return o; |
| 73 } |
| 74 |
| 75 checkDirectoryListItems(api.DirectoryListItems o) { |
| 76 buildCounterDirectoryListItems++; |
| 77 if (buildCounterDirectoryListItems < 3) { |
| 78 unittest.expect(o.description, unittest.equals('foo')); |
| 79 unittest.expect(o.discoveryLink, unittest.equals('foo')); |
| 80 unittest.expect(o.discoveryRestUrl, unittest.equals('foo')); |
| 81 unittest.expect(o.documentationLink, unittest.equals('foo')); |
| 82 checkDirectoryListItemsIcons(o.icons); |
| 83 unittest.expect(o.id, unittest.equals('foo')); |
| 84 unittest.expect(o.kind, unittest.equals('foo')); |
| 85 checkUnnamed299(o.labels); |
| 86 unittest.expect(o.name, unittest.equals('foo')); |
| 87 unittest.expect(o.preferred, unittest.isTrue); |
| 88 unittest.expect(o.title, unittest.equals('foo')); |
| 89 unittest.expect(o.version, unittest.equals('foo')); |
| 90 } |
| 91 buildCounterDirectoryListItems--; |
| 92 } |
| 93 |
| 94 buildUnnamed300() { |
| 95 var o = new core.List<api.DirectoryListItems>(); |
| 96 o.add(buildDirectoryListItems()); |
| 97 o.add(buildDirectoryListItems()); |
| 98 return o; |
| 99 } |
| 100 |
| 101 checkUnnamed300(core.List<api.DirectoryListItems> o) { |
| 102 unittest.expect(o, unittest.hasLength(2)); |
| 103 checkDirectoryListItems(o[0]); |
| 104 checkDirectoryListItems(o[1]); |
| 105 } |
| 106 |
| 107 core.int buildCounterDirectoryList = 0; |
| 108 buildDirectoryList() { |
| 109 var o = new api.DirectoryList(); |
| 110 buildCounterDirectoryList++; |
| 111 if (buildCounterDirectoryList < 3) { |
| 112 o.discoveryVersion = "foo"; |
| 113 o.items = buildUnnamed300(); |
| 114 o.kind = "foo"; |
| 115 } |
| 116 buildCounterDirectoryList--; |
| 117 return o; |
| 118 } |
| 119 |
| 120 checkDirectoryList(api.DirectoryList o) { |
| 121 buildCounterDirectoryList++; |
| 122 if (buildCounterDirectoryList < 3) { |
| 123 unittest.expect(o.discoveryVersion, unittest.equals('foo')); |
| 124 checkUnnamed300(o.items); |
| 125 unittest.expect(o.kind, unittest.equals('foo')); |
| 126 } |
| 127 buildCounterDirectoryList--; |
| 128 } |
| 129 |
| 130 buildUnnamed301() { |
| 131 var o = new core.List<core.String>(); |
| 132 o.add("foo"); |
| 133 o.add("foo"); |
| 134 return o; |
| 135 } |
| 136 |
| 137 checkUnnamed301(core.List<core.String> o) { |
| 138 unittest.expect(o, unittest.hasLength(2)); |
| 139 unittest.expect(o[0], unittest.equals('foo')); |
| 140 unittest.expect(o[1], unittest.equals('foo')); |
| 141 } |
| 142 |
| 143 core.int buildCounterJsonSchemaAnnotations = 0; |
| 144 buildJsonSchemaAnnotations() { |
| 145 var o = new api.JsonSchemaAnnotations(); |
| 146 buildCounterJsonSchemaAnnotations++; |
| 147 if (buildCounterJsonSchemaAnnotations < 3) { |
| 148 o.required = buildUnnamed301(); |
| 149 } |
| 150 buildCounterJsonSchemaAnnotations--; |
| 151 return o; |
| 152 } |
| 153 |
| 154 checkJsonSchemaAnnotations(api.JsonSchemaAnnotations o) { |
| 155 buildCounterJsonSchemaAnnotations++; |
| 156 if (buildCounterJsonSchemaAnnotations < 3) { |
| 157 checkUnnamed301(o.required); |
| 158 } |
| 159 buildCounterJsonSchemaAnnotations--; |
| 160 } |
| 161 |
| 162 buildUnnamed302() { |
| 163 var o = new core.List<core.String>(); |
| 164 o.add("foo"); |
| 165 o.add("foo"); |
| 166 return o; |
| 167 } |
| 168 |
| 169 checkUnnamed302(core.List<core.String> o) { |
| 170 unittest.expect(o, unittest.hasLength(2)); |
| 171 unittest.expect(o[0], unittest.equals('foo')); |
| 172 unittest.expect(o[1], unittest.equals('foo')); |
| 173 } |
| 174 |
| 175 buildUnnamed303() { |
| 176 var o = new core.List<core.String>(); |
| 177 o.add("foo"); |
| 178 o.add("foo"); |
| 179 return o; |
| 180 } |
| 181 |
| 182 checkUnnamed303(core.List<core.String> o) { |
| 183 unittest.expect(o, unittest.hasLength(2)); |
| 184 unittest.expect(o[0], unittest.equals('foo')); |
| 185 unittest.expect(o[1], unittest.equals('foo')); |
| 186 } |
| 187 |
| 188 buildUnnamed304() { |
| 189 var o = new core.Map<core.String, api.JsonSchema>(); |
| 190 o["x"] = buildJsonSchema(); |
| 191 o["y"] = buildJsonSchema(); |
| 192 return o; |
| 193 } |
| 194 |
| 195 checkUnnamed304(core.Map<core.String, api.JsonSchema> o) { |
| 196 unittest.expect(o, unittest.hasLength(2)); |
| 197 checkJsonSchema(o["x"]); |
| 198 checkJsonSchema(o["y"]); |
| 199 } |
| 200 |
| 201 core.int buildCounterJsonSchemaVariantMap = 0; |
| 202 buildJsonSchemaVariantMap() { |
| 203 var o = new api.JsonSchemaVariantMap(); |
| 204 buildCounterJsonSchemaVariantMap++; |
| 205 if (buildCounterJsonSchemaVariantMap < 3) { |
| 206 o.P_ref = "foo"; |
| 207 o.typeValue = "foo"; |
| 208 } |
| 209 buildCounterJsonSchemaVariantMap--; |
| 210 return o; |
| 211 } |
| 212 |
| 213 checkJsonSchemaVariantMap(api.JsonSchemaVariantMap o) { |
| 214 buildCounterJsonSchemaVariantMap++; |
| 215 if (buildCounterJsonSchemaVariantMap < 3) { |
| 216 unittest.expect(o.P_ref, unittest.equals('foo')); |
| 217 unittest.expect(o.typeValue, unittest.equals('foo')); |
| 218 } |
| 219 buildCounterJsonSchemaVariantMap--; |
| 220 } |
| 221 |
| 222 buildUnnamed305() { |
| 223 var o = new core.List<api.JsonSchemaVariantMap>(); |
| 224 o.add(buildJsonSchemaVariantMap()); |
| 225 o.add(buildJsonSchemaVariantMap()); |
| 226 return o; |
| 227 } |
| 228 |
| 229 checkUnnamed305(core.List<api.JsonSchemaVariantMap> o) { |
| 230 unittest.expect(o, unittest.hasLength(2)); |
| 231 checkJsonSchemaVariantMap(o[0]); |
| 232 checkJsonSchemaVariantMap(o[1]); |
| 233 } |
| 234 |
| 235 core.int buildCounterJsonSchemaVariant = 0; |
| 236 buildJsonSchemaVariant() { |
| 237 var o = new api.JsonSchemaVariant(); |
| 238 buildCounterJsonSchemaVariant++; |
| 239 if (buildCounterJsonSchemaVariant < 3) { |
| 240 o.discriminant = "foo"; |
| 241 o.map = buildUnnamed305(); |
| 242 } |
| 243 buildCounterJsonSchemaVariant--; |
| 244 return o; |
| 245 } |
| 246 |
| 247 checkJsonSchemaVariant(api.JsonSchemaVariant o) { |
| 248 buildCounterJsonSchemaVariant++; |
| 249 if (buildCounterJsonSchemaVariant < 3) { |
| 250 unittest.expect(o.discriminant, unittest.equals('foo')); |
| 251 checkUnnamed305(o.map); |
| 252 } |
| 253 buildCounterJsonSchemaVariant--; |
| 254 } |
| 255 |
| 256 core.int buildCounterJsonSchema = 0; |
| 257 buildJsonSchema() { |
| 258 var o = new api.JsonSchema(); |
| 259 buildCounterJsonSchema++; |
| 260 if (buildCounterJsonSchema < 3) { |
| 261 o.P_ref = "foo"; |
| 262 o.additionalProperties = buildJsonSchema(); |
| 263 o.annotations = buildJsonSchemaAnnotations(); |
| 264 o.default_ = "foo"; |
| 265 o.description = "foo"; |
| 266 o.enum_ = buildUnnamed302(); |
| 267 o.enumDescriptions = buildUnnamed303(); |
| 268 o.format = "foo"; |
| 269 o.id = "foo"; |
| 270 o.items = buildJsonSchema(); |
| 271 o.location = "foo"; |
| 272 o.maximum = "foo"; |
| 273 o.minimum = "foo"; |
| 274 o.pattern = "foo"; |
| 275 o.properties = buildUnnamed304(); |
| 276 o.readOnly = true; |
| 277 o.repeated = true; |
| 278 o.required = true; |
| 279 o.type = "foo"; |
| 280 o.variant = buildJsonSchemaVariant(); |
| 281 } |
| 282 buildCounterJsonSchema--; |
| 283 return o; |
| 284 } |
| 285 |
| 286 checkJsonSchema(api.JsonSchema o) { |
| 287 buildCounterJsonSchema++; |
| 288 if (buildCounterJsonSchema < 3) { |
| 289 unittest.expect(o.P_ref, unittest.equals('foo')); |
| 290 checkJsonSchema(o.additionalProperties); |
| 291 checkJsonSchemaAnnotations(o.annotations); |
| 292 unittest.expect(o.default_, unittest.equals('foo')); |
| 293 unittest.expect(o.description, unittest.equals('foo')); |
| 294 checkUnnamed302(o.enum_); |
| 295 checkUnnamed303(o.enumDescriptions); |
| 296 unittest.expect(o.format, unittest.equals('foo')); |
| 297 unittest.expect(o.id, unittest.equals('foo')); |
| 298 checkJsonSchema(o.items); |
| 299 unittest.expect(o.location, unittest.equals('foo')); |
| 300 unittest.expect(o.maximum, unittest.equals('foo')); |
| 301 unittest.expect(o.minimum, unittest.equals('foo')); |
| 302 unittest.expect(o.pattern, unittest.equals('foo')); |
| 303 checkUnnamed304(o.properties); |
| 304 unittest.expect(o.readOnly, unittest.isTrue); |
| 305 unittest.expect(o.repeated, unittest.isTrue); |
| 306 unittest.expect(o.required, unittest.isTrue); |
| 307 unittest.expect(o.type, unittest.equals('foo')); |
| 308 checkJsonSchemaVariant(o.variant); |
| 309 } |
| 310 buildCounterJsonSchema--; |
| 311 } |
| 312 |
| 313 core.int buildCounterRestDescriptionAuthOauth2ScopesValue = 0; |
| 314 buildRestDescriptionAuthOauth2ScopesValue() { |
| 315 var o = new api.RestDescriptionAuthOauth2ScopesValue(); |
| 316 buildCounterRestDescriptionAuthOauth2ScopesValue++; |
| 317 if (buildCounterRestDescriptionAuthOauth2ScopesValue < 3) { |
| 318 o.description = "foo"; |
| 319 } |
| 320 buildCounterRestDescriptionAuthOauth2ScopesValue--; |
| 321 return o; |
| 322 } |
| 323 |
| 324 checkRestDescriptionAuthOauth2ScopesValue(api.RestDescriptionAuthOauth2ScopesVal
ue o) { |
| 325 buildCounterRestDescriptionAuthOauth2ScopesValue++; |
| 326 if (buildCounterRestDescriptionAuthOauth2ScopesValue < 3) { |
| 327 unittest.expect(o.description, unittest.equals('foo')); |
| 328 } |
| 329 buildCounterRestDescriptionAuthOauth2ScopesValue--; |
| 330 } |
| 331 |
| 332 buildUnnamed306() { |
| 333 var o = new core.Map<core.String, api.RestDescriptionAuthOauth2ScopesValue>(); |
| 334 o["x"] = buildRestDescriptionAuthOauth2ScopesValue(); |
| 335 o["y"] = buildRestDescriptionAuthOauth2ScopesValue(); |
| 336 return o; |
| 337 } |
| 338 |
| 339 checkUnnamed306(core.Map<core.String, api.RestDescriptionAuthOauth2ScopesValue>
o) { |
| 340 unittest.expect(o, unittest.hasLength(2)); |
| 341 checkRestDescriptionAuthOauth2ScopesValue(o["x"]); |
| 342 checkRestDescriptionAuthOauth2ScopesValue(o["y"]); |
| 343 } |
| 344 |
| 345 core.int buildCounterRestDescriptionAuthOauth2 = 0; |
| 346 buildRestDescriptionAuthOauth2() { |
| 347 var o = new api.RestDescriptionAuthOauth2(); |
| 348 buildCounterRestDescriptionAuthOauth2++; |
| 349 if (buildCounterRestDescriptionAuthOauth2 < 3) { |
| 350 o.scopes = buildUnnamed306(); |
| 351 } |
| 352 buildCounterRestDescriptionAuthOauth2--; |
| 353 return o; |
| 354 } |
| 355 |
| 356 checkRestDescriptionAuthOauth2(api.RestDescriptionAuthOauth2 o) { |
| 357 buildCounterRestDescriptionAuthOauth2++; |
| 358 if (buildCounterRestDescriptionAuthOauth2 < 3) { |
| 359 checkUnnamed306(o.scopes); |
| 360 } |
| 361 buildCounterRestDescriptionAuthOauth2--; |
| 362 } |
| 363 |
| 364 core.int buildCounterRestDescriptionAuth = 0; |
| 365 buildRestDescriptionAuth() { |
| 366 var o = new api.RestDescriptionAuth(); |
| 367 buildCounterRestDescriptionAuth++; |
| 368 if (buildCounterRestDescriptionAuth < 3) { |
| 369 o.oauth2 = buildRestDescriptionAuthOauth2(); |
| 370 } |
| 371 buildCounterRestDescriptionAuth--; |
| 372 return o; |
| 373 } |
| 374 |
| 375 checkRestDescriptionAuth(api.RestDescriptionAuth o) { |
| 376 buildCounterRestDescriptionAuth++; |
| 377 if (buildCounterRestDescriptionAuth < 3) { |
| 378 checkRestDescriptionAuthOauth2(o.oauth2); |
| 379 } |
| 380 buildCounterRestDescriptionAuth--; |
| 381 } |
| 382 |
| 383 buildUnnamed307() { |
| 384 var o = new core.List<core.String>(); |
| 385 o.add("foo"); |
| 386 o.add("foo"); |
| 387 return o; |
| 388 } |
| 389 |
| 390 checkUnnamed307(core.List<core.String> o) { |
| 391 unittest.expect(o, unittest.hasLength(2)); |
| 392 unittest.expect(o[0], unittest.equals('foo')); |
| 393 unittest.expect(o[1], unittest.equals('foo')); |
| 394 } |
| 395 |
| 396 core.int buildCounterRestDescriptionIcons = 0; |
| 397 buildRestDescriptionIcons() { |
| 398 var o = new api.RestDescriptionIcons(); |
| 399 buildCounterRestDescriptionIcons++; |
| 400 if (buildCounterRestDescriptionIcons < 3) { |
| 401 o.x16 = "foo"; |
| 402 o.x32 = "foo"; |
| 403 } |
| 404 buildCounterRestDescriptionIcons--; |
| 405 return o; |
| 406 } |
| 407 |
| 408 checkRestDescriptionIcons(api.RestDescriptionIcons o) { |
| 409 buildCounterRestDescriptionIcons++; |
| 410 if (buildCounterRestDescriptionIcons < 3) { |
| 411 unittest.expect(o.x16, unittest.equals('foo')); |
| 412 unittest.expect(o.x32, unittest.equals('foo')); |
| 413 } |
| 414 buildCounterRestDescriptionIcons--; |
| 415 } |
| 416 |
| 417 buildUnnamed308() { |
| 418 var o = new core.List<core.String>(); |
| 419 o.add("foo"); |
| 420 o.add("foo"); |
| 421 return o; |
| 422 } |
| 423 |
| 424 checkUnnamed308(core.List<core.String> o) { |
| 425 unittest.expect(o, unittest.hasLength(2)); |
| 426 unittest.expect(o[0], unittest.equals('foo')); |
| 427 unittest.expect(o[1], unittest.equals('foo')); |
| 428 } |
| 429 |
| 430 buildUnnamed309() { |
| 431 var o = new core.Map<core.String, api.RestMethod>(); |
| 432 o["x"] = buildRestMethod(); |
| 433 o["y"] = buildRestMethod(); |
| 434 return o; |
| 435 } |
| 436 |
| 437 checkUnnamed309(core.Map<core.String, api.RestMethod> o) { |
| 438 unittest.expect(o, unittest.hasLength(2)); |
| 439 checkRestMethod(o["x"]); |
| 440 checkRestMethod(o["y"]); |
| 441 } |
| 442 |
| 443 buildUnnamed310() { |
| 444 var o = new core.Map<core.String, api.JsonSchema>(); |
| 445 o["x"] = buildJsonSchema(); |
| 446 o["y"] = buildJsonSchema(); |
| 447 return o; |
| 448 } |
| 449 |
| 450 checkUnnamed310(core.Map<core.String, api.JsonSchema> o) { |
| 451 unittest.expect(o, unittest.hasLength(2)); |
| 452 checkJsonSchema(o["x"]); |
| 453 checkJsonSchema(o["y"]); |
| 454 } |
| 455 |
| 456 buildUnnamed311() { |
| 457 var o = new core.Map<core.String, api.RestResource>(); |
| 458 o["x"] = buildRestResource(); |
| 459 o["y"] = buildRestResource(); |
| 460 return o; |
| 461 } |
| 462 |
| 463 checkUnnamed311(core.Map<core.String, api.RestResource> o) { |
| 464 unittest.expect(o, unittest.hasLength(2)); |
| 465 checkRestResource(o["x"]); |
| 466 checkRestResource(o["y"]); |
| 467 } |
| 468 |
| 469 buildUnnamed312() { |
| 470 var o = new core.Map<core.String, api.JsonSchema>(); |
| 471 o["x"] = buildJsonSchema(); |
| 472 o["y"] = buildJsonSchema(); |
| 473 return o; |
| 474 } |
| 475 |
| 476 checkUnnamed312(core.Map<core.String, api.JsonSchema> o) { |
| 477 unittest.expect(o, unittest.hasLength(2)); |
| 478 checkJsonSchema(o["x"]); |
| 479 checkJsonSchema(o["y"]); |
| 480 } |
| 481 |
| 482 core.int buildCounterRestDescription = 0; |
| 483 buildRestDescription() { |
| 484 var o = new api.RestDescription(); |
| 485 buildCounterRestDescription++; |
| 486 if (buildCounterRestDescription < 3) { |
| 487 o.auth = buildRestDescriptionAuth(); |
| 488 o.basePath = "foo"; |
| 489 o.baseUrl = "foo"; |
| 490 o.batchPath = "foo"; |
| 491 o.canonicalName = "foo"; |
| 492 o.description = "foo"; |
| 493 o.discoveryVersion = "foo"; |
| 494 o.documentationLink = "foo"; |
| 495 o.etag = "foo"; |
| 496 o.features = buildUnnamed307(); |
| 497 o.icons = buildRestDescriptionIcons(); |
| 498 o.id = "foo"; |
| 499 o.kind = "foo"; |
| 500 o.labels = buildUnnamed308(); |
| 501 o.methods = buildUnnamed309(); |
| 502 o.name = "foo"; |
| 503 o.ownerDomain = "foo"; |
| 504 o.ownerName = "foo"; |
| 505 o.packagePath = "foo"; |
| 506 o.parameters = buildUnnamed310(); |
| 507 o.protocol = "foo"; |
| 508 o.resources = buildUnnamed311(); |
| 509 o.revision = "foo"; |
| 510 o.rootUrl = "foo"; |
| 511 o.schemas = buildUnnamed312(); |
| 512 o.servicePath = "foo"; |
| 513 o.title = "foo"; |
| 514 o.version = "foo"; |
| 515 } |
| 516 buildCounterRestDescription--; |
| 517 return o; |
| 518 } |
| 519 |
| 520 checkRestDescription(api.RestDescription o) { |
| 521 buildCounterRestDescription++; |
| 522 if (buildCounterRestDescription < 3) { |
| 523 checkRestDescriptionAuth(o.auth); |
| 524 unittest.expect(o.basePath, unittest.equals('foo')); |
| 525 unittest.expect(o.baseUrl, unittest.equals('foo')); |
| 526 unittest.expect(o.batchPath, unittest.equals('foo')); |
| 527 unittest.expect(o.canonicalName, unittest.equals('foo')); |
| 528 unittest.expect(o.description, unittest.equals('foo')); |
| 529 unittest.expect(o.discoveryVersion, unittest.equals('foo')); |
| 530 unittest.expect(o.documentationLink, unittest.equals('foo')); |
| 531 unittest.expect(o.etag, unittest.equals('foo')); |
| 532 checkUnnamed307(o.features); |
| 533 checkRestDescriptionIcons(o.icons); |
| 534 unittest.expect(o.id, unittest.equals('foo')); |
| 535 unittest.expect(o.kind, unittest.equals('foo')); |
| 536 checkUnnamed308(o.labels); |
| 537 checkUnnamed309(o.methods); |
| 538 unittest.expect(o.name, unittest.equals('foo')); |
| 539 unittest.expect(o.ownerDomain, unittest.equals('foo')); |
| 540 unittest.expect(o.ownerName, unittest.equals('foo')); |
| 541 unittest.expect(o.packagePath, unittest.equals('foo')); |
| 542 checkUnnamed310(o.parameters); |
| 543 unittest.expect(o.protocol, unittest.equals('foo')); |
| 544 checkUnnamed311(o.resources); |
| 545 unittest.expect(o.revision, unittest.equals('foo')); |
| 546 unittest.expect(o.rootUrl, unittest.equals('foo')); |
| 547 checkUnnamed312(o.schemas); |
| 548 unittest.expect(o.servicePath, unittest.equals('foo')); |
| 549 unittest.expect(o.title, unittest.equals('foo')); |
| 550 unittest.expect(o.version, unittest.equals('foo')); |
| 551 } |
| 552 buildCounterRestDescription--; |
| 553 } |
| 554 |
| 555 buildUnnamed313() { |
| 556 var o = new core.List<core.String>(); |
| 557 o.add("foo"); |
| 558 o.add("foo"); |
| 559 return o; |
| 560 } |
| 561 |
| 562 checkUnnamed313(core.List<core.String> o) { |
| 563 unittest.expect(o, unittest.hasLength(2)); |
| 564 unittest.expect(o[0], unittest.equals('foo')); |
| 565 unittest.expect(o[1], unittest.equals('foo')); |
| 566 } |
| 567 |
| 568 core.int buildCounterRestMethodMediaUploadProtocolsResumable = 0; |
| 569 buildRestMethodMediaUploadProtocolsResumable() { |
| 570 var o = new api.RestMethodMediaUploadProtocolsResumable(); |
| 571 buildCounterRestMethodMediaUploadProtocolsResumable++; |
| 572 if (buildCounterRestMethodMediaUploadProtocolsResumable < 3) { |
| 573 o.multipart = true; |
| 574 o.path = "foo"; |
| 575 } |
| 576 buildCounterRestMethodMediaUploadProtocolsResumable--; |
| 577 return o; |
| 578 } |
| 579 |
| 580 checkRestMethodMediaUploadProtocolsResumable(api.RestMethodMediaUploadProtocolsR
esumable o) { |
| 581 buildCounterRestMethodMediaUploadProtocolsResumable++; |
| 582 if (buildCounterRestMethodMediaUploadProtocolsResumable < 3) { |
| 583 unittest.expect(o.multipart, unittest.isTrue); |
| 584 unittest.expect(o.path, unittest.equals('foo')); |
| 585 } |
| 586 buildCounterRestMethodMediaUploadProtocolsResumable--; |
| 587 } |
| 588 |
| 589 core.int buildCounterRestMethodMediaUploadProtocolsSimple = 0; |
| 590 buildRestMethodMediaUploadProtocolsSimple() { |
| 591 var o = new api.RestMethodMediaUploadProtocolsSimple(); |
| 592 buildCounterRestMethodMediaUploadProtocolsSimple++; |
| 593 if (buildCounterRestMethodMediaUploadProtocolsSimple < 3) { |
| 594 o.multipart = true; |
| 595 o.path = "foo"; |
| 596 } |
| 597 buildCounterRestMethodMediaUploadProtocolsSimple--; |
| 598 return o; |
| 599 } |
| 600 |
| 601 checkRestMethodMediaUploadProtocolsSimple(api.RestMethodMediaUploadProtocolsSimp
le o) { |
| 602 buildCounterRestMethodMediaUploadProtocolsSimple++; |
| 603 if (buildCounterRestMethodMediaUploadProtocolsSimple < 3) { |
| 604 unittest.expect(o.multipart, unittest.isTrue); |
| 605 unittest.expect(o.path, unittest.equals('foo')); |
| 606 } |
| 607 buildCounterRestMethodMediaUploadProtocolsSimple--; |
| 608 } |
| 609 |
| 610 core.int buildCounterRestMethodMediaUploadProtocols = 0; |
| 611 buildRestMethodMediaUploadProtocols() { |
| 612 var o = new api.RestMethodMediaUploadProtocols(); |
| 613 buildCounterRestMethodMediaUploadProtocols++; |
| 614 if (buildCounterRestMethodMediaUploadProtocols < 3) { |
| 615 o.resumable = buildRestMethodMediaUploadProtocolsResumable(); |
| 616 o.simple = buildRestMethodMediaUploadProtocolsSimple(); |
| 617 } |
| 618 buildCounterRestMethodMediaUploadProtocols--; |
| 619 return o; |
| 620 } |
| 621 |
| 622 checkRestMethodMediaUploadProtocols(api.RestMethodMediaUploadProtocols o) { |
| 623 buildCounterRestMethodMediaUploadProtocols++; |
| 624 if (buildCounterRestMethodMediaUploadProtocols < 3) { |
| 625 checkRestMethodMediaUploadProtocolsResumable(o.resumable); |
| 626 checkRestMethodMediaUploadProtocolsSimple(o.simple); |
| 627 } |
| 628 buildCounterRestMethodMediaUploadProtocols--; |
| 629 } |
| 630 |
| 631 core.int buildCounterRestMethodMediaUpload = 0; |
| 632 buildRestMethodMediaUpload() { |
| 633 var o = new api.RestMethodMediaUpload(); |
| 634 buildCounterRestMethodMediaUpload++; |
| 635 if (buildCounterRestMethodMediaUpload < 3) { |
| 636 o.accept = buildUnnamed313(); |
| 637 o.maxSize = "foo"; |
| 638 o.protocols = buildRestMethodMediaUploadProtocols(); |
| 639 } |
| 640 buildCounterRestMethodMediaUpload--; |
| 641 return o; |
| 642 } |
| 643 |
| 644 checkRestMethodMediaUpload(api.RestMethodMediaUpload o) { |
| 645 buildCounterRestMethodMediaUpload++; |
| 646 if (buildCounterRestMethodMediaUpload < 3) { |
| 647 checkUnnamed313(o.accept); |
| 648 unittest.expect(o.maxSize, unittest.equals('foo')); |
| 649 checkRestMethodMediaUploadProtocols(o.protocols); |
| 650 } |
| 651 buildCounterRestMethodMediaUpload--; |
| 652 } |
| 653 |
| 654 buildUnnamed314() { |
| 655 var o = new core.List<core.String>(); |
| 656 o.add("foo"); |
| 657 o.add("foo"); |
| 658 return o; |
| 659 } |
| 660 |
| 661 checkUnnamed314(core.List<core.String> o) { |
| 662 unittest.expect(o, unittest.hasLength(2)); |
| 663 unittest.expect(o[0], unittest.equals('foo')); |
| 664 unittest.expect(o[1], unittest.equals('foo')); |
| 665 } |
| 666 |
| 667 buildUnnamed315() { |
| 668 var o = new core.Map<core.String, api.JsonSchema>(); |
| 669 o["x"] = buildJsonSchema(); |
| 670 o["y"] = buildJsonSchema(); |
| 671 return o; |
| 672 } |
| 673 |
| 674 checkUnnamed315(core.Map<core.String, api.JsonSchema> o) { |
| 675 unittest.expect(o, unittest.hasLength(2)); |
| 676 checkJsonSchema(o["x"]); |
| 677 checkJsonSchema(o["y"]); |
| 678 } |
| 679 |
| 680 core.int buildCounterRestMethodRequest = 0; |
| 681 buildRestMethodRequest() { |
| 682 var o = new api.RestMethodRequest(); |
| 683 buildCounterRestMethodRequest++; |
| 684 if (buildCounterRestMethodRequest < 3) { |
| 685 o.P_ref = "foo"; |
| 686 o.parameterName = "foo"; |
| 687 } |
| 688 buildCounterRestMethodRequest--; |
| 689 return o; |
| 690 } |
| 691 |
| 692 checkRestMethodRequest(api.RestMethodRequest o) { |
| 693 buildCounterRestMethodRequest++; |
| 694 if (buildCounterRestMethodRequest < 3) { |
| 695 unittest.expect(o.P_ref, unittest.equals('foo')); |
| 696 unittest.expect(o.parameterName, unittest.equals('foo')); |
| 697 } |
| 698 buildCounterRestMethodRequest--; |
| 699 } |
| 700 |
| 701 core.int buildCounterRestMethodResponse = 0; |
| 702 buildRestMethodResponse() { |
| 703 var o = new api.RestMethodResponse(); |
| 704 buildCounterRestMethodResponse++; |
| 705 if (buildCounterRestMethodResponse < 3) { |
| 706 o.P_ref = "foo"; |
| 707 } |
| 708 buildCounterRestMethodResponse--; |
| 709 return o; |
| 710 } |
| 711 |
| 712 checkRestMethodResponse(api.RestMethodResponse o) { |
| 713 buildCounterRestMethodResponse++; |
| 714 if (buildCounterRestMethodResponse < 3) { |
| 715 unittest.expect(o.P_ref, unittest.equals('foo')); |
| 716 } |
| 717 buildCounterRestMethodResponse--; |
| 718 } |
| 719 |
| 720 buildUnnamed316() { |
| 721 var o = new core.List<core.String>(); |
| 722 o.add("foo"); |
| 723 o.add("foo"); |
| 724 return o; |
| 725 } |
| 726 |
| 727 checkUnnamed316(core.List<core.String> o) { |
| 728 unittest.expect(o, unittest.hasLength(2)); |
| 729 unittest.expect(o[0], unittest.equals('foo')); |
| 730 unittest.expect(o[1], unittest.equals('foo')); |
| 731 } |
| 732 |
| 733 core.int buildCounterRestMethod = 0; |
| 734 buildRestMethod() { |
| 735 var o = new api.RestMethod(); |
| 736 buildCounterRestMethod++; |
| 737 if (buildCounterRestMethod < 3) { |
| 738 o.description = "foo"; |
| 739 o.etagRequired = true; |
| 740 o.httpMethod = "foo"; |
| 741 o.id = "foo"; |
| 742 o.mediaUpload = buildRestMethodMediaUpload(); |
| 743 o.parameterOrder = buildUnnamed314(); |
| 744 o.parameters = buildUnnamed315(); |
| 745 o.path = "foo"; |
| 746 o.request = buildRestMethodRequest(); |
| 747 o.response = buildRestMethodResponse(); |
| 748 o.scopes = buildUnnamed316(); |
| 749 o.supportsMediaDownload = true; |
| 750 o.supportsMediaUpload = true; |
| 751 o.supportsSubscription = true; |
| 752 } |
| 753 buildCounterRestMethod--; |
| 754 return o; |
| 755 } |
| 756 |
| 757 checkRestMethod(api.RestMethod o) { |
| 758 buildCounterRestMethod++; |
| 759 if (buildCounterRestMethod < 3) { |
| 760 unittest.expect(o.description, unittest.equals('foo')); |
| 761 unittest.expect(o.etagRequired, unittest.isTrue); |
| 762 unittest.expect(o.httpMethod, unittest.equals('foo')); |
| 763 unittest.expect(o.id, unittest.equals('foo')); |
| 764 checkRestMethodMediaUpload(o.mediaUpload); |
| 765 checkUnnamed314(o.parameterOrder); |
| 766 checkUnnamed315(o.parameters); |
| 767 unittest.expect(o.path, unittest.equals('foo')); |
| 768 checkRestMethodRequest(o.request); |
| 769 checkRestMethodResponse(o.response); |
| 770 checkUnnamed316(o.scopes); |
| 771 unittest.expect(o.supportsMediaDownload, unittest.isTrue); |
| 772 unittest.expect(o.supportsMediaUpload, unittest.isTrue); |
| 773 unittest.expect(o.supportsSubscription, unittest.isTrue); |
| 774 } |
| 775 buildCounterRestMethod--; |
| 776 } |
| 777 |
| 778 buildUnnamed317() { |
| 779 var o = new core.Map<core.String, api.RestMethod>(); |
| 780 o["x"] = buildRestMethod(); |
| 781 o["y"] = buildRestMethod(); |
| 782 return o; |
| 783 } |
| 784 |
| 785 checkUnnamed317(core.Map<core.String, api.RestMethod> o) { |
| 786 unittest.expect(o, unittest.hasLength(2)); |
| 787 checkRestMethod(o["x"]); |
| 788 checkRestMethod(o["y"]); |
| 789 } |
| 790 |
| 791 buildUnnamed318() { |
| 792 var o = new core.Map<core.String, api.RestResource>(); |
| 793 o["x"] = buildRestResource(); |
| 794 o["y"] = buildRestResource(); |
| 795 return o; |
| 796 } |
| 797 |
| 798 checkUnnamed318(core.Map<core.String, api.RestResource> o) { |
| 799 unittest.expect(o, unittest.hasLength(2)); |
| 800 checkRestResource(o["x"]); |
| 801 checkRestResource(o["y"]); |
| 802 } |
| 803 |
| 804 core.int buildCounterRestResource = 0; |
| 805 buildRestResource() { |
| 806 var o = new api.RestResource(); |
| 807 buildCounterRestResource++; |
| 808 if (buildCounterRestResource < 3) { |
| 809 o.methods = buildUnnamed317(); |
| 810 o.resources = buildUnnamed318(); |
| 811 } |
| 812 buildCounterRestResource--; |
| 813 return o; |
| 814 } |
| 815 |
| 816 checkRestResource(api.RestResource o) { |
| 817 buildCounterRestResource++; |
| 818 if (buildCounterRestResource < 3) { |
| 819 checkUnnamed317(o.methods); |
| 820 checkUnnamed318(o.resources); |
| 821 } |
| 822 buildCounterRestResource--; |
| 823 } |
| 824 |
| 825 |
| 826 main() { |
| 827 unittest.group("obj-schema-DirectoryListItemsIcons", () { |
| 828 unittest.test("to-json--from-json", () { |
| 829 var o = buildDirectoryListItemsIcons(); |
| 830 var od = new api.DirectoryListItemsIcons.fromJson(o.toJson()); |
| 831 checkDirectoryListItemsIcons(od); |
| 832 }); |
| 833 }); |
| 834 |
| 835 |
| 836 unittest.group("obj-schema-DirectoryListItems", () { |
| 837 unittest.test("to-json--from-json", () { |
| 838 var o = buildDirectoryListItems(); |
| 839 var od = new api.DirectoryListItems.fromJson(o.toJson()); |
| 840 checkDirectoryListItems(od); |
| 841 }); |
| 842 }); |
| 843 |
| 844 |
| 845 unittest.group("obj-schema-DirectoryList", () { |
| 846 unittest.test("to-json--from-json", () { |
| 847 var o = buildDirectoryList(); |
| 848 var od = new api.DirectoryList.fromJson(o.toJson()); |
| 849 checkDirectoryList(od); |
| 850 }); |
| 851 }); |
| 852 |
| 853 |
| 854 unittest.group("obj-schema-JsonSchemaAnnotations", () { |
| 855 unittest.test("to-json--from-json", () { |
| 856 var o = buildJsonSchemaAnnotations(); |
| 857 var od = new api.JsonSchemaAnnotations.fromJson(o.toJson()); |
| 858 checkJsonSchemaAnnotations(od); |
| 859 }); |
| 860 }); |
| 861 |
| 862 |
| 863 unittest.group("obj-schema-JsonSchemaVariantMap", () { |
| 864 unittest.test("to-json--from-json", () { |
| 865 var o = buildJsonSchemaVariantMap(); |
| 866 var od = new api.JsonSchemaVariantMap.fromJson(o.toJson()); |
| 867 checkJsonSchemaVariantMap(od); |
| 868 }); |
| 869 }); |
| 870 |
| 871 |
| 872 unittest.group("obj-schema-JsonSchemaVariant", () { |
| 873 unittest.test("to-json--from-json", () { |
| 874 var o = buildJsonSchemaVariant(); |
| 875 var od = new api.JsonSchemaVariant.fromJson(o.toJson()); |
| 876 checkJsonSchemaVariant(od); |
| 877 }); |
| 878 }); |
| 879 |
| 880 |
| 881 unittest.group("obj-schema-JsonSchema", () { |
| 882 unittest.test("to-json--from-json", () { |
| 883 var o = buildJsonSchema(); |
| 884 var od = new api.JsonSchema.fromJson(o.toJson()); |
| 885 checkJsonSchema(od); |
| 886 }); |
| 887 }); |
| 888 |
| 889 |
| 890 unittest.group("obj-schema-RestDescriptionAuthOauth2ScopesValue", () { |
| 891 unittest.test("to-json--from-json", () { |
| 892 var o = buildRestDescriptionAuthOauth2ScopesValue(); |
| 893 var od = new api.RestDescriptionAuthOauth2ScopesValue.fromJson(o.toJson())
; |
| 894 checkRestDescriptionAuthOauth2ScopesValue(od); |
| 895 }); |
| 896 }); |
| 897 |
| 898 |
| 899 unittest.group("obj-schema-RestDescriptionAuthOauth2", () { |
| 900 unittest.test("to-json--from-json", () { |
| 901 var o = buildRestDescriptionAuthOauth2(); |
| 902 var od = new api.RestDescriptionAuthOauth2.fromJson(o.toJson()); |
| 903 checkRestDescriptionAuthOauth2(od); |
| 904 }); |
| 905 }); |
| 906 |
| 907 |
| 908 unittest.group("obj-schema-RestDescriptionAuth", () { |
| 909 unittest.test("to-json--from-json", () { |
| 910 var o = buildRestDescriptionAuth(); |
| 911 var od = new api.RestDescriptionAuth.fromJson(o.toJson()); |
| 912 checkRestDescriptionAuth(od); |
| 913 }); |
| 914 }); |
| 915 |
| 916 |
| 917 unittest.group("obj-schema-RestDescriptionIcons", () { |
| 918 unittest.test("to-json--from-json", () { |
| 919 var o = buildRestDescriptionIcons(); |
| 920 var od = new api.RestDescriptionIcons.fromJson(o.toJson()); |
| 921 checkRestDescriptionIcons(od); |
| 922 }); |
| 923 }); |
| 924 |
| 925 |
| 926 unittest.group("obj-schema-RestDescription", () { |
| 927 unittest.test("to-json--from-json", () { |
| 928 var o = buildRestDescription(); |
| 929 var od = new api.RestDescription.fromJson(o.toJson()); |
| 930 checkRestDescription(od); |
| 931 }); |
| 932 }); |
| 933 |
| 934 |
| 935 unittest.group("obj-schema-RestMethodMediaUploadProtocolsResumable", () { |
| 936 unittest.test("to-json--from-json", () { |
| 937 var o = buildRestMethodMediaUploadProtocolsResumable(); |
| 938 var od = new api.RestMethodMediaUploadProtocolsResumable.fromJson(o.toJson
()); |
| 939 checkRestMethodMediaUploadProtocolsResumable(od); |
| 940 }); |
| 941 }); |
| 942 |
| 943 |
| 944 unittest.group("obj-schema-RestMethodMediaUploadProtocolsSimple", () { |
| 945 unittest.test("to-json--from-json", () { |
| 946 var o = buildRestMethodMediaUploadProtocolsSimple(); |
| 947 var od = new api.RestMethodMediaUploadProtocolsSimple.fromJson(o.toJson())
; |
| 948 checkRestMethodMediaUploadProtocolsSimple(od); |
| 949 }); |
| 950 }); |
| 951 |
| 952 |
| 953 unittest.group("obj-schema-RestMethodMediaUploadProtocols", () { |
| 954 unittest.test("to-json--from-json", () { |
| 955 var o = buildRestMethodMediaUploadProtocols(); |
| 956 var od = new api.RestMethodMediaUploadProtocols.fromJson(o.toJson()); |
| 957 checkRestMethodMediaUploadProtocols(od); |
| 958 }); |
| 959 }); |
| 960 |
| 961 |
| 962 unittest.group("obj-schema-RestMethodMediaUpload", () { |
| 963 unittest.test("to-json--from-json", () { |
| 964 var o = buildRestMethodMediaUpload(); |
| 965 var od = new api.RestMethodMediaUpload.fromJson(o.toJson()); |
| 966 checkRestMethodMediaUpload(od); |
| 967 }); |
| 968 }); |
| 969 |
| 970 |
| 971 unittest.group("obj-schema-RestMethodRequest", () { |
| 972 unittest.test("to-json--from-json", () { |
| 973 var o = buildRestMethodRequest(); |
| 974 var od = new api.RestMethodRequest.fromJson(o.toJson()); |
| 975 checkRestMethodRequest(od); |
| 976 }); |
| 977 }); |
| 978 |
| 979 |
| 980 unittest.group("obj-schema-RestMethodResponse", () { |
| 981 unittest.test("to-json--from-json", () { |
| 982 var o = buildRestMethodResponse(); |
| 983 var od = new api.RestMethodResponse.fromJson(o.toJson()); |
| 984 checkRestMethodResponse(od); |
| 985 }); |
| 986 }); |
| 987 |
| 988 |
| 989 unittest.group("obj-schema-RestMethod", () { |
| 990 unittest.test("to-json--from-json", () { |
| 991 var o = buildRestMethod(); |
| 992 var od = new api.RestMethod.fromJson(o.toJson()); |
| 993 checkRestMethod(od); |
| 994 }); |
| 995 }); |
| 996 |
| 997 |
| 998 unittest.group("obj-schema-RestResource", () { |
| 999 unittest.test("to-json--from-json", () { |
| 1000 var o = buildRestResource(); |
| 1001 var od = new api.RestResource.fromJson(o.toJson()); |
| 1002 checkRestResource(od); |
| 1003 }); |
| 1004 }); |
| 1005 |
| 1006 |
| 1007 unittest.group("resource-ApisResourceApi", () { |
| 1008 unittest.test("method--getRest", () { |
| 1009 |
| 1010 var mock = new common_test.HttpServerMock(); |
| 1011 api.ApisResourceApi res = new api.DiscoveryApi(mock).apis; |
| 1012 var arg_api = "foo"; |
| 1013 var arg_version = "foo"; |
| 1014 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1015 var path = (req.url).path; |
| 1016 var pathOffset = 0; |
| 1017 var index; |
| 1018 var subPart; |
| 1019 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/discovery/v1/")); |
| 1020 pathOffset += 14; |
| 1021 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("apis/")); |
| 1022 pathOffset += 5; |
| 1023 index = path.indexOf("/", pathOffset); |
| 1024 unittest.expect(index >= 0, unittest.isTrue); |
| 1025 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1026 pathOffset = index; |
| 1027 unittest.expect(subPart, unittest.equals("$arg_api")); |
| 1028 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1029 pathOffset += 1; |
| 1030 index = path.indexOf("/rest", pathOffset); |
| 1031 unittest.expect(index >= 0, unittest.isTrue); |
| 1032 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1033 pathOffset = index; |
| 1034 unittest.expect(subPart, unittest.equals("$arg_version")); |
| 1035 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("/rest")); |
| 1036 pathOffset += 5; |
| 1037 |
| 1038 var query = (req.url).query; |
| 1039 var queryOffset = 0; |
| 1040 var queryMap = {}; |
| 1041 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1042 parseBool(n) { |
| 1043 if (n == "true") return true; |
| 1044 if (n == "false") return false; |
| 1045 if (n == null) return null; |
| 1046 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1047 } |
| 1048 if (query.length > 0) { |
| 1049 for (var part in query.split("&")) { |
| 1050 var keyvalue = part.split("="); |
| 1051 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1052 } |
| 1053 } |
| 1054 |
| 1055 |
| 1056 var h = { |
| 1057 "content-type" : "application/json; charset=utf-8", |
| 1058 }; |
| 1059 var resp = convert.JSON.encode(buildRestDescription()); |
| 1060 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1061 }), true); |
| 1062 res.getRest(arg_api, arg_version).then(unittest.expectAsync(((api.RestDesc
ription response) { |
| 1063 checkRestDescription(response); |
| 1064 }))); |
| 1065 }); |
| 1066 |
| 1067 unittest.test("method--list", () { |
| 1068 |
| 1069 var mock = new common_test.HttpServerMock(); |
| 1070 api.ApisResourceApi res = new api.DiscoveryApi(mock).apis; |
| 1071 var arg_name = "foo"; |
| 1072 var arg_preferred = true; |
| 1073 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1074 var path = (req.url).path; |
| 1075 var pathOffset = 0; |
| 1076 var index; |
| 1077 var subPart; |
| 1078 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/discovery/v1/")); |
| 1079 pathOffset += 14; |
| 1080 unittest.expect(path.substring(pathOffset, pathOffset + 4), unittest.equ
als("apis")); |
| 1081 pathOffset += 4; |
| 1082 |
| 1083 var query = (req.url).query; |
| 1084 var queryOffset = 0; |
| 1085 var queryMap = {}; |
| 1086 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1087 parseBool(n) { |
| 1088 if (n == "true") return true; |
| 1089 if (n == "false") return false; |
| 1090 if (n == null) return null; |
| 1091 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1092 } |
| 1093 if (query.length > 0) { |
| 1094 for (var part in query.split("&")) { |
| 1095 var keyvalue = part.split("="); |
| 1096 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1097 } |
| 1098 } |
| 1099 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
| 1100 unittest.expect(queryMap["preferred"].first, unittest.equals("$arg_prefe
rred")); |
| 1101 |
| 1102 |
| 1103 var h = { |
| 1104 "content-type" : "application/json; charset=utf-8", |
| 1105 }; |
| 1106 var resp = convert.JSON.encode(buildDirectoryList()); |
| 1107 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 1108 }), true); |
| 1109 res.list(name: arg_name, preferred: arg_preferred).then(unittest.expectAsy
nc(((api.DirectoryList response) { |
| 1110 checkDirectoryList(response); |
| 1111 }))); |
| 1112 }); |
| 1113 |
| 1114 }); |
| 1115 |
| 1116 |
| 1117 } |
| 1118 |
OLD | NEW |