| OLD | NEW |
| 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:test/test.dart' as unittest; |
| 11 | 11 |
| 12 import 'package:googleapis/reseller/v1.dart' as api; | 12 import 'package:googleapis/reseller/v1.dart' as api; |
| 13 | 13 |
| 14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 15 core.Function _callback; |
| 16 core.bool _expectJson; | 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 19 _callback = callback; |
| 20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 } else { | 39 } else { |
| 40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 41 return _callback(request, data); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 52 } |
| 53 | 53 |
| 54 core.int buildCounterAddress = 0; | 54 core.int buildCounterAddress = 0; |
| 55 buildAddress() { | 55 buildAddress() { |
| 56 var o = new api.Address(); | 56 var o = new api.Address(); |
| 57 buildCounterAddress++; | 57 buildCounterAddress++; |
| 58 if (buildCounterAddress < 3) { | 58 if (buildCounterAddress < 3) { |
| 59 o.addressLine1 = "foo"; | 59 o.addressLine1 = "foo"; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 checkRenewalSettings(api.RenewalSettings o) { | 163 checkRenewalSettings(api.RenewalSettings o) { |
| 164 buildCounterRenewalSettings++; | 164 buildCounterRenewalSettings++; |
| 165 if (buildCounterRenewalSettings < 3) { | 165 if (buildCounterRenewalSettings < 3) { |
| 166 unittest.expect(o.kind, unittest.equals('foo')); | 166 unittest.expect(o.kind, unittest.equals('foo')); |
| 167 unittest.expect(o.renewalType, unittest.equals('foo')); | 167 unittest.expect(o.renewalType, unittest.equals('foo')); |
| 168 } | 168 } |
| 169 buildCounterRenewalSettings--; | 169 buildCounterRenewalSettings--; |
| 170 } | 170 } |
| 171 | 171 |
| 172 buildUnnamed2271() { | 172 buildUnnamed2294() { |
| 173 var o = new core.List<core.String>(); | 173 var o = new core.List<core.String>(); |
| 174 o.add("foo"); | 174 o.add("foo"); |
| 175 o.add("foo"); | 175 o.add("foo"); |
| 176 return o; | 176 return o; |
| 177 } | 177 } |
| 178 | 178 |
| 179 checkUnnamed2271(core.List<core.String> o) { | 179 checkUnnamed2294(core.List<core.String> o) { |
| 180 unittest.expect(o, unittest.hasLength(2)); | 180 unittest.expect(o, unittest.hasLength(2)); |
| 181 unittest.expect(o[0], unittest.equals('foo')); | 181 unittest.expect(o[0], unittest.equals('foo')); |
| 182 unittest.expect(o[1], unittest.equals('foo')); | 182 unittest.expect(o[1], unittest.equals('foo')); |
| 183 } | 183 } |
| 184 | 184 |
| 185 core.int buildCounterResellernotifyGetwatchdetailsResponse = 0; | 185 core.int buildCounterResellernotifyGetwatchdetailsResponse = 0; |
| 186 buildResellernotifyGetwatchdetailsResponse() { | 186 buildResellernotifyGetwatchdetailsResponse() { |
| 187 var o = new api.ResellernotifyGetwatchdetailsResponse(); | 187 var o = new api.ResellernotifyGetwatchdetailsResponse(); |
| 188 buildCounterResellernotifyGetwatchdetailsResponse++; | 188 buildCounterResellernotifyGetwatchdetailsResponse++; |
| 189 if (buildCounterResellernotifyGetwatchdetailsResponse < 3) { | 189 if (buildCounterResellernotifyGetwatchdetailsResponse < 3) { |
| 190 o.serviceAccountEmailAddresses = buildUnnamed2271(); | 190 o.serviceAccountEmailAddresses = buildUnnamed2294(); |
| 191 o.topicName = "foo"; | 191 o.topicName = "foo"; |
| 192 } | 192 } |
| 193 buildCounterResellernotifyGetwatchdetailsResponse--; | 193 buildCounterResellernotifyGetwatchdetailsResponse--; |
| 194 return o; | 194 return o; |
| 195 } | 195 } |
| 196 | 196 |
| 197 checkResellernotifyGetwatchdetailsResponse(api.ResellernotifyGetwatchdetailsResp
onse o) { | 197 checkResellernotifyGetwatchdetailsResponse(api.ResellernotifyGetwatchdetailsResp
onse o) { |
| 198 buildCounterResellernotifyGetwatchdetailsResponse++; | 198 buildCounterResellernotifyGetwatchdetailsResponse++; |
| 199 if (buildCounterResellernotifyGetwatchdetailsResponse < 3) { | 199 if (buildCounterResellernotifyGetwatchdetailsResponse < 3) { |
| 200 checkUnnamed2271(o.serviceAccountEmailAddresses); | 200 checkUnnamed2294(o.serviceAccountEmailAddresses); |
| 201 unittest.expect(o.topicName, unittest.equals('foo')); | 201 unittest.expect(o.topicName, unittest.equals('foo')); |
| 202 } | 202 } |
| 203 buildCounterResellernotifyGetwatchdetailsResponse--; | 203 buildCounterResellernotifyGetwatchdetailsResponse--; |
| 204 } | 204 } |
| 205 | 205 |
| 206 core.int buildCounterResellernotifyResource = 0; | 206 core.int buildCounterResellernotifyResource = 0; |
| 207 buildResellernotifyResource() { | 207 buildResellernotifyResource() { |
| 208 var o = new api.ResellernotifyResource(); | 208 var o = new api.ResellernotifyResource(); |
| 209 buildCounterResellernotifyResource++; | 209 buildCounterResellernotifyResource++; |
| 210 if (buildCounterResellernotifyResource < 3) { | 210 if (buildCounterResellernotifyResource < 3) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 checkSubscriptionPlan(api.SubscriptionPlan o) { | 284 checkSubscriptionPlan(api.SubscriptionPlan o) { |
| 285 buildCounterSubscriptionPlan++; | 285 buildCounterSubscriptionPlan++; |
| 286 if (buildCounterSubscriptionPlan < 3) { | 286 if (buildCounterSubscriptionPlan < 3) { |
| 287 checkSubscriptionPlanCommitmentInterval(o.commitmentInterval); | 287 checkSubscriptionPlanCommitmentInterval(o.commitmentInterval); |
| 288 unittest.expect(o.isCommitmentPlan, unittest.isTrue); | 288 unittest.expect(o.isCommitmentPlan, unittest.isTrue); |
| 289 unittest.expect(o.planName, unittest.equals('foo')); | 289 unittest.expect(o.planName, unittest.equals('foo')); |
| 290 } | 290 } |
| 291 buildCounterSubscriptionPlan--; | 291 buildCounterSubscriptionPlan--; |
| 292 } | 292 } |
| 293 | 293 |
| 294 buildUnnamed2272() { | 294 buildUnnamed2295() { |
| 295 var o = new core.List<core.String>(); | 295 var o = new core.List<core.String>(); |
| 296 o.add("foo"); | 296 o.add("foo"); |
| 297 o.add("foo"); | 297 o.add("foo"); |
| 298 return o; | 298 return o; |
| 299 } | 299 } |
| 300 | 300 |
| 301 checkUnnamed2272(core.List<core.String> o) { | 301 checkUnnamed2295(core.List<core.String> o) { |
| 302 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
| 303 unittest.expect(o[0], unittest.equals('foo')); | 303 unittest.expect(o[0], unittest.equals('foo')); |
| 304 unittest.expect(o[1], unittest.equals('foo')); | 304 unittest.expect(o[1], unittest.equals('foo')); |
| 305 } | 305 } |
| 306 | 306 |
| 307 core.int buildCounterSubscriptionTransferInfo = 0; | 307 core.int buildCounterSubscriptionTransferInfo = 0; |
| 308 buildSubscriptionTransferInfo() { | 308 buildSubscriptionTransferInfo() { |
| 309 var o = new api.SubscriptionTransferInfo(); | 309 var o = new api.SubscriptionTransferInfo(); |
| 310 buildCounterSubscriptionTransferInfo++; | 310 buildCounterSubscriptionTransferInfo++; |
| 311 if (buildCounterSubscriptionTransferInfo < 3) { | 311 if (buildCounterSubscriptionTransferInfo < 3) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 o.kind = "foo"; | 359 o.kind = "foo"; |
| 360 o.plan = buildSubscriptionPlan(); | 360 o.plan = buildSubscriptionPlan(); |
| 361 o.purchaseOrderId = "foo"; | 361 o.purchaseOrderId = "foo"; |
| 362 o.renewalSettings = buildRenewalSettings(); | 362 o.renewalSettings = buildRenewalSettings(); |
| 363 o.resourceUiUrl = "foo"; | 363 o.resourceUiUrl = "foo"; |
| 364 o.seats = buildSeats(); | 364 o.seats = buildSeats(); |
| 365 o.skuId = "foo"; | 365 o.skuId = "foo"; |
| 366 o.skuName = "foo"; | 366 o.skuName = "foo"; |
| 367 o.status = "foo"; | 367 o.status = "foo"; |
| 368 o.subscriptionId = "foo"; | 368 o.subscriptionId = "foo"; |
| 369 o.suspensionReasons = buildUnnamed2272(); | 369 o.suspensionReasons = buildUnnamed2295(); |
| 370 o.transferInfo = buildSubscriptionTransferInfo(); | 370 o.transferInfo = buildSubscriptionTransferInfo(); |
| 371 o.trialSettings = buildSubscriptionTrialSettings(); | 371 o.trialSettings = buildSubscriptionTrialSettings(); |
| 372 } | 372 } |
| 373 buildCounterSubscription--; | 373 buildCounterSubscription--; |
| 374 return o; | 374 return o; |
| 375 } | 375 } |
| 376 | 376 |
| 377 checkSubscription(api.Subscription o) { | 377 checkSubscription(api.Subscription o) { |
| 378 buildCounterSubscription++; | 378 buildCounterSubscription++; |
| 379 if (buildCounterSubscription < 3) { | 379 if (buildCounterSubscription < 3) { |
| 380 unittest.expect(o.billingMethod, unittest.equals('foo')); | 380 unittest.expect(o.billingMethod, unittest.equals('foo')); |
| 381 unittest.expect(o.creationTime, unittest.equals('foo')); | 381 unittest.expect(o.creationTime, unittest.equals('foo')); |
| 382 unittest.expect(o.customerDomain, unittest.equals('foo')); | 382 unittest.expect(o.customerDomain, unittest.equals('foo')); |
| 383 unittest.expect(o.customerId, unittest.equals('foo')); | 383 unittest.expect(o.customerId, unittest.equals('foo')); |
| 384 unittest.expect(o.dealCode, unittest.equals('foo')); | 384 unittest.expect(o.dealCode, unittest.equals('foo')); |
| 385 unittest.expect(o.kind, unittest.equals('foo')); | 385 unittest.expect(o.kind, unittest.equals('foo')); |
| 386 checkSubscriptionPlan(o.plan); | 386 checkSubscriptionPlan(o.plan); |
| 387 unittest.expect(o.purchaseOrderId, unittest.equals('foo')); | 387 unittest.expect(o.purchaseOrderId, unittest.equals('foo')); |
| 388 checkRenewalSettings(o.renewalSettings); | 388 checkRenewalSettings(o.renewalSettings); |
| 389 unittest.expect(o.resourceUiUrl, unittest.equals('foo')); | 389 unittest.expect(o.resourceUiUrl, unittest.equals('foo')); |
| 390 checkSeats(o.seats); | 390 checkSeats(o.seats); |
| 391 unittest.expect(o.skuId, unittest.equals('foo')); | 391 unittest.expect(o.skuId, unittest.equals('foo')); |
| 392 unittest.expect(o.skuName, unittest.equals('foo')); | 392 unittest.expect(o.skuName, unittest.equals('foo')); |
| 393 unittest.expect(o.status, unittest.equals('foo')); | 393 unittest.expect(o.status, unittest.equals('foo')); |
| 394 unittest.expect(o.subscriptionId, unittest.equals('foo')); | 394 unittest.expect(o.subscriptionId, unittest.equals('foo')); |
| 395 checkUnnamed2272(o.suspensionReasons); | 395 checkUnnamed2295(o.suspensionReasons); |
| 396 checkSubscriptionTransferInfo(o.transferInfo); | 396 checkSubscriptionTransferInfo(o.transferInfo); |
| 397 checkSubscriptionTrialSettings(o.trialSettings); | 397 checkSubscriptionTrialSettings(o.trialSettings); |
| 398 } | 398 } |
| 399 buildCounterSubscription--; | 399 buildCounterSubscription--; |
| 400 } | 400 } |
| 401 | 401 |
| 402 buildUnnamed2273() { | 402 buildUnnamed2296() { |
| 403 var o = new core.List<api.Subscription>(); | 403 var o = new core.List<api.Subscription>(); |
| 404 o.add(buildSubscription()); | 404 o.add(buildSubscription()); |
| 405 o.add(buildSubscription()); | 405 o.add(buildSubscription()); |
| 406 return o; | 406 return o; |
| 407 } | 407 } |
| 408 | 408 |
| 409 checkUnnamed2273(core.List<api.Subscription> o) { | 409 checkUnnamed2296(core.List<api.Subscription> o) { |
| 410 unittest.expect(o, unittest.hasLength(2)); | 410 unittest.expect(o, unittest.hasLength(2)); |
| 411 checkSubscription(o[0]); | 411 checkSubscription(o[0]); |
| 412 checkSubscription(o[1]); | 412 checkSubscription(o[1]); |
| 413 } | 413 } |
| 414 | 414 |
| 415 core.int buildCounterSubscriptions = 0; | 415 core.int buildCounterSubscriptions = 0; |
| 416 buildSubscriptions() { | 416 buildSubscriptions() { |
| 417 var o = new api.Subscriptions(); | 417 var o = new api.Subscriptions(); |
| 418 buildCounterSubscriptions++; | 418 buildCounterSubscriptions++; |
| 419 if (buildCounterSubscriptions < 3) { | 419 if (buildCounterSubscriptions < 3) { |
| 420 o.kind = "foo"; | 420 o.kind = "foo"; |
| 421 o.nextPageToken = "foo"; | 421 o.nextPageToken = "foo"; |
| 422 o.subscriptions = buildUnnamed2273(); | 422 o.subscriptions = buildUnnamed2296(); |
| 423 } | 423 } |
| 424 buildCounterSubscriptions--; | 424 buildCounterSubscriptions--; |
| 425 return o; | 425 return o; |
| 426 } | 426 } |
| 427 | 427 |
| 428 checkSubscriptions(api.Subscriptions o) { | 428 checkSubscriptions(api.Subscriptions o) { |
| 429 buildCounterSubscriptions++; | 429 buildCounterSubscriptions++; |
| 430 if (buildCounterSubscriptions < 3) { | 430 if (buildCounterSubscriptions < 3) { |
| 431 unittest.expect(o.kind, unittest.equals('foo')); | 431 unittest.expect(o.kind, unittest.equals('foo')); |
| 432 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 432 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 433 checkUnnamed2273(o.subscriptions); | 433 checkUnnamed2296(o.subscriptions); |
| 434 } | 434 } |
| 435 buildCounterSubscriptions--; | 435 buildCounterSubscriptions--; |
| 436 } | 436 } |
| 437 | 437 |
| 438 | 438 |
| 439 main() { | 439 main() { |
| 440 unittest.group("obj-schema-Address", () { | 440 unittest.group("obj-schema-Address", () { |
| 441 unittest.test("to-json--from-json", () { | 441 unittest.test("to-json--from-json", () { |
| 442 var o = buildAddress(); | 442 var o = buildAddress(); |
| 443 var od = new api.Address.fromJson(o.toJson()); | 443 var od = new api.Address.fromJson(o.toJson()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 }); | 553 }); |
| 554 }); | 554 }); |
| 555 | 555 |
| 556 | 556 |
| 557 unittest.group("resource-CustomersResourceApi", () { | 557 unittest.group("resource-CustomersResourceApi", () { |
| 558 unittest.test("method--get", () { | 558 unittest.test("method--get", () { |
| 559 | 559 |
| 560 var mock = new HttpServerMock(); | 560 var mock = new HttpServerMock(); |
| 561 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; | 561 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; |
| 562 var arg_customerId = "foo"; | 562 var arg_customerId = "foo"; |
| 563 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 563 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 564 var path = (req.url).path; | 564 var path = (req.url).path; |
| 565 var pathOffset = 0; | 565 var pathOffset = 0; |
| 566 var index; | 566 var index; |
| 567 var subPart; | 567 var subPart; |
| 568 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 568 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 569 pathOffset += 1; | 569 pathOffset += 1; |
| 570 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 570 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 571 pathOffset += 17; | 571 pathOffset += 17; |
| 572 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 572 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 573 pathOffset += 10; | 573 pathOffset += 10; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 | 595 |
| 596 var h = { | 596 var h = { |
| 597 "content-type" : "application/json; charset=utf-8", | 597 "content-type" : "application/json; charset=utf-8", |
| 598 }; | 598 }; |
| 599 var resp = convert.JSON.encode(buildCustomer()); | 599 var resp = convert.JSON.encode(buildCustomer()); |
| 600 return new async.Future.value(stringResponse(200, h, resp)); | 600 return new async.Future.value(stringResponse(200, h, resp)); |
| 601 }), true); | 601 }), true); |
| 602 res.get(arg_customerId).then(unittest.expectAsync(((api.Customer response)
{ | 602 res.get(arg_customerId).then(unittest.expectAsync1(((api.Customer response
) { |
| 603 checkCustomer(response); | 603 checkCustomer(response); |
| 604 }))); | 604 }))); |
| 605 }); | 605 }); |
| 606 | 606 |
| 607 unittest.test("method--insert", () { | 607 unittest.test("method--insert", () { |
| 608 | 608 |
| 609 var mock = new HttpServerMock(); | 609 var mock = new HttpServerMock(); |
| 610 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; | 610 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; |
| 611 var arg_request = buildCustomer(); | 611 var arg_request = buildCustomer(); |
| 612 var arg_customerAuthToken = "foo"; | 612 var arg_customerAuthToken = "foo"; |
| 613 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 613 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 614 var obj = new api.Customer.fromJson(json); | 614 var obj = new api.Customer.fromJson(json); |
| 615 checkCustomer(obj); | 615 checkCustomer(obj); |
| 616 | 616 |
| 617 var path = (req.url).path; | 617 var path = (req.url).path; |
| 618 var pathOffset = 0; | 618 var pathOffset = 0; |
| 619 var index; | 619 var index; |
| 620 var subPart; | 620 var subPart; |
| 621 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 621 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 622 pathOffset += 1; | 622 pathOffset += 1; |
| 623 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 623 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 643 } | 643 } |
| 644 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg
_customerAuthToken)); | 644 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg
_customerAuthToken)); |
| 645 | 645 |
| 646 | 646 |
| 647 var h = { | 647 var h = { |
| 648 "content-type" : "application/json; charset=utf-8", | 648 "content-type" : "application/json; charset=utf-8", |
| 649 }; | 649 }; |
| 650 var resp = convert.JSON.encode(buildCustomer()); | 650 var resp = convert.JSON.encode(buildCustomer()); |
| 651 return new async.Future.value(stringResponse(200, h, resp)); | 651 return new async.Future.value(stringResponse(200, h, resp)); |
| 652 }), true); | 652 }), true); |
| 653 res.insert(arg_request, customerAuthToken: arg_customerAuthToken).then(uni
ttest.expectAsync(((api.Customer response) { | 653 res.insert(arg_request, customerAuthToken: arg_customerAuthToken).then(uni
ttest.expectAsync1(((api.Customer response) { |
| 654 checkCustomer(response); | 654 checkCustomer(response); |
| 655 }))); | 655 }))); |
| 656 }); | 656 }); |
| 657 | 657 |
| 658 unittest.test("method--patch", () { | 658 unittest.test("method--patch", () { |
| 659 | 659 |
| 660 var mock = new HttpServerMock(); | 660 var mock = new HttpServerMock(); |
| 661 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; | 661 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; |
| 662 var arg_request = buildCustomer(); | 662 var arg_request = buildCustomer(); |
| 663 var arg_customerId = "foo"; | 663 var arg_customerId = "foo"; |
| 664 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 664 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 665 var obj = new api.Customer.fromJson(json); | 665 var obj = new api.Customer.fromJson(json); |
| 666 checkCustomer(obj); | 666 checkCustomer(obj); |
| 667 | 667 |
| 668 var path = (req.url).path; | 668 var path = (req.url).path; |
| 669 var pathOffset = 0; | 669 var pathOffset = 0; |
| 670 var index; | 670 var index; |
| 671 var subPart; | 671 var subPart; |
| 672 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 672 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 673 pathOffset += 1; | 673 pathOffset += 1; |
| 674 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 674 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 | 698 |
| 699 | 699 |
| 700 var h = { | 700 var h = { |
| 701 "content-type" : "application/json; charset=utf-8", | 701 "content-type" : "application/json; charset=utf-8", |
| 702 }; | 702 }; |
| 703 var resp = convert.JSON.encode(buildCustomer()); | 703 var resp = convert.JSON.encode(buildCustomer()); |
| 704 return new async.Future.value(stringResponse(200, h, resp)); | 704 return new async.Future.value(stringResponse(200, h, resp)); |
| 705 }), true); | 705 }), true); |
| 706 res.patch(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cus
tomer response) { | 706 res.patch(arg_request, arg_customerId).then(unittest.expectAsync1(((api.Cu
stomer response) { |
| 707 checkCustomer(response); | 707 checkCustomer(response); |
| 708 }))); | 708 }))); |
| 709 }); | 709 }); |
| 710 | 710 |
| 711 unittest.test("method--update", () { | 711 unittest.test("method--update", () { |
| 712 | 712 |
| 713 var mock = new HttpServerMock(); | 713 var mock = new HttpServerMock(); |
| 714 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; | 714 api.CustomersResourceApi res = new api.ResellerApi(mock).customers; |
| 715 var arg_request = buildCustomer(); | 715 var arg_request = buildCustomer(); |
| 716 var arg_customerId = "foo"; | 716 var arg_customerId = "foo"; |
| 717 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 717 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 718 var obj = new api.Customer.fromJson(json); | 718 var obj = new api.Customer.fromJson(json); |
| 719 checkCustomer(obj); | 719 checkCustomer(obj); |
| 720 | 720 |
| 721 var path = (req.url).path; | 721 var path = (req.url).path; |
| 722 var pathOffset = 0; | 722 var pathOffset = 0; |
| 723 var index; | 723 var index; |
| 724 var subPart; | 724 var subPart; |
| 725 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 725 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 726 pathOffset += 1; | 726 pathOffset += 1; |
| 727 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 727 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 | 751 |
| 752 | 752 |
| 753 var h = { | 753 var h = { |
| 754 "content-type" : "application/json; charset=utf-8", | 754 "content-type" : "application/json; charset=utf-8", |
| 755 }; | 755 }; |
| 756 var resp = convert.JSON.encode(buildCustomer()); | 756 var resp = convert.JSON.encode(buildCustomer()); |
| 757 return new async.Future.value(stringResponse(200, h, resp)); | 757 return new async.Future.value(stringResponse(200, h, resp)); |
| 758 }), true); | 758 }), true); |
| 759 res.update(arg_request, arg_customerId).then(unittest.expectAsync(((api.Cu
stomer response) { | 759 res.update(arg_request, arg_customerId).then(unittest.expectAsync1(((api.C
ustomer response) { |
| 760 checkCustomer(response); | 760 checkCustomer(response); |
| 761 }))); | 761 }))); |
| 762 }); | 762 }); |
| 763 | 763 |
| 764 }); | 764 }); |
| 765 | 765 |
| 766 | 766 |
| 767 unittest.group("resource-ResellernotifyResourceApi", () { | 767 unittest.group("resource-ResellernotifyResourceApi", () { |
| 768 unittest.test("method--getwatchdetails", () { | 768 unittest.test("method--getwatchdetails", () { |
| 769 | 769 |
| 770 var mock = new HttpServerMock(); | 770 var mock = new HttpServerMock(); |
| 771 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; | 771 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; |
| 772 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 772 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 773 var path = (req.url).path; | 773 var path = (req.url).path; |
| 774 var pathOffset = 0; | 774 var pathOffset = 0; |
| 775 var index; | 775 var index; |
| 776 var subPart; | 776 var subPart; |
| 777 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 777 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 778 pathOffset += 1; | 778 pathOffset += 1; |
| 779 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 779 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 780 pathOffset += 17; | 780 pathOffset += 17; |
| 781 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq
uals("resellernotify/getwatchdetails")); | 781 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq
uals("resellernotify/getwatchdetails")); |
| 782 pathOffset += 30; | 782 pathOffset += 30; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 798 } | 798 } |
| 799 } | 799 } |
| 800 | 800 |
| 801 | 801 |
| 802 var h = { | 802 var h = { |
| 803 "content-type" : "application/json; charset=utf-8", | 803 "content-type" : "application/json; charset=utf-8", |
| 804 }; | 804 }; |
| 805 var resp = convert.JSON.encode(buildResellernotifyGetwatchdetailsRespons
e()); | 805 var resp = convert.JSON.encode(buildResellernotifyGetwatchdetailsRespons
e()); |
| 806 return new async.Future.value(stringResponse(200, h, resp)); | 806 return new async.Future.value(stringResponse(200, h, resp)); |
| 807 }), true); | 807 }), true); |
| 808 res.getwatchdetails().then(unittest.expectAsync(((api.ResellernotifyGetwat
chdetailsResponse response) { | 808 res.getwatchdetails().then(unittest.expectAsync1(((api.ResellernotifyGetwa
tchdetailsResponse response) { |
| 809 checkResellernotifyGetwatchdetailsResponse(response); | 809 checkResellernotifyGetwatchdetailsResponse(response); |
| 810 }))); | 810 }))); |
| 811 }); | 811 }); |
| 812 | 812 |
| 813 unittest.test("method--register", () { | 813 unittest.test("method--register", () { |
| 814 | 814 |
| 815 var mock = new HttpServerMock(); | 815 var mock = new HttpServerMock(); |
| 816 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; | 816 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; |
| 817 var arg_serviceAccountEmailAddress = "foo"; | 817 var arg_serviceAccountEmailAddress = "foo"; |
| 818 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 818 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 819 var path = (req.url).path; | 819 var path = (req.url).path; |
| 820 var pathOffset = 0; | 820 var pathOffset = 0; |
| 821 var index; | 821 var index; |
| 822 var subPart; | 822 var subPart; |
| 823 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 823 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 824 pathOffset += 1; | 824 pathOffset += 1; |
| 825 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 825 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 826 pathOffset += 17; | 826 pathOffset += 17; |
| 827 unittest.expect(path.substring(pathOffset, pathOffset + 23), unittest.eq
uals("resellernotify/register")); | 827 unittest.expect(path.substring(pathOffset, pathOffset + 23), unittest.eq
uals("resellernotify/register")); |
| 828 pathOffset += 23; | 828 pathOffset += 23; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 845 } | 845 } |
| 846 unittest.expect(queryMap["serviceAccountEmailAddress"].first, unittest.e
quals(arg_serviceAccountEmailAddress)); | 846 unittest.expect(queryMap["serviceAccountEmailAddress"].first, unittest.e
quals(arg_serviceAccountEmailAddress)); |
| 847 | 847 |
| 848 | 848 |
| 849 var h = { | 849 var h = { |
| 850 "content-type" : "application/json; charset=utf-8", | 850 "content-type" : "application/json; charset=utf-8", |
| 851 }; | 851 }; |
| 852 var resp = convert.JSON.encode(buildResellernotifyResource()); | 852 var resp = convert.JSON.encode(buildResellernotifyResource()); |
| 853 return new async.Future.value(stringResponse(200, h, resp)); | 853 return new async.Future.value(stringResponse(200, h, resp)); |
| 854 }), true); | 854 }), true); |
| 855 res.register(serviceAccountEmailAddress: arg_serviceAccountEmailAddress).t
hen(unittest.expectAsync(((api.ResellernotifyResource response) { | 855 res.register(serviceAccountEmailAddress: arg_serviceAccountEmailAddress).t
hen(unittest.expectAsync1(((api.ResellernotifyResource response) { |
| 856 checkResellernotifyResource(response); | 856 checkResellernotifyResource(response); |
| 857 }))); | 857 }))); |
| 858 }); | 858 }); |
| 859 | 859 |
| 860 unittest.test("method--unregister", () { | 860 unittest.test("method--unregister", () { |
| 861 | 861 |
| 862 var mock = new HttpServerMock(); | 862 var mock = new HttpServerMock(); |
| 863 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; | 863 api.ResellernotifyResourceApi res = new api.ResellerApi(mock).resellernoti
fy; |
| 864 var arg_serviceAccountEmailAddress = "foo"; | 864 var arg_serviceAccountEmailAddress = "foo"; |
| 865 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 865 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 866 var path = (req.url).path; | 866 var path = (req.url).path; |
| 867 var pathOffset = 0; | 867 var pathOffset = 0; |
| 868 var index; | 868 var index; |
| 869 var subPart; | 869 var subPart; |
| 870 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 870 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 871 pathOffset += 1; | 871 pathOffset += 1; |
| 872 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 872 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 873 pathOffset += 17; | 873 pathOffset += 17; |
| 874 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("resellernotify/unregister")); | 874 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("resellernotify/unregister")); |
| 875 pathOffset += 25; | 875 pathOffset += 25; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 892 } | 892 } |
| 893 unittest.expect(queryMap["serviceAccountEmailAddress"].first, unittest.e
quals(arg_serviceAccountEmailAddress)); | 893 unittest.expect(queryMap["serviceAccountEmailAddress"].first, unittest.e
quals(arg_serviceAccountEmailAddress)); |
| 894 | 894 |
| 895 | 895 |
| 896 var h = { | 896 var h = { |
| 897 "content-type" : "application/json; charset=utf-8", | 897 "content-type" : "application/json; charset=utf-8", |
| 898 }; | 898 }; |
| 899 var resp = convert.JSON.encode(buildResellernotifyResource()); | 899 var resp = convert.JSON.encode(buildResellernotifyResource()); |
| 900 return new async.Future.value(stringResponse(200, h, resp)); | 900 return new async.Future.value(stringResponse(200, h, resp)); |
| 901 }), true); | 901 }), true); |
| 902 res.unregister(serviceAccountEmailAddress: arg_serviceAccountEmailAddress)
.then(unittest.expectAsync(((api.ResellernotifyResource response) { | 902 res.unregister(serviceAccountEmailAddress: arg_serviceAccountEmailAddress)
.then(unittest.expectAsync1(((api.ResellernotifyResource response) { |
| 903 checkResellernotifyResource(response); | 903 checkResellernotifyResource(response); |
| 904 }))); | 904 }))); |
| 905 }); | 905 }); |
| 906 | 906 |
| 907 }); | 907 }); |
| 908 | 908 |
| 909 | 909 |
| 910 unittest.group("resource-SubscriptionsResourceApi", () { | 910 unittest.group("resource-SubscriptionsResourceApi", () { |
| 911 unittest.test("method--activate", () { | 911 unittest.test("method--activate", () { |
| 912 | 912 |
| 913 var mock = new HttpServerMock(); | 913 var mock = new HttpServerMock(); |
| 914 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 914 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 915 var arg_customerId = "foo"; | 915 var arg_customerId = "foo"; |
| 916 var arg_subscriptionId = "foo"; | 916 var arg_subscriptionId = "foo"; |
| 917 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 917 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 918 var path = (req.url).path; | 918 var path = (req.url).path; |
| 919 var pathOffset = 0; | 919 var pathOffset = 0; |
| 920 var index; | 920 var index; |
| 921 var subPart; | 921 var subPart; |
| 922 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 922 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 923 pathOffset += 1; | 923 pathOffset += 1; |
| 924 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 924 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 925 pathOffset += 17; | 925 pathOffset += 17; |
| 926 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 926 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 927 pathOffset += 10; | 927 pathOffset += 10; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 957 } | 957 } |
| 958 } | 958 } |
| 959 | 959 |
| 960 | 960 |
| 961 var h = { | 961 var h = { |
| 962 "content-type" : "application/json; charset=utf-8", | 962 "content-type" : "application/json; charset=utf-8", |
| 963 }; | 963 }; |
| 964 var resp = convert.JSON.encode(buildSubscription()); | 964 var resp = convert.JSON.encode(buildSubscription()); |
| 965 return new async.Future.value(stringResponse(200, h, resp)); | 965 return new async.Future.value(stringResponse(200, h, resp)); |
| 966 }), true); | 966 }), true); |
| 967 res.activate(arg_customerId, arg_subscriptionId).then(unittest.expectAsync
(((api.Subscription response) { | 967 res.activate(arg_customerId, arg_subscriptionId).then(unittest.expectAsync
1(((api.Subscription response) { |
| 968 checkSubscription(response); | 968 checkSubscription(response); |
| 969 }))); | 969 }))); |
| 970 }); | 970 }); |
| 971 | 971 |
| 972 unittest.test("method--changePlan", () { | 972 unittest.test("method--changePlan", () { |
| 973 | 973 |
| 974 var mock = new HttpServerMock(); | 974 var mock = new HttpServerMock(); |
| 975 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 975 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 976 var arg_request = buildChangePlanRequest(); | 976 var arg_request = buildChangePlanRequest(); |
| 977 var arg_customerId = "foo"; | 977 var arg_customerId = "foo"; |
| 978 var arg_subscriptionId = "foo"; | 978 var arg_subscriptionId = "foo"; |
| 979 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 979 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 980 var obj = new api.ChangePlanRequest.fromJson(json); | 980 var obj = new api.ChangePlanRequest.fromJson(json); |
| 981 checkChangePlanRequest(obj); | 981 checkChangePlanRequest(obj); |
| 982 | 982 |
| 983 var path = (req.url).path; | 983 var path = (req.url).path; |
| 984 var pathOffset = 0; | 984 var pathOffset = 0; |
| 985 var index; | 985 var index; |
| 986 var subPart; | 986 var subPart; |
| 987 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 987 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 988 pathOffset += 1; | 988 pathOffset += 1; |
| 989 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 989 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1022 } |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 | 1025 |
| 1026 var h = { | 1026 var h = { |
| 1027 "content-type" : "application/json; charset=utf-8", | 1027 "content-type" : "application/json; charset=utf-8", |
| 1028 }; | 1028 }; |
| 1029 var resp = convert.JSON.encode(buildSubscription()); | 1029 var resp = convert.JSON.encode(buildSubscription()); |
| 1030 return new async.Future.value(stringResponse(200, h, resp)); | 1030 return new async.Future.value(stringResponse(200, h, resp)); |
| 1031 }), true); | 1031 }), true); |
| 1032 res.changePlan(arg_request, arg_customerId, arg_subscriptionId).then(unitt
est.expectAsync(((api.Subscription response) { | 1032 res.changePlan(arg_request, arg_customerId, arg_subscriptionId).then(unitt
est.expectAsync1(((api.Subscription response) { |
| 1033 checkSubscription(response); | 1033 checkSubscription(response); |
| 1034 }))); | 1034 }))); |
| 1035 }); | 1035 }); |
| 1036 | 1036 |
| 1037 unittest.test("method--changeRenewalSettings", () { | 1037 unittest.test("method--changeRenewalSettings", () { |
| 1038 | 1038 |
| 1039 var mock = new HttpServerMock(); | 1039 var mock = new HttpServerMock(); |
| 1040 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1040 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1041 var arg_request = buildRenewalSettings(); | 1041 var arg_request = buildRenewalSettings(); |
| 1042 var arg_customerId = "foo"; | 1042 var arg_customerId = "foo"; |
| 1043 var arg_subscriptionId = "foo"; | 1043 var arg_subscriptionId = "foo"; |
| 1044 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1044 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1045 var obj = new api.RenewalSettings.fromJson(json); | 1045 var obj = new api.RenewalSettings.fromJson(json); |
| 1046 checkRenewalSettings(obj); | 1046 checkRenewalSettings(obj); |
| 1047 | 1047 |
| 1048 var path = (req.url).path; | 1048 var path = (req.url).path; |
| 1049 var pathOffset = 0; | 1049 var pathOffset = 0; |
| 1050 var index; | 1050 var index; |
| 1051 var subPart; | 1051 var subPart; |
| 1052 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1052 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1053 pathOffset += 1; | 1053 pathOffset += 1; |
| 1054 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1054 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 } | 1087 } |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 | 1090 |
| 1091 var h = { | 1091 var h = { |
| 1092 "content-type" : "application/json; charset=utf-8", | 1092 "content-type" : "application/json; charset=utf-8", |
| 1093 }; | 1093 }; |
| 1094 var resp = convert.JSON.encode(buildSubscription()); | 1094 var resp = convert.JSON.encode(buildSubscription()); |
| 1095 return new async.Future.value(stringResponse(200, h, resp)); | 1095 return new async.Future.value(stringResponse(200, h, resp)); |
| 1096 }), true); | 1096 }), true); |
| 1097 res.changeRenewalSettings(arg_request, arg_customerId, arg_subscriptionId)
.then(unittest.expectAsync(((api.Subscription response) { | 1097 res.changeRenewalSettings(arg_request, arg_customerId, arg_subscriptionId)
.then(unittest.expectAsync1(((api.Subscription response) { |
| 1098 checkSubscription(response); | 1098 checkSubscription(response); |
| 1099 }))); | 1099 }))); |
| 1100 }); | 1100 }); |
| 1101 | 1101 |
| 1102 unittest.test("method--changeSeats", () { | 1102 unittest.test("method--changeSeats", () { |
| 1103 | 1103 |
| 1104 var mock = new HttpServerMock(); | 1104 var mock = new HttpServerMock(); |
| 1105 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1105 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1106 var arg_request = buildSeats(); | 1106 var arg_request = buildSeats(); |
| 1107 var arg_customerId = "foo"; | 1107 var arg_customerId = "foo"; |
| 1108 var arg_subscriptionId = "foo"; | 1108 var arg_subscriptionId = "foo"; |
| 1109 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1109 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1110 var obj = new api.Seats.fromJson(json); | 1110 var obj = new api.Seats.fromJson(json); |
| 1111 checkSeats(obj); | 1111 checkSeats(obj); |
| 1112 | 1112 |
| 1113 var path = (req.url).path; | 1113 var path = (req.url).path; |
| 1114 var pathOffset = 0; | 1114 var pathOffset = 0; |
| 1115 var index; | 1115 var index; |
| 1116 var subPart; | 1116 var subPart; |
| 1117 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1117 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1118 pathOffset += 1; | 1118 pathOffset += 1; |
| 1119 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1119 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 } | 1152 } |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 | 1155 |
| 1156 var h = { | 1156 var h = { |
| 1157 "content-type" : "application/json; charset=utf-8", | 1157 "content-type" : "application/json; charset=utf-8", |
| 1158 }; | 1158 }; |
| 1159 var resp = convert.JSON.encode(buildSubscription()); | 1159 var resp = convert.JSON.encode(buildSubscription()); |
| 1160 return new async.Future.value(stringResponse(200, h, resp)); | 1160 return new async.Future.value(stringResponse(200, h, resp)); |
| 1161 }), true); | 1161 }), true); |
| 1162 res.changeSeats(arg_request, arg_customerId, arg_subscriptionId).then(unit
test.expectAsync(((api.Subscription response) { | 1162 res.changeSeats(arg_request, arg_customerId, arg_subscriptionId).then(unit
test.expectAsync1(((api.Subscription response) { |
| 1163 checkSubscription(response); | 1163 checkSubscription(response); |
| 1164 }))); | 1164 }))); |
| 1165 }); | 1165 }); |
| 1166 | 1166 |
| 1167 unittest.test("method--delete", () { | 1167 unittest.test("method--delete", () { |
| 1168 | 1168 |
| 1169 var mock = new HttpServerMock(); | 1169 var mock = new HttpServerMock(); |
| 1170 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1170 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1171 var arg_customerId = "foo"; | 1171 var arg_customerId = "foo"; |
| 1172 var arg_subscriptionId = "foo"; | 1172 var arg_subscriptionId = "foo"; |
| 1173 var arg_deletionType = "foo"; | 1173 var arg_deletionType = "foo"; |
| 1174 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1174 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1175 var path = (req.url).path; | 1175 var path = (req.url).path; |
| 1176 var pathOffset = 0; | 1176 var pathOffset = 0; |
| 1177 var index; | 1177 var index; |
| 1178 var subPart; | 1178 var subPart; |
| 1179 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1179 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1180 pathOffset += 1; | 1180 pathOffset += 1; |
| 1181 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1181 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 1182 pathOffset += 17; | 1182 pathOffset += 17; |
| 1183 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 1183 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 1184 pathOffset += 10; | 1184 pathOffset += 10; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1211 } | 1211 } |
| 1212 unittest.expect(queryMap["deletionType"].first, unittest.equals(arg_dele
tionType)); | 1212 unittest.expect(queryMap["deletionType"].first, unittest.equals(arg_dele
tionType)); |
| 1213 | 1213 |
| 1214 | 1214 |
| 1215 var h = { | 1215 var h = { |
| 1216 "content-type" : "application/json; charset=utf-8", | 1216 "content-type" : "application/json; charset=utf-8", |
| 1217 }; | 1217 }; |
| 1218 var resp = ""; | 1218 var resp = ""; |
| 1219 return new async.Future.value(stringResponse(200, h, resp)); | 1219 return new async.Future.value(stringResponse(200, h, resp)); |
| 1220 }), true); | 1220 }), true); |
| 1221 res.delete(arg_customerId, arg_subscriptionId, arg_deletionType).then(unit
test.expectAsync((_) {})); | 1221 res.delete(arg_customerId, arg_subscriptionId, arg_deletionType).then(unit
test.expectAsync1((_) {})); |
| 1222 }); | 1222 }); |
| 1223 | 1223 |
| 1224 unittest.test("method--get", () { | 1224 unittest.test("method--get", () { |
| 1225 | 1225 |
| 1226 var mock = new HttpServerMock(); | 1226 var mock = new HttpServerMock(); |
| 1227 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1227 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1228 var arg_customerId = "foo"; | 1228 var arg_customerId = "foo"; |
| 1229 var arg_subscriptionId = "foo"; | 1229 var arg_subscriptionId = "foo"; |
| 1230 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1230 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1231 var path = (req.url).path; | 1231 var path = (req.url).path; |
| 1232 var pathOffset = 0; | 1232 var pathOffset = 0; |
| 1233 var index; | 1233 var index; |
| 1234 var subPart; | 1234 var subPart; |
| 1235 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1235 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1236 pathOffset += 1; | 1236 pathOffset += 1; |
| 1237 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1237 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 1238 pathOffset += 17; | 1238 pathOffset += 17; |
| 1239 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 1239 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 1240 pathOffset += 10; | 1240 pathOffset += 10; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1266 } | 1266 } |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 | 1269 |
| 1270 var h = { | 1270 var h = { |
| 1271 "content-type" : "application/json; charset=utf-8", | 1271 "content-type" : "application/json; charset=utf-8", |
| 1272 }; | 1272 }; |
| 1273 var resp = convert.JSON.encode(buildSubscription()); | 1273 var resp = convert.JSON.encode(buildSubscription()); |
| 1274 return new async.Future.value(stringResponse(200, h, resp)); | 1274 return new async.Future.value(stringResponse(200, h, resp)); |
| 1275 }), true); | 1275 }), true); |
| 1276 res.get(arg_customerId, arg_subscriptionId).then(unittest.expectAsync(((ap
i.Subscription response) { | 1276 res.get(arg_customerId, arg_subscriptionId).then(unittest.expectAsync1(((a
pi.Subscription response) { |
| 1277 checkSubscription(response); | 1277 checkSubscription(response); |
| 1278 }))); | 1278 }))); |
| 1279 }); | 1279 }); |
| 1280 | 1280 |
| 1281 unittest.test("method--insert", () { | 1281 unittest.test("method--insert", () { |
| 1282 | 1282 |
| 1283 var mock = new HttpServerMock(); | 1283 var mock = new HttpServerMock(); |
| 1284 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1284 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1285 var arg_request = buildSubscription(); | 1285 var arg_request = buildSubscription(); |
| 1286 var arg_customerId = "foo"; | 1286 var arg_customerId = "foo"; |
| 1287 var arg_customerAuthToken = "foo"; | 1287 var arg_customerAuthToken = "foo"; |
| 1288 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1288 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1289 var obj = new api.Subscription.fromJson(json); | 1289 var obj = new api.Subscription.fromJson(json); |
| 1290 checkSubscription(obj); | 1290 checkSubscription(obj); |
| 1291 | 1291 |
| 1292 var path = (req.url).path; | 1292 var path = (req.url).path; |
| 1293 var pathOffset = 0; | 1293 var pathOffset = 0; |
| 1294 var index; | 1294 var index; |
| 1295 var subPart; | 1295 var subPart; |
| 1296 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1296 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1297 pathOffset += 1; | 1297 pathOffset += 1; |
| 1298 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1298 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1325 } | 1325 } |
| 1326 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg
_customerAuthToken)); | 1326 unittest.expect(queryMap["customerAuthToken"].first, unittest.equals(arg
_customerAuthToken)); |
| 1327 | 1327 |
| 1328 | 1328 |
| 1329 var h = { | 1329 var h = { |
| 1330 "content-type" : "application/json; charset=utf-8", | 1330 "content-type" : "application/json; charset=utf-8", |
| 1331 }; | 1331 }; |
| 1332 var resp = convert.JSON.encode(buildSubscription()); | 1332 var resp = convert.JSON.encode(buildSubscription()); |
| 1333 return new async.Future.value(stringResponse(200, h, resp)); | 1333 return new async.Future.value(stringResponse(200, h, resp)); |
| 1334 }), true); | 1334 }), true); |
| 1335 res.insert(arg_request, arg_customerId, customerAuthToken: arg_customerAut
hToken).then(unittest.expectAsync(((api.Subscription response) { | 1335 res.insert(arg_request, arg_customerId, customerAuthToken: arg_customerAut
hToken).then(unittest.expectAsync1(((api.Subscription response) { |
| 1336 checkSubscription(response); | 1336 checkSubscription(response); |
| 1337 }))); | 1337 }))); |
| 1338 }); | 1338 }); |
| 1339 | 1339 |
| 1340 unittest.test("method--list", () { | 1340 unittest.test("method--list", () { |
| 1341 | 1341 |
| 1342 var mock = new HttpServerMock(); | 1342 var mock = new HttpServerMock(); |
| 1343 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1343 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1344 var arg_customerAuthToken = "foo"; | 1344 var arg_customerAuthToken = "foo"; |
| 1345 var arg_customerId = "foo"; | 1345 var arg_customerId = "foo"; |
| 1346 var arg_customerNamePrefix = "foo"; | 1346 var arg_customerNamePrefix = "foo"; |
| 1347 var arg_maxResults = 42; | 1347 var arg_maxResults = 42; |
| 1348 var arg_pageToken = "foo"; | 1348 var arg_pageToken = "foo"; |
| 1349 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1349 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1350 var path = (req.url).path; | 1350 var path = (req.url).path; |
| 1351 var pathOffset = 0; | 1351 var pathOffset = 0; |
| 1352 var index; | 1352 var index; |
| 1353 var subPart; | 1353 var subPart; |
| 1354 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1354 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1355 pathOffset += 1; | 1355 pathOffset += 1; |
| 1356 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1356 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 1357 pathOffset += 17; | 1357 pathOffset += 17; |
| 1358 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("subscriptions")); | 1358 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("subscriptions")); |
| 1359 pathOffset += 13; | 1359 pathOffset += 13; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1380 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 1380 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1381 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1381 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1382 | 1382 |
| 1383 | 1383 |
| 1384 var h = { | 1384 var h = { |
| 1385 "content-type" : "application/json; charset=utf-8", | 1385 "content-type" : "application/json; charset=utf-8", |
| 1386 }; | 1386 }; |
| 1387 var resp = convert.JSON.encode(buildSubscriptions()); | 1387 var resp = convert.JSON.encode(buildSubscriptions()); |
| 1388 return new async.Future.value(stringResponse(200, h, resp)); | 1388 return new async.Future.value(stringResponse(200, h, resp)); |
| 1389 }), true); | 1389 }), true); |
| 1390 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) { | 1390 res.list(customerAuthToken: arg_customerAuthToken, customerId: arg_custome
rId, customerNamePrefix: arg_customerNamePrefix, maxResults: arg_maxResults, pag
eToken: arg_pageToken).then(unittest.expectAsync1(((api.Subscriptions response)
{ |
| 1391 checkSubscriptions(response); | 1391 checkSubscriptions(response); |
| 1392 }))); | 1392 }))); |
| 1393 }); | 1393 }); |
| 1394 | 1394 |
| 1395 unittest.test("method--startPaidService", () { | 1395 unittest.test("method--startPaidService", () { |
| 1396 | 1396 |
| 1397 var mock = new HttpServerMock(); | 1397 var mock = new HttpServerMock(); |
| 1398 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1398 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1399 var arg_customerId = "foo"; | 1399 var arg_customerId = "foo"; |
| 1400 var arg_subscriptionId = "foo"; | 1400 var arg_subscriptionId = "foo"; |
| 1401 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1401 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1402 var path = (req.url).path; | 1402 var path = (req.url).path; |
| 1403 var pathOffset = 0; | 1403 var pathOffset = 0; |
| 1404 var index; | 1404 var index; |
| 1405 var subPart; | 1405 var subPart; |
| 1406 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1406 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1407 pathOffset += 1; | 1407 pathOffset += 1; |
| 1408 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1408 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 1409 pathOffset += 17; | 1409 pathOffset += 17; |
| 1410 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 1410 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 1411 pathOffset += 10; | 1411 pathOffset += 10; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 | 1444 |
| 1445 var h = { | 1445 var h = { |
| 1446 "content-type" : "application/json; charset=utf-8", | 1446 "content-type" : "application/json; charset=utf-8", |
| 1447 }; | 1447 }; |
| 1448 var resp = convert.JSON.encode(buildSubscription()); | 1448 var resp = convert.JSON.encode(buildSubscription()); |
| 1449 return new async.Future.value(stringResponse(200, h, resp)); | 1449 return new async.Future.value(stringResponse(200, h, resp)); |
| 1450 }), true); | 1450 }), true); |
| 1451 res.startPaidService(arg_customerId, arg_subscriptionId).then(unittest.exp
ectAsync(((api.Subscription response) { | 1451 res.startPaidService(arg_customerId, arg_subscriptionId).then(unittest.exp
ectAsync1(((api.Subscription response) { |
| 1452 checkSubscription(response); | 1452 checkSubscription(response); |
| 1453 }))); | 1453 }))); |
| 1454 }); | 1454 }); |
| 1455 | 1455 |
| 1456 unittest.test("method--suspend", () { | 1456 unittest.test("method--suspend", () { |
| 1457 | 1457 |
| 1458 var mock = new HttpServerMock(); | 1458 var mock = new HttpServerMock(); |
| 1459 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; | 1459 api.SubscriptionsResourceApi res = new api.ResellerApi(mock).subscriptions
; |
| 1460 var arg_customerId = "foo"; | 1460 var arg_customerId = "foo"; |
| 1461 var arg_subscriptionId = "foo"; | 1461 var arg_subscriptionId = "foo"; |
| 1462 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1462 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1463 var path = (req.url).path; | 1463 var path = (req.url).path; |
| 1464 var pathOffset = 0; | 1464 var pathOffset = 0; |
| 1465 var index; | 1465 var index; |
| 1466 var subPart; | 1466 var subPart; |
| 1467 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1467 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1468 pathOffset += 1; | 1468 pathOffset += 1; |
| 1469 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); | 1469 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("apps/reseller/v1/")); |
| 1470 pathOffset += 17; | 1470 pathOffset += 17; |
| 1471 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); | 1471 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("customers/")); |
| 1472 pathOffset += 10; | 1472 pathOffset += 10; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1502 } | 1502 } |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 | 1505 |
| 1506 var h = { | 1506 var h = { |
| 1507 "content-type" : "application/json; charset=utf-8", | 1507 "content-type" : "application/json; charset=utf-8", |
| 1508 }; | 1508 }; |
| 1509 var resp = convert.JSON.encode(buildSubscription()); | 1509 var resp = convert.JSON.encode(buildSubscription()); |
| 1510 return new async.Future.value(stringResponse(200, h, resp)); | 1510 return new async.Future.value(stringResponse(200, h, resp)); |
| 1511 }), true); | 1511 }), true); |
| 1512 res.suspend(arg_customerId, arg_subscriptionId).then(unittest.expectAsync(
((api.Subscription response) { | 1512 res.suspend(arg_customerId, arg_subscriptionId).then(unittest.expectAsync1
(((api.Subscription response) { |
| 1513 checkSubscription(response); | 1513 checkSubscription(response); |
| 1514 }))); | 1514 }))); |
| 1515 }); | 1515 }); |
| 1516 | 1516 |
| 1517 }); | 1517 }); |
| 1518 | 1518 |
| 1519 | 1519 |
| 1520 } | 1520 } |
| 1521 | 1521 |
| OLD | NEW |