| // ignore_for_file: camel_case_types |
| // ignore_for_file: cascade_invocations |
| // 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_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: 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: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/networkservices/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.List<api.AuditLogConfig> buildUnnamed599() => [ |
| buildAuditLogConfig(), |
| buildAuditLogConfig(), |
| ]; |
| |
| void checkUnnamed599(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 = buildUnnamed599(); |
| o.service = 'foo'; |
| } |
| buildCounterAuditConfig--; |
| return o; |
| } |
| |
| void checkAuditConfig(api.AuditConfig o) { |
| buildCounterAuditConfig++; |
| if (buildCounterAuditConfig < 3) { |
| checkUnnamed599(o.auditLogConfigs!); |
| unittest.expect( |
| o.service!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterAuditConfig--; |
| } |
| |
| core.List<core.String> buildUnnamed600() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed600(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 = buildUnnamed600(); |
| o.logType = 'foo'; |
| } |
| buildCounterAuditLogConfig--; |
| return o; |
| } |
| |
| void checkAuditLogConfig(api.AuditLogConfig o) { |
| buildCounterAuditLogConfig++; |
| if (buildCounterAuditLogConfig < 3) { |
| checkUnnamed600(o.exemptedMembers!); |
| unittest.expect( |
| o.logType!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterAuditLogConfig--; |
| } |
| |
| core.List<core.String> buildUnnamed601() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed601(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 = buildUnnamed601(); |
| o.role = 'foo'; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| void checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| checkExpr(o.condition!); |
| checkUnnamed601(o.members!); |
| unittest.expect( |
| o.role!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterBinding--; |
| } |
| |
| core.int buildCounterCancelOperationRequest = 0; |
| api.CancelOperationRequest buildCancelOperationRequest() { |
| final o = api.CancelOperationRequest(); |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| return o; |
| } |
| |
| void checkCancelOperationRequest(api.CancelOperationRequest o) { |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| } |
| |
| 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.List<api.Location> buildUnnamed602() => [ |
| buildLocation(), |
| buildLocation(), |
| ]; |
| |
| void checkUnnamed602(core.List<api.Location> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLocation(o[0]); |
| checkLocation(o[1]); |
| } |
| |
| core.int buildCounterListLocationsResponse = 0; |
| api.ListLocationsResponse buildListLocationsResponse() { |
| final o = api.ListLocationsResponse(); |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| o.locations = buildUnnamed602(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| void checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed602(o.locations!); |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| core.List<api.Operation> buildUnnamed603() => [ |
| buildOperation(), |
| buildOperation(), |
| ]; |
| |
| void checkUnnamed603(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0]); |
| checkOperation(o[1]); |
| } |
| |
| core.int buildCounterListOperationsResponse = 0; |
| api.ListOperationsResponse buildListOperationsResponse() { |
| final o = api.ListOperationsResponse(); |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.operations = buildUnnamed603(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| void checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed603(o.operations!); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed604() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed604(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.Object> buildUnnamed605() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed605(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.int buildCounterLocation = 0; |
| api.Location buildLocation() { |
| final o = api.Location(); |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| o.displayName = 'foo'; |
| o.labels = buildUnnamed604(); |
| o.locationId = 'foo'; |
| o.metadata = buildUnnamed605(); |
| o.name = 'foo'; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| void checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| unittest.expect( |
| o.displayName!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed604(o.labels!); |
| unittest.expect( |
| o.locationId!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed605(o.metadata!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterLocation--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed606() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed606(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.Map<core.String, core.Object> buildUnnamed607() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed607(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.int buildCounterOperation = 0; |
| api.Operation buildOperation() { |
| final o = api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.done = true; |
| o.error = buildStatus(); |
| o.metadata = buildUnnamed606(); |
| o.name = 'foo'; |
| o.response = buildUnnamed607(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done!, unittest.isTrue); |
| checkStatus(o.error!); |
| checkUnnamed606(o.metadata!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed607(o.response!); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterOperationMetadata = 0; |
| api.OperationMetadata buildOperationMetadata() { |
| final o = api.OperationMetadata(); |
| buildCounterOperationMetadata++; |
| if (buildCounterOperationMetadata < 3) { |
| o.apiVersion = 'foo'; |
| o.createTime = 'foo'; |
| o.endTime = 'foo'; |
| o.requestedCancellation = true; |
| o.statusMessage = 'foo'; |
| o.target = 'foo'; |
| o.verb = 'foo'; |
| } |
| buildCounterOperationMetadata--; |
| return o; |
| } |
| |
| void checkOperationMetadata(api.OperationMetadata o) { |
| buildCounterOperationMetadata++; |
| if (buildCounterOperationMetadata < 3) { |
| unittest.expect( |
| o.apiVersion!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.createTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.endTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect(o.requestedCancellation!, unittest.isTrue); |
| unittest.expect( |
| o.statusMessage!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.target!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.verb!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterOperationMetadata--; |
| } |
| |
| core.List<api.AuditConfig> buildUnnamed608() => [ |
| buildAuditConfig(), |
| buildAuditConfig(), |
| ]; |
| |
| void checkUnnamed608(core.List<api.AuditConfig> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAuditConfig(o[0]); |
| checkAuditConfig(o[1]); |
| } |
| |
| core.List<api.Binding> buildUnnamed609() => [ |
| buildBinding(), |
| buildBinding(), |
| ]; |
| |
| void checkUnnamed609(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 = buildUnnamed608(); |
| o.bindings = buildUnnamed609(); |
| o.etag = 'foo'; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| void checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed608(o.auditConfigs!); |
| checkUnnamed609(o.bindings!); |
| unittest.expect( |
| o.etag!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.version!, |
| unittest.equals(42), |
| ); |
| } |
| buildCounterPolicy--; |
| } |
| |
| 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.Map<core.String, core.Object> buildUnnamed610() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed610(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted7 = (o['x']!) as core.Map; |
| unittest.expect(casted7, unittest.hasLength(3)); |
| unittest.expect( |
| casted7['list'], |
| unittest.equals([1, 2, 3]), |
| ); |
| unittest.expect( |
| casted7['bool'], |
| unittest.equals(true), |
| ); |
| unittest.expect( |
| casted7['string'], |
| unittest.equals('foo'), |
| ); |
| var casted8 = (o['y']!) as core.Map; |
| unittest.expect(casted8, unittest.hasLength(3)); |
| unittest.expect( |
| casted8['list'], |
| unittest.equals([1, 2, 3]), |
| ); |
| unittest.expect( |
| casted8['bool'], |
| unittest.equals(true), |
| ); |
| unittest.expect( |
| casted8['string'], |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.List<core.Map<core.String, core.Object>> buildUnnamed611() => [ |
| buildUnnamed610(), |
| buildUnnamed610(), |
| ]; |
| |
| void checkUnnamed611(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed610(o[0]); |
| checkUnnamed610(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| final o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed611(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect( |
| o.code!, |
| unittest.equals(42), |
| ); |
| checkUnnamed611(o.details!); |
| unittest.expect( |
| o.message!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.List<core.String> buildUnnamed612() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed612(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 = buildUnnamed612(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed612(o.permissions!); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed613() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed613(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 = buildUnnamed613(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed613(o.permissions!); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| void main() { |
| 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-CancelOperationRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildCancelOperationRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.CancelOperationRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkCancelOperationRequest(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-ListLocationsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListLocationsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListLocationsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListLocationsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListOperationsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListOperationsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListOperationsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListOperationsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Location', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildLocation(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Location.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkLocation(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-OperationMetadata', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOperationMetadata(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.OperationMetadata.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkOperationMetadata(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-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-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('resource-ProjectsLocationsResource', () { |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.NetworkServicesApi(mock).projects.locations; |
| 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(buildLocation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkLocation(response as api.Location); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.NetworkServicesApi(mock).projects.locations; |
| final arg_name = 'foo'; |
| 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 + 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['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(buildListLocationsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_name, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListLocationsResponse(response as api.ListLocationsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsEdgeCacheKeysetsResource', () { |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheKeysets; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| 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( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| 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_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheKeysets; |
| 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--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheKeysets; |
| 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-ProjectsLocationsEdgeCacheOriginsResource', () { |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheOrigins; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| 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( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| 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_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheOrigins; |
| 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--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheOrigins; |
| 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-ProjectsLocationsEdgeCacheServicesResource', () { |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheServices; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| 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( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| 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_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheServices; |
| 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--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = |
| api.NetworkServicesApi(mock).projects.locations.edgeCacheServices; |
| 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-ProjectsLocationsOperationsResource', () { |
| unittest.test('method--cancel', () async { |
| final mock = HttpServerMock(); |
| final res = api.NetworkServicesApi(mock).projects.locations.operations; |
| final arg_request = buildCancelOperationRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.CancelOperationRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkCancelOperationRequest(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.cancel(arg_request, arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.NetworkServicesApi(mock).projects.locations.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(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.NetworkServicesApi(mock).projects.locations.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.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.NetworkServicesApi(mock).projects.locations.operations; |
| final arg_name = 'foo'; |
| 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 + 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['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(buildListOperationsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_name, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListOperationsResponse(response as api.ListOperationsResponse); |
| }); |
| }); |
| } |