OLD | NEW |
(Empty) | |
| 1 library googleapis.partners.v2.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/partners/v2.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 buildCounterCertificationExamStatus = 0; |
| 55 buildCertificationExamStatus() { |
| 56 var o = new api.CertificationExamStatus(); |
| 57 buildCounterCertificationExamStatus++; |
| 58 if (buildCounterCertificationExamStatus < 3) { |
| 59 o.numberUsersPass = 42; |
| 60 o.type = "foo"; |
| 61 } |
| 62 buildCounterCertificationExamStatus--; |
| 63 return o; |
| 64 } |
| 65 |
| 66 checkCertificationExamStatus(api.CertificationExamStatus o) { |
| 67 buildCounterCertificationExamStatus++; |
| 68 if (buildCounterCertificationExamStatus < 3) { |
| 69 unittest.expect(o.numberUsersPass, unittest.equals(42)); |
| 70 unittest.expect(o.type, unittest.equals('foo')); |
| 71 } |
| 72 buildCounterCertificationExamStatus--; |
| 73 } |
| 74 |
| 75 buildUnnamed1964() { |
| 76 var o = new core.List<api.CertificationExamStatus>(); |
| 77 o.add(buildCertificationExamStatus()); |
| 78 o.add(buildCertificationExamStatus()); |
| 79 return o; |
| 80 } |
| 81 |
| 82 checkUnnamed1964(core.List<api.CertificationExamStatus> o) { |
| 83 unittest.expect(o, unittest.hasLength(2)); |
| 84 checkCertificationExamStatus(o[0]); |
| 85 checkCertificationExamStatus(o[1]); |
| 86 } |
| 87 |
| 88 core.int buildCounterCertificationStatus = 0; |
| 89 buildCertificationStatus() { |
| 90 var o = new api.CertificationStatus(); |
| 91 buildCounterCertificationStatus++; |
| 92 if (buildCounterCertificationStatus < 3) { |
| 93 o.examStatuses = buildUnnamed1964(); |
| 94 o.isCertified = true; |
| 95 o.type = "foo"; |
| 96 } |
| 97 buildCounterCertificationStatus--; |
| 98 return o; |
| 99 } |
| 100 |
| 101 checkCertificationStatus(api.CertificationStatus o) { |
| 102 buildCounterCertificationStatus++; |
| 103 if (buildCounterCertificationStatus < 3) { |
| 104 checkUnnamed1964(o.examStatuses); |
| 105 unittest.expect(o.isCertified, unittest.isTrue); |
| 106 unittest.expect(o.type, unittest.equals('foo')); |
| 107 } |
| 108 buildCounterCertificationStatus--; |
| 109 } |
| 110 |
| 111 buildUnnamed1965() { |
| 112 var o = new core.List<api.CertificationStatus>(); |
| 113 o.add(buildCertificationStatus()); |
| 114 o.add(buildCertificationStatus()); |
| 115 return o; |
| 116 } |
| 117 |
| 118 checkUnnamed1965(core.List<api.CertificationStatus> o) { |
| 119 unittest.expect(o, unittest.hasLength(2)); |
| 120 checkCertificationStatus(o[0]); |
| 121 checkCertificationStatus(o[1]); |
| 122 } |
| 123 |
| 124 buildUnnamed1966() { |
| 125 var o = new core.List<core.String>(); |
| 126 o.add("foo"); |
| 127 o.add("foo"); |
| 128 return o; |
| 129 } |
| 130 |
| 131 checkUnnamed1966(core.List<core.String> o) { |
| 132 unittest.expect(o, unittest.hasLength(2)); |
| 133 unittest.expect(o[0], unittest.equals('foo')); |
| 134 unittest.expect(o[1], unittest.equals('foo')); |
| 135 } |
| 136 |
| 137 buildUnnamed1967() { |
| 138 var o = new core.List<api.LocalizedCompanyInfo>(); |
| 139 o.add(buildLocalizedCompanyInfo()); |
| 140 o.add(buildLocalizedCompanyInfo()); |
| 141 return o; |
| 142 } |
| 143 |
| 144 checkUnnamed1967(core.List<api.LocalizedCompanyInfo> o) { |
| 145 unittest.expect(o, unittest.hasLength(2)); |
| 146 checkLocalizedCompanyInfo(o[0]); |
| 147 checkLocalizedCompanyInfo(o[1]); |
| 148 } |
| 149 |
| 150 buildUnnamed1968() { |
| 151 var o = new core.List<api.Location>(); |
| 152 o.add(buildLocation()); |
| 153 o.add(buildLocation()); |
| 154 return o; |
| 155 } |
| 156 |
| 157 checkUnnamed1968(core.List<api.Location> o) { |
| 158 unittest.expect(o, unittest.hasLength(2)); |
| 159 checkLocation(o[0]); |
| 160 checkLocation(o[1]); |
| 161 } |
| 162 |
| 163 buildUnnamed1969() { |
| 164 var o = new core.List<api.Rank>(); |
| 165 o.add(buildRank()); |
| 166 o.add(buildRank()); |
| 167 return o; |
| 168 } |
| 169 |
| 170 checkUnnamed1969(core.List<api.Rank> o) { |
| 171 unittest.expect(o, unittest.hasLength(2)); |
| 172 checkRank(o[0]); |
| 173 checkRank(o[1]); |
| 174 } |
| 175 |
| 176 buildUnnamed1970() { |
| 177 var o = new core.List<core.String>(); |
| 178 o.add("foo"); |
| 179 o.add("foo"); |
| 180 return o; |
| 181 } |
| 182 |
| 183 checkUnnamed1970(core.List<core.String> o) { |
| 184 unittest.expect(o, unittest.hasLength(2)); |
| 185 unittest.expect(o[0], unittest.equals('foo')); |
| 186 unittest.expect(o[1], unittest.equals('foo')); |
| 187 } |
| 188 |
| 189 core.int buildCounterCompany = 0; |
| 190 buildCompany() { |
| 191 var o = new api.Company(); |
| 192 buildCounterCompany++; |
| 193 if (buildCounterCompany < 3) { |
| 194 o.certificationStatuses = buildUnnamed1965(); |
| 195 o.convertedMinMonthlyBudget = buildMoney(); |
| 196 o.id = "foo"; |
| 197 o.industries = buildUnnamed1966(); |
| 198 o.localizedInfos = buildUnnamed1967(); |
| 199 o.locations = buildUnnamed1968(); |
| 200 o.name = "foo"; |
| 201 o.originalMinMonthlyBudget = buildMoney(); |
| 202 o.publicProfile = buildPublicProfile(); |
| 203 o.ranks = buildUnnamed1969(); |
| 204 o.services = buildUnnamed1970(); |
| 205 o.websiteUrl = "foo"; |
| 206 } |
| 207 buildCounterCompany--; |
| 208 return o; |
| 209 } |
| 210 |
| 211 checkCompany(api.Company o) { |
| 212 buildCounterCompany++; |
| 213 if (buildCounterCompany < 3) { |
| 214 checkUnnamed1965(o.certificationStatuses); |
| 215 checkMoney(o.convertedMinMonthlyBudget); |
| 216 unittest.expect(o.id, unittest.equals('foo')); |
| 217 checkUnnamed1966(o.industries); |
| 218 checkUnnamed1967(o.localizedInfos); |
| 219 checkUnnamed1968(o.locations); |
| 220 unittest.expect(o.name, unittest.equals('foo')); |
| 221 checkMoney(o.originalMinMonthlyBudget); |
| 222 checkPublicProfile(o.publicProfile); |
| 223 checkUnnamed1969(o.ranks); |
| 224 checkUnnamed1970(o.services); |
| 225 unittest.expect(o.websiteUrl, unittest.equals('foo')); |
| 226 } |
| 227 buildCounterCompany--; |
| 228 } |
| 229 |
| 230 core.int buildCounterCreateLeadRequest = 0; |
| 231 buildCreateLeadRequest() { |
| 232 var o = new api.CreateLeadRequest(); |
| 233 buildCounterCreateLeadRequest++; |
| 234 if (buildCounterCreateLeadRequest < 3) { |
| 235 o.lead = buildLead(); |
| 236 o.recaptchaChallenge = buildRecaptchaChallenge(); |
| 237 o.requestMetadata = buildRequestMetadata(); |
| 238 } |
| 239 buildCounterCreateLeadRequest--; |
| 240 return o; |
| 241 } |
| 242 |
| 243 checkCreateLeadRequest(api.CreateLeadRequest o) { |
| 244 buildCounterCreateLeadRequest++; |
| 245 if (buildCounterCreateLeadRequest < 3) { |
| 246 checkLead(o.lead); |
| 247 checkRecaptchaChallenge(o.recaptchaChallenge); |
| 248 checkRequestMetadata(o.requestMetadata); |
| 249 } |
| 250 buildCounterCreateLeadRequest--; |
| 251 } |
| 252 |
| 253 core.int buildCounterCreateLeadResponse = 0; |
| 254 buildCreateLeadResponse() { |
| 255 var o = new api.CreateLeadResponse(); |
| 256 buildCounterCreateLeadResponse++; |
| 257 if (buildCounterCreateLeadResponse < 3) { |
| 258 o.lead = buildLead(); |
| 259 o.recaptchaStatus = "foo"; |
| 260 o.responseMetadata = buildResponseMetadata(); |
| 261 } |
| 262 buildCounterCreateLeadResponse--; |
| 263 return o; |
| 264 } |
| 265 |
| 266 checkCreateLeadResponse(api.CreateLeadResponse o) { |
| 267 buildCounterCreateLeadResponse++; |
| 268 if (buildCounterCreateLeadResponse < 3) { |
| 269 checkLead(o.lead); |
| 270 unittest.expect(o.recaptchaStatus, unittest.equals('foo')); |
| 271 checkResponseMetadata(o.responseMetadata); |
| 272 } |
| 273 buildCounterCreateLeadResponse--; |
| 274 } |
| 275 |
| 276 core.int buildCounterDebugInfo = 0; |
| 277 buildDebugInfo() { |
| 278 var o = new api.DebugInfo(); |
| 279 buildCounterDebugInfo++; |
| 280 if (buildCounterDebugInfo < 3) { |
| 281 } |
| 282 buildCounterDebugInfo--; |
| 283 return o; |
| 284 } |
| 285 |
| 286 checkDebugInfo(api.DebugInfo o) { |
| 287 buildCounterDebugInfo++; |
| 288 if (buildCounterDebugInfo < 3) { |
| 289 } |
| 290 buildCounterDebugInfo--; |
| 291 } |
| 292 |
| 293 buildUnnamed1971() { |
| 294 var o = new core.List<core.String>(); |
| 295 o.add("foo"); |
| 296 o.add("foo"); |
| 297 return o; |
| 298 } |
| 299 |
| 300 checkUnnamed1971(core.List<core.String> o) { |
| 301 unittest.expect(o, unittest.hasLength(2)); |
| 302 unittest.expect(o[0], unittest.equals('foo')); |
| 303 unittest.expect(o[1], unittest.equals('foo')); |
| 304 } |
| 305 |
| 306 core.int buildCounterEventData = 0; |
| 307 buildEventData() { |
| 308 var o = new api.EventData(); |
| 309 buildCounterEventData++; |
| 310 if (buildCounterEventData < 3) { |
| 311 o.key = "foo"; |
| 312 o.values = buildUnnamed1971(); |
| 313 } |
| 314 buildCounterEventData--; |
| 315 return o; |
| 316 } |
| 317 |
| 318 checkEventData(api.EventData o) { |
| 319 buildCounterEventData++; |
| 320 if (buildCounterEventData < 3) { |
| 321 unittest.expect(o.key, unittest.equals('foo')); |
| 322 checkUnnamed1971(o.values); |
| 323 } |
| 324 buildCounterEventData--; |
| 325 } |
| 326 |
| 327 core.int buildCounterGetCompanyResponse = 0; |
| 328 buildGetCompanyResponse() { |
| 329 var o = new api.GetCompanyResponse(); |
| 330 buildCounterGetCompanyResponse++; |
| 331 if (buildCounterGetCompanyResponse < 3) { |
| 332 o.company = buildCompany(); |
| 333 o.responseMetadata = buildResponseMetadata(); |
| 334 } |
| 335 buildCounterGetCompanyResponse--; |
| 336 return o; |
| 337 } |
| 338 |
| 339 checkGetCompanyResponse(api.GetCompanyResponse o) { |
| 340 buildCounterGetCompanyResponse++; |
| 341 if (buildCounterGetCompanyResponse < 3) { |
| 342 checkCompany(o.company); |
| 343 checkResponseMetadata(o.responseMetadata); |
| 344 } |
| 345 buildCounterGetCompanyResponse--; |
| 346 } |
| 347 |
| 348 core.int buildCounterLatLng = 0; |
| 349 buildLatLng() { |
| 350 var o = new api.LatLng(); |
| 351 buildCounterLatLng++; |
| 352 if (buildCounterLatLng < 3) { |
| 353 o.latitude = 42.0; |
| 354 o.longitude = 42.0; |
| 355 } |
| 356 buildCounterLatLng--; |
| 357 return o; |
| 358 } |
| 359 |
| 360 checkLatLng(api.LatLng o) { |
| 361 buildCounterLatLng++; |
| 362 if (buildCounterLatLng < 3) { |
| 363 unittest.expect(o.latitude, unittest.equals(42.0)); |
| 364 unittest.expect(o.longitude, unittest.equals(42.0)); |
| 365 } |
| 366 buildCounterLatLng--; |
| 367 } |
| 368 |
| 369 buildUnnamed1972() { |
| 370 var o = new core.List<core.String>(); |
| 371 o.add("foo"); |
| 372 o.add("foo"); |
| 373 return o; |
| 374 } |
| 375 |
| 376 checkUnnamed1972(core.List<core.String> o) { |
| 377 unittest.expect(o, unittest.hasLength(2)); |
| 378 unittest.expect(o[0], unittest.equals('foo')); |
| 379 unittest.expect(o[1], unittest.equals('foo')); |
| 380 } |
| 381 |
| 382 core.int buildCounterLead = 0; |
| 383 buildLead() { |
| 384 var o = new api.Lead(); |
| 385 buildCounterLead++; |
| 386 if (buildCounterLead < 3) { |
| 387 o.comments = "foo"; |
| 388 o.email = "foo"; |
| 389 o.familyName = "foo"; |
| 390 o.givenName = "foo"; |
| 391 o.gpsMotivations = buildUnnamed1972(); |
| 392 o.id = "foo"; |
| 393 o.minMonthlyBudget = buildMoney(); |
| 394 o.phoneNumber = "foo"; |
| 395 o.type = "foo"; |
| 396 o.websiteUrl = "foo"; |
| 397 } |
| 398 buildCounterLead--; |
| 399 return o; |
| 400 } |
| 401 |
| 402 checkLead(api.Lead o) { |
| 403 buildCounterLead++; |
| 404 if (buildCounterLead < 3) { |
| 405 unittest.expect(o.comments, unittest.equals('foo')); |
| 406 unittest.expect(o.email, unittest.equals('foo')); |
| 407 unittest.expect(o.familyName, unittest.equals('foo')); |
| 408 unittest.expect(o.givenName, unittest.equals('foo')); |
| 409 checkUnnamed1972(o.gpsMotivations); |
| 410 unittest.expect(o.id, unittest.equals('foo')); |
| 411 checkMoney(o.minMonthlyBudget); |
| 412 unittest.expect(o.phoneNumber, unittest.equals('foo')); |
| 413 unittest.expect(o.type, unittest.equals('foo')); |
| 414 unittest.expect(o.websiteUrl, unittest.equals('foo')); |
| 415 } |
| 416 buildCounterLead--; |
| 417 } |
| 418 |
| 419 buildUnnamed1973() { |
| 420 var o = new core.List<api.Company>(); |
| 421 o.add(buildCompany()); |
| 422 o.add(buildCompany()); |
| 423 return o; |
| 424 } |
| 425 |
| 426 checkUnnamed1973(core.List<api.Company> o) { |
| 427 unittest.expect(o, unittest.hasLength(2)); |
| 428 checkCompany(o[0]); |
| 429 checkCompany(o[1]); |
| 430 } |
| 431 |
| 432 core.int buildCounterListCompaniesResponse = 0; |
| 433 buildListCompaniesResponse() { |
| 434 var o = new api.ListCompaniesResponse(); |
| 435 buildCounterListCompaniesResponse++; |
| 436 if (buildCounterListCompaniesResponse < 3) { |
| 437 o.companies = buildUnnamed1973(); |
| 438 o.nextPageToken = "foo"; |
| 439 o.responseMetadata = buildResponseMetadata(); |
| 440 } |
| 441 buildCounterListCompaniesResponse--; |
| 442 return o; |
| 443 } |
| 444 |
| 445 checkListCompaniesResponse(api.ListCompaniesResponse o) { |
| 446 buildCounterListCompaniesResponse++; |
| 447 if (buildCounterListCompaniesResponse < 3) { |
| 448 checkUnnamed1973(o.companies); |
| 449 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 450 checkResponseMetadata(o.responseMetadata); |
| 451 } |
| 452 buildCounterListCompaniesResponse--; |
| 453 } |
| 454 |
| 455 buildUnnamed1974() { |
| 456 var o = new core.List<core.String>(); |
| 457 o.add("foo"); |
| 458 o.add("foo"); |
| 459 return o; |
| 460 } |
| 461 |
| 462 checkUnnamed1974(core.List<core.String> o) { |
| 463 unittest.expect(o, unittest.hasLength(2)); |
| 464 unittest.expect(o[0], unittest.equals('foo')); |
| 465 unittest.expect(o[1], unittest.equals('foo')); |
| 466 } |
| 467 |
| 468 core.int buildCounterListUserStatesResponse = 0; |
| 469 buildListUserStatesResponse() { |
| 470 var o = new api.ListUserStatesResponse(); |
| 471 buildCounterListUserStatesResponse++; |
| 472 if (buildCounterListUserStatesResponse < 3) { |
| 473 o.responseMetadata = buildResponseMetadata(); |
| 474 o.userStates = buildUnnamed1974(); |
| 475 } |
| 476 buildCounterListUserStatesResponse--; |
| 477 return o; |
| 478 } |
| 479 |
| 480 checkListUserStatesResponse(api.ListUserStatesResponse o) { |
| 481 buildCounterListUserStatesResponse++; |
| 482 if (buildCounterListUserStatesResponse < 3) { |
| 483 checkResponseMetadata(o.responseMetadata); |
| 484 checkUnnamed1974(o.userStates); |
| 485 } |
| 486 buildCounterListUserStatesResponse--; |
| 487 } |
| 488 |
| 489 buildUnnamed1975() { |
| 490 var o = new core.List<core.String>(); |
| 491 o.add("foo"); |
| 492 o.add("foo"); |
| 493 return o; |
| 494 } |
| 495 |
| 496 checkUnnamed1975(core.List<core.String> o) { |
| 497 unittest.expect(o, unittest.hasLength(2)); |
| 498 unittest.expect(o[0], unittest.equals('foo')); |
| 499 unittest.expect(o[1], unittest.equals('foo')); |
| 500 } |
| 501 |
| 502 core.int buildCounterLocalizedCompanyInfo = 0; |
| 503 buildLocalizedCompanyInfo() { |
| 504 var o = new api.LocalizedCompanyInfo(); |
| 505 buildCounterLocalizedCompanyInfo++; |
| 506 if (buildCounterLocalizedCompanyInfo < 3) { |
| 507 o.countryCodes = buildUnnamed1975(); |
| 508 o.displayName = "foo"; |
| 509 o.languageCode = "foo"; |
| 510 o.overview = "foo"; |
| 511 } |
| 512 buildCounterLocalizedCompanyInfo--; |
| 513 return o; |
| 514 } |
| 515 |
| 516 checkLocalizedCompanyInfo(api.LocalizedCompanyInfo o) { |
| 517 buildCounterLocalizedCompanyInfo++; |
| 518 if (buildCounterLocalizedCompanyInfo < 3) { |
| 519 checkUnnamed1975(o.countryCodes); |
| 520 unittest.expect(o.displayName, unittest.equals('foo')); |
| 521 unittest.expect(o.languageCode, unittest.equals('foo')); |
| 522 unittest.expect(o.overview, unittest.equals('foo')); |
| 523 } |
| 524 buildCounterLocalizedCompanyInfo--; |
| 525 } |
| 526 |
| 527 core.int buildCounterLocation = 0; |
| 528 buildLocation() { |
| 529 var o = new api.Location(); |
| 530 buildCounterLocation++; |
| 531 if (buildCounterLocation < 3) { |
| 532 o.address = "foo"; |
| 533 o.latLng = buildLatLng(); |
| 534 } |
| 535 buildCounterLocation--; |
| 536 return o; |
| 537 } |
| 538 |
| 539 checkLocation(api.Location o) { |
| 540 buildCounterLocation++; |
| 541 if (buildCounterLocation < 3) { |
| 542 unittest.expect(o.address, unittest.equals('foo')); |
| 543 checkLatLng(o.latLng); |
| 544 } |
| 545 buildCounterLocation--; |
| 546 } |
| 547 |
| 548 buildUnnamed1976() { |
| 549 var o = new core.Map<core.String, core.String>(); |
| 550 o["x"] = "foo"; |
| 551 o["y"] = "foo"; |
| 552 return o; |
| 553 } |
| 554 |
| 555 checkUnnamed1976(core.Map<core.String, core.String> o) { |
| 556 unittest.expect(o, unittest.hasLength(2)); |
| 557 unittest.expect(o["x"], unittest.equals('foo')); |
| 558 unittest.expect(o["y"], unittest.equals('foo')); |
| 559 } |
| 560 |
| 561 core.int buildCounterLogMessageRequest = 0; |
| 562 buildLogMessageRequest() { |
| 563 var o = new api.LogMessageRequest(); |
| 564 buildCounterLogMessageRequest++; |
| 565 if (buildCounterLogMessageRequest < 3) { |
| 566 o.clientInfo = buildUnnamed1976(); |
| 567 o.details = "foo"; |
| 568 o.level = "foo"; |
| 569 o.requestMetadata = buildRequestMetadata(); |
| 570 } |
| 571 buildCounterLogMessageRequest--; |
| 572 return o; |
| 573 } |
| 574 |
| 575 checkLogMessageRequest(api.LogMessageRequest o) { |
| 576 buildCounterLogMessageRequest++; |
| 577 if (buildCounterLogMessageRequest < 3) { |
| 578 checkUnnamed1976(o.clientInfo); |
| 579 unittest.expect(o.details, unittest.equals('foo')); |
| 580 unittest.expect(o.level, unittest.equals('foo')); |
| 581 checkRequestMetadata(o.requestMetadata); |
| 582 } |
| 583 buildCounterLogMessageRequest--; |
| 584 } |
| 585 |
| 586 core.int buildCounterLogMessageResponse = 0; |
| 587 buildLogMessageResponse() { |
| 588 var o = new api.LogMessageResponse(); |
| 589 buildCounterLogMessageResponse++; |
| 590 if (buildCounterLogMessageResponse < 3) { |
| 591 o.responseMetadata = buildResponseMetadata(); |
| 592 } |
| 593 buildCounterLogMessageResponse--; |
| 594 return o; |
| 595 } |
| 596 |
| 597 checkLogMessageResponse(api.LogMessageResponse o) { |
| 598 buildCounterLogMessageResponse++; |
| 599 if (buildCounterLogMessageResponse < 3) { |
| 600 checkResponseMetadata(o.responseMetadata); |
| 601 } |
| 602 buildCounterLogMessageResponse--; |
| 603 } |
| 604 |
| 605 buildUnnamed1977() { |
| 606 var o = new core.List<api.EventData>(); |
| 607 o.add(buildEventData()); |
| 608 o.add(buildEventData()); |
| 609 return o; |
| 610 } |
| 611 |
| 612 checkUnnamed1977(core.List<api.EventData> o) { |
| 613 unittest.expect(o, unittest.hasLength(2)); |
| 614 checkEventData(o[0]); |
| 615 checkEventData(o[1]); |
| 616 } |
| 617 |
| 618 core.int buildCounterLogUserEventRequest = 0; |
| 619 buildLogUserEventRequest() { |
| 620 var o = new api.LogUserEventRequest(); |
| 621 buildCounterLogUserEventRequest++; |
| 622 if (buildCounterLogUserEventRequest < 3) { |
| 623 o.eventAction = "foo"; |
| 624 o.eventCategory = "foo"; |
| 625 o.eventDatas = buildUnnamed1977(); |
| 626 o.eventScope = "foo"; |
| 627 o.lead = buildLead(); |
| 628 o.requestMetadata = buildRequestMetadata(); |
| 629 o.url = "foo"; |
| 630 } |
| 631 buildCounterLogUserEventRequest--; |
| 632 return o; |
| 633 } |
| 634 |
| 635 checkLogUserEventRequest(api.LogUserEventRequest o) { |
| 636 buildCounterLogUserEventRequest++; |
| 637 if (buildCounterLogUserEventRequest < 3) { |
| 638 unittest.expect(o.eventAction, unittest.equals('foo')); |
| 639 unittest.expect(o.eventCategory, unittest.equals('foo')); |
| 640 checkUnnamed1977(o.eventDatas); |
| 641 unittest.expect(o.eventScope, unittest.equals('foo')); |
| 642 checkLead(o.lead); |
| 643 checkRequestMetadata(o.requestMetadata); |
| 644 unittest.expect(o.url, unittest.equals('foo')); |
| 645 } |
| 646 buildCounterLogUserEventRequest--; |
| 647 } |
| 648 |
| 649 core.int buildCounterLogUserEventResponse = 0; |
| 650 buildLogUserEventResponse() { |
| 651 var o = new api.LogUserEventResponse(); |
| 652 buildCounterLogUserEventResponse++; |
| 653 if (buildCounterLogUserEventResponse < 3) { |
| 654 o.responseMetadata = buildResponseMetadata(); |
| 655 } |
| 656 buildCounterLogUserEventResponse--; |
| 657 return o; |
| 658 } |
| 659 |
| 660 checkLogUserEventResponse(api.LogUserEventResponse o) { |
| 661 buildCounterLogUserEventResponse++; |
| 662 if (buildCounterLogUserEventResponse < 3) { |
| 663 checkResponseMetadata(o.responseMetadata); |
| 664 } |
| 665 buildCounterLogUserEventResponse--; |
| 666 } |
| 667 |
| 668 core.int buildCounterMoney = 0; |
| 669 buildMoney() { |
| 670 var o = new api.Money(); |
| 671 buildCounterMoney++; |
| 672 if (buildCounterMoney < 3) { |
| 673 o.currencyCode = "foo"; |
| 674 o.nanos = 42; |
| 675 o.units = "foo"; |
| 676 } |
| 677 buildCounterMoney--; |
| 678 return o; |
| 679 } |
| 680 |
| 681 checkMoney(api.Money o) { |
| 682 buildCounterMoney++; |
| 683 if (buildCounterMoney < 3) { |
| 684 unittest.expect(o.currencyCode, unittest.equals('foo')); |
| 685 unittest.expect(o.nanos, unittest.equals(42)); |
| 686 unittest.expect(o.units, unittest.equals('foo')); |
| 687 } |
| 688 buildCounterMoney--; |
| 689 } |
| 690 |
| 691 core.int buildCounterPublicProfile = 0; |
| 692 buildPublicProfile() { |
| 693 var o = new api.PublicProfile(); |
| 694 buildCounterPublicProfile++; |
| 695 if (buildCounterPublicProfile < 3) { |
| 696 o.displayImageUrl = "foo"; |
| 697 o.displayName = "foo"; |
| 698 o.id = "foo"; |
| 699 o.url = "foo"; |
| 700 } |
| 701 buildCounterPublicProfile--; |
| 702 return o; |
| 703 } |
| 704 |
| 705 checkPublicProfile(api.PublicProfile o) { |
| 706 buildCounterPublicProfile++; |
| 707 if (buildCounterPublicProfile < 3) { |
| 708 unittest.expect(o.displayImageUrl, unittest.equals('foo')); |
| 709 unittest.expect(o.displayName, unittest.equals('foo')); |
| 710 unittest.expect(o.id, unittest.equals('foo')); |
| 711 unittest.expect(o.url, unittest.equals('foo')); |
| 712 } |
| 713 buildCounterPublicProfile--; |
| 714 } |
| 715 |
| 716 core.int buildCounterRank = 0; |
| 717 buildRank() { |
| 718 var o = new api.Rank(); |
| 719 buildCounterRank++; |
| 720 if (buildCounterRank < 3) { |
| 721 o.type = "foo"; |
| 722 o.value = 42.0; |
| 723 } |
| 724 buildCounterRank--; |
| 725 return o; |
| 726 } |
| 727 |
| 728 checkRank(api.Rank o) { |
| 729 buildCounterRank++; |
| 730 if (buildCounterRank < 3) { |
| 731 unittest.expect(o.type, unittest.equals('foo')); |
| 732 unittest.expect(o.value, unittest.equals(42.0)); |
| 733 } |
| 734 buildCounterRank--; |
| 735 } |
| 736 |
| 737 core.int buildCounterRecaptchaChallenge = 0; |
| 738 buildRecaptchaChallenge() { |
| 739 var o = new api.RecaptchaChallenge(); |
| 740 buildCounterRecaptchaChallenge++; |
| 741 if (buildCounterRecaptchaChallenge < 3) { |
| 742 o.id = "foo"; |
| 743 o.response = "foo"; |
| 744 } |
| 745 buildCounterRecaptchaChallenge--; |
| 746 return o; |
| 747 } |
| 748 |
| 749 checkRecaptchaChallenge(api.RecaptchaChallenge o) { |
| 750 buildCounterRecaptchaChallenge++; |
| 751 if (buildCounterRecaptchaChallenge < 3) { |
| 752 unittest.expect(o.id, unittest.equals('foo')); |
| 753 unittest.expect(o.response, unittest.equals('foo')); |
| 754 } |
| 755 buildCounterRecaptchaChallenge--; |
| 756 } |
| 757 |
| 758 buildUnnamed1978() { |
| 759 var o = new core.List<core.String>(); |
| 760 o.add("foo"); |
| 761 o.add("foo"); |
| 762 return o; |
| 763 } |
| 764 |
| 765 checkUnnamed1978(core.List<core.String> o) { |
| 766 unittest.expect(o, unittest.hasLength(2)); |
| 767 unittest.expect(o[0], unittest.equals('foo')); |
| 768 unittest.expect(o[1], unittest.equals('foo')); |
| 769 } |
| 770 |
| 771 core.int buildCounterRequestMetadata = 0; |
| 772 buildRequestMetadata() { |
| 773 var o = new api.RequestMetadata(); |
| 774 buildCounterRequestMetadata++; |
| 775 if (buildCounterRequestMetadata < 3) { |
| 776 o.experimentIds = buildUnnamed1978(); |
| 777 o.locale = "foo"; |
| 778 o.partnersSessionId = "foo"; |
| 779 } |
| 780 buildCounterRequestMetadata--; |
| 781 return o; |
| 782 } |
| 783 |
| 784 checkRequestMetadata(api.RequestMetadata o) { |
| 785 buildCounterRequestMetadata++; |
| 786 if (buildCounterRequestMetadata < 3) { |
| 787 checkUnnamed1978(o.experimentIds); |
| 788 unittest.expect(o.locale, unittest.equals('foo')); |
| 789 unittest.expect(o.partnersSessionId, unittest.equals('foo')); |
| 790 } |
| 791 buildCounterRequestMetadata--; |
| 792 } |
| 793 |
| 794 core.int buildCounterResponseMetadata = 0; |
| 795 buildResponseMetadata() { |
| 796 var o = new api.ResponseMetadata(); |
| 797 buildCounterResponseMetadata++; |
| 798 if (buildCounterResponseMetadata < 3) { |
| 799 o.debugInfo = buildDebugInfo(); |
| 800 } |
| 801 buildCounterResponseMetadata--; |
| 802 return o; |
| 803 } |
| 804 |
| 805 checkResponseMetadata(api.ResponseMetadata o) { |
| 806 buildCounterResponseMetadata++; |
| 807 if (buildCounterResponseMetadata < 3) { |
| 808 checkDebugInfo(o.debugInfo); |
| 809 } |
| 810 buildCounterResponseMetadata--; |
| 811 } |
| 812 |
| 813 buildUnnamed1979() { |
| 814 var o = new core.List<core.String>(); |
| 815 o.add("foo"); |
| 816 o.add("foo"); |
| 817 return o; |
| 818 } |
| 819 |
| 820 checkUnnamed1979(core.List<core.String> o) { |
| 821 unittest.expect(o, unittest.hasLength(2)); |
| 822 unittest.expect(o[0], unittest.equals('foo')); |
| 823 unittest.expect(o[1], unittest.equals('foo')); |
| 824 } |
| 825 |
| 826 buildUnnamed1980() { |
| 827 var o = new core.List<core.String>(); |
| 828 o.add("foo"); |
| 829 o.add("foo"); |
| 830 return o; |
| 831 } |
| 832 |
| 833 checkUnnamed1980(core.List<core.String> o) { |
| 834 unittest.expect(o, unittest.hasLength(2)); |
| 835 unittest.expect(o[0], unittest.equals('foo')); |
| 836 unittest.expect(o[1], unittest.equals('foo')); |
| 837 } |
| 838 |
| 839 buildUnnamed1981() { |
| 840 var o = new core.List<core.String>(); |
| 841 o.add("foo"); |
| 842 o.add("foo"); |
| 843 return o; |
| 844 } |
| 845 |
| 846 checkUnnamed1981(core.List<core.String> o) { |
| 847 unittest.expect(o, unittest.hasLength(2)); |
| 848 unittest.expect(o[0], unittest.equals('foo')); |
| 849 unittest.expect(o[1], unittest.equals('foo')); |
| 850 } |
| 851 |
| 852 buildUnnamed1982() { |
| 853 var o = new core.List<core.String>(); |
| 854 o.add("foo"); |
| 855 o.add("foo"); |
| 856 return o; |
| 857 } |
| 858 |
| 859 checkUnnamed1982(core.List<core.String> o) { |
| 860 unittest.expect(o, unittest.hasLength(2)); |
| 861 unittest.expect(o[0], unittest.equals('foo')); |
| 862 unittest.expect(o[1], unittest.equals('foo')); |
| 863 } |
| 864 |
| 865 buildUnnamed1983() { |
| 866 var o = new core.List<core.String>(); |
| 867 o.add("foo"); |
| 868 o.add("foo"); |
| 869 return o; |
| 870 } |
| 871 |
| 872 checkUnnamed1983(core.List<core.String> o) { |
| 873 unittest.expect(o, unittest.hasLength(2)); |
| 874 unittest.expect(o[0], unittest.equals('foo')); |
| 875 unittest.expect(o[1], unittest.equals('foo')); |
| 876 } |
| 877 |
| 878 buildUnnamed1984() { |
| 879 var o = new core.List<core.String>(); |
| 880 o.add("foo"); |
| 881 o.add("foo"); |
| 882 return o; |
| 883 } |
| 884 |
| 885 checkUnnamed1984(core.List<core.String> o) { |
| 886 unittest.expect(o, unittest.hasLength(2)); |
| 887 unittest.expect(o[0], unittest.equals('foo')); |
| 888 unittest.expect(o[1], unittest.equals('foo')); |
| 889 } |
| 890 |
| 891 buildUnnamed1985() { |
| 892 var o = new core.List<core.String>(); |
| 893 o.add("foo"); |
| 894 o.add("foo"); |
| 895 return o; |
| 896 } |
| 897 |
| 898 checkUnnamed1985(core.List<core.String> o) { |
| 899 unittest.expect(o, unittest.hasLength(2)); |
| 900 unittest.expect(o[0], unittest.equals('foo')); |
| 901 unittest.expect(o[1], unittest.equals('foo')); |
| 902 } |
| 903 |
| 904 |
| 905 main() { |
| 906 unittest.group("obj-schema-CertificationExamStatus", () { |
| 907 unittest.test("to-json--from-json", () { |
| 908 var o = buildCertificationExamStatus(); |
| 909 var od = new api.CertificationExamStatus.fromJson(o.toJson()); |
| 910 checkCertificationExamStatus(od); |
| 911 }); |
| 912 }); |
| 913 |
| 914 |
| 915 unittest.group("obj-schema-CertificationStatus", () { |
| 916 unittest.test("to-json--from-json", () { |
| 917 var o = buildCertificationStatus(); |
| 918 var od = new api.CertificationStatus.fromJson(o.toJson()); |
| 919 checkCertificationStatus(od); |
| 920 }); |
| 921 }); |
| 922 |
| 923 |
| 924 unittest.group("obj-schema-Company", () { |
| 925 unittest.test("to-json--from-json", () { |
| 926 var o = buildCompany(); |
| 927 var od = new api.Company.fromJson(o.toJson()); |
| 928 checkCompany(od); |
| 929 }); |
| 930 }); |
| 931 |
| 932 |
| 933 unittest.group("obj-schema-CreateLeadRequest", () { |
| 934 unittest.test("to-json--from-json", () { |
| 935 var o = buildCreateLeadRequest(); |
| 936 var od = new api.CreateLeadRequest.fromJson(o.toJson()); |
| 937 checkCreateLeadRequest(od); |
| 938 }); |
| 939 }); |
| 940 |
| 941 |
| 942 unittest.group("obj-schema-CreateLeadResponse", () { |
| 943 unittest.test("to-json--from-json", () { |
| 944 var o = buildCreateLeadResponse(); |
| 945 var od = new api.CreateLeadResponse.fromJson(o.toJson()); |
| 946 checkCreateLeadResponse(od); |
| 947 }); |
| 948 }); |
| 949 |
| 950 |
| 951 unittest.group("obj-schema-DebugInfo", () { |
| 952 unittest.test("to-json--from-json", () { |
| 953 var o = buildDebugInfo(); |
| 954 var od = new api.DebugInfo.fromJson(o.toJson()); |
| 955 checkDebugInfo(od); |
| 956 }); |
| 957 }); |
| 958 |
| 959 |
| 960 unittest.group("obj-schema-EventData", () { |
| 961 unittest.test("to-json--from-json", () { |
| 962 var o = buildEventData(); |
| 963 var od = new api.EventData.fromJson(o.toJson()); |
| 964 checkEventData(od); |
| 965 }); |
| 966 }); |
| 967 |
| 968 |
| 969 unittest.group("obj-schema-GetCompanyResponse", () { |
| 970 unittest.test("to-json--from-json", () { |
| 971 var o = buildGetCompanyResponse(); |
| 972 var od = new api.GetCompanyResponse.fromJson(o.toJson()); |
| 973 checkGetCompanyResponse(od); |
| 974 }); |
| 975 }); |
| 976 |
| 977 |
| 978 unittest.group("obj-schema-LatLng", () { |
| 979 unittest.test("to-json--from-json", () { |
| 980 var o = buildLatLng(); |
| 981 var od = new api.LatLng.fromJson(o.toJson()); |
| 982 checkLatLng(od); |
| 983 }); |
| 984 }); |
| 985 |
| 986 |
| 987 unittest.group("obj-schema-Lead", () { |
| 988 unittest.test("to-json--from-json", () { |
| 989 var o = buildLead(); |
| 990 var od = new api.Lead.fromJson(o.toJson()); |
| 991 checkLead(od); |
| 992 }); |
| 993 }); |
| 994 |
| 995 |
| 996 unittest.group("obj-schema-ListCompaniesResponse", () { |
| 997 unittest.test("to-json--from-json", () { |
| 998 var o = buildListCompaniesResponse(); |
| 999 var od = new api.ListCompaniesResponse.fromJson(o.toJson()); |
| 1000 checkListCompaniesResponse(od); |
| 1001 }); |
| 1002 }); |
| 1003 |
| 1004 |
| 1005 unittest.group("obj-schema-ListUserStatesResponse", () { |
| 1006 unittest.test("to-json--from-json", () { |
| 1007 var o = buildListUserStatesResponse(); |
| 1008 var od = new api.ListUserStatesResponse.fromJson(o.toJson()); |
| 1009 checkListUserStatesResponse(od); |
| 1010 }); |
| 1011 }); |
| 1012 |
| 1013 |
| 1014 unittest.group("obj-schema-LocalizedCompanyInfo", () { |
| 1015 unittest.test("to-json--from-json", () { |
| 1016 var o = buildLocalizedCompanyInfo(); |
| 1017 var od = new api.LocalizedCompanyInfo.fromJson(o.toJson()); |
| 1018 checkLocalizedCompanyInfo(od); |
| 1019 }); |
| 1020 }); |
| 1021 |
| 1022 |
| 1023 unittest.group("obj-schema-Location", () { |
| 1024 unittest.test("to-json--from-json", () { |
| 1025 var o = buildLocation(); |
| 1026 var od = new api.Location.fromJson(o.toJson()); |
| 1027 checkLocation(od); |
| 1028 }); |
| 1029 }); |
| 1030 |
| 1031 |
| 1032 unittest.group("obj-schema-LogMessageRequest", () { |
| 1033 unittest.test("to-json--from-json", () { |
| 1034 var o = buildLogMessageRequest(); |
| 1035 var od = new api.LogMessageRequest.fromJson(o.toJson()); |
| 1036 checkLogMessageRequest(od); |
| 1037 }); |
| 1038 }); |
| 1039 |
| 1040 |
| 1041 unittest.group("obj-schema-LogMessageResponse", () { |
| 1042 unittest.test("to-json--from-json", () { |
| 1043 var o = buildLogMessageResponse(); |
| 1044 var od = new api.LogMessageResponse.fromJson(o.toJson()); |
| 1045 checkLogMessageResponse(od); |
| 1046 }); |
| 1047 }); |
| 1048 |
| 1049 |
| 1050 unittest.group("obj-schema-LogUserEventRequest", () { |
| 1051 unittest.test("to-json--from-json", () { |
| 1052 var o = buildLogUserEventRequest(); |
| 1053 var od = new api.LogUserEventRequest.fromJson(o.toJson()); |
| 1054 checkLogUserEventRequest(od); |
| 1055 }); |
| 1056 }); |
| 1057 |
| 1058 |
| 1059 unittest.group("obj-schema-LogUserEventResponse", () { |
| 1060 unittest.test("to-json--from-json", () { |
| 1061 var o = buildLogUserEventResponse(); |
| 1062 var od = new api.LogUserEventResponse.fromJson(o.toJson()); |
| 1063 checkLogUserEventResponse(od); |
| 1064 }); |
| 1065 }); |
| 1066 |
| 1067 |
| 1068 unittest.group("obj-schema-Money", () { |
| 1069 unittest.test("to-json--from-json", () { |
| 1070 var o = buildMoney(); |
| 1071 var od = new api.Money.fromJson(o.toJson()); |
| 1072 checkMoney(od); |
| 1073 }); |
| 1074 }); |
| 1075 |
| 1076 |
| 1077 unittest.group("obj-schema-PublicProfile", () { |
| 1078 unittest.test("to-json--from-json", () { |
| 1079 var o = buildPublicProfile(); |
| 1080 var od = new api.PublicProfile.fromJson(o.toJson()); |
| 1081 checkPublicProfile(od); |
| 1082 }); |
| 1083 }); |
| 1084 |
| 1085 |
| 1086 unittest.group("obj-schema-Rank", () { |
| 1087 unittest.test("to-json--from-json", () { |
| 1088 var o = buildRank(); |
| 1089 var od = new api.Rank.fromJson(o.toJson()); |
| 1090 checkRank(od); |
| 1091 }); |
| 1092 }); |
| 1093 |
| 1094 |
| 1095 unittest.group("obj-schema-RecaptchaChallenge", () { |
| 1096 unittest.test("to-json--from-json", () { |
| 1097 var o = buildRecaptchaChallenge(); |
| 1098 var od = new api.RecaptchaChallenge.fromJson(o.toJson()); |
| 1099 checkRecaptchaChallenge(od); |
| 1100 }); |
| 1101 }); |
| 1102 |
| 1103 |
| 1104 unittest.group("obj-schema-RequestMetadata", () { |
| 1105 unittest.test("to-json--from-json", () { |
| 1106 var o = buildRequestMetadata(); |
| 1107 var od = new api.RequestMetadata.fromJson(o.toJson()); |
| 1108 checkRequestMetadata(od); |
| 1109 }); |
| 1110 }); |
| 1111 |
| 1112 |
| 1113 unittest.group("obj-schema-ResponseMetadata", () { |
| 1114 unittest.test("to-json--from-json", () { |
| 1115 var o = buildResponseMetadata(); |
| 1116 var od = new api.ResponseMetadata.fromJson(o.toJson()); |
| 1117 checkResponseMetadata(od); |
| 1118 }); |
| 1119 }); |
| 1120 |
| 1121 |
| 1122 unittest.group("resource-ClientMessagesResourceApi", () { |
| 1123 unittest.test("method--log", () { |
| 1124 |
| 1125 var mock = new HttpServerMock(); |
| 1126 api.ClientMessagesResourceApi res = new api.PartnersApi(mock).clientMessag
es; |
| 1127 var arg_request = buildLogMessageRequest(); |
| 1128 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1129 var obj = new api.LogMessageRequest.fromJson(json); |
| 1130 checkLogMessageRequest(obj); |
| 1131 |
| 1132 var path = (req.url).path; |
| 1133 var pathOffset = 0; |
| 1134 var index; |
| 1135 var subPart; |
| 1136 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1137 pathOffset += 1; |
| 1138 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v2/clientMessages:log")); |
| 1139 pathOffset += 21; |
| 1140 |
| 1141 var query = (req.url).query; |
| 1142 var queryOffset = 0; |
| 1143 var queryMap = {}; |
| 1144 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1145 parseBool(n) { |
| 1146 if (n == "true") return true; |
| 1147 if (n == "false") return false; |
| 1148 if (n == null) return null; |
| 1149 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1150 } |
| 1151 if (query.length > 0) { |
| 1152 for (var part in query.split("&")) { |
| 1153 var keyvalue = part.split("="); |
| 1154 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1155 } |
| 1156 } |
| 1157 |
| 1158 |
| 1159 var h = { |
| 1160 "content-type" : "application/json; charset=utf-8", |
| 1161 }; |
| 1162 var resp = convert.JSON.encode(buildLogMessageResponse()); |
| 1163 return new async.Future.value(stringResponse(200, h, resp)); |
| 1164 }), true); |
| 1165 res.log(arg_request).then(unittest.expectAsync(((api.LogMessageResponse re
sponse) { |
| 1166 checkLogMessageResponse(response); |
| 1167 }))); |
| 1168 }); |
| 1169 |
| 1170 }); |
| 1171 |
| 1172 |
| 1173 unittest.group("resource-CompaniesResourceApi", () { |
| 1174 unittest.test("method--get", () { |
| 1175 |
| 1176 var mock = new HttpServerMock(); |
| 1177 api.CompaniesResourceApi res = new api.PartnersApi(mock).companies; |
| 1178 var arg_companyId = "foo"; |
| 1179 var arg_requestMetadata_locale = "foo"; |
| 1180 var arg_requestMetadata_partnersSessionId = "foo"; |
| 1181 var arg_requestMetadata_experimentIds = buildUnnamed1979(); |
| 1182 var arg_view = "foo"; |
| 1183 var arg_orderBy = "foo"; |
| 1184 var arg_currencyCode = "foo"; |
| 1185 var arg_address = "foo"; |
| 1186 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1187 var path = (req.url).path; |
| 1188 var pathOffset = 0; |
| 1189 var index; |
| 1190 var subPart; |
| 1191 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1192 pathOffset += 1; |
| 1193 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v2/companies/")); |
| 1194 pathOffset += 13; |
| 1195 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1196 pathOffset = path.length; |
| 1197 unittest.expect(subPart, unittest.equals("$arg_companyId")); |
| 1198 |
| 1199 var query = (req.url).query; |
| 1200 var queryOffset = 0; |
| 1201 var queryMap = {}; |
| 1202 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1203 parseBool(n) { |
| 1204 if (n == "true") return true; |
| 1205 if (n == "false") return false; |
| 1206 if (n == null) return null; |
| 1207 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1208 } |
| 1209 if (query.length > 0) { |
| 1210 for (var part in query.split("&")) { |
| 1211 var keyvalue = part.split("="); |
| 1212 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1213 } |
| 1214 } |
| 1215 unittest.expect(queryMap["requestMetadata.locale"].first, unittest.equal
s(arg_requestMetadata_locale)); |
| 1216 unittest.expect(queryMap["requestMetadata.partnersSessionId"].first, uni
ttest.equals(arg_requestMetadata_partnersSessionId)); |
| 1217 unittest.expect(queryMap["requestMetadata.experimentIds"], unittest.equa
ls(arg_requestMetadata_experimentIds)); |
| 1218 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 1219 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; |
| 1220 unittest.expect(queryMap["currencyCode"].first, unittest.equals(arg_curr
encyCode)); |
| 1221 unittest.expect(queryMap["address"].first, unittest.equals(arg_address))
; |
| 1222 |
| 1223 |
| 1224 var h = { |
| 1225 "content-type" : "application/json; charset=utf-8", |
| 1226 }; |
| 1227 var resp = convert.JSON.encode(buildGetCompanyResponse()); |
| 1228 return new async.Future.value(stringResponse(200, h, resp)); |
| 1229 }), true); |
| 1230 res.get(arg_companyId, requestMetadata_locale: arg_requestMetadata_locale,
requestMetadata_partnersSessionId: arg_requestMetadata_partnersSessionId, reque
stMetadata_experimentIds: arg_requestMetadata_experimentIds, view: arg_view, ord
erBy: arg_orderBy, currencyCode: arg_currencyCode, address: arg_address).then(un
ittest.expectAsync(((api.GetCompanyResponse response) { |
| 1231 checkGetCompanyResponse(response); |
| 1232 }))); |
| 1233 }); |
| 1234 |
| 1235 unittest.test("method--list", () { |
| 1236 |
| 1237 var mock = new HttpServerMock(); |
| 1238 api.CompaniesResourceApi res = new api.PartnersApi(mock).companies; |
| 1239 var arg_requestMetadata_locale = "foo"; |
| 1240 var arg_requestMetadata_partnersSessionId = "foo"; |
| 1241 var arg_requestMetadata_experimentIds = buildUnnamed1980(); |
| 1242 var arg_pageSize = 42; |
| 1243 var arg_pageToken = "foo"; |
| 1244 var arg_companyName = "foo"; |
| 1245 var arg_view = "foo"; |
| 1246 var arg_minMonthlyBudget_currencyCode = "foo"; |
| 1247 var arg_minMonthlyBudget_units = "foo"; |
| 1248 var arg_minMonthlyBudget_nanos = 42; |
| 1249 var arg_maxMonthlyBudget_currencyCode = "foo"; |
| 1250 var arg_maxMonthlyBudget_units = "foo"; |
| 1251 var arg_maxMonthlyBudget_nanos = 42; |
| 1252 var arg_industries = buildUnnamed1981(); |
| 1253 var arg_services = buildUnnamed1982(); |
| 1254 var arg_languageCodes = buildUnnamed1983(); |
| 1255 var arg_address = "foo"; |
| 1256 var arg_orderBy = "foo"; |
| 1257 var arg_gpsMotivations = buildUnnamed1984(); |
| 1258 var arg_websiteUrl = "foo"; |
| 1259 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1260 var path = (req.url).path; |
| 1261 var pathOffset = 0; |
| 1262 var index; |
| 1263 var subPart; |
| 1264 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1265 pathOffset += 1; |
| 1266 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v2/companies")); |
| 1267 pathOffset += 12; |
| 1268 |
| 1269 var query = (req.url).query; |
| 1270 var queryOffset = 0; |
| 1271 var queryMap = {}; |
| 1272 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1273 parseBool(n) { |
| 1274 if (n == "true") return true; |
| 1275 if (n == "false") return false; |
| 1276 if (n == null) return null; |
| 1277 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1278 } |
| 1279 if (query.length > 0) { |
| 1280 for (var part in query.split("&")) { |
| 1281 var keyvalue = part.split("="); |
| 1282 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1283 } |
| 1284 } |
| 1285 unittest.expect(queryMap["requestMetadata.locale"].first, unittest.equal
s(arg_requestMetadata_locale)); |
| 1286 unittest.expect(queryMap["requestMetadata.partnersSessionId"].first, uni
ttest.equals(arg_requestMetadata_partnersSessionId)); |
| 1287 unittest.expect(queryMap["requestMetadata.experimentIds"], unittest.equa
ls(arg_requestMetadata_experimentIds)); |
| 1288 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1289 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1290 unittest.expect(queryMap["companyName"].first, unittest.equals(arg_compa
nyName)); |
| 1291 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 1292 unittest.expect(queryMap["minMonthlyBudget.currencyCode"].first, unittes
t.equals(arg_minMonthlyBudget_currencyCode)); |
| 1293 unittest.expect(queryMap["minMonthlyBudget.units"].first, unittest.equal
s(arg_minMonthlyBudget_units)); |
| 1294 unittest.expect(core.int.parse(queryMap["minMonthlyBudget.nanos"].first)
, unittest.equals(arg_minMonthlyBudget_nanos)); |
| 1295 unittest.expect(queryMap["maxMonthlyBudget.currencyCode"].first, unittes
t.equals(arg_maxMonthlyBudget_currencyCode)); |
| 1296 unittest.expect(queryMap["maxMonthlyBudget.units"].first, unittest.equal
s(arg_maxMonthlyBudget_units)); |
| 1297 unittest.expect(core.int.parse(queryMap["maxMonthlyBudget.nanos"].first)
, unittest.equals(arg_maxMonthlyBudget_nanos)); |
| 1298 unittest.expect(queryMap["industries"], unittest.equals(arg_industries))
; |
| 1299 unittest.expect(queryMap["services"], unittest.equals(arg_services)); |
| 1300 unittest.expect(queryMap["languageCodes"], unittest.equals(arg_languageC
odes)); |
| 1301 unittest.expect(queryMap["address"].first, unittest.equals(arg_address))
; |
| 1302 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; |
| 1303 unittest.expect(queryMap["gpsMotivations"], unittest.equals(arg_gpsMotiv
ations)); |
| 1304 unittest.expect(queryMap["websiteUrl"].first, unittest.equals(arg_websit
eUrl)); |
| 1305 |
| 1306 |
| 1307 var h = { |
| 1308 "content-type" : "application/json; charset=utf-8", |
| 1309 }; |
| 1310 var resp = convert.JSON.encode(buildListCompaniesResponse()); |
| 1311 return new async.Future.value(stringResponse(200, h, resp)); |
| 1312 }), true); |
| 1313 res.list(requestMetadata_locale: arg_requestMetadata_locale, requestMetada
ta_partnersSessionId: arg_requestMetadata_partnersSessionId, requestMetadata_exp
erimentIds: arg_requestMetadata_experimentIds, pageSize: arg_pageSize, pageToken
: arg_pageToken, companyName: arg_companyName, view: arg_view, minMonthlyBudget_
currencyCode: arg_minMonthlyBudget_currencyCode, minMonthlyBudget_units: arg_min
MonthlyBudget_units, minMonthlyBudget_nanos: arg_minMonthlyBudget_nanos, maxMont
hlyBudget_currencyCode: arg_maxMonthlyBudget_currencyCode, maxMonthlyBudget_unit
s: arg_maxMonthlyBudget_units, maxMonthlyBudget_nanos: arg_maxMonthlyBudget_nano
s, industries: arg_industries, services: arg_services, languageCodes: arg_langua
geCodes, address: arg_address, orderBy: arg_orderBy, gpsMotivations: arg_gpsMoti
vations, websiteUrl: arg_websiteUrl).then(unittest.expectAsync(((api.ListCompani
esResponse response) { |
| 1314 checkListCompaniesResponse(response); |
| 1315 }))); |
| 1316 }); |
| 1317 |
| 1318 }); |
| 1319 |
| 1320 |
| 1321 unittest.group("resource-CompaniesLeadsResourceApi", () { |
| 1322 unittest.test("method--create", () { |
| 1323 |
| 1324 var mock = new HttpServerMock(); |
| 1325 api.CompaniesLeadsResourceApi res = new api.PartnersApi(mock).companies.le
ads; |
| 1326 var arg_request = buildCreateLeadRequest(); |
| 1327 var arg_companyId = "foo"; |
| 1328 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1329 var obj = new api.CreateLeadRequest.fromJson(json); |
| 1330 checkCreateLeadRequest(obj); |
| 1331 |
| 1332 var path = (req.url).path; |
| 1333 var pathOffset = 0; |
| 1334 var index; |
| 1335 var subPart; |
| 1336 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1337 pathOffset += 1; |
| 1338 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v2/companies/")); |
| 1339 pathOffset += 13; |
| 1340 index = path.indexOf("/leads", pathOffset); |
| 1341 unittest.expect(index >= 0, unittest.isTrue); |
| 1342 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1343 pathOffset = index; |
| 1344 unittest.expect(subPart, unittest.equals("$arg_companyId")); |
| 1345 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/leads")); |
| 1346 pathOffset += 6; |
| 1347 |
| 1348 var query = (req.url).query; |
| 1349 var queryOffset = 0; |
| 1350 var queryMap = {}; |
| 1351 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1352 parseBool(n) { |
| 1353 if (n == "true") return true; |
| 1354 if (n == "false") return false; |
| 1355 if (n == null) return null; |
| 1356 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1357 } |
| 1358 if (query.length > 0) { |
| 1359 for (var part in query.split("&")) { |
| 1360 var keyvalue = part.split("="); |
| 1361 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1362 } |
| 1363 } |
| 1364 |
| 1365 |
| 1366 var h = { |
| 1367 "content-type" : "application/json; charset=utf-8", |
| 1368 }; |
| 1369 var resp = convert.JSON.encode(buildCreateLeadResponse()); |
| 1370 return new async.Future.value(stringResponse(200, h, resp)); |
| 1371 }), true); |
| 1372 res.create(arg_request, arg_companyId).then(unittest.expectAsync(((api.Cre
ateLeadResponse response) { |
| 1373 checkCreateLeadResponse(response); |
| 1374 }))); |
| 1375 }); |
| 1376 |
| 1377 }); |
| 1378 |
| 1379 |
| 1380 unittest.group("resource-UserEventsResourceApi", () { |
| 1381 unittest.test("method--log", () { |
| 1382 |
| 1383 var mock = new HttpServerMock(); |
| 1384 api.UserEventsResourceApi res = new api.PartnersApi(mock).userEvents; |
| 1385 var arg_request = buildLogUserEventRequest(); |
| 1386 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1387 var obj = new api.LogUserEventRequest.fromJson(json); |
| 1388 checkLogUserEventRequest(obj); |
| 1389 |
| 1390 var path = (req.url).path; |
| 1391 var pathOffset = 0; |
| 1392 var index; |
| 1393 var subPart; |
| 1394 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1395 pathOffset += 1; |
| 1396 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v2/userEvents:log")); |
| 1397 pathOffset += 17; |
| 1398 |
| 1399 var query = (req.url).query; |
| 1400 var queryOffset = 0; |
| 1401 var queryMap = {}; |
| 1402 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1403 parseBool(n) { |
| 1404 if (n == "true") return true; |
| 1405 if (n == "false") return false; |
| 1406 if (n == null) return null; |
| 1407 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1408 } |
| 1409 if (query.length > 0) { |
| 1410 for (var part in query.split("&")) { |
| 1411 var keyvalue = part.split("="); |
| 1412 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1413 } |
| 1414 } |
| 1415 |
| 1416 |
| 1417 var h = { |
| 1418 "content-type" : "application/json; charset=utf-8", |
| 1419 }; |
| 1420 var resp = convert.JSON.encode(buildLogUserEventResponse()); |
| 1421 return new async.Future.value(stringResponse(200, h, resp)); |
| 1422 }), true); |
| 1423 res.log(arg_request).then(unittest.expectAsync(((api.LogUserEventResponse
response) { |
| 1424 checkLogUserEventResponse(response); |
| 1425 }))); |
| 1426 }); |
| 1427 |
| 1428 }); |
| 1429 |
| 1430 |
| 1431 unittest.group("resource-UserStatesResourceApi", () { |
| 1432 unittest.test("method--list", () { |
| 1433 |
| 1434 var mock = new HttpServerMock(); |
| 1435 api.UserStatesResourceApi res = new api.PartnersApi(mock).userStates; |
| 1436 var arg_requestMetadata_locale = "foo"; |
| 1437 var arg_requestMetadata_partnersSessionId = "foo"; |
| 1438 var arg_requestMetadata_experimentIds = buildUnnamed1985(); |
| 1439 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1440 var path = (req.url).path; |
| 1441 var pathOffset = 0; |
| 1442 var index; |
| 1443 var subPart; |
| 1444 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1445 pathOffset += 1; |
| 1446 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v2/userStates")); |
| 1447 pathOffset += 13; |
| 1448 |
| 1449 var query = (req.url).query; |
| 1450 var queryOffset = 0; |
| 1451 var queryMap = {}; |
| 1452 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1453 parseBool(n) { |
| 1454 if (n == "true") return true; |
| 1455 if (n == "false") return false; |
| 1456 if (n == null) return null; |
| 1457 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1458 } |
| 1459 if (query.length > 0) { |
| 1460 for (var part in query.split("&")) { |
| 1461 var keyvalue = part.split("="); |
| 1462 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1463 } |
| 1464 } |
| 1465 unittest.expect(queryMap["requestMetadata.locale"].first, unittest.equal
s(arg_requestMetadata_locale)); |
| 1466 unittest.expect(queryMap["requestMetadata.partnersSessionId"].first, uni
ttest.equals(arg_requestMetadata_partnersSessionId)); |
| 1467 unittest.expect(queryMap["requestMetadata.experimentIds"], unittest.equa
ls(arg_requestMetadata_experimentIds)); |
| 1468 |
| 1469 |
| 1470 var h = { |
| 1471 "content-type" : "application/json; charset=utf-8", |
| 1472 }; |
| 1473 var resp = convert.JSON.encode(buildListUserStatesResponse()); |
| 1474 return new async.Future.value(stringResponse(200, h, resp)); |
| 1475 }), true); |
| 1476 res.list(requestMetadata_locale: arg_requestMetadata_locale, requestMetada
ta_partnersSessionId: arg_requestMetadata_partnersSessionId, requestMetadata_exp
erimentIds: arg_requestMetadata_experimentIds).then(unittest.expectAsync(((api.L
istUserStatesResponse response) { |
| 1477 checkListUserStatesResponse(response); |
| 1478 }))); |
| 1479 }); |
| 1480 |
| 1481 }); |
| 1482 |
| 1483 |
| 1484 } |
| 1485 |
OLD | NEW |