| OLD | NEW |
| 1 library googleapis.servicemanagement.v1.test; | 1 library googleapis.servicemanagement.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; |
| (...skipping 2542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 } | 2553 } |
| 2554 buildCounterService--; | 2554 buildCounterService--; |
| 2555 } | 2555 } |
| 2556 | 2556 |
| 2557 core.int buildCounterSetIamPolicyRequest = 0; | 2557 core.int buildCounterSetIamPolicyRequest = 0; |
| 2558 buildSetIamPolicyRequest() { | 2558 buildSetIamPolicyRequest() { |
| 2559 var o = new api.SetIamPolicyRequest(); | 2559 var o = new api.SetIamPolicyRequest(); |
| 2560 buildCounterSetIamPolicyRequest++; | 2560 buildCounterSetIamPolicyRequest++; |
| 2561 if (buildCounterSetIamPolicyRequest < 3) { | 2561 if (buildCounterSetIamPolicyRequest < 3) { |
| 2562 o.policy = buildPolicy(); | 2562 o.policy = buildPolicy(); |
| 2563 o.updateMask = "foo"; |
| 2563 } | 2564 } |
| 2564 buildCounterSetIamPolicyRequest--; | 2565 buildCounterSetIamPolicyRequest--; |
| 2565 return o; | 2566 return o; |
| 2566 } | 2567 } |
| 2567 | 2568 |
| 2568 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | 2569 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| 2569 buildCounterSetIamPolicyRequest++; | 2570 buildCounterSetIamPolicyRequest++; |
| 2570 if (buildCounterSetIamPolicyRequest < 3) { | 2571 if (buildCounterSetIamPolicyRequest < 3) { |
| 2571 checkPolicy(o.policy); | 2572 checkPolicy(o.policy); |
| 2573 unittest.expect(o.updateMask, unittest.equals('foo')); |
| 2572 } | 2574 } |
| 2573 buildCounterSetIamPolicyRequest--; | 2575 buildCounterSetIamPolicyRequest--; |
| 2574 } | 2576 } |
| 2575 | 2577 |
| 2576 core.int buildCounterSourceContext = 0; | 2578 core.int buildCounterSourceContext = 0; |
| 2577 buildSourceContext() { | 2579 buildSourceContext() { |
| 2578 var o = new api.SourceContext(); | 2580 var o = new api.SourceContext(); |
| 2579 buildCounterSourceContext++; | 2581 buildCounterSourceContext++; |
| 2580 if (buildCounterSourceContext < 3) { | 2582 if (buildCounterSourceContext < 3) { |
| 2581 o.fileName = "foo"; | 2583 o.fileName = "foo"; |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4311 }), true); | 4313 }), true); |
| 4312 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((ap
i.Policy response) { | 4314 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((ap
i.Policy response) { |
| 4313 checkPolicy(response); | 4315 checkPolicy(response); |
| 4314 }))); | 4316 }))); |
| 4315 }); | 4317 }); |
| 4316 | 4318 |
| 4317 unittest.test("method--list", () { | 4319 unittest.test("method--list", () { |
| 4318 | 4320 |
| 4319 var mock = new HttpServerMock(); | 4321 var mock = new HttpServerMock(); |
| 4320 api.ServicesResourceApi res = new api.ServicemanagementApi(mock).services; | 4322 api.ServicesResourceApi res = new api.ServicemanagementApi(mock).services; |
| 4323 var arg_consumerId = "foo"; |
| 4324 var arg_pageToken = "foo"; |
| 4321 var arg_pageSize = 42; | 4325 var arg_pageSize = 42; |
| 4322 var arg_producerProjectId = "foo"; | 4326 var arg_producerProjectId = "foo"; |
| 4323 var arg_pageToken = "foo"; | |
| 4324 var arg_consumerId = "foo"; | |
| 4325 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 4327 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4326 var path = (req.url).path; | 4328 var path = (req.url).path; |
| 4327 var pathOffset = 0; | 4329 var pathOffset = 0; |
| 4328 var index; | 4330 var index; |
| 4329 var subPart; | 4331 var subPart; |
| 4330 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 4332 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 4331 pathOffset += 1; | 4333 pathOffset += 1; |
| 4332 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/services")); | 4334 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/services")); |
| 4333 pathOffset += 11; | 4335 pathOffset += 11; |
| 4334 | 4336 |
| 4335 var query = (req.url).query; | 4337 var query = (req.url).query; |
| 4336 var queryOffset = 0; | 4338 var queryOffset = 0; |
| 4337 var queryMap = {}; | 4339 var queryMap = {}; |
| 4338 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 4340 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 4339 parseBool(n) { | 4341 parseBool(n) { |
| 4340 if (n == "true") return true; | 4342 if (n == "true") return true; |
| 4341 if (n == "false") return false; | 4343 if (n == "false") return false; |
| 4342 if (n == null) return null; | 4344 if (n == null) return null; |
| 4343 throw new core.ArgumentError("Invalid boolean: $n"); | 4345 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4344 } | 4346 } |
| 4345 if (query.length > 0) { | 4347 if (query.length > 0) { |
| 4346 for (var part in query.split("&")) { | 4348 for (var part in query.split("&")) { |
| 4347 var keyvalue = part.split("="); | 4349 var keyvalue = part.split("="); |
| 4348 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 4350 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4349 } | 4351 } |
| 4350 } | 4352 } |
| 4353 unittest.expect(queryMap["consumerId"].first, unittest.equals(arg_consum
erId)); |
| 4354 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 4351 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 4355 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 4352 unittest.expect(queryMap["producerProjectId"].first, unittest.equals(arg
_producerProjectId)); | 4356 unittest.expect(queryMap["producerProjectId"].first, unittest.equals(arg
_producerProjectId)); |
| 4353 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 4354 unittest.expect(queryMap["consumerId"].first, unittest.equals(arg_consum
erId)); | |
| 4355 | 4357 |
| 4356 | 4358 |
| 4357 var h = { | 4359 var h = { |
| 4358 "content-type" : "application/json; charset=utf-8", | 4360 "content-type" : "application/json; charset=utf-8", |
| 4359 }; | 4361 }; |
| 4360 var resp = convert.JSON.encode(buildListServicesResponse()); | 4362 var resp = convert.JSON.encode(buildListServicesResponse()); |
| 4361 return new async.Future.value(stringResponse(200, h, resp)); | 4363 return new async.Future.value(stringResponse(200, h, resp)); |
| 4362 }), true); | 4364 }), true); |
| 4363 res.list(pageSize: arg_pageSize, producerProjectId: arg_producerProjectId,
pageToken: arg_pageToken, consumerId: arg_consumerId).then(unittest.expectAsync
(((api.ListServicesResponse response) { | 4365 res.list(consumerId: arg_consumerId, pageToken: arg_pageToken, pageSize: a
rg_pageSize, producerProjectId: arg_producerProjectId).then(unittest.expectAsync
(((api.ListServicesResponse response) { |
| 4364 checkListServicesResponse(response); | 4366 checkListServicesResponse(response); |
| 4365 }))); | 4367 }))); |
| 4366 }); | 4368 }); |
| 4367 | 4369 |
| 4368 unittest.test("method--setIamPolicy", () { | 4370 unittest.test("method--setIamPolicy", () { |
| 4369 | 4371 |
| 4370 var mock = new HttpServerMock(); | 4372 var mock = new HttpServerMock(); |
| 4371 api.ServicesResourceApi res = new api.ServicemanagementApi(mock).services; | 4373 api.ServicesResourceApi res = new api.ServicemanagementApi(mock).services; |
| 4372 var arg_request = buildSetIamPolicyRequest(); | 4374 var arg_request = buildSetIamPolicyRequest(); |
| 4373 var arg_resource = "foo"; | 4375 var arg_resource = "foo"; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4626 res.get(arg_serviceName, arg_configId).then(unittest.expectAsync(((api.Ser
vice response) { | 4628 res.get(arg_serviceName, arg_configId).then(unittest.expectAsync(((api.Ser
vice response) { |
| 4627 checkService(response); | 4629 checkService(response); |
| 4628 }))); | 4630 }))); |
| 4629 }); | 4631 }); |
| 4630 | 4632 |
| 4631 unittest.test("method--list", () { | 4633 unittest.test("method--list", () { |
| 4632 | 4634 |
| 4633 var mock = new HttpServerMock(); | 4635 var mock = new HttpServerMock(); |
| 4634 api.ServicesConfigsResourceApi res = new api.ServicemanagementApi(mock).se
rvices.configs; | 4636 api.ServicesConfigsResourceApi res = new api.ServicemanagementApi(mock).se
rvices.configs; |
| 4635 var arg_serviceName = "foo"; | 4637 var arg_serviceName = "foo"; |
| 4638 var arg_pageToken = "foo"; |
| 4636 var arg_pageSize = 42; | 4639 var arg_pageSize = 42; |
| 4637 var arg_pageToken = "foo"; | |
| 4638 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 4640 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4639 var path = (req.url).path; | 4641 var path = (req.url).path; |
| 4640 var pathOffset = 0; | 4642 var pathOffset = 0; |
| 4641 var index; | 4643 var index; |
| 4642 var subPart; | 4644 var subPart; |
| 4643 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 4645 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 4644 pathOffset += 1; | 4646 pathOffset += 1; |
| 4645 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/services/")); | 4647 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/services/")); |
| 4646 pathOffset += 12; | 4648 pathOffset += 12; |
| 4647 index = path.indexOf("/configs", pathOffset); | 4649 index = path.indexOf("/configs", pathOffset); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4661 if (n == "false") return false; | 4663 if (n == "false") return false; |
| 4662 if (n == null) return null; | 4664 if (n == null) return null; |
| 4663 throw new core.ArgumentError("Invalid boolean: $n"); | 4665 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4664 } | 4666 } |
| 4665 if (query.length > 0) { | 4667 if (query.length > 0) { |
| 4666 for (var part in query.split("&")) { | 4668 for (var part in query.split("&")) { |
| 4667 var keyvalue = part.split("="); | 4669 var keyvalue = part.split("="); |
| 4668 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 4670 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4669 } | 4671 } |
| 4670 } | 4672 } |
| 4673 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 4671 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 4674 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 4672 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 4673 | 4675 |
| 4674 | 4676 |
| 4675 var h = { | 4677 var h = { |
| 4676 "content-type" : "application/json; charset=utf-8", | 4678 "content-type" : "application/json; charset=utf-8", |
| 4677 }; | 4679 }; |
| 4678 var resp = convert.JSON.encode(buildListServiceConfigsResponse()); | 4680 var resp = convert.JSON.encode(buildListServiceConfigsResponse()); |
| 4679 return new async.Future.value(stringResponse(200, h, resp)); | 4681 return new async.Future.value(stringResponse(200, h, resp)); |
| 4680 }), true); | 4682 }), true); |
| 4681 res.list(arg_serviceName, pageSize: arg_pageSize, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.ListServiceConfigsResponse response) { | 4683 res.list(arg_serviceName, pageToken: arg_pageToken, pageSize: arg_pageSize
).then(unittest.expectAsync(((api.ListServiceConfigsResponse response) { |
| 4682 checkListServiceConfigsResponse(response); | 4684 checkListServiceConfigsResponse(response); |
| 4683 }))); | 4685 }))); |
| 4684 }); | 4686 }); |
| 4685 | 4687 |
| 4686 unittest.test("method--submit", () { | 4688 unittest.test("method--submit", () { |
| 4687 | 4689 |
| 4688 var mock = new HttpServerMock(); | 4690 var mock = new HttpServerMock(); |
| 4689 api.ServicesConfigsResourceApi res = new api.ServicemanagementApi(mock).se
rvices.configs; | 4691 api.ServicesConfigsResourceApi res = new api.ServicemanagementApi(mock).se
rvices.configs; |
| 4690 var arg_request = buildSubmitConfigSourceRequest(); | 4692 var arg_request = buildSubmitConfigSourceRequest(); |
| 4691 var arg_serviceName = "foo"; | 4693 var arg_serviceName = "foo"; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4850 res.get(arg_serviceName, arg_rolloutId).then(unittest.expectAsync(((api.Ro
llout response) { | 4852 res.get(arg_serviceName, arg_rolloutId).then(unittest.expectAsync(((api.Ro
llout response) { |
| 4851 checkRollout(response); | 4853 checkRollout(response); |
| 4852 }))); | 4854 }))); |
| 4853 }); | 4855 }); |
| 4854 | 4856 |
| 4855 unittest.test("method--list", () { | 4857 unittest.test("method--list", () { |
| 4856 | 4858 |
| 4857 var mock = new HttpServerMock(); | 4859 var mock = new HttpServerMock(); |
| 4858 api.ServicesRolloutsResourceApi res = new api.ServicemanagementApi(mock).s
ervices.rollouts; | 4860 api.ServicesRolloutsResourceApi res = new api.ServicemanagementApi(mock).s
ervices.rollouts; |
| 4859 var arg_serviceName = "foo"; | 4861 var arg_serviceName = "foo"; |
| 4862 var arg_pageToken = "foo"; |
| 4860 var arg_pageSize = 42; | 4863 var arg_pageSize = 42; |
| 4861 var arg_pageToken = "foo"; | |
| 4862 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 4864 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 4863 var path = (req.url).path; | 4865 var path = (req.url).path; |
| 4864 var pathOffset = 0; | 4866 var pathOffset = 0; |
| 4865 var index; | 4867 var index; |
| 4866 var subPart; | 4868 var subPart; |
| 4867 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 4869 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 4868 pathOffset += 1; | 4870 pathOffset += 1; |
| 4869 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/services/")); | 4871 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/services/")); |
| 4870 pathOffset += 12; | 4872 pathOffset += 12; |
| 4871 index = path.indexOf("/rollouts", pathOffset); | 4873 index = path.indexOf("/rollouts", pathOffset); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4885 if (n == "false") return false; | 4887 if (n == "false") return false; |
| 4886 if (n == null) return null; | 4888 if (n == null) return null; |
| 4887 throw new core.ArgumentError("Invalid boolean: $n"); | 4889 throw new core.ArgumentError("Invalid boolean: $n"); |
| 4888 } | 4890 } |
| 4889 if (query.length > 0) { | 4891 if (query.length > 0) { |
| 4890 for (var part in query.split("&")) { | 4892 for (var part in query.split("&")) { |
| 4891 var keyvalue = part.split("="); | 4893 var keyvalue = part.split("="); |
| 4892 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 4894 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 4893 } | 4895 } |
| 4894 } | 4896 } |
| 4897 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 4895 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 4898 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 4896 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
| 4897 | 4899 |
| 4898 | 4900 |
| 4899 var h = { | 4901 var h = { |
| 4900 "content-type" : "application/json; charset=utf-8", | 4902 "content-type" : "application/json; charset=utf-8", |
| 4901 }; | 4903 }; |
| 4902 var resp = convert.JSON.encode(buildListServiceRolloutsResponse()); | 4904 var resp = convert.JSON.encode(buildListServiceRolloutsResponse()); |
| 4903 return new async.Future.value(stringResponse(200, h, resp)); | 4905 return new async.Future.value(stringResponse(200, h, resp)); |
| 4904 }), true); | 4906 }), true); |
| 4905 res.list(arg_serviceName, pageSize: arg_pageSize, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.ListServiceRolloutsResponse response) { | 4907 res.list(arg_serviceName, pageToken: arg_pageToken, pageSize: arg_pageSize
).then(unittest.expectAsync(((api.ListServiceRolloutsResponse response) { |
| 4906 checkListServiceRolloutsResponse(response); | 4908 checkListServiceRolloutsResponse(response); |
| 4907 }))); | 4909 }))); |
| 4908 }); | 4910 }); |
| 4909 | 4911 |
| 4910 }); | 4912 }); |
| 4911 | 4913 |
| 4912 | 4914 |
| 4913 } | 4915 } |
| 4914 | 4916 |
| OLD | NEW |