Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: generated/googleapis/test/reseller/v1_test.dart

Issue 1078053002: Roll of googleapis as of 4/7/2015. (Closed) Base URL: https://github.com/dart-lang/googleapis.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis.reseller.v1.test; 1 library googleapis.reseller.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:unittest/unittest.dart' as unittest; 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 11
15 import 'package:googleapis/reseller/v1.dart' as api; 12 import 'package:googleapis/reseller/v1.dart' as api;
16 13
14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback;
16 core.bool _expectJson;
17 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 }
18 53
19 core.int buildCounterAddress = 0; 54 core.int buildCounterAddress = 0;
20 buildAddress() { 55 buildAddress() {
21 var o = new api.Address(); 56 var o = new api.Address();
22 buildCounterAddress++; 57 buildCounterAddress++;
23 if (buildCounterAddress < 3) { 58 if (buildCounterAddress < 3) {
24 o.addressLine1 = "foo"; 59 o.addressLine1 = "foo";
25 o.addressLine2 = "foo"; 60 o.addressLine2 = "foo";
26 o.addressLine3 = "foo"; 61 o.addressLine3 = "foo";
27 o.contactName = "foo"; 62 o.contactName = "foo";
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 checkSeats(o.seats); 314 checkSeats(o.seats);
280 unittest.expect(o.skuId, unittest.equals('foo')); 315 unittest.expect(o.skuId, unittest.equals('foo'));
281 unittest.expect(o.status, unittest.equals('foo')); 316 unittest.expect(o.status, unittest.equals('foo'));
282 unittest.expect(o.subscriptionId, unittest.equals('foo')); 317 unittest.expect(o.subscriptionId, unittest.equals('foo'));
283 checkSubscriptionTransferInfo(o.transferInfo); 318 checkSubscriptionTransferInfo(o.transferInfo);
284 checkSubscriptionTrialSettings(o.trialSettings); 319 checkSubscriptionTrialSettings(o.trialSettings);
285 } 320 }
286 buildCounterSubscription--; 321 buildCounterSubscription--;
287 } 322 }
288 323
289 buildUnnamed1332() { 324 buildUnnamed1326() {
290 var o = new core.List<api.Subscription>(); 325 var o = new core.List<api.Subscription>();
291 o.add(buildSubscription()); 326 o.add(buildSubscription());
292 o.add(buildSubscription()); 327 o.add(buildSubscription());
293 return o; 328 return o;
294 } 329 }
295 330
296 checkUnnamed1332(core.List<api.Subscription> o) { 331 checkUnnamed1326(core.List<api.Subscription> o) {
297 unittest.expect(o, unittest.hasLength(2)); 332 unittest.expect(o, unittest.hasLength(2));
298 checkSubscription(o[0]); 333 checkSubscription(o[0]);
299 checkSubscription(o[1]); 334 checkSubscription(o[1]);
300 } 335 }
301 336
302 core.int buildCounterSubscriptions = 0; 337 core.int buildCounterSubscriptions = 0;
303 buildSubscriptions() { 338 buildSubscriptions() {
304 var o = new api.Subscriptions(); 339 var o = new api.Subscriptions();
305 buildCounterSubscriptions++; 340 buildCounterSubscriptions++;
306 if (buildCounterSubscriptions < 3) { 341 if (buildCounterSubscriptions < 3) {
307 o.kind = "foo"; 342 o.kind = "foo";
308 o.nextPageToken = "foo"; 343 o.nextPageToken = "foo";
309 o.subscriptions = buildUnnamed1332(); 344 o.subscriptions = buildUnnamed1326();
310 } 345 }
311 buildCounterSubscriptions--; 346 buildCounterSubscriptions--;
312 return o; 347 return o;
313 } 348 }
314 349
315 checkSubscriptions(api.Subscriptions o) { 350 checkSubscriptions(api.Subscriptions o) {
316 buildCounterSubscriptions++; 351 buildCounterSubscriptions++;
317 if (buildCounterSubscriptions < 3) { 352 if (buildCounterSubscriptions < 3) {
318 unittest.expect(o.kind, unittest.equals('foo')); 353 unittest.expect(o.kind, unittest.equals('foo'));
319 unittest.expect(o.nextPageToken, unittest.equals('foo')); 354 unittest.expect(o.nextPageToken, unittest.equals('foo'));
320 checkUnnamed1332(o.subscriptions); 355 checkUnnamed1326(o.subscriptions);
321 } 356 }
322 buildCounterSubscriptions--; 357 buildCounterSubscriptions--;
323 } 358 }
324 359
325 360
326 main() { 361 main() {
327 unittest.group("obj-schema-Address", () { 362 unittest.group("obj-schema-Address", () {
328 unittest.test("to-json--from-json", () { 363 unittest.test("to-json--from-json", () {
329 var o = buildAddress(); 364 var o = buildAddress();
330 var od = new api.Address.fromJson(o.toJson()); 365 var od = new api.Address.fromJson(o.toJson());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 var o = buildSubscriptions(); 454 var o = buildSubscriptions();
420 var od = new api.Subscriptions.fromJson(o.toJson()); 455 var od = new api.Subscriptions.fromJson(o.toJson());
421 checkSubscriptions(od); 456 checkSubscriptions(od);
422 }); 457 });
423 }); 458 });
424 459
425 460
426 unittest.group("resource-CustomersResourceApi", () { 461 unittest.group("resource-CustomersResourceApi", () {
427 unittest.test("method--get", () { 462 unittest.test("method--get", () {
428 463
429 var mock = new common_test.HttpServerMock(); 464 var mock = new HttpServerMock();
430 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; 465 api.CustomersResourceApi res = new api.ResellerApi(mock).customers;
431 var arg_customerId = "foo"; 466 var arg_customerId = "foo";
432 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 467 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
433 var path = (req.url).path; 468 var path = (req.url).path;
434 var pathOffset = 0; 469 var pathOffset = 0;
435 var index; 470 var index;
436 var subPart; 471 var subPart;
437 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 472 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
438 pathOffset += 1; 473 pathOffset += 1;
439 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("apps/reseller/v1/")); 474 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq uals("apps/reseller/v1/"));
(...skipping 19 matching lines...) Expand all
459 var keyvalue = part.split("="); 494 var keyvalue = part.split("=");
460 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 495 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
461 } 496 }
462 } 497 }
463 498
464 499
465 var h = { 500 var h = {
466 "content-type" : "application/json; charset=utf-8", 501 "content-type" : "application/json; charset=utf-8",
467 }; 502 };
468 var resp = convert.JSON.encode(buildCustomer()); 503 var resp = convert.JSON.encode(buildCustomer());
469 return new async.Future.value(common_test.stringResponse(200, h, resp)); 504 return new async.Future.value(stringResponse(200, h, resp));
470 }), true); 505 }), true);
471 res.get(arg_customerId).then(unittest.expectAsync(((api.Customer response) { 506 res.get(arg_customerId).then(unittest.expectAsync(((api.Customer response) {
472 checkCustomer(response); 507 checkCustomer(response);
473 }))); 508 })));
474 }); 509 });
475 510
476 unittest.test("method--insert", () { 511 unittest.test("method--insert", () {
477 512
478 var mock = new common_test.HttpServerMock(); 513 var mock = new HttpServerMock();
479 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; 514 api.CustomersResourceApi res = new api.ResellerApi(mock).customers;
480 var arg_request = buildCustomer(); 515 var arg_request = buildCustomer();
481 var arg_customerAuthToken = "foo"; 516 var arg_customerAuthToken = "foo";
482 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 517 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
483 var obj = new api.Customer.fromJson(json); 518 var obj = new api.Customer.fromJson(json);
484 checkCustomer(obj); 519 checkCustomer(obj);
485 520
486 var path = (req.url).path; 521 var path = (req.url).path;
487 var pathOffset = 0; 522 var pathOffset = 0;
488 var index; 523 var index;
(...skipping 21 matching lines...) Expand all
510 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 545 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
511 } 546 }
512 } 547 }
513 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg _customerAuthToken)); 548 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg _customerAuthToken));
514 549
515 550
516 var h = { 551 var h = {
517 "content-type" : "application/json; charset=utf-8", 552 "content-type" : "application/json; charset=utf-8",
518 }; 553 };
519 var resp = convert.JSON.encode(buildCustomer()); 554 var resp = convert.JSON.encode(buildCustomer());
520 return new async.Future.value(common_test.stringResponse(200, h, resp)); 555 return new async.Future.value(stringResponse(200, h, resp));
521 }), true); 556 }), true);
522 res.insert(arg_request, customerAuthToken: arg_customerAuthToken).then(uni ttest.expectAsync(((api.Customer response) { 557 res.insert(arg_request, customerAuthToken: arg_customerAuthToken).then(uni ttest.expectAsync(((api.Customer response) {
523 checkCustomer(response); 558 checkCustomer(response);
524 }))); 559 })));
525 }); 560 });
526 561
527 unittest.test("method--patch", () { 562 unittest.test("method--patch", () {
528 563
529 var mock = new common_test.HttpServerMock(); 564 var mock = new HttpServerMock();
530 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; 565 api.CustomersResourceApi res = new api.ResellerApi(mock).customers;
531 var arg_request = buildCustomer(); 566 var arg_request = buildCustomer();
532 var arg_customerId = "foo"; 567 var arg_customerId = "foo";
533 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 568 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
534 var obj = new api.Customer.fromJson(json); 569 var obj = new api.Customer.fromJson(json);
535 checkCustomer(obj); 570 checkCustomer(obj);
536 571
537 var path = (req.url).path; 572 var path = (req.url).path;
538 var pathOffset = 0; 573 var pathOffset = 0;
539 var index; 574 var index;
(...skipping 23 matching lines...) Expand all
563 var keyvalue = part.split("="); 598 var keyvalue = part.split("=");
564 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 599 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
565 } 600 }
566 } 601 }
567 602
568 603
569 var h = { 604 var h = {
570 "content-type" : "application/json; charset=utf-8", 605 "content-type" : "application/json; charset=utf-8",
571 }; 606 };
572 var resp = convert.JSON.encode(buildCustomer()); 607 var resp = convert.JSON.encode(buildCustomer());
573 return new async.Future.value(common_test.stringResponse(200, h, resp)); 608 return new async.Future.value(stringResponse(200, h, resp));
574 }), true); 609 }), true);
575 res.patch(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cus tomer response) { 610 res.patch(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cus tomer response) {
576 checkCustomer(response); 611 checkCustomer(response);
577 }))); 612 })));
578 }); 613 });
579 614
580 unittest.test("method--update", () { 615 unittest.test("method--update", () {
581 616
582 var mock = new common_test.HttpServerMock(); 617 var mock = new HttpServerMock();
583 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; 618 api.CustomersResourceApi res = new api.ResellerApi(mock).customers;
584 var arg_request = buildCustomer(); 619 var arg_request = buildCustomer();
585 var arg_customerId = "foo"; 620 var arg_customerId = "foo";
586 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 621 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
587 var obj = new api.Customer.fromJson(json); 622 var obj = new api.Customer.fromJson(json);
588 checkCustomer(obj); 623 checkCustomer(obj);
589 624
590 var path = (req.url).path; 625 var path = (req.url).path;
591 var pathOffset = 0; 626 var pathOffset = 0;
592 var index; 627 var index;
(...skipping 23 matching lines...) Expand all
616 var keyvalue = part.split("="); 651 var keyvalue = part.split("=");
617 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 652 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
618 } 653 }
619 } 654 }
620 655
621 656
622 var h = { 657 var h = {
623 "content-type" : "application/json; charset=utf-8", 658 "content-type" : "application/json; charset=utf-8",
624 }; 659 };
625 var resp = convert.JSON.encode(buildCustomer()); 660 var resp = convert.JSON.encode(buildCustomer());
626 return new async.Future.value(common_test.stringResponse(200, h, resp)); 661 return new async.Future.value(stringResponse(200, h, resp));
627 }), true); 662 }), true);
628 res.update(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cu stomer response) { 663 res.update(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cu stomer response) {
629 checkCustomer(response); 664 checkCustomer(response);
630 }))); 665 })));
631 }); 666 });
632 667
633 }); 668 });
634 669
635 670
636 unittest.group("resource-SubscriptionsResourceApi", () { 671 unittest.group("resource-SubscriptionsResourceApi", () {
637 unittest.test("method--activate", () { 672 unittest.test("method--activate", () {
638 673
639 var mock = new common_test.HttpServerMock(); 674 var mock = new HttpServerMock();
640 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 675 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
641 var arg_customerId = "foo"; 676 var arg_customerId = "foo";
642 var arg_subscriptionId = "foo"; 677 var arg_subscriptionId = "foo";
643 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 678 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
644 var path = (req.url).path; 679 var path = (req.url).path;
645 var pathOffset = 0; 680 var pathOffset = 0;
646 var index; 681 var index;
647 var subPart; 682 var subPart;
648 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 683 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
649 pathOffset += 1; 684 pathOffset += 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 var keyvalue = part.split("="); 716 var keyvalue = part.split("=");
682 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 717 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
683 } 718 }
684 } 719 }
685 720
686 721
687 var h = { 722 var h = {
688 "content-type" : "application/json; charset=utf-8", 723 "content-type" : "application/json; charset=utf-8",
689 }; 724 };
690 var resp = convert.JSON.encode(buildSubscription()); 725 var resp = convert.JSON.encode(buildSubscription());
691 return new async.Future.value(common_test.stringResponse(200, h, resp)); 726 return new async.Future.value(stringResponse(200, h, resp));
692 }), true); 727 }), true);
693 res.activate(arg_customerId, arg_subscriptionId).then(unittest.expectAsync (((api.Subscription response) { 728 res.activate(arg_customerId, arg_subscriptionId).then(unittest.expectAsync (((api.Subscription response) {
694 checkSubscription(response); 729 checkSubscription(response);
695 }))); 730 })));
696 }); 731 });
697 732
698 unittest.test("method--changePlan", () { 733 unittest.test("method--changePlan", () {
699 734
700 var mock = new common_test.HttpServerMock(); 735 var mock = new HttpServerMock();
701 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 736 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
702 var arg_request = buildChangePlanRequest(); 737 var arg_request = buildChangePlanRequest();
703 var arg_customerId = "foo"; 738 var arg_customerId = "foo";
704 var arg_subscriptionId = "foo"; 739 var arg_subscriptionId = "foo";
705 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 740 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
706 var obj = new api.ChangePlanRequest.fromJson(json); 741 var obj = new api.ChangePlanRequest.fromJson(json);
707 checkChangePlanRequest(obj); 742 checkChangePlanRequest(obj);
708 743
709 var path = (req.url).path; 744 var path = (req.url).path;
710 var pathOffset = 0; 745 var pathOffset = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 var keyvalue = part.split("="); 781 var keyvalue = part.split("=");
747 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 782 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
748 } 783 }
749 } 784 }
750 785
751 786
752 var h = { 787 var h = {
753 "content-type" : "application/json; charset=utf-8", 788 "content-type" : "application/json; charset=utf-8",
754 }; 789 };
755 var resp = convert.JSON.encode(buildSubscription()); 790 var resp = convert.JSON.encode(buildSubscription());
756 return new async.Future.value(common_test.stringResponse(200, h, resp)); 791 return new async.Future.value(stringResponse(200, h, resp));
757 }), true); 792 }), true);
758 res.changePlan(arg_request, arg_customerId, arg_subscriptionId).then(unitt est.expectAsync(((api.Subscription response) { 793 res.changePlan(arg_request, arg_customerId, arg_subscriptionId).then(unitt est.expectAsync(((api.Subscription response) {
759 checkSubscription(response); 794 checkSubscription(response);
760 }))); 795 })));
761 }); 796 });
762 797
763 unittest.test("method--changeRenewalSettings", () { 798 unittest.test("method--changeRenewalSettings", () {
764 799
765 var mock = new common_test.HttpServerMock(); 800 var mock = new HttpServerMock();
766 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 801 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
767 var arg_request = buildRenewalSettings(); 802 var arg_request = buildRenewalSettings();
768 var arg_customerId = "foo"; 803 var arg_customerId = "foo";
769 var arg_subscriptionId = "foo"; 804 var arg_subscriptionId = "foo";
770 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 805 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
771 var obj = new api.RenewalSettings.fromJson(json); 806 var obj = new api.RenewalSettings.fromJson(json);
772 checkRenewalSettings(obj); 807 checkRenewalSettings(obj);
773 808
774 var path = (req.url).path; 809 var path = (req.url).path;
775 var pathOffset = 0; 810 var pathOffset = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 var keyvalue = part.split("="); 846 var keyvalue = part.split("=");
812 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 847 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
813 } 848 }
814 } 849 }
815 850
816 851
817 var h = { 852 var h = {
818 "content-type" : "application/json; charset=utf-8", 853 "content-type" : "application/json; charset=utf-8",
819 }; 854 };
820 var resp = convert.JSON.encode(buildSubscription()); 855 var resp = convert.JSON.encode(buildSubscription());
821 return new async.Future.value(common_test.stringResponse(200, h, resp)); 856 return new async.Future.value(stringResponse(200, h, resp));
822 }), true); 857 }), true);
823 res.changeRenewalSettings(arg_request, arg_customerId, arg_subscriptionId) .then(unittest.expectAsync(((api.Subscription response) { 858 res.changeRenewalSettings(arg_request, arg_customerId, arg_subscriptionId) .then(unittest.expectAsync(((api.Subscription response) {
824 checkSubscription(response); 859 checkSubscription(response);
825 }))); 860 })));
826 }); 861 });
827 862
828 unittest.test("method--changeSeats", () { 863 unittest.test("method--changeSeats", () {
829 864
830 var mock = new common_test.HttpServerMock(); 865 var mock = new HttpServerMock();
831 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 866 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
832 var arg_request = buildSeats(); 867 var arg_request = buildSeats();
833 var arg_customerId = "foo"; 868 var arg_customerId = "foo";
834 var arg_subscriptionId = "foo"; 869 var arg_subscriptionId = "foo";
835 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 870 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
836 var obj = new api.Seats.fromJson(json); 871 var obj = new api.Seats.fromJson(json);
837 checkSeats(obj); 872 checkSeats(obj);
838 873
839 var path = (req.url).path; 874 var path = (req.url).path;
840 var pathOffset = 0; 875 var pathOffset = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 var keyvalue = part.split("="); 911 var keyvalue = part.split("=");
877 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 912 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
878 } 913 }
879 } 914 }
880 915
881 916
882 var h = { 917 var h = {
883 "content-type" : "application/json; charset=utf-8", 918 "content-type" : "application/json; charset=utf-8",
884 }; 919 };
885 var resp = convert.JSON.encode(buildSubscription()); 920 var resp = convert.JSON.encode(buildSubscription());
886 return new async.Future.value(common_test.stringResponse(200, h, resp)); 921 return new async.Future.value(stringResponse(200, h, resp));
887 }), true); 922 }), true);
888 res.changeSeats(arg_request, arg_customerId, arg_subscriptionId).then(unit test.expectAsync(((api.Subscription response) { 923 res.changeSeats(arg_request, arg_customerId, arg_subscriptionId).then(unit test.expectAsync(((api.Subscription response) {
889 checkSubscription(response); 924 checkSubscription(response);
890 }))); 925 })));
891 }); 926 });
892 927
893 unittest.test("method--delete", () { 928 unittest.test("method--delete", () {
894 929
895 var mock = new common_test.HttpServerMock(); 930 var mock = new HttpServerMock();
896 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 931 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
897 var arg_customerId = "foo"; 932 var arg_customerId = "foo";
898 var arg_subscriptionId = "foo"; 933 var arg_subscriptionId = "foo";
899 var arg_deletionType = "foo"; 934 var arg_deletionType = "foo";
900 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 935 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
901 var path = (req.url).path; 936 var path = (req.url).path;
902 var pathOffset = 0; 937 var pathOffset = 0;
903 var index; 938 var index;
904 var subPart; 939 var subPart;
905 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 940 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
(...skipping 29 matching lines...) Expand all
935 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 970 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
936 } 971 }
937 } 972 }
938 unittest.expect(queryMap["deletionType"].first, unittest.equals(arg_dele tionType)); 973 unittest.expect(queryMap["deletionType"].first, unittest.equals(arg_dele tionType));
939 974
940 975
941 var h = { 976 var h = {
942 "content-type" : "application/json; charset=utf-8", 977 "content-type" : "application/json; charset=utf-8",
943 }; 978 };
944 var resp = ""; 979 var resp = "";
945 return new async.Future.value(common_test.stringResponse(200, h, resp)); 980 return new async.Future.value(stringResponse(200, h, resp));
946 }), true); 981 }), true);
947 res.delete(arg_customerId, arg_subscriptionId, arg_deletionType).then(unit test.expectAsync((_) {})); 982 res.delete(arg_customerId, arg_subscriptionId, arg_deletionType).then(unit test.expectAsync((_) {}));
948 }); 983 });
949 984
950 unittest.test("method--get", () { 985 unittest.test("method--get", () {
951 986
952 var mock = new common_test.HttpServerMock(); 987 var mock = new HttpServerMock();
953 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 988 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
954 var arg_customerId = "foo"; 989 var arg_customerId = "foo";
955 var arg_subscriptionId = "foo"; 990 var arg_subscriptionId = "foo";
956 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 991 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
957 var path = (req.url).path; 992 var path = (req.url).path;
958 var pathOffset = 0; 993 var pathOffset = 0;
959 var index; 994 var index;
960 var subPart; 995 var subPart;
961 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 996 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
962 pathOffset += 1; 997 pathOffset += 1;
(...skipping 27 matching lines...) Expand all
990 var keyvalue = part.split("="); 1025 var keyvalue = part.split("=");
991 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1026 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
992 } 1027 }
993 } 1028 }
994 1029
995 1030
996 var h = { 1031 var h = {
997 "content-type" : "application/json; charset=utf-8", 1032 "content-type" : "application/json; charset=utf-8",
998 }; 1033 };
999 var resp = convert.JSON.encode(buildSubscription()); 1034 var resp = convert.JSON.encode(buildSubscription());
1000 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1035 return new async.Future.value(stringResponse(200, h, resp));
1001 }), true); 1036 }), true);
1002 res.get(arg_customerId, arg_subscriptionId).then(unittest.expectAsync(((ap i.Subscription response) { 1037 res.get(arg_customerId, arg_subscriptionId).then(unittest.expectAsync(((ap i.Subscription response) {
1003 checkSubscription(response); 1038 checkSubscription(response);
1004 }))); 1039 })));
1005 }); 1040 });
1006 1041
1007 unittest.test("method--insert", () { 1042 unittest.test("method--insert", () {
1008 1043
1009 var mock = new common_test.HttpServerMock(); 1044 var mock = new HttpServerMock();
1010 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 1045 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
1011 var arg_request = buildSubscription(); 1046 var arg_request = buildSubscription();
1012 var arg_customerId = "foo"; 1047 var arg_customerId = "foo";
1013 var arg_customerAuthToken = "foo"; 1048 var arg_customerAuthToken = "foo";
1014 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 1049 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1015 var obj = new api.Subscription.fromJson(json); 1050 var obj = new api.Subscription.fromJson(json);
1016 checkSubscription(obj); 1051 checkSubscription(obj);
1017 1052
1018 var path = (req.url).path; 1053 var path = (req.url).path;
1019 var pathOffset = 0; 1054 var pathOffset = 0;
(...skipping 29 matching lines...) Expand all
1049 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1084 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1050 } 1085 }
1051 } 1086 }
1052 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg _customerAuthToken)); 1087 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg _customerAuthToken));
1053 1088
1054 1089
1055 var h = { 1090 var h = {
1056 "content-type" : "application/json; charset=utf-8", 1091 "content-type" : "application/json; charset=utf-8",
1057 }; 1092 };
1058 var resp = convert.JSON.encode(buildSubscription()); 1093 var resp = convert.JSON.encode(buildSubscription());
1059 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1094 return new async.Future.value(stringResponse(200, h, resp));
1060 }), true); 1095 }), true);
1061 res.insert(arg_request, arg_customerId, customerAuthToken: arg_customerAut hToken).then(unittest.expectAsync(((api.Subscription response) { 1096 res.insert(arg_request, arg_customerId, customerAuthToken: arg_customerAut hToken).then(unittest.expectAsync(((api.Subscription response) {
1062 checkSubscription(response); 1097 checkSubscription(response);
1063 }))); 1098 })));
1064 }); 1099 });
1065 1100
1066 unittest.test("method--list", () { 1101 unittest.test("method--list", () {
1067 1102
1068 var mock = new common_test.HttpServerMock(); 1103 var mock = new HttpServerMock();
1069 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 1104 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
1070 var arg_customerAuthToken = "foo"; 1105 var arg_customerAuthToken = "foo";
1071 var arg_customerId = "foo"; 1106 var arg_customerId = "foo";
1072 var arg_customerNamePrefix = "foo"; 1107 var arg_customerNamePrefix = "foo";
1073 var arg_maxResults = 42; 1108 var arg_maxResults = 42;
1074 var arg_pageToken = "foo"; 1109 var arg_pageToken = "foo";
1075 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 1110 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1076 var path = (req.url).path; 1111 var path = (req.url).path;
1077 var pathOffset = 0; 1112 var pathOffset = 0;
1078 var index; 1113 var index;
(...skipping 25 matching lines...) Expand all
1104 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom erId)); 1139 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom erId));
1105 unittest.expect(queryMap["customerNamePrefix"].first, unittest.equals(ar g_customerNamePrefix)); 1140 unittest.expect(queryMap["customerNamePrefix"].first, unittest.equals(ar g_customerNamePrefix));
1106 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e quals(arg_maxResults)); 1141 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e quals(arg_maxResults));
1107 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 1142 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
1108 1143
1109 1144
1110 var h = { 1145 var h = {
1111 "content-type" : "application/json; charset=utf-8", 1146 "content-type" : "application/json; charset=utf-8",
1112 }; 1147 };
1113 var resp = convert.JSON.encode(buildSubscriptions()); 1148 var resp = convert.JSON.encode(buildSubscriptions());
1114 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1149 return new async.Future.value(stringResponse(200, h, resp));
1115 }), true); 1150 }), true);
1116 res.list(customerAuthToken: arg_customerAuthToken, customerId: arg_custome rId, customerNamePrefix: arg_customerNamePrefix, maxResults: arg_maxResults, pag eToken: arg_pageToken).then(unittest.expectAsync(((api.Subscriptions response) { 1151 res.list(customerAuthToken: arg_customerAuthToken, customerId: arg_custome rId, customerNamePrefix: arg_customerNamePrefix, maxResults: arg_maxResults, pag eToken: arg_pageToken).then(unittest.expectAsync(((api.Subscriptions response) {
1117 checkSubscriptions(response); 1152 checkSubscriptions(response);
1118 }))); 1153 })));
1119 }); 1154 });
1120 1155
1121 unittest.test("method--startPaidService", () { 1156 unittest.test("method--startPaidService", () {
1122 1157
1123 var mock = new common_test.HttpServerMock(); 1158 var mock = new HttpServerMock();
1124 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 1159 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
1125 var arg_customerId = "foo"; 1160 var arg_customerId = "foo";
1126 var arg_subscriptionId = "foo"; 1161 var arg_subscriptionId = "foo";
1127 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 1162 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1128 var path = (req.url).path; 1163 var path = (req.url).path;
1129 var pathOffset = 0; 1164 var pathOffset = 0;
1130 var index; 1165 var index;
1131 var subPart; 1166 var subPart;
1132 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1167 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1133 pathOffset += 1; 1168 pathOffset += 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 var keyvalue = part.split("="); 1200 var keyvalue = part.split("=");
1166 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1201 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1167 } 1202 }
1168 } 1203 }
1169 1204
1170 1205
1171 var h = { 1206 var h = {
1172 "content-type" : "application/json; charset=utf-8", 1207 "content-type" : "application/json; charset=utf-8",
1173 }; 1208 };
1174 var resp = convert.JSON.encode(buildSubscription()); 1209 var resp = convert.JSON.encode(buildSubscription());
1175 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1210 return new async.Future.value(stringResponse(200, h, resp));
1176 }), true); 1211 }), true);
1177 res.startPaidService(arg_customerId, arg_subscriptionId).then(unittest.exp ectAsync(((api.Subscription response) { 1212 res.startPaidService(arg_customerId, arg_subscriptionId).then(unittest.exp ectAsync(((api.Subscription response) {
1178 checkSubscription(response); 1213 checkSubscription(response);
1179 }))); 1214 })));
1180 }); 1215 });
1181 1216
1182 unittest.test("method--suspend", () { 1217 unittest.test("method--suspend", () {
1183 1218
1184 var mock = new common_test.HttpServerMock(); 1219 var mock = new HttpServerMock();
1185 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ; 1220 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions ;
1186 var arg_customerId = "foo"; 1221 var arg_customerId = "foo";
1187 var arg_subscriptionId = "foo"; 1222 var arg_subscriptionId = "foo";
1188 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 1223 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
1189 var path = (req.url).path; 1224 var path = (req.url).path;
1190 var pathOffset = 0; 1225 var pathOffset = 0;
1191 var index; 1226 var index;
1192 var subPart; 1227 var subPart;
1193 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1228 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1194 pathOffset += 1; 1229 pathOffset += 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 var keyvalue = part.split("="); 1261 var keyvalue = part.split("=");
1227 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1262 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1228 } 1263 }
1229 } 1264 }
1230 1265
1231 1266
1232 var h = { 1267 var h = {
1233 "content-type" : "application/json; charset=utf-8", 1268 "content-type" : "application/json; charset=utf-8",
1234 }; 1269 };
1235 var resp = convert.JSON.encode(buildSubscription()); 1270 var resp = convert.JSON.encode(buildSubscription());
1236 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1271 return new async.Future.value(stringResponse(200, h, resp));
1237 }), true); 1272 }), true);
1238 res.suspend(arg_customerId, arg_subscriptionId).then(unittest.expectAsync( ((api.Subscription response) { 1273 res.suspend(arg_customerId, arg_subscriptionId).then(unittest.expectAsync( ((api.Subscription response) {
1239 checkSubscription(response); 1274 checkSubscription(response);
1240 }))); 1275 })));
1241 }); 1276 });
1242 1277
1243 }); 1278 });
1244 1279
1245 1280
1246 } 1281 }
1247 1282
OLDNEW
« no previous file with comments | « generated/googleapis/test/qpxexpress/v1_test.dart ('k') | generated/googleapis/test/siteverification/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698