| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: file_names |
| // ignore_for_file: library_names |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_parenthesis |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: avoid_returning_null |
| // ignore_for_file: cascade_invocations |
| // ignore_for_file: prefer_single_quotes |
| // ignore_for_file: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| import 'package:googleapis/accesscontextmanager/v1.dart' as api; |
| |
| import '../test_shared.dart'; |
| |
| core.int buildCounterAccessLevel = 0; |
| api.AccessLevel buildAccessLevel() { |
| var o = api.AccessLevel(); |
| buildCounterAccessLevel++; |
| if (buildCounterAccessLevel < 3) { |
| o.basic = buildBasicLevel(); |
| o.custom = buildCustomLevel(); |
| o.description = 'foo'; |
| o.name = 'foo'; |
| o.title = 'foo'; |
| } |
| buildCounterAccessLevel--; |
| return o; |
| } |
| |
| void checkAccessLevel(api.AccessLevel o) { |
| buildCounterAccessLevel++; |
| if (buildCounterAccessLevel < 3) { |
| checkBasicLevel(o.basic as api.BasicLevel); |
| checkCustomLevel(o.custom as api.CustomLevel); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.title, unittest.equals('foo')); |
| } |
| buildCounterAccessLevel--; |
| } |
| |
| core.int buildCounterAccessPolicy = 0; |
| api.AccessPolicy buildAccessPolicy() { |
| var o = api.AccessPolicy(); |
| buildCounterAccessPolicy++; |
| if (buildCounterAccessPolicy < 3) { |
| o.etag = 'foo'; |
| o.name = 'foo'; |
| o.parent = 'foo'; |
| o.title = 'foo'; |
| } |
| buildCounterAccessPolicy--; |
| return o; |
| } |
| |
| void checkAccessPolicy(api.AccessPolicy o) { |
| buildCounterAccessPolicy++; |
| if (buildCounterAccessPolicy < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.parent, unittest.equals('foo')); |
| unittest.expect(o.title, unittest.equals('foo')); |
| } |
| buildCounterAccessPolicy--; |
| } |
| |
| core.List<api.Condition> buildUnnamed5518() { |
| var o = <api.Condition>[]; |
| o.add(buildCondition()); |
| o.add(buildCondition()); |
| return o; |
| } |
| |
| void checkUnnamed5518(core.List<api.Condition> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkCondition(o[0] as api.Condition); |
| checkCondition(o[1] as api.Condition); |
| } |
| |
| core.int buildCounterBasicLevel = 0; |
| api.BasicLevel buildBasicLevel() { |
| var o = api.BasicLevel(); |
| buildCounterBasicLevel++; |
| if (buildCounterBasicLevel < 3) { |
| o.combiningFunction = 'foo'; |
| o.conditions = buildUnnamed5518(); |
| } |
| buildCounterBasicLevel--; |
| return o; |
| } |
| |
| void checkBasicLevel(api.BasicLevel o) { |
| buildCounterBasicLevel++; |
| if (buildCounterBasicLevel < 3) { |
| unittest.expect(o.combiningFunction, unittest.equals('foo')); |
| checkUnnamed5518(o.conditions); |
| } |
| buildCounterBasicLevel--; |
| } |
| |
| core.int buildCounterCancelOperationRequest = 0; |
| api.CancelOperationRequest buildCancelOperationRequest() { |
| var o = api.CancelOperationRequest(); |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| return o; |
| } |
| |
| void checkCancelOperationRequest(api.CancelOperationRequest o) { |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| } |
| |
| core.int buildCounterCommitServicePerimetersRequest = 0; |
| api.CommitServicePerimetersRequest buildCommitServicePerimetersRequest() { |
| var o = api.CommitServicePerimetersRequest(); |
| buildCounterCommitServicePerimetersRequest++; |
| if (buildCounterCommitServicePerimetersRequest < 3) { |
| o.etag = 'foo'; |
| } |
| buildCounterCommitServicePerimetersRequest--; |
| return o; |
| } |
| |
| void checkCommitServicePerimetersRequest(api.CommitServicePerimetersRequest o) { |
| buildCounterCommitServicePerimetersRequest++; |
| if (buildCounterCommitServicePerimetersRequest < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| } |
| buildCounterCommitServicePerimetersRequest--; |
| } |
| |
| core.List<api.ServicePerimeter> buildUnnamed5519() { |
| var o = <api.ServicePerimeter>[]; |
| o.add(buildServicePerimeter()); |
| o.add(buildServicePerimeter()); |
| return o; |
| } |
| |
| void checkUnnamed5519(core.List<api.ServicePerimeter> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkServicePerimeter(o[0] as api.ServicePerimeter); |
| checkServicePerimeter(o[1] as api.ServicePerimeter); |
| } |
| |
| core.int buildCounterCommitServicePerimetersResponse = 0; |
| api.CommitServicePerimetersResponse buildCommitServicePerimetersResponse() { |
| var o = api.CommitServicePerimetersResponse(); |
| buildCounterCommitServicePerimetersResponse++; |
| if (buildCounterCommitServicePerimetersResponse < 3) { |
| o.servicePerimeters = buildUnnamed5519(); |
| } |
| buildCounterCommitServicePerimetersResponse--; |
| return o; |
| } |
| |
| void checkCommitServicePerimetersResponse( |
| api.CommitServicePerimetersResponse o) { |
| buildCounterCommitServicePerimetersResponse++; |
| if (buildCounterCommitServicePerimetersResponse < 3) { |
| checkUnnamed5519(o.servicePerimeters); |
| } |
| buildCounterCommitServicePerimetersResponse--; |
| } |
| |
| core.List<core.String> buildUnnamed5520() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5520(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> buildUnnamed5521() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5521(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> buildUnnamed5522() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5522(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> buildUnnamed5523() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5523(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterCondition = 0; |
| api.Condition buildCondition() { |
| var o = api.Condition(); |
| buildCounterCondition++; |
| if (buildCounterCondition < 3) { |
| o.devicePolicy = buildDevicePolicy(); |
| o.ipSubnetworks = buildUnnamed5520(); |
| o.members = buildUnnamed5521(); |
| o.negate = true; |
| o.regions = buildUnnamed5522(); |
| o.requiredAccessLevels = buildUnnamed5523(); |
| } |
| buildCounterCondition--; |
| return o; |
| } |
| |
| void checkCondition(api.Condition o) { |
| buildCounterCondition++; |
| if (buildCounterCondition < 3) { |
| checkDevicePolicy(o.devicePolicy as api.DevicePolicy); |
| checkUnnamed5520(o.ipSubnetworks); |
| checkUnnamed5521(o.members); |
| unittest.expect(o.negate, unittest.isTrue); |
| checkUnnamed5522(o.regions); |
| checkUnnamed5523(o.requiredAccessLevels); |
| } |
| buildCounterCondition--; |
| } |
| |
| core.int buildCounterCustomLevel = 0; |
| api.CustomLevel buildCustomLevel() { |
| var o = api.CustomLevel(); |
| buildCounterCustomLevel++; |
| if (buildCounterCustomLevel < 3) { |
| o.expr = buildExpr(); |
| } |
| buildCounterCustomLevel--; |
| return o; |
| } |
| |
| void checkCustomLevel(api.CustomLevel o) { |
| buildCounterCustomLevel++; |
| if (buildCounterCustomLevel < 3) { |
| checkExpr(o.expr as api.Expr); |
| } |
| buildCounterCustomLevel--; |
| } |
| |
| core.List<core.String> buildUnnamed5524() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5524(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> buildUnnamed5525() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5525(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<api.OsConstraint> buildUnnamed5526() { |
| var o = <api.OsConstraint>[]; |
| o.add(buildOsConstraint()); |
| o.add(buildOsConstraint()); |
| return o; |
| } |
| |
| void checkUnnamed5526(core.List<api.OsConstraint> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOsConstraint(o[0] as api.OsConstraint); |
| checkOsConstraint(o[1] as api.OsConstraint); |
| } |
| |
| core.int buildCounterDevicePolicy = 0; |
| api.DevicePolicy buildDevicePolicy() { |
| var o = api.DevicePolicy(); |
| buildCounterDevicePolicy++; |
| if (buildCounterDevicePolicy < 3) { |
| o.allowedDeviceManagementLevels = buildUnnamed5524(); |
| o.allowedEncryptionStatuses = buildUnnamed5525(); |
| o.osConstraints = buildUnnamed5526(); |
| o.requireAdminApproval = true; |
| o.requireCorpOwned = true; |
| o.requireScreenlock = true; |
| } |
| buildCounterDevicePolicy--; |
| return o; |
| } |
| |
| void checkDevicePolicy(api.DevicePolicy o) { |
| buildCounterDevicePolicy++; |
| if (buildCounterDevicePolicy < 3) { |
| checkUnnamed5524(o.allowedDeviceManagementLevels); |
| checkUnnamed5525(o.allowedEncryptionStatuses); |
| checkUnnamed5526(o.osConstraints); |
| unittest.expect(o.requireAdminApproval, unittest.isTrue); |
| unittest.expect(o.requireCorpOwned, unittest.isTrue); |
| unittest.expect(o.requireScreenlock, unittest.isTrue); |
| } |
| buildCounterDevicePolicy--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| api.Empty buildEmpty() { |
| var 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() { |
| var 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.List<core.String> buildUnnamed5527() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5527(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 buildCounterGcpUserAccessBinding = 0; |
| api.GcpUserAccessBinding buildGcpUserAccessBinding() { |
| var o = api.GcpUserAccessBinding(); |
| buildCounterGcpUserAccessBinding++; |
| if (buildCounterGcpUserAccessBinding < 3) { |
| o.accessLevels = buildUnnamed5527(); |
| o.groupKey = 'foo'; |
| o.name = 'foo'; |
| } |
| buildCounterGcpUserAccessBinding--; |
| return o; |
| } |
| |
| void checkGcpUserAccessBinding(api.GcpUserAccessBinding o) { |
| buildCounterGcpUserAccessBinding++; |
| if (buildCounterGcpUserAccessBinding < 3) { |
| checkUnnamed5527(o.accessLevels); |
| unittest.expect(o.groupKey, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| } |
| buildCounterGcpUserAccessBinding--; |
| } |
| |
| core.List<api.AccessLevel> buildUnnamed5528() { |
| var o = <api.AccessLevel>[]; |
| o.add(buildAccessLevel()); |
| o.add(buildAccessLevel()); |
| return o; |
| } |
| |
| void checkUnnamed5528(core.List<api.AccessLevel> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAccessLevel(o[0] as api.AccessLevel); |
| checkAccessLevel(o[1] as api.AccessLevel); |
| } |
| |
| core.int buildCounterListAccessLevelsResponse = 0; |
| api.ListAccessLevelsResponse buildListAccessLevelsResponse() { |
| var o = api.ListAccessLevelsResponse(); |
| buildCounterListAccessLevelsResponse++; |
| if (buildCounterListAccessLevelsResponse < 3) { |
| o.accessLevels = buildUnnamed5528(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListAccessLevelsResponse--; |
| return o; |
| } |
| |
| void checkListAccessLevelsResponse(api.ListAccessLevelsResponse o) { |
| buildCounterListAccessLevelsResponse++; |
| if (buildCounterListAccessLevelsResponse < 3) { |
| checkUnnamed5528(o.accessLevels); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListAccessLevelsResponse--; |
| } |
| |
| core.List<api.AccessPolicy> buildUnnamed5529() { |
| var o = <api.AccessPolicy>[]; |
| o.add(buildAccessPolicy()); |
| o.add(buildAccessPolicy()); |
| return o; |
| } |
| |
| void checkUnnamed5529(core.List<api.AccessPolicy> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAccessPolicy(o[0] as api.AccessPolicy); |
| checkAccessPolicy(o[1] as api.AccessPolicy); |
| } |
| |
| core.int buildCounterListAccessPoliciesResponse = 0; |
| api.ListAccessPoliciesResponse buildListAccessPoliciesResponse() { |
| var o = api.ListAccessPoliciesResponse(); |
| buildCounterListAccessPoliciesResponse++; |
| if (buildCounterListAccessPoliciesResponse < 3) { |
| o.accessPolicies = buildUnnamed5529(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListAccessPoliciesResponse--; |
| return o; |
| } |
| |
| void checkListAccessPoliciesResponse(api.ListAccessPoliciesResponse o) { |
| buildCounterListAccessPoliciesResponse++; |
| if (buildCounterListAccessPoliciesResponse < 3) { |
| checkUnnamed5529(o.accessPolicies); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListAccessPoliciesResponse--; |
| } |
| |
| core.List<api.GcpUserAccessBinding> buildUnnamed5530() { |
| var o = <api.GcpUserAccessBinding>[]; |
| o.add(buildGcpUserAccessBinding()); |
| o.add(buildGcpUserAccessBinding()); |
| return o; |
| } |
| |
| void checkUnnamed5530(core.List<api.GcpUserAccessBinding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkGcpUserAccessBinding(o[0] as api.GcpUserAccessBinding); |
| checkGcpUserAccessBinding(o[1] as api.GcpUserAccessBinding); |
| } |
| |
| core.int buildCounterListGcpUserAccessBindingsResponse = 0; |
| api.ListGcpUserAccessBindingsResponse buildListGcpUserAccessBindingsResponse() { |
| var o = api.ListGcpUserAccessBindingsResponse(); |
| buildCounterListGcpUserAccessBindingsResponse++; |
| if (buildCounterListGcpUserAccessBindingsResponse < 3) { |
| o.gcpUserAccessBindings = buildUnnamed5530(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListGcpUserAccessBindingsResponse--; |
| return o; |
| } |
| |
| void checkListGcpUserAccessBindingsResponse( |
| api.ListGcpUserAccessBindingsResponse o) { |
| buildCounterListGcpUserAccessBindingsResponse++; |
| if (buildCounterListGcpUserAccessBindingsResponse < 3) { |
| checkUnnamed5530(o.gcpUserAccessBindings); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListGcpUserAccessBindingsResponse--; |
| } |
| |
| core.List<api.Operation> buildUnnamed5531() { |
| var o = <api.Operation>[]; |
| o.add(buildOperation()); |
| o.add(buildOperation()); |
| return o; |
| } |
| |
| void checkUnnamed5531(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0] as api.Operation); |
| checkOperation(o[1] as api.Operation); |
| } |
| |
| core.int buildCounterListOperationsResponse = 0; |
| api.ListOperationsResponse buildListOperationsResponse() { |
| var o = api.ListOperationsResponse(); |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.operations = buildUnnamed5531(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| void checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed5531(o.operations); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| core.List<api.ServicePerimeter> buildUnnamed5532() { |
| var o = <api.ServicePerimeter>[]; |
| o.add(buildServicePerimeter()); |
| o.add(buildServicePerimeter()); |
| return o; |
| } |
| |
| void checkUnnamed5532(core.List<api.ServicePerimeter> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkServicePerimeter(o[0] as api.ServicePerimeter); |
| checkServicePerimeter(o[1] as api.ServicePerimeter); |
| } |
| |
| core.int buildCounterListServicePerimetersResponse = 0; |
| api.ListServicePerimetersResponse buildListServicePerimetersResponse() { |
| var o = api.ListServicePerimetersResponse(); |
| buildCounterListServicePerimetersResponse++; |
| if (buildCounterListServicePerimetersResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.servicePerimeters = buildUnnamed5532(); |
| } |
| buildCounterListServicePerimetersResponse--; |
| return o; |
| } |
| |
| void checkListServicePerimetersResponse(api.ListServicePerimetersResponse o) { |
| buildCounterListServicePerimetersResponse++; |
| if (buildCounterListServicePerimetersResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed5532(o.servicePerimeters); |
| } |
| buildCounterListServicePerimetersResponse--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed5533() { |
| var o = <core.String, core.Object>{}; |
| o['x'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| o['y'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| return o; |
| } |
| |
| void checkUnnamed5533(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> buildUnnamed5534() { |
| var o = <core.String, core.Object>{}; |
| o['x'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| o['y'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| return o; |
| } |
| |
| void checkUnnamed5534(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() { |
| var o = api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.done = true; |
| o.error = buildStatus(); |
| o.metadata = buildUnnamed5533(); |
| o.name = 'foo'; |
| o.response = buildUnnamed5534(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done, unittest.isTrue); |
| checkStatus(o.error as api.Status); |
| checkUnnamed5533(o.metadata); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkUnnamed5534(o.response); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterOsConstraint = 0; |
| api.OsConstraint buildOsConstraint() { |
| var o = api.OsConstraint(); |
| buildCounterOsConstraint++; |
| if (buildCounterOsConstraint < 3) { |
| o.minimumVersion = 'foo'; |
| o.osType = 'foo'; |
| o.requireVerifiedChromeOs = true; |
| } |
| buildCounterOsConstraint--; |
| return o; |
| } |
| |
| void checkOsConstraint(api.OsConstraint o) { |
| buildCounterOsConstraint++; |
| if (buildCounterOsConstraint < 3) { |
| unittest.expect(o.minimumVersion, unittest.equals('foo')); |
| unittest.expect(o.osType, unittest.equals('foo')); |
| unittest.expect(o.requireVerifiedChromeOs, unittest.isTrue); |
| } |
| buildCounterOsConstraint--; |
| } |
| |
| core.List<api.AccessLevel> buildUnnamed5535() { |
| var o = <api.AccessLevel>[]; |
| o.add(buildAccessLevel()); |
| o.add(buildAccessLevel()); |
| return o; |
| } |
| |
| void checkUnnamed5535(core.List<api.AccessLevel> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAccessLevel(o[0] as api.AccessLevel); |
| checkAccessLevel(o[1] as api.AccessLevel); |
| } |
| |
| core.int buildCounterReplaceAccessLevelsRequest = 0; |
| api.ReplaceAccessLevelsRequest buildReplaceAccessLevelsRequest() { |
| var o = api.ReplaceAccessLevelsRequest(); |
| buildCounterReplaceAccessLevelsRequest++; |
| if (buildCounterReplaceAccessLevelsRequest < 3) { |
| o.accessLevels = buildUnnamed5535(); |
| o.etag = 'foo'; |
| } |
| buildCounterReplaceAccessLevelsRequest--; |
| return o; |
| } |
| |
| void checkReplaceAccessLevelsRequest(api.ReplaceAccessLevelsRequest o) { |
| buildCounterReplaceAccessLevelsRequest++; |
| if (buildCounterReplaceAccessLevelsRequest < 3) { |
| checkUnnamed5535(o.accessLevels); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| } |
| buildCounterReplaceAccessLevelsRequest--; |
| } |
| |
| core.List<api.AccessLevel> buildUnnamed5536() { |
| var o = <api.AccessLevel>[]; |
| o.add(buildAccessLevel()); |
| o.add(buildAccessLevel()); |
| return o; |
| } |
| |
| void checkUnnamed5536(core.List<api.AccessLevel> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAccessLevel(o[0] as api.AccessLevel); |
| checkAccessLevel(o[1] as api.AccessLevel); |
| } |
| |
| core.int buildCounterReplaceAccessLevelsResponse = 0; |
| api.ReplaceAccessLevelsResponse buildReplaceAccessLevelsResponse() { |
| var o = api.ReplaceAccessLevelsResponse(); |
| buildCounterReplaceAccessLevelsResponse++; |
| if (buildCounterReplaceAccessLevelsResponse < 3) { |
| o.accessLevels = buildUnnamed5536(); |
| } |
| buildCounterReplaceAccessLevelsResponse--; |
| return o; |
| } |
| |
| void checkReplaceAccessLevelsResponse(api.ReplaceAccessLevelsResponse o) { |
| buildCounterReplaceAccessLevelsResponse++; |
| if (buildCounterReplaceAccessLevelsResponse < 3) { |
| checkUnnamed5536(o.accessLevels); |
| } |
| buildCounterReplaceAccessLevelsResponse--; |
| } |
| |
| core.List<api.ServicePerimeter> buildUnnamed5537() { |
| var o = <api.ServicePerimeter>[]; |
| o.add(buildServicePerimeter()); |
| o.add(buildServicePerimeter()); |
| return o; |
| } |
| |
| void checkUnnamed5537(core.List<api.ServicePerimeter> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkServicePerimeter(o[0] as api.ServicePerimeter); |
| checkServicePerimeter(o[1] as api.ServicePerimeter); |
| } |
| |
| core.int buildCounterReplaceServicePerimetersRequest = 0; |
| api.ReplaceServicePerimetersRequest buildReplaceServicePerimetersRequest() { |
| var o = api.ReplaceServicePerimetersRequest(); |
| buildCounterReplaceServicePerimetersRequest++; |
| if (buildCounterReplaceServicePerimetersRequest < 3) { |
| o.etag = 'foo'; |
| o.servicePerimeters = buildUnnamed5537(); |
| } |
| buildCounterReplaceServicePerimetersRequest--; |
| return o; |
| } |
| |
| void checkReplaceServicePerimetersRequest( |
| api.ReplaceServicePerimetersRequest o) { |
| buildCounterReplaceServicePerimetersRequest++; |
| if (buildCounterReplaceServicePerimetersRequest < 3) { |
| unittest.expect(o.etag, unittest.equals('foo')); |
| checkUnnamed5537(o.servicePerimeters); |
| } |
| buildCounterReplaceServicePerimetersRequest--; |
| } |
| |
| core.List<api.ServicePerimeter> buildUnnamed5538() { |
| var o = <api.ServicePerimeter>[]; |
| o.add(buildServicePerimeter()); |
| o.add(buildServicePerimeter()); |
| return o; |
| } |
| |
| void checkUnnamed5538(core.List<api.ServicePerimeter> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkServicePerimeter(o[0] as api.ServicePerimeter); |
| checkServicePerimeter(o[1] as api.ServicePerimeter); |
| } |
| |
| core.int buildCounterReplaceServicePerimetersResponse = 0; |
| api.ReplaceServicePerimetersResponse buildReplaceServicePerimetersResponse() { |
| var o = api.ReplaceServicePerimetersResponse(); |
| buildCounterReplaceServicePerimetersResponse++; |
| if (buildCounterReplaceServicePerimetersResponse < 3) { |
| o.servicePerimeters = buildUnnamed5538(); |
| } |
| buildCounterReplaceServicePerimetersResponse--; |
| return o; |
| } |
| |
| void checkReplaceServicePerimetersResponse( |
| api.ReplaceServicePerimetersResponse o) { |
| buildCounterReplaceServicePerimetersResponse++; |
| if (buildCounterReplaceServicePerimetersResponse < 3) { |
| checkUnnamed5538(o.servicePerimeters); |
| } |
| buildCounterReplaceServicePerimetersResponse--; |
| } |
| |
| core.int buildCounterServicePerimeter = 0; |
| api.ServicePerimeter buildServicePerimeter() { |
| var o = api.ServicePerimeter(); |
| buildCounterServicePerimeter++; |
| if (buildCounterServicePerimeter < 3) { |
| o.description = 'foo'; |
| o.name = 'foo'; |
| o.perimeterType = 'foo'; |
| o.spec = buildServicePerimeterConfig(); |
| o.status = buildServicePerimeterConfig(); |
| o.title = 'foo'; |
| o.useExplicitDryRunSpec = true; |
| } |
| buildCounterServicePerimeter--; |
| return o; |
| } |
| |
| void checkServicePerimeter(api.ServicePerimeter o) { |
| buildCounterServicePerimeter++; |
| if (buildCounterServicePerimeter < 3) { |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.perimeterType, unittest.equals('foo')); |
| checkServicePerimeterConfig(o.spec as api.ServicePerimeterConfig); |
| checkServicePerimeterConfig(o.status as api.ServicePerimeterConfig); |
| unittest.expect(o.title, unittest.equals('foo')); |
| unittest.expect(o.useExplicitDryRunSpec, unittest.isTrue); |
| } |
| buildCounterServicePerimeter--; |
| } |
| |
| core.List<core.String> buildUnnamed5539() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5539(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> buildUnnamed5540() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5540(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> buildUnnamed5541() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5541(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 buildCounterServicePerimeterConfig = 0; |
| api.ServicePerimeterConfig buildServicePerimeterConfig() { |
| var o = api.ServicePerimeterConfig(); |
| buildCounterServicePerimeterConfig++; |
| if (buildCounterServicePerimeterConfig < 3) { |
| o.accessLevels = buildUnnamed5539(); |
| o.resources = buildUnnamed5540(); |
| o.restrictedServices = buildUnnamed5541(); |
| o.vpcAccessibleServices = buildVpcAccessibleServices(); |
| } |
| buildCounterServicePerimeterConfig--; |
| return o; |
| } |
| |
| void checkServicePerimeterConfig(api.ServicePerimeterConfig o) { |
| buildCounterServicePerimeterConfig++; |
| if (buildCounterServicePerimeterConfig < 3) { |
| checkUnnamed5539(o.accessLevels); |
| checkUnnamed5540(o.resources); |
| checkUnnamed5541(o.restrictedServices); |
| checkVpcAccessibleServices( |
| o.vpcAccessibleServices as api.VpcAccessibleServices); |
| } |
| buildCounterServicePerimeterConfig--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed5542() { |
| var o = <core.String, core.Object>{}; |
| o['x'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| o['y'] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| return o; |
| } |
| |
| void checkUnnamed5542(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>> buildUnnamed5543() { |
| var o = <core.Map<core.String, core.Object>>[]; |
| o.add(buildUnnamed5542()); |
| o.add(buildUnnamed5542()); |
| return o; |
| } |
| |
| void checkUnnamed5543(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed5542(o[0]); |
| checkUnnamed5542(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| var o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed5543(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code, unittest.equals(42)); |
| checkUnnamed5543(o.details); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.List<core.String> buildUnnamed5544() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5544(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 buildCounterVpcAccessibleServices = 0; |
| api.VpcAccessibleServices buildVpcAccessibleServices() { |
| var o = api.VpcAccessibleServices(); |
| buildCounterVpcAccessibleServices++; |
| if (buildCounterVpcAccessibleServices < 3) { |
| o.allowedServices = buildUnnamed5544(); |
| o.enableRestriction = true; |
| } |
| buildCounterVpcAccessibleServices--; |
| return o; |
| } |
| |
| void checkVpcAccessibleServices(api.VpcAccessibleServices o) { |
| buildCounterVpcAccessibleServices++; |
| if (buildCounterVpcAccessibleServices < 3) { |
| checkUnnamed5544(o.allowedServices); |
| unittest.expect(o.enableRestriction, unittest.isTrue); |
| } |
| buildCounterVpcAccessibleServices--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-AccessLevel', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildAccessLevel(); |
| var od = api.AccessLevel.fromJson(o.toJson()); |
| checkAccessLevel(od as api.AccessLevel); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AccessPolicy', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildAccessPolicy(); |
| var od = api.AccessPolicy.fromJson(o.toJson()); |
| checkAccessPolicy(od as api.AccessPolicy); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BasicLevel', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBasicLevel(); |
| var od = api.BasicLevel.fromJson(o.toJson()); |
| checkBasicLevel(od as api.BasicLevel); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CancelOperationRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCancelOperationRequest(); |
| var od = api.CancelOperationRequest.fromJson(o.toJson()); |
| checkCancelOperationRequest(od as api.CancelOperationRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CommitServicePerimetersRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCommitServicePerimetersRequest(); |
| var od = api.CommitServicePerimetersRequest.fromJson(o.toJson()); |
| checkCommitServicePerimetersRequest( |
| od as api.CommitServicePerimetersRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CommitServicePerimetersResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCommitServicePerimetersResponse(); |
| var od = api.CommitServicePerimetersResponse.fromJson(o.toJson()); |
| checkCommitServicePerimetersResponse( |
| od as api.CommitServicePerimetersResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Condition', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCondition(); |
| var od = api.Condition.fromJson(o.toJson()); |
| checkCondition(od as api.Condition); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CustomLevel', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCustomLevel(); |
| var od = api.CustomLevel.fromJson(o.toJson()); |
| checkCustomLevel(od as api.CustomLevel); |
| }); |
| }); |
| |
| unittest.group('obj-schema-DevicePolicy', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildDevicePolicy(); |
| var od = api.DevicePolicy.fromJson(o.toJson()); |
| checkDevicePolicy(od as api.DevicePolicy); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Empty', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildEmpty(); |
| var od = api.Empty.fromJson(o.toJson()); |
| checkEmpty(od as api.Empty); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Expr', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildExpr(); |
| var od = api.Expr.fromJson(o.toJson()); |
| checkExpr(od as api.Expr); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GcpUserAccessBinding', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildGcpUserAccessBinding(); |
| var od = api.GcpUserAccessBinding.fromJson(o.toJson()); |
| checkGcpUserAccessBinding(od as api.GcpUserAccessBinding); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListAccessLevelsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListAccessLevelsResponse(); |
| var od = api.ListAccessLevelsResponse.fromJson(o.toJson()); |
| checkListAccessLevelsResponse(od as api.ListAccessLevelsResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListAccessPoliciesResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListAccessPoliciesResponse(); |
| var od = api.ListAccessPoliciesResponse.fromJson(o.toJson()); |
| checkListAccessPoliciesResponse(od as api.ListAccessPoliciesResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListGcpUserAccessBindingsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListGcpUserAccessBindingsResponse(); |
| var od = api.ListGcpUserAccessBindingsResponse.fromJson(o.toJson()); |
| checkListGcpUserAccessBindingsResponse( |
| od as api.ListGcpUserAccessBindingsResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListOperationsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListOperationsResponse(); |
| var od = api.ListOperationsResponse.fromJson(o.toJson()); |
| checkListOperationsResponse(od as api.ListOperationsResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListServicePerimetersResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListServicePerimetersResponse(); |
| var od = api.ListServicePerimetersResponse.fromJson(o.toJson()); |
| checkListServicePerimetersResponse( |
| od as api.ListServicePerimetersResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Operation', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildOperation(); |
| var od = api.Operation.fromJson(o.toJson()); |
| checkOperation(od as api.Operation); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OsConstraint', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildOsConstraint(); |
| var od = api.OsConstraint.fromJson(o.toJson()); |
| checkOsConstraint(od as api.OsConstraint); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReplaceAccessLevelsRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildReplaceAccessLevelsRequest(); |
| var od = api.ReplaceAccessLevelsRequest.fromJson(o.toJson()); |
| checkReplaceAccessLevelsRequest(od as api.ReplaceAccessLevelsRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReplaceAccessLevelsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildReplaceAccessLevelsResponse(); |
| var od = api.ReplaceAccessLevelsResponse.fromJson(o.toJson()); |
| checkReplaceAccessLevelsResponse(od as api.ReplaceAccessLevelsResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReplaceServicePerimetersRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildReplaceServicePerimetersRequest(); |
| var od = api.ReplaceServicePerimetersRequest.fromJson(o.toJson()); |
| checkReplaceServicePerimetersRequest( |
| od as api.ReplaceServicePerimetersRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReplaceServicePerimetersResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildReplaceServicePerimetersResponse(); |
| var od = api.ReplaceServicePerimetersResponse.fromJson(o.toJson()); |
| checkReplaceServicePerimetersResponse( |
| od as api.ReplaceServicePerimetersResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ServicePerimeter', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildServicePerimeter(); |
| var od = api.ServicePerimeter.fromJson(o.toJson()); |
| checkServicePerimeter(od as api.ServicePerimeter); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ServicePerimeterConfig', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildServicePerimeterConfig(); |
| var od = api.ServicePerimeterConfig.fromJson(o.toJson()); |
| checkServicePerimeterConfig(od as api.ServicePerimeterConfig); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Status', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildStatus(); |
| var od = api.Status.fromJson(o.toJson()); |
| checkStatus(od as api.Status); |
| }); |
| }); |
| |
| unittest.group('obj-schema-VpcAccessibleServices', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildVpcAccessibleServices(); |
| var od = api.VpcAccessibleServices.fromJson(o.toJson()); |
| checkVpcAccessibleServices(od as api.VpcAccessibleServices); |
| }); |
| }); |
| |
| unittest.group('resource-AccessPoliciesResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies; |
| var arg_request = buildAccessPolicy(); |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.AccessPolicy.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkAccessPolicy(obj as api.AccessPolicy); |
| |
| var 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 + 17), |
| unittest.equals("v1/accessPolicies")); |
| pathOffset += 17; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildAccessPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkAccessPolicy(response as api.AccessPolicy); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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 + 17), |
| unittest.equals("v1/accessPolicies")); |
| pathOffset += 17; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var 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)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListAccessPoliciesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list( |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| parent: arg_parent, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListAccessPoliciesResponse( |
| response as api.ListAccessPoliciesResponse); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies; |
| var arg_request = buildAccessPolicy(); |
| var arg_name = 'foo'; |
| var arg_updateMask = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.AccessPolicy.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkAccessPolicy(obj as api.AccessPolicy); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-AccessPoliciesAccessLevelsResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_request = buildAccessLevel(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.AccessLevel.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkAccessLevel(obj as api.AccessLevel); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_name = 'foo'; |
| var arg_accessLevelFormat = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["accessLevelFormat"].first, |
| unittest.equals(arg_accessLevelFormat)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildAccessLevel()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, |
| accessLevelFormat: arg_accessLevelFormat, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkAccessLevel(response as api.AccessLevel); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_parent = 'foo'; |
| var arg_accessLevelFormat = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["accessLevelFormat"].first, |
| unittest.equals(arg_accessLevelFormat)); |
| 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)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListAccessLevelsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| accessLevelFormat: arg_accessLevelFormat, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListAccessLevelsResponse(response as api.ListAccessLevelsResponse); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_request = buildAccessLevel(); |
| var arg_name = 'foo'; |
| var arg_updateMask = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.AccessLevel.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkAccessLevel(obj as api.AccessLevel); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--replaceAll', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).accessPolicies.accessLevels; |
| var arg_request = buildReplaceAccessLevelsRequest(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.ReplaceAccessLevelsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkReplaceAccessLevelsRequest(obj as api.ReplaceAccessLevelsRequest); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .replaceAll(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-AccessPoliciesServicePerimetersResourceApi', () { |
| unittest.test('method--commit', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_request = buildCommitServicePerimetersRequest(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CommitServicePerimetersRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkCommitServicePerimetersRequest( |
| obj as api.CommitServicePerimetersRequest); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .commit(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_request = buildServicePerimeter(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.ServicePerimeter.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkServicePerimeter(obj as api.ServicePerimeter); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildServicePerimeter()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkServicePerimeter(response as api.ServicePerimeter); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_parent = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListServicePerimetersResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListServicePerimetersResponse( |
| response as api.ListServicePerimetersResponse); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_request = buildServicePerimeter(); |
| var arg_name = 'foo'; |
| var arg_updateMask = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.ServicePerimeter.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkServicePerimeter(obj as api.ServicePerimeter); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--replaceAll', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).accessPolicies.servicePerimeters; |
| var arg_request = buildReplaceServicePerimetersRequest(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.ReplaceServicePerimetersRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkReplaceServicePerimetersRequest( |
| obj as api.ReplaceServicePerimetersRequest); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .replaceAll(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-OperationsResourceApi', () { |
| unittest.test('method--cancel', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).operations; |
| var arg_request = buildCancelOperationRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CancelOperationRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkCancelOperationRequest(obj as api.CancelOperationRequest); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response as api.Empty); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).operations; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response as api.Empty); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).operations; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| var res = api.AccessContextManagerApi(mock).operations; |
| var arg_name = 'foo'; |
| var arg_filter = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var 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)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListOperationsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_name, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListOperationsResponse(response as api.ListOperationsResponse); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-OrganizationsGcpUserAccessBindingsResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).organizations.gcpUserAccessBindings; |
| var arg_request = buildGcpUserAccessBinding(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.GcpUserAccessBinding.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkGcpUserAccessBinding(obj as api.GcpUserAccessBinding); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).organizations.gcpUserAccessBindings; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).organizations.gcpUserAccessBindings; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildGcpUserAccessBinding()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkGcpUserAccessBinding(response as api.GcpUserAccessBinding); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).organizations.gcpUserAccessBindings; |
| var arg_parent = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = |
| convert.json.encode(buildListGcpUserAccessBindingsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListGcpUserAccessBindingsResponse( |
| response as api.ListGcpUserAccessBindingsResponse); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| var res = |
| api.AccessContextManagerApi(mock).organizations.gcpUserAccessBindings; |
| var arg_request = buildGcpUserAccessBinding(); |
| var arg_name = 'foo'; |
| var arg_updateMask = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.GcpUserAccessBinding.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkGcpUserAccessBinding(obj as api.GcpUserAccessBinding); |
| |
| var 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; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var 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('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response as api.Operation); |
| }))); |
| }); |
| }); |
| } |