| // 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/redis/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| 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 buildCounterExportInstanceRequest = 0; |
| api.ExportInstanceRequest buildExportInstanceRequest() { |
| final o = api.ExportInstanceRequest(); |
| buildCounterExportInstanceRequest++; |
| if (buildCounterExportInstanceRequest < 3) { |
| o.outputConfig = buildOutputConfig(); |
| } |
| buildCounterExportInstanceRequest--; |
| return o; |
| } |
| |
| void checkExportInstanceRequest(api.ExportInstanceRequest o) { |
| buildCounterExportInstanceRequest++; |
| if (buildCounterExportInstanceRequest < 3) { |
| checkOutputConfig(o.outputConfig!); |
| } |
| buildCounterExportInstanceRequest--; |
| } |
| |
| core.int buildCounterFailoverInstanceRequest = 0; |
| api.FailoverInstanceRequest buildFailoverInstanceRequest() { |
| final o = api.FailoverInstanceRequest(); |
| buildCounterFailoverInstanceRequest++; |
| if (buildCounterFailoverInstanceRequest < 3) { |
| o.dataProtectionMode = 'foo'; |
| } |
| buildCounterFailoverInstanceRequest--; |
| return o; |
| } |
| |
| void checkFailoverInstanceRequest(api.FailoverInstanceRequest o) { |
| buildCounterFailoverInstanceRequest++; |
| if (buildCounterFailoverInstanceRequest < 3) { |
| unittest.expect( |
| o.dataProtectionMode!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterFailoverInstanceRequest--; |
| } |
| |
| core.int buildCounterGcsDestination = 0; |
| api.GcsDestination buildGcsDestination() { |
| final o = api.GcsDestination(); |
| buildCounterGcsDestination++; |
| if (buildCounterGcsDestination < 3) { |
| o.uri = 'foo'; |
| } |
| buildCounterGcsDestination--; |
| return o; |
| } |
| |
| void checkGcsDestination(api.GcsDestination o) { |
| buildCounterGcsDestination++; |
| if (buildCounterGcsDestination < 3) { |
| unittest.expect( |
| o.uri!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterGcsDestination--; |
| } |
| |
| core.int buildCounterGcsSource = 0; |
| api.GcsSource buildGcsSource() { |
| final o = api.GcsSource(); |
| buildCounterGcsSource++; |
| if (buildCounterGcsSource < 3) { |
| o.uri = 'foo'; |
| } |
| buildCounterGcsSource--; |
| return o; |
| } |
| |
| void checkGcsSource(api.GcsSource o) { |
| buildCounterGcsSource++; |
| if (buildCounterGcsSource < 3) { |
| unittest.expect( |
| o.uri!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterGcsSource--; |
| } |
| |
| core.int buildCounterImportInstanceRequest = 0; |
| api.ImportInstanceRequest buildImportInstanceRequest() { |
| final o = api.ImportInstanceRequest(); |
| buildCounterImportInstanceRequest++; |
| if (buildCounterImportInstanceRequest < 3) { |
| o.inputConfig = buildInputConfig(); |
| } |
| buildCounterImportInstanceRequest--; |
| return o; |
| } |
| |
| void checkImportInstanceRequest(api.ImportInstanceRequest o) { |
| buildCounterImportInstanceRequest++; |
| if (buildCounterImportInstanceRequest < 3) { |
| checkInputConfig(o.inputConfig!); |
| } |
| buildCounterImportInstanceRequest--; |
| } |
| |
| core.int buildCounterInputConfig = 0; |
| api.InputConfig buildInputConfig() { |
| final o = api.InputConfig(); |
| buildCounterInputConfig++; |
| if (buildCounterInputConfig < 3) { |
| o.gcsSource = buildGcsSource(); |
| } |
| buildCounterInputConfig--; |
| return o; |
| } |
| |
| void checkInputConfig(api.InputConfig o) { |
| buildCounterInputConfig++; |
| if (buildCounterInputConfig < 3) { |
| checkGcsSource(o.gcsSource!); |
| } |
| buildCounterInputConfig--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed0() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed0(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.List<api.NodeInfo> buildUnnamed1() => [ |
| buildNodeInfo(), |
| buildNodeInfo(), |
| ]; |
| |
| void checkUnnamed1(core.List<api.NodeInfo> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNodeInfo(o[0]); |
| checkNodeInfo(o[1]); |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed2() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed2(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.List<api.TlsCertificate> buildUnnamed3() => [ |
| buildTlsCertificate(), |
| buildTlsCertificate(), |
| ]; |
| |
| void checkUnnamed3(core.List<api.TlsCertificate> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTlsCertificate(o[0]); |
| checkTlsCertificate(o[1]); |
| } |
| |
| core.int buildCounterInstance = 0; |
| api.Instance buildInstance() { |
| final o = api.Instance(); |
| buildCounterInstance++; |
| if (buildCounterInstance < 3) { |
| o.alternativeLocationId = 'foo'; |
| o.authEnabled = true; |
| o.authorizedNetwork = 'foo'; |
| o.connectMode = 'foo'; |
| o.createTime = 'foo'; |
| o.currentLocationId = 'foo'; |
| o.displayName = 'foo'; |
| o.host = 'foo'; |
| o.labels = buildUnnamed0(); |
| o.locationId = 'foo'; |
| o.maintenancePolicy = buildMaintenancePolicy(); |
| o.maintenanceSchedule = buildMaintenanceSchedule(); |
| o.memorySizeGb = 42; |
| o.name = 'foo'; |
| o.nodes = buildUnnamed1(); |
| o.persistenceConfig = buildPersistenceConfig(); |
| o.persistenceIamIdentity = 'foo'; |
| o.port = 42; |
| o.readEndpoint = 'foo'; |
| o.readEndpointPort = 42; |
| o.readReplicasMode = 'foo'; |
| o.redisConfigs = buildUnnamed2(); |
| o.redisVersion = 'foo'; |
| o.replicaCount = 42; |
| o.reservedIpRange = 'foo'; |
| o.serverCaCerts = buildUnnamed3(); |
| o.state = 'foo'; |
| o.statusMessage = 'foo'; |
| o.tier = 'foo'; |
| o.transitEncryptionMode = 'foo'; |
| } |
| buildCounterInstance--; |
| return o; |
| } |
| |
| void checkInstance(api.Instance o) { |
| buildCounterInstance++; |
| if (buildCounterInstance < 3) { |
| unittest.expect( |
| o.alternativeLocationId!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect(o.authEnabled!, unittest.isTrue); |
| unittest.expect( |
| o.authorizedNetwork!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.connectMode!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.createTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.currentLocationId!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.displayName!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.host!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed0(o.labels!); |
| unittest.expect( |
| o.locationId!, |
| unittest.equals('foo'), |
| ); |
| checkMaintenancePolicy(o.maintenancePolicy!); |
| checkMaintenanceSchedule(o.maintenanceSchedule!); |
| unittest.expect( |
| o.memorySizeGb!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed1(o.nodes!); |
| checkPersistenceConfig(o.persistenceConfig!); |
| unittest.expect( |
| o.persistenceIamIdentity!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.port!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.readEndpoint!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.readEndpointPort!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.readReplicasMode!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed2(o.redisConfigs!); |
| unittest.expect( |
| o.redisVersion!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.replicaCount!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.reservedIpRange!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed3(o.serverCaCerts!); |
| unittest.expect( |
| o.state!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.statusMessage!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.tier!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.transitEncryptionMode!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterInstance--; |
| } |
| |
| core.int buildCounterInstanceAuthString = 0; |
| api.InstanceAuthString buildInstanceAuthString() { |
| final o = api.InstanceAuthString(); |
| buildCounterInstanceAuthString++; |
| if (buildCounterInstanceAuthString < 3) { |
| o.authString = 'foo'; |
| } |
| buildCounterInstanceAuthString--; |
| return o; |
| } |
| |
| void checkInstanceAuthString(api.InstanceAuthString o) { |
| buildCounterInstanceAuthString++; |
| if (buildCounterInstanceAuthString < 3) { |
| unittest.expect( |
| o.authString!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterInstanceAuthString--; |
| } |
| |
| core.List<api.Instance> buildUnnamed4() => [ |
| buildInstance(), |
| buildInstance(), |
| ]; |
| |
| void checkUnnamed4(core.List<api.Instance> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkInstance(o[0]); |
| checkInstance(o[1]); |
| } |
| |
| core.List<core.String> buildUnnamed5() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed5(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 buildCounterListInstancesResponse = 0; |
| api.ListInstancesResponse buildListInstancesResponse() { |
| final o = api.ListInstancesResponse(); |
| buildCounterListInstancesResponse++; |
| if (buildCounterListInstancesResponse < 3) { |
| o.instances = buildUnnamed4(); |
| o.nextPageToken = 'foo'; |
| o.unreachable = buildUnnamed5(); |
| } |
| buildCounterListInstancesResponse--; |
| return o; |
| } |
| |
| void checkListInstancesResponse(api.ListInstancesResponse o) { |
| buildCounterListInstancesResponse++; |
| if (buildCounterListInstancesResponse < 3) { |
| checkUnnamed4(o.instances!); |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed5(o.unreachable!); |
| } |
| buildCounterListInstancesResponse--; |
| } |
| |
| core.List<api.Location> buildUnnamed6() => [ |
| buildLocation(), |
| buildLocation(), |
| ]; |
| |
| void checkUnnamed6(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 = buildUnnamed6(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| void checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed6(o.locations!); |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| core.List<api.Operation> buildUnnamed7() => [ |
| buildOperation(), |
| buildOperation(), |
| ]; |
| |
| void checkUnnamed7(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 = buildUnnamed7(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| void checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed7(o.operations!); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed8() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed8(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?> buildUnnamed9() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed9(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 = buildUnnamed8(); |
| o.locationId = 'foo'; |
| o.metadata = buildUnnamed9(); |
| o.name = 'foo'; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| void checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| unittest.expect( |
| o.displayName!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed8(o.labels!); |
| unittest.expect( |
| o.locationId!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed9(o.metadata!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterLocation--; |
| } |
| |
| core.List<api.WeeklyMaintenanceWindow> buildUnnamed10() => [ |
| buildWeeklyMaintenanceWindow(), |
| buildWeeklyMaintenanceWindow(), |
| ]; |
| |
| void checkUnnamed10(core.List<api.WeeklyMaintenanceWindow> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkWeeklyMaintenanceWindow(o[0]); |
| checkWeeklyMaintenanceWindow(o[1]); |
| } |
| |
| core.int buildCounterMaintenancePolicy = 0; |
| api.MaintenancePolicy buildMaintenancePolicy() { |
| final o = api.MaintenancePolicy(); |
| buildCounterMaintenancePolicy++; |
| if (buildCounterMaintenancePolicy < 3) { |
| o.createTime = 'foo'; |
| o.description = 'foo'; |
| o.updateTime = 'foo'; |
| o.weeklyMaintenanceWindow = buildUnnamed10(); |
| } |
| buildCounterMaintenancePolicy--; |
| return o; |
| } |
| |
| void checkMaintenancePolicy(api.MaintenancePolicy o) { |
| buildCounterMaintenancePolicy++; |
| if (buildCounterMaintenancePolicy < 3) { |
| unittest.expect( |
| o.createTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.description!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.updateTime!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed10(o.weeklyMaintenanceWindow!); |
| } |
| buildCounterMaintenancePolicy--; |
| } |
| |
| core.int buildCounterMaintenanceSchedule = 0; |
| api.MaintenanceSchedule buildMaintenanceSchedule() { |
| final o = api.MaintenanceSchedule(); |
| buildCounterMaintenanceSchedule++; |
| if (buildCounterMaintenanceSchedule < 3) { |
| o.canReschedule = true; |
| o.endTime = 'foo'; |
| o.scheduleDeadlineTime = 'foo'; |
| o.startTime = 'foo'; |
| } |
| buildCounterMaintenanceSchedule--; |
| return o; |
| } |
| |
| void checkMaintenanceSchedule(api.MaintenanceSchedule o) { |
| buildCounterMaintenanceSchedule++; |
| if (buildCounterMaintenanceSchedule < 3) { |
| unittest.expect(o.canReschedule!, unittest.isTrue); |
| unittest.expect( |
| o.endTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.scheduleDeadlineTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.startTime!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterMaintenanceSchedule--; |
| } |
| |
| core.int buildCounterNodeInfo = 0; |
| api.NodeInfo buildNodeInfo() { |
| final o = api.NodeInfo(); |
| buildCounterNodeInfo++; |
| if (buildCounterNodeInfo < 3) { |
| o.id = 'foo'; |
| o.zone = 'foo'; |
| } |
| buildCounterNodeInfo--; |
| return o; |
| } |
| |
| void checkNodeInfo(api.NodeInfo o) { |
| buildCounterNodeInfo++; |
| if (buildCounterNodeInfo < 3) { |
| unittest.expect( |
| o.id!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.zone!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterNodeInfo--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed11() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed11(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var 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?> buildUnnamed12() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed12(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var 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 = buildUnnamed11(); |
| o.name = 'foo'; |
| o.response = buildUnnamed12(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done!, unittest.isTrue); |
| checkStatus(o.error!); |
| checkUnnamed11(o.metadata!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed12(o.response!); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterOutputConfig = 0; |
| api.OutputConfig buildOutputConfig() { |
| final o = api.OutputConfig(); |
| buildCounterOutputConfig++; |
| if (buildCounterOutputConfig < 3) { |
| o.gcsDestination = buildGcsDestination(); |
| } |
| buildCounterOutputConfig--; |
| return o; |
| } |
| |
| void checkOutputConfig(api.OutputConfig o) { |
| buildCounterOutputConfig++; |
| if (buildCounterOutputConfig < 3) { |
| checkGcsDestination(o.gcsDestination!); |
| } |
| buildCounterOutputConfig--; |
| } |
| |
| core.int buildCounterPersistenceConfig = 0; |
| api.PersistenceConfig buildPersistenceConfig() { |
| final o = api.PersistenceConfig(); |
| buildCounterPersistenceConfig++; |
| if (buildCounterPersistenceConfig < 3) { |
| o.persistenceMode = 'foo'; |
| o.rdbNextSnapshotTime = 'foo'; |
| o.rdbSnapshotPeriod = 'foo'; |
| o.rdbSnapshotStartTime = 'foo'; |
| } |
| buildCounterPersistenceConfig--; |
| return o; |
| } |
| |
| void checkPersistenceConfig(api.PersistenceConfig o) { |
| buildCounterPersistenceConfig++; |
| if (buildCounterPersistenceConfig < 3) { |
| unittest.expect( |
| o.persistenceMode!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.rdbNextSnapshotTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.rdbSnapshotPeriod!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.rdbSnapshotStartTime!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterPersistenceConfig--; |
| } |
| |
| core.int buildCounterRescheduleMaintenanceRequest = 0; |
| api.RescheduleMaintenanceRequest buildRescheduleMaintenanceRequest() { |
| final o = api.RescheduleMaintenanceRequest(); |
| buildCounterRescheduleMaintenanceRequest++; |
| if (buildCounterRescheduleMaintenanceRequest < 3) { |
| o.rescheduleType = 'foo'; |
| o.scheduleTime = 'foo'; |
| } |
| buildCounterRescheduleMaintenanceRequest--; |
| return o; |
| } |
| |
| void checkRescheduleMaintenanceRequest(api.RescheduleMaintenanceRequest o) { |
| buildCounterRescheduleMaintenanceRequest++; |
| if (buildCounterRescheduleMaintenanceRequest < 3) { |
| unittest.expect( |
| o.rescheduleType!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.scheduleTime!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterRescheduleMaintenanceRequest--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed13() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }, |
| }; |
| |
| void checkUnnamed13(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?>> buildUnnamed14() => [ |
| buildUnnamed13(), |
| buildUnnamed13(), |
| ]; |
| |
| void checkUnnamed14(core.List<core.Map<core.String, core.Object?>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed13(o[0]); |
| checkUnnamed13(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| final o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed14(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect( |
| o.code!, |
| unittest.equals(42), |
| ); |
| checkUnnamed14(o.details!); |
| unittest.expect( |
| o.message!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.int buildCounterTimeOfDay = 0; |
| api.TimeOfDay buildTimeOfDay() { |
| final o = api.TimeOfDay(); |
| buildCounterTimeOfDay++; |
| if (buildCounterTimeOfDay < 3) { |
| o.hours = 42; |
| o.minutes = 42; |
| o.nanos = 42; |
| o.seconds = 42; |
| } |
| buildCounterTimeOfDay--; |
| return o; |
| } |
| |
| void checkTimeOfDay(api.TimeOfDay o) { |
| buildCounterTimeOfDay++; |
| if (buildCounterTimeOfDay < 3) { |
| unittest.expect( |
| o.hours!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.minutes!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.nanos!, |
| unittest.equals(42), |
| ); |
| unittest.expect( |
| o.seconds!, |
| unittest.equals(42), |
| ); |
| } |
| buildCounterTimeOfDay--; |
| } |
| |
| core.int buildCounterTlsCertificate = 0; |
| api.TlsCertificate buildTlsCertificate() { |
| final o = api.TlsCertificate(); |
| buildCounterTlsCertificate++; |
| if (buildCounterTlsCertificate < 3) { |
| o.cert = 'foo'; |
| o.createTime = 'foo'; |
| o.expireTime = 'foo'; |
| o.serialNumber = 'foo'; |
| o.sha1Fingerprint = 'foo'; |
| } |
| buildCounterTlsCertificate--; |
| return o; |
| } |
| |
| void checkTlsCertificate(api.TlsCertificate o) { |
| buildCounterTlsCertificate++; |
| if (buildCounterTlsCertificate < 3) { |
| unittest.expect( |
| o.cert!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.createTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.expireTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.serialNumber!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.sha1Fingerprint!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterTlsCertificate--; |
| } |
| |
| core.int buildCounterUpgradeInstanceRequest = 0; |
| api.UpgradeInstanceRequest buildUpgradeInstanceRequest() { |
| final o = api.UpgradeInstanceRequest(); |
| buildCounterUpgradeInstanceRequest++; |
| if (buildCounterUpgradeInstanceRequest < 3) { |
| o.redisVersion = 'foo'; |
| } |
| buildCounterUpgradeInstanceRequest--; |
| return o; |
| } |
| |
| void checkUpgradeInstanceRequest(api.UpgradeInstanceRequest o) { |
| buildCounterUpgradeInstanceRequest++; |
| if (buildCounterUpgradeInstanceRequest < 3) { |
| unittest.expect( |
| o.redisVersion!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterUpgradeInstanceRequest--; |
| } |
| |
| core.int buildCounterWeeklyMaintenanceWindow = 0; |
| api.WeeklyMaintenanceWindow buildWeeklyMaintenanceWindow() { |
| final o = api.WeeklyMaintenanceWindow(); |
| buildCounterWeeklyMaintenanceWindow++; |
| if (buildCounterWeeklyMaintenanceWindow < 3) { |
| o.day = 'foo'; |
| o.duration = 'foo'; |
| o.startTime = buildTimeOfDay(); |
| } |
| buildCounterWeeklyMaintenanceWindow--; |
| return o; |
| } |
| |
| void checkWeeklyMaintenanceWindow(api.WeeklyMaintenanceWindow o) { |
| buildCounterWeeklyMaintenanceWindow++; |
| if (buildCounterWeeklyMaintenanceWindow < 3) { |
| unittest.expect( |
| o.day!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.duration!, |
| unittest.equals('foo'), |
| ); |
| checkTimeOfDay(o.startTime!); |
| } |
| buildCounterWeeklyMaintenanceWindow--; |
| } |
| |
| void main() { |
| 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-ExportInstanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildExportInstanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ExportInstanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkExportInstanceRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-FailoverInstanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildFailoverInstanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.FailoverInstanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkFailoverInstanceRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GcsDestination', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGcsDestination(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GcsDestination.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkGcsDestination(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GcsSource', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGcsSource(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.GcsSource.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkGcsSource(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ImportInstanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildImportInstanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ImportInstanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkImportInstanceRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-InputConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildInputConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.InputConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkInputConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Instance', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildInstance(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Instance.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkInstance(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-InstanceAuthString', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildInstanceAuthString(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.InstanceAuthString.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkInstanceAuthString(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListInstancesResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListInstancesResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListInstancesResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListInstancesResponse(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-MaintenancePolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildMaintenancePolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.MaintenancePolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkMaintenancePolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-MaintenanceSchedule', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildMaintenanceSchedule(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.MaintenanceSchedule.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkMaintenanceSchedule(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NodeInfo', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildNodeInfo(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.NodeInfo.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkNodeInfo(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-OutputConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOutputConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.OutputConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkOutputConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PersistenceConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPersistenceConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PersistenceConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPersistenceConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RescheduleMaintenanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildRescheduleMaintenanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.RescheduleMaintenanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkRescheduleMaintenanceRequest(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-TimeOfDay', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTimeOfDay(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.TimeOfDay.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkTimeOfDay(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TlsCertificate', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTlsCertificate(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.TlsCertificate.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkTlsCertificate(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-UpgradeInstanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUpgradeInstanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UpgradeInstanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkUpgradeInstanceRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-WeeklyMaintenanceWindow', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildWeeklyMaintenanceWindow(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.WeeklyMaintenanceWindow.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkWeeklyMaintenanceWindow(od); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsResource', () { |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(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.CloudRedisApi(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-ProjectsLocationsInstancesResource', () { |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildInstance(); |
| final arg_parent = 'foo'; |
| final arg_instanceId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = |
| api.Instance.fromJson(json as core.Map<core.String, core.dynamic>); |
| checkInstance(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['instanceId']!.first, |
| unittest.equals(arg_instanceId), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.create(arg_request, arg_parent, |
| instanceId: arg_instanceId, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| 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.delete(arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--export', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildExportInstanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ExportInstanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkExportInstanceRequest(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(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.export(arg_request, arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--failover', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildFailoverInstanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.FailoverInstanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkFailoverInstanceRequest(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(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.failover(arg_request, arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| 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(buildInstance()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkInstance(response as api.Instance); |
| }); |
| |
| unittest.test('method--getAuthString', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| 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(buildInstanceAuthString()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.getAuthString(arg_name, $fields: arg_$fields); |
| checkInstanceAuthString(response as api.InstanceAuthString); |
| }); |
| |
| unittest.test('method--import', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildImportInstanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ImportInstanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkImportInstanceRequest(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(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.import(arg_request, arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_parent = '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( |
| 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(buildListInstancesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListInstancesResponse(response as api.ListInstancesResponse); |
| }); |
| |
| unittest.test('method--patch', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildInstance(); |
| final arg_name = 'foo'; |
| final arg_updateMask = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = |
| api.Instance.fromJson(json as core.Map<core.String, core.dynamic>); |
| checkInstance(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['updateMask']!.first, |
| unittest.equals(arg_updateMask), |
| ); |
| 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.patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--rescheduleMaintenance', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildRescheduleMaintenanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.RescheduleMaintenanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkRescheduleMaintenanceRequest(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(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.rescheduleMaintenance(arg_request, arg_name, |
| $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--upgrade', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(mock).projects.locations.instances; |
| final arg_request = buildUpgradeInstanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UpgradeInstanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkUpgradeInstanceRequest(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(buildOperation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.upgrade(arg_request, arg_name, $fields: arg_$fields); |
| checkOperation(response as api.Operation); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsOperationsResource', () { |
| unittest.test('method--cancel', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(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.cancel(arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudRedisApi(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.CloudRedisApi(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.CloudRedisApi(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); |
| }); |
| }); |
| } |