Index: generated/googleapis_beta/test/cloudresourcemanager/v1beta1_test.dart |
diff --git a/generated/googleapis_beta/test/cloudresourcemanager/v1beta1_test.dart b/generated/googleapis_beta/test/cloudresourcemanager/v1beta1_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0119ac1cc24246787b63930fc35b7b752345b0e9 |
--- /dev/null |
+++ b/generated/googleapis_beta/test/cloudresourcemanager/v1beta1_test.dart |
@@ -0,0 +1,1147 @@ |
+library googleapis_beta.cloudresourcemanager.v1beta1.test; |
+ |
+import "dart:core" as core; |
+import "dart:collection" as collection; |
+import "dart:async" as async; |
+import "dart:convert" as convert; |
+ |
+import 'package:http/http.dart' as http; |
+import 'package:http/testing.dart' as http_testing; |
+import 'package:unittest/unittest.dart' as unittest; |
+ |
+import 'package:googleapis_beta/cloudresourcemanager/v1beta1.dart' as api; |
+ |
+class HttpServerMock extends http.BaseClient { |
+ core.Function _callback; |
+ core.bool _expectJson; |
+ |
+ void register(core.Function callback, core.bool expectJson) { |
+ _callback = callback; |
+ _expectJson = expectJson; |
+ } |
+ |
+ async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
+ if (_expectJson) { |
+ return request.finalize() |
+ .transform(convert.UTF8.decoder) |
+ .join('') |
+ .then((core.String jsonString) { |
+ if (jsonString.isEmpty) { |
+ return _callback(request, null); |
+ } else { |
+ return _callback(request, convert.JSON.decode(jsonString)); |
+ } |
+ }); |
+ } else { |
+ var stream = request.finalize(); |
+ if (stream == null) { |
+ return _callback(request, []); |
+ } else { |
+ return stream.toBytes().then((data) { |
+ return _callback(request, data); |
+ }); |
+ } |
+ } |
+ } |
+} |
+ |
+http.StreamedResponse stringResponse( |
+ core.int status, core.Map headers, core.String body) { |
+ var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
+ return new http.StreamedResponse(stream, status, headers: headers); |
+} |
+ |
+buildUnnamed2301() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2301(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterBinding = 0; |
+buildBinding() { |
+ var o = new api.Binding(); |
+ buildCounterBinding++; |
+ if (buildCounterBinding < 3) { |
+ o.members = buildUnnamed2301(); |
+ o.role = "foo"; |
+ } |
+ buildCounterBinding--; |
+ return o; |
+} |
+ |
+checkBinding(api.Binding o) { |
+ buildCounterBinding++; |
+ if (buildCounterBinding < 3) { |
+ checkUnnamed2301(o.members); |
+ unittest.expect(o.role, unittest.equals('foo')); |
+ } |
+ buildCounterBinding--; |
+} |
+ |
+core.int buildCounterCloudAuditOptions = 0; |
+buildCloudAuditOptions() { |
+ var o = new api.CloudAuditOptions(); |
+ buildCounterCloudAuditOptions++; |
+ if (buildCounterCloudAuditOptions < 3) { |
+ } |
+ buildCounterCloudAuditOptions--; |
+ return o; |
+} |
+ |
+checkCloudAuditOptions(api.CloudAuditOptions o) { |
+ buildCounterCloudAuditOptions++; |
+ if (buildCounterCloudAuditOptions < 3) { |
+ } |
+ buildCounterCloudAuditOptions--; |
+} |
+ |
+buildUnnamed2302() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2302(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterCondition = 0; |
+buildCondition() { |
+ var o = new api.Condition(); |
+ buildCounterCondition++; |
+ if (buildCounterCondition < 3) { |
+ o.iam = "foo"; |
+ o.op = "foo"; |
+ o.svc = "foo"; |
+ o.sys = "foo"; |
+ o.value = "foo"; |
+ o.values = buildUnnamed2302(); |
+ } |
+ buildCounterCondition--; |
+ return o; |
+} |
+ |
+checkCondition(api.Condition o) { |
+ buildCounterCondition++; |
+ if (buildCounterCondition < 3) { |
+ unittest.expect(o.iam, unittest.equals('foo')); |
+ unittest.expect(o.op, unittest.equals('foo')); |
+ unittest.expect(o.svc, unittest.equals('foo')); |
+ unittest.expect(o.sys, unittest.equals('foo')); |
+ unittest.expect(o.value, unittest.equals('foo')); |
+ checkUnnamed2302(o.values); |
+ } |
+ buildCounterCondition--; |
+} |
+ |
+core.int buildCounterCounterOptions = 0; |
+buildCounterOptions() { |
+ var o = new api.CounterOptions(); |
+ buildCounterCounterOptions++; |
+ if (buildCounterCounterOptions < 3) { |
+ o.field = "foo"; |
+ o.metric = "foo"; |
+ } |
+ buildCounterCounterOptions--; |
+ return o; |
+} |
+ |
+checkCounterOptions(api.CounterOptions o) { |
+ buildCounterCounterOptions++; |
+ if (buildCounterCounterOptions < 3) { |
+ unittest.expect(o.field, unittest.equals('foo')); |
+ unittest.expect(o.metric, unittest.equals('foo')); |
+ } |
+ buildCounterCounterOptions--; |
+} |
+ |
+core.int buildCounterDataAccessOptions = 0; |
+buildDataAccessOptions() { |
+ var o = new api.DataAccessOptions(); |
+ buildCounterDataAccessOptions++; |
+ if (buildCounterDataAccessOptions < 3) { |
+ } |
+ buildCounterDataAccessOptions--; |
+ return o; |
+} |
+ |
+checkDataAccessOptions(api.DataAccessOptions o) { |
+ buildCounterDataAccessOptions++; |
+ if (buildCounterDataAccessOptions < 3) { |
+ } |
+ buildCounterDataAccessOptions--; |
+} |
+ |
+core.int buildCounterEmpty = 0; |
+buildEmpty() { |
+ var o = new api.Empty(); |
+ buildCounterEmpty++; |
+ if (buildCounterEmpty < 3) { |
+ } |
+ buildCounterEmpty--; |
+ return o; |
+} |
+ |
+checkEmpty(api.Empty o) { |
+ buildCounterEmpty++; |
+ if (buildCounterEmpty < 3) { |
+ } |
+ buildCounterEmpty--; |
+} |
+ |
+core.int buildCounterGetIamPolicyRequest = 0; |
+buildGetIamPolicyRequest() { |
+ var o = new api.GetIamPolicyRequest(); |
+ buildCounterGetIamPolicyRequest++; |
+ if (buildCounterGetIamPolicyRequest < 3) { |
+ } |
+ buildCounterGetIamPolicyRequest--; |
+ return o; |
+} |
+ |
+checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
+ buildCounterGetIamPolicyRequest++; |
+ if (buildCounterGetIamPolicyRequest < 3) { |
+ } |
+ buildCounterGetIamPolicyRequest--; |
+} |
+ |
+buildUnnamed2303() { |
+ var o = new core.List<api.Project>(); |
+ o.add(buildProject()); |
+ o.add(buildProject()); |
+ return o; |
+} |
+ |
+checkUnnamed2303(core.List<api.Project> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkProject(o[0]); |
+ checkProject(o[1]); |
+} |
+ |
+core.int buildCounterListProjectsResponse = 0; |
+buildListProjectsResponse() { |
+ var o = new api.ListProjectsResponse(); |
+ buildCounterListProjectsResponse++; |
+ if (buildCounterListProjectsResponse < 3) { |
+ o.nextPageToken = "foo"; |
+ o.projects = buildUnnamed2303(); |
+ } |
+ buildCounterListProjectsResponse--; |
+ return o; |
+} |
+ |
+checkListProjectsResponse(api.ListProjectsResponse o) { |
+ buildCounterListProjectsResponse++; |
+ if (buildCounterListProjectsResponse < 3) { |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ checkUnnamed2303(o.projects); |
+ } |
+ buildCounterListProjectsResponse--; |
+} |
+ |
+core.int buildCounterLogConfig = 0; |
+buildLogConfig() { |
+ var o = new api.LogConfig(); |
+ buildCounterLogConfig++; |
+ if (buildCounterLogConfig < 3) { |
+ o.cloudAudit = buildCloudAuditOptions(); |
+ o.counter = buildCounterOptions(); |
+ o.dataAccess = buildDataAccessOptions(); |
+ } |
+ buildCounterLogConfig--; |
+ return o; |
+} |
+ |
+checkLogConfig(api.LogConfig o) { |
+ buildCounterLogConfig++; |
+ if (buildCounterLogConfig < 3) { |
+ checkCloudAuditOptions(o.cloudAudit); |
+ checkCounterOptions(o.counter); |
+ checkDataAccessOptions(o.dataAccess); |
+ } |
+ buildCounterLogConfig--; |
+} |
+ |
+buildUnnamed2304() { |
+ var o = new core.List<api.Binding>(); |
+ o.add(buildBinding()); |
+ o.add(buildBinding()); |
+ return o; |
+} |
+ |
+checkUnnamed2304(core.List<api.Binding> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkBinding(o[0]); |
+ checkBinding(o[1]); |
+} |
+ |
+buildUnnamed2305() { |
+ var o = new core.List<api.Rule>(); |
+ o.add(buildRule()); |
+ o.add(buildRule()); |
+ return o; |
+} |
+ |
+checkUnnamed2305(core.List<api.Rule> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkRule(o[0]); |
+ checkRule(o[1]); |
+} |
+ |
+core.int buildCounterPolicy = 0; |
+buildPolicy() { |
+ var o = new api.Policy(); |
+ buildCounterPolicy++; |
+ if (buildCounterPolicy < 3) { |
+ o.bindings = buildUnnamed2304(); |
+ o.etag = "foo"; |
+ o.rules = buildUnnamed2305(); |
+ o.version = 42; |
+ } |
+ buildCounterPolicy--; |
+ return o; |
+} |
+ |
+checkPolicy(api.Policy o) { |
+ buildCounterPolicy++; |
+ if (buildCounterPolicy < 3) { |
+ checkUnnamed2304(o.bindings); |
+ unittest.expect(o.etag, unittest.equals('foo')); |
+ checkUnnamed2305(o.rules); |
+ unittest.expect(o.version, unittest.equals(42)); |
+ } |
+ buildCounterPolicy--; |
+} |
+ |
+buildUnnamed2306() { |
+ var o = new core.Map<core.String, core.String>(); |
+ o["x"] = "foo"; |
+ o["y"] = "foo"; |
+ return o; |
+} |
+ |
+checkUnnamed2306(core.Map<core.String, core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o["x"], unittest.equals('foo')); |
+ unittest.expect(o["y"], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterProject = 0; |
+buildProject() { |
+ var o = new api.Project(); |
+ buildCounterProject++; |
+ if (buildCounterProject < 3) { |
+ o.createTime = "foo"; |
+ o.labels = buildUnnamed2306(); |
+ o.lifecycleState = "foo"; |
+ o.name = "foo"; |
+ o.projectId = "foo"; |
+ o.projectNumber = "foo"; |
+ } |
+ buildCounterProject--; |
+ return o; |
+} |
+ |
+checkProject(api.Project o) { |
+ buildCounterProject++; |
+ if (buildCounterProject < 3) { |
+ unittest.expect(o.createTime, unittest.equals('foo')); |
+ checkUnnamed2306(o.labels); |
+ unittest.expect(o.lifecycleState, unittest.equals('foo')); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ unittest.expect(o.projectId, unittest.equals('foo')); |
+ unittest.expect(o.projectNumber, unittest.equals('foo')); |
+ } |
+ buildCounterProject--; |
+} |
+ |
+buildUnnamed2307() { |
+ var o = new core.List<api.Condition>(); |
+ o.add(buildCondition()); |
+ o.add(buildCondition()); |
+ return o; |
+} |
+ |
+checkUnnamed2307(core.List<api.Condition> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkCondition(o[0]); |
+ checkCondition(o[1]); |
+} |
+ |
+buildUnnamed2308() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2308(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+buildUnnamed2309() { |
+ var o = new core.List<api.LogConfig>(); |
+ o.add(buildLogConfig()); |
+ o.add(buildLogConfig()); |
+ return o; |
+} |
+ |
+checkUnnamed2309(core.List<api.LogConfig> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogConfig(o[0]); |
+ checkLogConfig(o[1]); |
+} |
+ |
+buildUnnamed2310() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2310(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+buildUnnamed2311() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2311(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterRule = 0; |
+buildRule() { |
+ var o = new api.Rule(); |
+ buildCounterRule++; |
+ if (buildCounterRule < 3) { |
+ o.action = "foo"; |
+ o.conditions = buildUnnamed2307(); |
+ o.description = "foo"; |
+ o.in_ = buildUnnamed2308(); |
+ o.logConfig = buildUnnamed2309(); |
+ o.notIn = buildUnnamed2310(); |
+ o.permissions = buildUnnamed2311(); |
+ } |
+ buildCounterRule--; |
+ return o; |
+} |
+ |
+checkRule(api.Rule o) { |
+ buildCounterRule++; |
+ if (buildCounterRule < 3) { |
+ unittest.expect(o.action, unittest.equals('foo')); |
+ checkUnnamed2307(o.conditions); |
+ unittest.expect(o.description, unittest.equals('foo')); |
+ checkUnnamed2308(o.in_); |
+ checkUnnamed2309(o.logConfig); |
+ checkUnnamed2310(o.notIn); |
+ checkUnnamed2311(o.permissions); |
+ } |
+ buildCounterRule--; |
+} |
+ |
+core.int buildCounterSetIamPolicyRequest = 0; |
+buildSetIamPolicyRequest() { |
+ var o = new api.SetIamPolicyRequest(); |
+ buildCounterSetIamPolicyRequest++; |
+ if (buildCounterSetIamPolicyRequest < 3) { |
+ o.policy = buildPolicy(); |
+ } |
+ buildCounterSetIamPolicyRequest--; |
+ return o; |
+} |
+ |
+checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
+ buildCounterSetIamPolicyRequest++; |
+ if (buildCounterSetIamPolicyRequest < 3) { |
+ checkPolicy(o.policy); |
+ } |
+ buildCounterSetIamPolicyRequest--; |
+} |
+ |
+buildUnnamed2312() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2312(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterTestIamPermissionsRequest = 0; |
+buildTestIamPermissionsRequest() { |
+ var o = new api.TestIamPermissionsRequest(); |
+ buildCounterTestIamPermissionsRequest++; |
+ if (buildCounterTestIamPermissionsRequest < 3) { |
+ o.permissions = buildUnnamed2312(); |
+ } |
+ buildCounterTestIamPermissionsRequest--; |
+ return o; |
+} |
+ |
+checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
+ buildCounterTestIamPermissionsRequest++; |
+ if (buildCounterTestIamPermissionsRequest < 3) { |
+ checkUnnamed2312(o.permissions); |
+ } |
+ buildCounterTestIamPermissionsRequest--; |
+} |
+ |
+buildUnnamed2313() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed2313(core.List<core.String> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ unittest.expect(o[0], unittest.equals('foo')); |
+ unittest.expect(o[1], unittest.equals('foo')); |
+} |
+ |
+core.int buildCounterTestIamPermissionsResponse = 0; |
+buildTestIamPermissionsResponse() { |
+ var o = new api.TestIamPermissionsResponse(); |
+ buildCounterTestIamPermissionsResponse++; |
+ if (buildCounterTestIamPermissionsResponse < 3) { |
+ o.permissions = buildUnnamed2313(); |
+ } |
+ buildCounterTestIamPermissionsResponse--; |
+ return o; |
+} |
+ |
+checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
+ buildCounterTestIamPermissionsResponse++; |
+ if (buildCounterTestIamPermissionsResponse < 3) { |
+ checkUnnamed2313(o.permissions); |
+ } |
+ buildCounterTestIamPermissionsResponse--; |
+} |
+ |
+ |
+main() { |
+ unittest.group("obj-schema-Binding", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildBinding(); |
+ var od = new api.Binding.fromJson(o.toJson()); |
+ checkBinding(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-CloudAuditOptions", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildCloudAuditOptions(); |
+ var od = new api.CloudAuditOptions.fromJson(o.toJson()); |
+ checkCloudAuditOptions(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Condition", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildCondition(); |
+ var od = new api.Condition.fromJson(o.toJson()); |
+ checkCondition(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-CounterOptions", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildCounterOptions(); |
+ var od = new api.CounterOptions.fromJson(o.toJson()); |
+ checkCounterOptions(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-DataAccessOptions", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildDataAccessOptions(); |
+ var od = new api.DataAccessOptions.fromJson(o.toJson()); |
+ checkDataAccessOptions(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Empty", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildEmpty(); |
+ var od = new api.Empty.fromJson(o.toJson()); |
+ checkEmpty(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-GetIamPolicyRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildGetIamPolicyRequest(); |
+ var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
+ checkGetIamPolicyRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListProjectsResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListProjectsResponse(); |
+ var od = new api.ListProjectsResponse.fromJson(o.toJson()); |
+ checkListProjectsResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogConfig", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogConfig(); |
+ var od = new api.LogConfig.fromJson(o.toJson()); |
+ checkLogConfig(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Policy", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildPolicy(); |
+ var od = new api.Policy.fromJson(o.toJson()); |
+ checkPolicy(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Project", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildProject(); |
+ var od = new api.Project.fromJson(o.toJson()); |
+ checkProject(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Rule", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildRule(); |
+ var od = new api.Rule.fromJson(o.toJson()); |
+ checkRule(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SetIamPolicyRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSetIamPolicyRequest(); |
+ var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
+ checkSetIamPolicyRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-TestIamPermissionsRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildTestIamPermissionsRequest(); |
+ var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
+ checkTestIamPermissionsRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-TestIamPermissionsResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildTestIamPermissionsResponse(); |
+ var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
+ checkTestIamPermissionsResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("resource-ProjectsResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_request = buildProject(); |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.Project.fromJson(json); |
+ checkProject(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.equals("v1beta1/projects")); |
+ pathOffset += 16; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildProject()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.create(arg_request).then(unittest.expectAsync(((api.Project response) { |
+ checkProject(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_projectId = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
+ pathOffset = path.length; |
+ unittest.expect(subPart, unittest.equals("$arg_projectId")); |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_projectId).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_projectId = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
+ pathOffset = path.length; |
+ unittest.expect(subPart, unittest.equals("$arg_projectId")); |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildProject()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_projectId).then(unittest.expectAsync(((api.Project response) { |
+ checkProject(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--getIamPolicy", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_request = buildGetIamPolicyRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.GetIamPolicyRequest.fromJson(json); |
+ checkGetIamPolicyRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ index = path.indexOf(":getIamPolicy", pathOffset); |
+ unittest.expect(index >= 0, unittest.isTrue); |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
+ pathOffset = index; |
+ unittest.expect(subPart, unittest.equals("$arg_resource")); |
+ unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals(":getIamPolicy")); |
+ pathOffset += 13; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildPolicy()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((api.Policy response) { |
+ checkPolicy(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_pageToken = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_filter = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.equals("v1beta1/projects")); |
+ pathOffset += 16; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListProjectsResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(pageToken: arg_pageToken, pageSize: arg_pageSize, filter: arg_filter).then(unittest.expectAsync(((api.ListProjectsResponse response) { |
+ checkListProjectsResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--setIamPolicy", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_request = buildSetIamPolicyRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.SetIamPolicyRequest.fromJson(json); |
+ checkSetIamPolicyRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ index = path.indexOf(":setIamPolicy", pathOffset); |
+ unittest.expect(index >= 0, unittest.isTrue); |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
+ pathOffset = index; |
+ unittest.expect(subPart, unittest.equals("$arg_resource")); |
+ unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.equals(":setIamPolicy")); |
+ pathOffset += 13; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildPolicy()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync(((api.Policy response) { |
+ checkPolicy(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--testIamPermissions", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_request = buildTestIamPermissionsRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.TestIamPermissionsRequest.fromJson(json); |
+ checkTestIamPermissionsRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ index = path.indexOf(":testIamPermissions", pathOffset); |
+ unittest.expect(index >= 0, unittest.isTrue); |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
+ pathOffset = index; |
+ unittest.expect(subPart, unittest.equals("$arg_resource")); |
+ unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.equals(":testIamPermissions")); |
+ pathOffset += 19; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsync(((api.TestIamPermissionsResponse response) { |
+ checkTestIamPermissionsResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--undelete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_projectId = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ index = path.indexOf(":undelete", pathOffset); |
+ unittest.expect(index >= 0, unittest.isTrue); |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
+ pathOffset = index; |
+ unittest.expect(subPart, unittest.equals("$arg_projectId")); |
+ unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equals(":undelete")); |
+ pathOffset += 9; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.undelete(arg_projectId).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--update", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projects; |
+ var arg_request = buildProject(); |
+ var arg_projectId = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.Project.fromJson(json); |
+ checkProject(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.equals("v1beta1/projects/")); |
+ pathOffset += 17; |
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
+ pathOffset = path.length; |
+ unittest.expect(subPart, unittest.equals("$arg_projectId")); |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildProject()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.update(arg_request, arg_projectId).then(unittest.expectAsync(((api.Project response) { |
+ checkProject(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+} |
+ |