| // Copyright 2016 Google LLC |
| // |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file or at |
| // https://developers.google.com/open-source/licenses/bsd |
| |
| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: deprecated_member_use_from_same_package |
| // ignore_for_file: doc_directive_unknown |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_const_declarations |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unintended_html_in_doc_comment |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: unreachable_from_main |
| // ignore_for_file: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/cloudresourcemanager/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.int buildCounterAncestor = 0; |
| api.Ancestor buildAncestor() { |
| final o = api.Ancestor(); |
| buildCounterAncestor++; |
| if (buildCounterAncestor < 3) { |
| o.resourceId = buildResourceId(); |
| } |
| buildCounterAncestor--; |
| return o; |
| } |
| |
| void checkAncestor(api.Ancestor o) { |
| buildCounterAncestor++; |
| if (buildCounterAncestor < 3) { |
| checkResourceId(o.resourceId!); |
| } |
| buildCounterAncestor--; |
| } |
| |
| core.List<api.AuditLogConfig> buildUnnamed0() => [ |
| buildAuditLogConfig(), |
| buildAuditLogConfig(), |
| ]; |
| |
| void checkUnnamed0(core.List<api.AuditLogConfig> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAuditLogConfig(o[0]); |
| checkAuditLogConfig(o[1]); |
| } |
| |
| core.int buildCounterAuditConfig = 0; |
| api.AuditConfig buildAuditConfig() { |
| final o = api.AuditConfig(); |
| buildCounterAuditConfig++; |
| if (buildCounterAuditConfig < 3) { |
| o.auditLogConfigs = buildUnnamed0(); |
| o.service = 'foo'; |
| } |
| buildCounterAuditConfig--; |
| return o; |
| } |
| |
| void checkAuditConfig(api.AuditConfig o) { |
| buildCounterAuditConfig++; |
| if (buildCounterAuditConfig < 3) { |
| checkUnnamed0(o.auditLogConfigs!); |
| unittest.expect(o.service!, unittest.equals('foo')); |
| } |
| buildCounterAuditConfig--; |
| } |
| |
| core.List<core.String> buildUnnamed1() => ['foo', 'foo']; |
| |
| void checkUnnamed1(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 buildCounterAuditLogConfig = 0; |
| api.AuditLogConfig buildAuditLogConfig() { |
| final o = api.AuditLogConfig(); |
| buildCounterAuditLogConfig++; |
| if (buildCounterAuditLogConfig < 3) { |
| o.exemptedMembers = buildUnnamed1(); |
| o.logType = 'foo'; |
| } |
| buildCounterAuditLogConfig--; |
| return o; |
| } |
| |
| void checkAuditLogConfig(api.AuditLogConfig o) { |
| buildCounterAuditLogConfig++; |
| if (buildCounterAuditLogConfig < 3) { |
| checkUnnamed1(o.exemptedMembers!); |
| unittest.expect(o.logType!, unittest.equals('foo')); |
| } |
| buildCounterAuditLogConfig--; |
| } |
| |
| core.List<core.String> buildUnnamed2() => ['foo', 'foo']; |
| |
| void checkUnnamed2(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; |
| api.Binding buildBinding() { |
| final o = api.Binding(); |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| o.condition = buildExpr(); |
| o.members = buildUnnamed2(); |
| o.role = 'foo'; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| void checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| checkExpr(o.condition!); |
| checkUnnamed2(o.members!); |
| unittest.expect(o.role!, unittest.equals('foo')); |
| } |
| buildCounterBinding--; |
| } |
| |
| core.int buildCounterBooleanConstraint = 0; |
| api.BooleanConstraint buildBooleanConstraint() { |
| final o = api.BooleanConstraint(); |
| buildCounterBooleanConstraint++; |
| if (buildCounterBooleanConstraint < 3) {} |
| buildCounterBooleanConstraint--; |
| return o; |
| } |
| |
| void checkBooleanConstraint(api.BooleanConstraint o) { |
| buildCounterBooleanConstraint++; |
| if (buildCounterBooleanConstraint < 3) {} |
| buildCounterBooleanConstraint--; |
| } |
| |
| core.int buildCounterBooleanPolicy = 0; |
| api.BooleanPolicy buildBooleanPolicy() { |
| final o = api.BooleanPolicy(); |
| buildCounterBooleanPolicy++; |
| if (buildCounterBooleanPolicy < 3) { |
| o.enforced = true; |
| } |
| buildCounterBooleanPolicy--; |
| return o; |
| } |
| |
| void checkBooleanPolicy(api.BooleanPolicy o) { |
| buildCounterBooleanPolicy++; |
| if (buildCounterBooleanPolicy < 3) { |
| unittest.expect(o.enforced!, unittest.isTrue); |
| } |
| buildCounterBooleanPolicy--; |
| } |
| |
| core.int buildCounterClearOrgPolicyRequest = 0; |
| api.ClearOrgPolicyRequest buildClearOrgPolicyRequest() { |
| final o = api.ClearOrgPolicyRequest(); |
| buildCounterClearOrgPolicyRequest++; |
| if (buildCounterClearOrgPolicyRequest < 3) { |
| o.constraint = 'foo'; |
| o.etag = 'foo'; |
| } |
| buildCounterClearOrgPolicyRequest--; |
| return o; |
| } |
| |
| void checkClearOrgPolicyRequest(api.ClearOrgPolicyRequest o) { |
| buildCounterClearOrgPolicyRequest++; |
| if (buildCounterClearOrgPolicyRequest < 3) { |
| unittest.expect(o.constraint!, unittest.equals('foo')); |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| } |
| buildCounterClearOrgPolicyRequest--; |
| } |
| |
| core.int buildCounterConstraint = 0; |
| api.Constraint buildConstraint() { |
| final o = api.Constraint(); |
| buildCounterConstraint++; |
| if (buildCounterConstraint < 3) { |
| o.booleanConstraint = buildBooleanConstraint(); |
| o.constraintDefault = 'foo'; |
| o.description = 'foo'; |
| o.displayName = 'foo'; |
| o.listConstraint = buildListConstraint(); |
| o.name = 'foo'; |
| o.version = 42; |
| } |
| buildCounterConstraint--; |
| return o; |
| } |
| |
| void checkConstraint(api.Constraint o) { |
| buildCounterConstraint++; |
| if (buildCounterConstraint < 3) { |
| checkBooleanConstraint(o.booleanConstraint!); |
| unittest.expect(o.constraintDefault!, unittest.equals('foo')); |
| unittest.expect(o.description!, unittest.equals('foo')); |
| unittest.expect(o.displayName!, unittest.equals('foo')); |
| checkListConstraint(o.listConstraint!); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| unittest.expect(o.version!, unittest.equals(42)); |
| } |
| buildCounterConstraint--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| api.Empty buildEmpty() { |
| final o = api.Empty(); |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| return o; |
| } |
| |
| void checkEmpty(api.Empty o) { |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| } |
| |
| core.int buildCounterExpr = 0; |
| api.Expr buildExpr() { |
| final o = api.Expr(); |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| o.description = 'foo'; |
| o.expression = 'foo'; |
| o.location = 'foo'; |
| o.title = 'foo'; |
| } |
| buildCounterExpr--; |
| return o; |
| } |
| |
| void checkExpr(api.Expr o) { |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| unittest.expect(o.description!, unittest.equals('foo')); |
| unittest.expect(o.expression!, unittest.equals('foo')); |
| unittest.expect(o.location!, unittest.equals('foo')); |
| unittest.expect(o.title!, unittest.equals('foo')); |
| } |
| buildCounterExpr--; |
| } |
| |
| core.int buildCounterGetAncestryRequest = 0; |
| api.GetAncestryRequest buildGetAncestryRequest() { |
| final o = api.GetAncestryRequest(); |
| buildCounterGetAncestryRequest++; |
| if (buildCounterGetAncestryRequest < 3) {} |
| buildCounterGetAncestryRequest--; |
| return o; |
| } |
| |
| void checkGetAncestryRequest(api.GetAncestryRequest o) { |
| buildCounterGetAncestryRequest++; |
| if (buildCounterGetAncestryRequest < 3) {} |
| buildCounterGetAncestryRequest--; |
| } |
| |
| core.List<api.Ancestor> buildUnnamed3() => [buildAncestor(), buildAncestor()]; |
| |
| void checkUnnamed3(core.List<api.Ancestor> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAncestor(o[0]); |
| checkAncestor(o[1]); |
| } |
| |
| core.int buildCounterGetAncestryResponse = 0; |
| api.GetAncestryResponse buildGetAncestryResponse() { |
| final o = api.GetAncestryResponse(); |
| buildCounterGetAncestryResponse++; |
| if (buildCounterGetAncestryResponse < 3) { |
| o.ancestor = buildUnnamed3(); |
| } |
| buildCounterGetAncestryResponse--; |
| return o; |
| } |
| |
| void checkGetAncestryResponse(api.GetAncestryResponse o) { |
| buildCounterGetAncestryResponse++; |
| if (buildCounterGetAncestryResponse < 3) { |
| checkUnnamed3(o.ancestor!); |
| } |
| buildCounterGetAncestryResponse--; |
| } |
| |
| core.int buildCounterGetEffectiveOrgPolicyRequest = 0; |
| api.GetEffectiveOrgPolicyRequest buildGetEffectiveOrgPolicyRequest() { |
| final o = api.GetEffectiveOrgPolicyRequest(); |
| buildCounterGetEffectiveOrgPolicyRequest++; |
| if (buildCounterGetEffectiveOrgPolicyRequest < 3) { |
| o.constraint = 'foo'; |
| } |
| buildCounterGetEffectiveOrgPolicyRequest--; |
| return o; |
| } |
| |
| void checkGetEffectiveOrgPolicyRequest(api.GetEffectiveOrgPolicyRequest o) { |
| buildCounterGetEffectiveOrgPolicyRequest++; |
| if (buildCounterGetEffectiveOrgPolicyRequest < 3) { |
| unittest.expect(o.constraint!, unittest.equals('foo')); |
| } |
| buildCounterGetEffectiveOrgPolicyRequest--; |
| } |
| |
| core.int buildCounterGetIamPolicyRequest = 0; |
| api.GetIamPolicyRequest buildGetIamPolicyRequest() { |
| final o = api.GetIamPolicyRequest(); |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) { |
| o.options = buildGetPolicyOptions(); |
| } |
| buildCounterGetIamPolicyRequest--; |
| return o; |
| } |
| |
| void checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) { |
| checkGetPolicyOptions(o.options!); |
| } |
| buildCounterGetIamPolicyRequest--; |
| } |
| |
| core.int buildCounterGetOrgPolicyRequest = 0; |
| api.GetOrgPolicyRequest buildGetOrgPolicyRequest() { |
| final o = api.GetOrgPolicyRequest(); |
| buildCounterGetOrgPolicyRequest++; |
| if (buildCounterGetOrgPolicyRequest < 3) { |
| o.constraint = 'foo'; |
| } |
| buildCounterGetOrgPolicyRequest--; |
| return o; |
| } |
| |
| void checkGetOrgPolicyRequest(api.GetOrgPolicyRequest o) { |
| buildCounterGetOrgPolicyRequest++; |
| if (buildCounterGetOrgPolicyRequest < 3) { |
| unittest.expect(o.constraint!, unittest.equals('foo')); |
| } |
| buildCounterGetOrgPolicyRequest--; |
| } |
| |
| core.int buildCounterGetPolicyOptions = 0; |
| api.GetPolicyOptions buildGetPolicyOptions() { |
| final o = api.GetPolicyOptions(); |
| buildCounterGetPolicyOptions++; |
| if (buildCounterGetPolicyOptions < 3) { |
| o.requestedPolicyVersion = 42; |
| } |
| buildCounterGetPolicyOptions--; |
| return o; |
| } |
| |
| void checkGetPolicyOptions(api.GetPolicyOptions o) { |
| buildCounterGetPolicyOptions++; |
| if (buildCounterGetPolicyOptions < 3) { |
| unittest.expect(o.requestedPolicyVersion!, unittest.equals(42)); |
| } |
| buildCounterGetPolicyOptions--; |
| } |
| |
| core.List<core.String> buildUnnamed4() => ['foo', 'foo']; |
| |
| void checkUnnamed4(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 buildCounterLien = 0; |
| api.Lien buildLien() { |
| final o = api.Lien(); |
| buildCounterLien++; |
| if (buildCounterLien < 3) { |
| o.createTime = 'foo'; |
| o.name = 'foo'; |
| o.origin = 'foo'; |
| o.parent = 'foo'; |
| o.reason = 'foo'; |
| o.restrictions = buildUnnamed4(); |
| } |
| buildCounterLien--; |
| return o; |
| } |
| |
| void checkLien(api.Lien o) { |
| buildCounterLien++; |
| if (buildCounterLien < 3) { |
| unittest.expect(o.createTime!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| unittest.expect(o.origin!, unittest.equals('foo')); |
| unittest.expect(o.parent!, unittest.equals('foo')); |
| unittest.expect(o.reason!, unittest.equals('foo')); |
| checkUnnamed4(o.restrictions!); |
| } |
| buildCounterLien--; |
| } |
| |
| core.int buildCounterListAvailableOrgPolicyConstraintsRequest = 0; |
| api.ListAvailableOrgPolicyConstraintsRequest |
| buildListAvailableOrgPolicyConstraintsRequest() { |
| final o = api.ListAvailableOrgPolicyConstraintsRequest(); |
| buildCounterListAvailableOrgPolicyConstraintsRequest++; |
| if (buildCounterListAvailableOrgPolicyConstraintsRequest < 3) { |
| o.pageSize = 42; |
| o.pageToken = 'foo'; |
| } |
| buildCounterListAvailableOrgPolicyConstraintsRequest--; |
| return o; |
| } |
| |
| void checkListAvailableOrgPolicyConstraintsRequest( |
| api.ListAvailableOrgPolicyConstraintsRequest o, |
| ) { |
| buildCounterListAvailableOrgPolicyConstraintsRequest++; |
| if (buildCounterListAvailableOrgPolicyConstraintsRequest < 3) { |
| unittest.expect(o.pageSize!, unittest.equals(42)); |
| unittest.expect(o.pageToken!, unittest.equals('foo')); |
| } |
| buildCounterListAvailableOrgPolicyConstraintsRequest--; |
| } |
| |
| core.List<api.Constraint> buildUnnamed5() => [ |
| buildConstraint(), |
| buildConstraint(), |
| ]; |
| |
| void checkUnnamed5(core.List<api.Constraint> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkConstraint(o[0]); |
| checkConstraint(o[1]); |
| } |
| |
| core.int buildCounterListAvailableOrgPolicyConstraintsResponse = 0; |
| api.ListAvailableOrgPolicyConstraintsResponse |
| buildListAvailableOrgPolicyConstraintsResponse() { |
| final o = api.ListAvailableOrgPolicyConstraintsResponse(); |
| buildCounterListAvailableOrgPolicyConstraintsResponse++; |
| if (buildCounterListAvailableOrgPolicyConstraintsResponse < 3) { |
| o.constraints = buildUnnamed5(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListAvailableOrgPolicyConstraintsResponse--; |
| return o; |
| } |
| |
| void checkListAvailableOrgPolicyConstraintsResponse( |
| api.ListAvailableOrgPolicyConstraintsResponse o, |
| ) { |
| buildCounterListAvailableOrgPolicyConstraintsResponse++; |
| if (buildCounterListAvailableOrgPolicyConstraintsResponse < 3) { |
| checkUnnamed5(o.constraints!); |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| } |
| buildCounterListAvailableOrgPolicyConstraintsResponse--; |
| } |
| |
| core.int buildCounterListConstraint = 0; |
| api.ListConstraint buildListConstraint() { |
| final o = api.ListConstraint(); |
| buildCounterListConstraint++; |
| if (buildCounterListConstraint < 3) { |
| o.suggestedValue = 'foo'; |
| o.supportsUnder = true; |
| } |
| buildCounterListConstraint--; |
| return o; |
| } |
| |
| void checkListConstraint(api.ListConstraint o) { |
| buildCounterListConstraint++; |
| if (buildCounterListConstraint < 3) { |
| unittest.expect(o.suggestedValue!, unittest.equals('foo')); |
| unittest.expect(o.supportsUnder!, unittest.isTrue); |
| } |
| buildCounterListConstraint--; |
| } |
| |
| core.List<api.Lien> buildUnnamed6() => [buildLien(), buildLien()]; |
| |
| void checkUnnamed6(core.List<api.Lien> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLien(o[0]); |
| checkLien(o[1]); |
| } |
| |
| core.int buildCounterListLiensResponse = 0; |
| api.ListLiensResponse buildListLiensResponse() { |
| final o = api.ListLiensResponse(); |
| buildCounterListLiensResponse++; |
| if (buildCounterListLiensResponse < 3) { |
| o.liens = buildUnnamed6(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLiensResponse--; |
| return o; |
| } |
| |
| void checkListLiensResponse(api.ListLiensResponse o) { |
| buildCounterListLiensResponse++; |
| if (buildCounterListLiensResponse < 3) { |
| checkUnnamed6(o.liens!); |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| } |
| buildCounterListLiensResponse--; |
| } |
| |
| core.int buildCounterListOrgPoliciesRequest = 0; |
| api.ListOrgPoliciesRequest buildListOrgPoliciesRequest() { |
| final o = api.ListOrgPoliciesRequest(); |
| buildCounterListOrgPoliciesRequest++; |
| if (buildCounterListOrgPoliciesRequest < 3) { |
| o.pageSize = 42; |
| o.pageToken = 'foo'; |
| } |
| buildCounterListOrgPoliciesRequest--; |
| return o; |
| } |
| |
| void checkListOrgPoliciesRequest(api.ListOrgPoliciesRequest o) { |
| buildCounterListOrgPoliciesRequest++; |
| if (buildCounterListOrgPoliciesRequest < 3) { |
| unittest.expect(o.pageSize!, unittest.equals(42)); |
| unittest.expect(o.pageToken!, unittest.equals('foo')); |
| } |
| buildCounterListOrgPoliciesRequest--; |
| } |
| |
| core.List<api.OrgPolicy> buildUnnamed7() => [ |
| buildOrgPolicy(), |
| buildOrgPolicy(), |
| ]; |
| |
| void checkUnnamed7(core.List<api.OrgPolicy> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOrgPolicy(o[0]); |
| checkOrgPolicy(o[1]); |
| } |
| |
| core.int buildCounterListOrgPoliciesResponse = 0; |
| api.ListOrgPoliciesResponse buildListOrgPoliciesResponse() { |
| final o = api.ListOrgPoliciesResponse(); |
| buildCounterListOrgPoliciesResponse++; |
| if (buildCounterListOrgPoliciesResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.policies = buildUnnamed7(); |
| } |
| buildCounterListOrgPoliciesResponse--; |
| return o; |
| } |
| |
| void checkListOrgPoliciesResponse(api.ListOrgPoliciesResponse o) { |
| buildCounterListOrgPoliciesResponse++; |
| if (buildCounterListOrgPoliciesResponse < 3) { |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| checkUnnamed7(o.policies!); |
| } |
| buildCounterListOrgPoliciesResponse--; |
| } |
| |
| core.List<core.String> buildUnnamed8() => ['foo', 'foo']; |
| |
| void checkUnnamed8(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.List<core.String> buildUnnamed9() => ['foo', 'foo']; |
| |
| void checkUnnamed9(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 buildCounterListPolicy = 0; |
| api.ListPolicy buildListPolicy() { |
| final o = api.ListPolicy(); |
| buildCounterListPolicy++; |
| if (buildCounterListPolicy < 3) { |
| o.allValues = 'foo'; |
| o.allowedValues = buildUnnamed8(); |
| o.deniedValues = buildUnnamed9(); |
| o.inheritFromParent = true; |
| o.suggestedValue = 'foo'; |
| } |
| buildCounterListPolicy--; |
| return o; |
| } |
| |
| void checkListPolicy(api.ListPolicy o) { |
| buildCounterListPolicy++; |
| if (buildCounterListPolicy < 3) { |
| unittest.expect(o.allValues!, unittest.equals('foo')); |
| checkUnnamed8(o.allowedValues!); |
| checkUnnamed9(o.deniedValues!); |
| unittest.expect(o.inheritFromParent!, unittest.isTrue); |
| unittest.expect(o.suggestedValue!, unittest.equals('foo')); |
| } |
| buildCounterListPolicy--; |
| } |
| |
| core.List<api.Project> buildUnnamed10() => [buildProject(), buildProject()]; |
| |
| void checkUnnamed10(core.List<api.Project> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkProject(o[0]); |
| checkProject(o[1]); |
| } |
| |
| core.int buildCounterListProjectsResponse = 0; |
| api.ListProjectsResponse buildListProjectsResponse() { |
| final o = api.ListProjectsResponse(); |
| buildCounterListProjectsResponse++; |
| if (buildCounterListProjectsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.projects = buildUnnamed10(); |
| } |
| buildCounterListProjectsResponse--; |
| return o; |
| } |
| |
| void checkListProjectsResponse(api.ListProjectsResponse o) { |
| buildCounterListProjectsResponse++; |
| if (buildCounterListProjectsResponse < 3) { |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| checkUnnamed10(o.projects!); |
| } |
| buildCounterListProjectsResponse--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed11() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed11(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted1 = (o['x']!) as core.Map; |
| unittest.expect(casted1, unittest.hasLength(3)); |
| unittest.expect(casted1['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted1['bool'], unittest.equals(true)); |
| unittest.expect(casted1['string'], unittest.equals('foo')); |
| var casted2 = (o['y']!) as core.Map; |
| unittest.expect(casted2, unittest.hasLength(3)); |
| unittest.expect(casted2['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted2['bool'], unittest.equals(true)); |
| unittest.expect(casted2['string'], unittest.equals('foo')); |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed12() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed12(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted3 = (o['x']!) as core.Map; |
| unittest.expect(casted3, unittest.hasLength(3)); |
| unittest.expect(casted3['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted3['bool'], unittest.equals(true)); |
| unittest.expect(casted3['string'], unittest.equals('foo')); |
| var casted4 = (o['y']!) as core.Map; |
| unittest.expect(casted4, unittest.hasLength(3)); |
| unittest.expect(casted4['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted4['bool'], unittest.equals(true)); |
| unittest.expect(casted4['string'], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterOperation = 0; |
| api.Operation buildOperation() { |
| final o = api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.done = true; |
| o.error = buildStatus(); |
| o.metadata = buildUnnamed11(); |
| o.name = 'foo'; |
| o.response = buildUnnamed12(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done!, unittest.isTrue); |
| checkStatus(o.error!); |
| checkUnnamed11(o.metadata!); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkUnnamed12(o.response!); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterOrgPolicy = 0; |
| api.OrgPolicy buildOrgPolicy() { |
| final o = api.OrgPolicy(); |
| buildCounterOrgPolicy++; |
| if (buildCounterOrgPolicy < 3) { |
| o.booleanPolicy = buildBooleanPolicy(); |
| o.constraint = 'foo'; |
| o.etag = 'foo'; |
| o.listPolicy = buildListPolicy(); |
| o.restoreDefault = buildRestoreDefault(); |
| o.updateTime = 'foo'; |
| o.version = 42; |
| } |
| buildCounterOrgPolicy--; |
| return o; |
| } |
| |
| void checkOrgPolicy(api.OrgPolicy o) { |
| buildCounterOrgPolicy++; |
| if (buildCounterOrgPolicy < 3) { |
| checkBooleanPolicy(o.booleanPolicy!); |
| unittest.expect(o.constraint!, unittest.equals('foo')); |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| checkListPolicy(o.listPolicy!); |
| checkRestoreDefault(o.restoreDefault!); |
| unittest.expect(o.updateTime!, unittest.equals('foo')); |
| unittest.expect(o.version!, unittest.equals(42)); |
| } |
| buildCounterOrgPolicy--; |
| } |
| |
| core.int buildCounterOrganization = 0; |
| api.Organization buildOrganization() { |
| final o = api.Organization(); |
| buildCounterOrganization++; |
| if (buildCounterOrganization < 3) { |
| o.creationTime = 'foo'; |
| o.displayName = 'foo'; |
| o.lifecycleState = 'foo'; |
| o.name = 'foo'; |
| o.owner = buildOrganizationOwner(); |
| } |
| buildCounterOrganization--; |
| return o; |
| } |
| |
| void checkOrganization(api.Organization o) { |
| buildCounterOrganization++; |
| if (buildCounterOrganization < 3) { |
| unittest.expect(o.creationTime!, unittest.equals('foo')); |
| unittest.expect(o.displayName!, unittest.equals('foo')); |
| unittest.expect(o.lifecycleState!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkOrganizationOwner(o.owner!); |
| } |
| buildCounterOrganization--; |
| } |
| |
| core.int buildCounterOrganizationOwner = 0; |
| api.OrganizationOwner buildOrganizationOwner() { |
| final o = api.OrganizationOwner(); |
| buildCounterOrganizationOwner++; |
| if (buildCounterOrganizationOwner < 3) { |
| o.directoryCustomerId = 'foo'; |
| } |
| buildCounterOrganizationOwner--; |
| return o; |
| } |
| |
| void checkOrganizationOwner(api.OrganizationOwner o) { |
| buildCounterOrganizationOwner++; |
| if (buildCounterOrganizationOwner < 3) { |
| unittest.expect(o.directoryCustomerId!, unittest.equals('foo')); |
| } |
| buildCounterOrganizationOwner--; |
| } |
| |
| core.List<api.AuditConfig> buildUnnamed13() => [ |
| buildAuditConfig(), |
| buildAuditConfig(), |
| ]; |
| |
| void checkUnnamed13(core.List<api.AuditConfig> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAuditConfig(o[0]); |
| checkAuditConfig(o[1]); |
| } |
| |
| core.List<api.Binding> buildUnnamed14() => [buildBinding(), buildBinding()]; |
| |
| void checkUnnamed14(core.List<api.Binding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBinding(o[0]); |
| checkBinding(o[1]); |
| } |
| |
| core.int buildCounterPolicy = 0; |
| api.Policy buildPolicy() { |
| final o = api.Policy(); |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| o.auditConfigs = buildUnnamed13(); |
| o.bindings = buildUnnamed14(); |
| o.etag = 'foo'; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| void checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed13(o.auditConfigs!); |
| checkUnnamed14(o.bindings!); |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| unittest.expect(o.version!, unittest.equals(42)); |
| } |
| buildCounterPolicy--; |
| } |
| |
| core.List<core.String> buildUnnamed15() => ['foo', 'foo']; |
| |
| void checkUnnamed15(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.Map<core.String, core.String> buildUnnamed16() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed16(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.Map<core.String, core.String> buildUnnamed17() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed17(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; |
| api.Project buildProject() { |
| final o = api.Project(); |
| buildCounterProject++; |
| if (buildCounterProject < 3) { |
| o.configuredCapabilities = buildUnnamed15(); |
| o.createTime = 'foo'; |
| o.labels = buildUnnamed16(); |
| o.lifecycleState = 'foo'; |
| o.name = 'foo'; |
| o.parent = buildResourceId(); |
| o.projectId = 'foo'; |
| o.projectNumber = 'foo'; |
| o.tags = buildUnnamed17(); |
| } |
| buildCounterProject--; |
| return o; |
| } |
| |
| void checkProject(api.Project o) { |
| buildCounterProject++; |
| if (buildCounterProject < 3) { |
| checkUnnamed15(o.configuredCapabilities!); |
| unittest.expect(o.createTime!, unittest.equals('foo')); |
| checkUnnamed16(o.labels!); |
| unittest.expect(o.lifecycleState!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkResourceId(o.parent!); |
| unittest.expect(o.projectId!, unittest.equals('foo')); |
| unittest.expect(o.projectNumber!, unittest.equals('foo')); |
| checkUnnamed17(o.tags!); |
| } |
| buildCounterProject--; |
| } |
| |
| core.int buildCounterResourceId = 0; |
| api.ResourceId buildResourceId() { |
| final o = api.ResourceId(); |
| buildCounterResourceId++; |
| if (buildCounterResourceId < 3) { |
| o.id = 'foo'; |
| o.type = 'foo'; |
| } |
| buildCounterResourceId--; |
| return o; |
| } |
| |
| void checkResourceId(api.ResourceId o) { |
| buildCounterResourceId++; |
| if (buildCounterResourceId < 3) { |
| unittest.expect(o.id!, unittest.equals('foo')); |
| unittest.expect(o.type!, unittest.equals('foo')); |
| } |
| buildCounterResourceId--; |
| } |
| |
| core.int buildCounterRestoreDefault = 0; |
| api.RestoreDefault buildRestoreDefault() { |
| final o = api.RestoreDefault(); |
| buildCounterRestoreDefault++; |
| if (buildCounterRestoreDefault < 3) {} |
| buildCounterRestoreDefault--; |
| return o; |
| } |
| |
| void checkRestoreDefault(api.RestoreDefault o) { |
| buildCounterRestoreDefault++; |
| if (buildCounterRestoreDefault < 3) {} |
| buildCounterRestoreDefault--; |
| } |
| |
| core.int buildCounterSearchOrganizationsRequest = 0; |
| api.SearchOrganizationsRequest buildSearchOrganizationsRequest() { |
| final o = api.SearchOrganizationsRequest(); |
| buildCounterSearchOrganizationsRequest++; |
| if (buildCounterSearchOrganizationsRequest < 3) { |
| o.filter = 'foo'; |
| o.pageSize = 42; |
| o.pageToken = 'foo'; |
| } |
| buildCounterSearchOrganizationsRequest--; |
| return o; |
| } |
| |
| void checkSearchOrganizationsRequest(api.SearchOrganizationsRequest o) { |
| buildCounterSearchOrganizationsRequest++; |
| if (buildCounterSearchOrganizationsRequest < 3) { |
| unittest.expect(o.filter!, unittest.equals('foo')); |
| unittest.expect(o.pageSize!, unittest.equals(42)); |
| unittest.expect(o.pageToken!, unittest.equals('foo')); |
| } |
| buildCounterSearchOrganizationsRequest--; |
| } |
| |
| core.List<api.Organization> buildUnnamed18() => [ |
| buildOrganization(), |
| buildOrganization(), |
| ]; |
| |
| void checkUnnamed18(core.List<api.Organization> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOrganization(o[0]); |
| checkOrganization(o[1]); |
| } |
| |
| core.int buildCounterSearchOrganizationsResponse = 0; |
| api.SearchOrganizationsResponse buildSearchOrganizationsResponse() { |
| final o = api.SearchOrganizationsResponse(); |
| buildCounterSearchOrganizationsResponse++; |
| if (buildCounterSearchOrganizationsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.organizations = buildUnnamed18(); |
| } |
| buildCounterSearchOrganizationsResponse--; |
| return o; |
| } |
| |
| void checkSearchOrganizationsResponse(api.SearchOrganizationsResponse o) { |
| buildCounterSearchOrganizationsResponse++; |
| if (buildCounterSearchOrganizationsResponse < 3) { |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| checkUnnamed18(o.organizations!); |
| } |
| buildCounterSearchOrganizationsResponse--; |
| } |
| |
| core.int buildCounterSetIamPolicyRequest = 0; |
| api.SetIamPolicyRequest buildSetIamPolicyRequest() { |
| final o = api.SetIamPolicyRequest(); |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| o.policy = buildPolicy(); |
| o.updateMask = 'foo'; |
| } |
| buildCounterSetIamPolicyRequest--; |
| return o; |
| } |
| |
| void checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| checkPolicy(o.policy!); |
| unittest.expect(o.updateMask!, unittest.equals('foo')); |
| } |
| buildCounterSetIamPolicyRequest--; |
| } |
| |
| core.int buildCounterSetOrgPolicyRequest = 0; |
| api.SetOrgPolicyRequest buildSetOrgPolicyRequest() { |
| final o = api.SetOrgPolicyRequest(); |
| buildCounterSetOrgPolicyRequest++; |
| if (buildCounterSetOrgPolicyRequest < 3) { |
| o.policy = buildOrgPolicy(); |
| } |
| buildCounterSetOrgPolicyRequest--; |
| return o; |
| } |
| |
| void checkSetOrgPolicyRequest(api.SetOrgPolicyRequest o) { |
| buildCounterSetOrgPolicyRequest++; |
| if (buildCounterSetOrgPolicyRequest < 3) { |
| checkOrgPolicy(o.policy!); |
| } |
| buildCounterSetOrgPolicyRequest--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed19() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed19(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted5 = (o['x']!) as core.Map; |
| unittest.expect(casted5, unittest.hasLength(3)); |
| unittest.expect(casted5['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted5['bool'], unittest.equals(true)); |
| unittest.expect(casted5['string'], unittest.equals('foo')); |
| var casted6 = (o['y']!) as core.Map; |
| unittest.expect(casted6, unittest.hasLength(3)); |
| unittest.expect(casted6['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted6['bool'], unittest.equals(true)); |
| unittest.expect(casted6['string'], unittest.equals('foo')); |
| } |
| |
| core.List<core.Map<core.String, core.Object?>> buildUnnamed20() => [ |
| buildUnnamed19(), |
| buildUnnamed19(), |
| ]; |
| |
| void checkUnnamed20(core.List<core.Map<core.String, core.Object?>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed19(o[0]); |
| checkUnnamed19(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| final o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed20(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code!, unittest.equals(42)); |
| checkUnnamed20(o.details!); |
| unittest.expect(o.message!, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.List<core.String> buildUnnamed21() => ['foo', 'foo']; |
| |
| void checkUnnamed21(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; |
| api.TestIamPermissionsRequest buildTestIamPermissionsRequest() { |
| final o = api.TestIamPermissionsRequest(); |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| o.permissions = buildUnnamed21(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed21(o.permissions!); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed22() => ['foo', 'foo']; |
| |
| void checkUnnamed22(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; |
| api.TestIamPermissionsResponse buildTestIamPermissionsResponse() { |
| final o = api.TestIamPermissionsResponse(); |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| o.permissions = buildUnnamed22(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed22(o.permissions!); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| core.int buildCounterUndeleteProjectRequest = 0; |
| api.UndeleteProjectRequest buildUndeleteProjectRequest() { |
| final o = api.UndeleteProjectRequest(); |
| buildCounterUndeleteProjectRequest++; |
| if (buildCounterUndeleteProjectRequest < 3) {} |
| buildCounterUndeleteProjectRequest--; |
| return o; |
| } |
| |
| void checkUndeleteProjectRequest(api.UndeleteProjectRequest o) { |
| buildCounterUndeleteProjectRequest++; |
| if (buildCounterUndeleteProjectRequest < 3) {} |
| buildCounterUndeleteProjectRequest--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-Ancestor', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAncestor(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Ancestor.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkAncestor(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AuditConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAuditConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.AuditConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkAuditConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AuditLogConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAuditLogConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.AuditLogConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkAuditLogConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Binding', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildBinding(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Binding.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkBinding(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BooleanConstraint', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildBooleanConstraint(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.BooleanConstraint.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkBooleanConstraint(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BooleanPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildBooleanPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.BooleanPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkBooleanPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ClearOrgPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildClearOrgPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ClearOrgPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkClearOrgPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Constraint', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildConstraint(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Constraint.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkConstraint(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Empty', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildEmpty(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Empty.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkEmpty(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Expr', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildExpr(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Expr.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkExpr(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetAncestryRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetAncestryRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetAncestryRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetAncestryRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetAncestryResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetAncestryResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetAncestryResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetAncestryResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetEffectiveOrgPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetEffectiveOrgPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetEffectiveOrgPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetEffectiveOrgPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetIamPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetIamPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetOrgPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetOrgPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetOrgPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetOrgPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetPolicyOptions', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetPolicyOptions(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetPolicyOptions.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetPolicyOptions(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Lien', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildLien(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Lien.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkLien(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListAvailableOrgPolicyConstraintsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListAvailableOrgPolicyConstraintsRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListAvailableOrgPolicyConstraintsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListAvailableOrgPolicyConstraintsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListAvailableOrgPolicyConstraintsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListAvailableOrgPolicyConstraintsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListAvailableOrgPolicyConstraintsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListAvailableOrgPolicyConstraintsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListConstraint', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListConstraint(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListConstraint.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListConstraint(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListLiensResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListLiensResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListLiensResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListLiensResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListOrgPoliciesRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListOrgPoliciesRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListOrgPoliciesRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListOrgPoliciesRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListOrgPoliciesResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListOrgPoliciesResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListOrgPoliciesResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListOrgPoliciesResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListProjectsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListProjectsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListProjectsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkListProjectsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Operation', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOperation(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Operation.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkOperation(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OrgPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOrgPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.OrgPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkOrgPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Organization', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOrganization(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Organization.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkOrganization(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OrganizationOwner', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOrganizationOwner(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.OrganizationOwner.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkOrganizationOwner(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Policy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Policy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Project', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildProject(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Project.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkProject(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ResourceId', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildResourceId(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ResourceId.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkResourceId(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RestoreDefault', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildRestoreDefault(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.RestoreDefault.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkRestoreDefault(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SearchOrganizationsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSearchOrganizationsRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SearchOrganizationsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSearchOrganizationsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SearchOrganizationsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSearchOrganizationsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SearchOrganizationsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSearchOrganizationsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSetIamPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SetIamPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetOrgPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSetOrgPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SetOrgPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetOrgPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Status', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildStatus(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Status.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkStatus(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTestIamPermissionsRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.TestIamPermissionsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkTestIamPermissionsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTestIamPermissionsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.TestIamPermissionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkTestIamPermissionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-UndeleteProjectRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUndeleteProjectRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UndeleteProjectRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkUndeleteProjectRequest(od); |
| }); |
| }); |
| |
| unittest.group('resource-FoldersResource', () { |
| unittest.test('method--clearOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildClearOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ClearOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkClearOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.clearOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--getEffectiveOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildGetEffectiveOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetEffectiveOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetEffectiveOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getEffectiveOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--getOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildGetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--listAvailableOrgPolicyConstraints', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildListAvailableOrgPolicyConstraintsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListAvailableOrgPolicyConstraintsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode( |
| buildListAvailableOrgPolicyConstraintsResponse(), |
| ); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listAvailableOrgPolicyConstraints( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListAvailableOrgPolicyConstraintsResponse( |
| response as api.ListAvailableOrgPolicyConstraintsResponse, |
| ); |
| }); |
| |
| unittest.test('method--listOrgPolicies', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildListOrgPoliciesRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListOrgPoliciesRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListOrgPoliciesRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildListOrgPoliciesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listOrgPolicies( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse); |
| }); |
| |
| unittest.test('method--setOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).folders; |
| final arg_request = buildSetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| }); |
| |
| unittest.group('resource-LiensResource', () { |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).liens; |
| final arg_request = buildLien(); |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.Lien.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkLien(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 8), |
| unittest.equals('v1/liens'), |
| ); |
| pathOffset += 8; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildLien()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.create(arg_request, $fields: arg_$fields); |
| checkLien(response as api.Lien); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).liens; |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.delete(arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).liens; |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildLien()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkLien(response as api.Lien); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).liens; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_parent = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 8), |
| unittest.equals('v1/liens'), |
| ); |
| pathOffset += 8; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['parent']!.first, |
| unittest.equals(arg_parent), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildListLiensResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.list( |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| parent: arg_parent, |
| $fields: arg_$fields, |
| ); |
| checkListLiensResponse(response as api.ListLiensResponse); |
| }); |
| }); |
| |
| unittest.group('resource-OperationsResource', () { |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).operations; |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| }); |
| |
| unittest.group('resource-OrganizationsResource', () { |
| unittest.test('method--clearOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildClearOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ClearOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkClearOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.clearOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrganization()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkOrganization(response as api.Organization); |
| }); |
| |
| unittest.test('method--getEffectiveOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildGetEffectiveOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetEffectiveOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetEffectiveOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getEffectiveOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildGetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetIamPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getIamPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--getOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildGetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--listAvailableOrgPolicyConstraints', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildListAvailableOrgPolicyConstraintsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListAvailableOrgPolicyConstraintsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode( |
| buildListAvailableOrgPolicyConstraintsResponse(), |
| ); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listAvailableOrgPolicyConstraints( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListAvailableOrgPolicyConstraintsResponse( |
| response as api.ListAvailableOrgPolicyConstraintsResponse, |
| ); |
| }); |
| |
| unittest.test('method--listOrgPolicies', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildListOrgPoliciesRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListOrgPoliciesRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListOrgPoliciesRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildListOrgPoliciesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listOrgPolicies( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse); |
| }); |
| |
| unittest.test('method--search', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildSearchOrganizationsRequest(); |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SearchOrganizationsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSearchOrganizationsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 23), |
| unittest.equals('v1/organizations:search'), |
| ); |
| pathOffset += 23; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildSearchOrganizationsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.search(arg_request, $fields: arg_$fields); |
| checkSearchOrganizationsResponse( |
| response as api.SearchOrganizationsResponse, |
| ); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setIamPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--setOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildSetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).organizations; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.testIamPermissions( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse, |
| ); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsResource', () { |
| unittest.test('method--clearOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildClearOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ClearOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkClearOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.clearOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildProject(); |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.Project.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkProject(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 11), |
| unittest.equals('v1/projects'), |
| ); |
| pathOffset += 11; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.create(arg_request, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_projectId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_projectId')); |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.delete(arg_projectId, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_projectId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_projectId')); |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildProject()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.get(arg_projectId, $fields: arg_$fields); |
| checkProject(response as api.Project); |
| }); |
| |
| unittest.test('method--getAncestry', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildGetAncestryRequest(); |
| final arg_projectId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetAncestryRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetAncestryRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| index = path.indexOf(':getAncestry', 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 + 12), |
| unittest.equals(':getAncestry'), |
| ); |
| pathOffset += 12; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildGetAncestryResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getAncestry( |
| arg_request, |
| arg_projectId, |
| $fields: arg_$fields, |
| ); |
| checkGetAncestryResponse(response as api.GetAncestryResponse); |
| }); |
| |
| unittest.test('method--getEffectiveOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildGetEffectiveOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetEffectiveOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetEffectiveOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getEffectiveOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildGetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetIamPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| 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; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getIamPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--getOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildGetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_filter = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 11), |
| unittest.equals('v1/projects'), |
| ); |
| pathOffset += 11; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['filter']!.first, |
| unittest.equals(arg_filter), |
| ); |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildListProjectsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.list( |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields, |
| ); |
| checkListProjectsResponse(response as api.ListProjectsResponse); |
| }); |
| |
| unittest.test('method--listAvailableOrgPolicyConstraints', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildListAvailableOrgPolicyConstraintsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListAvailableOrgPolicyConstraintsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode( |
| buildListAvailableOrgPolicyConstraintsResponse(), |
| ); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listAvailableOrgPolicyConstraints( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListAvailableOrgPolicyConstraintsResponse( |
| response as api.ListAvailableOrgPolicyConstraintsResponse, |
| ); |
| }); |
| |
| unittest.test('method--listOrgPolicies', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildListOrgPoliciesRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ListOrgPoliciesRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkListOrgPoliciesRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildListOrgPoliciesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.listOrgPolicies( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| 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; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setIamPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--setOrgPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildSetOrgPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetOrgPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetOrgPolicyRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildOrgPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setOrgPolicy( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkOrgPolicy(response as api.OrgPolicy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| 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; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.testIamPermissions( |
| arg_request, |
| arg_resource, |
| $fields: arg_$fields, |
| ); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse, |
| ); |
| }); |
| |
| unittest.test('method--undelete', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildUndeleteProjectRequest(); |
| final arg_projectId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UndeleteProjectRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkUndeleteProjectRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| 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; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.undelete( |
| arg_request, |
| arg_projectId, |
| $fields: arg_$fields, |
| ); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--update', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudResourceManagerApi(mock).projects; |
| final arg_request = buildProject(); |
| final arg_projectId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.Project.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkProject(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v1/projects/'), |
| ); |
| pathOffset += 12; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_projectId')); |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildProject()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.update( |
| arg_request, |
| arg_projectId, |
| $fields: arg_$fields, |
| ); |
| checkProject(response as api.Project); |
| }); |
| }); |
| } |