| // Copyright 2021 Google LLC |
| // |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file or at |
| // https://developers.google.com/open-source/licenses/bsd |
| |
| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: deprecated_member_use_from_same_package |
| // ignore_for_file: doc_directive_unknown |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_const_declarations |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unintended_html_in_doc_comment |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: unreachable_from_main |
| // ignore_for_file: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/memcache/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.List<core.String> buildUnnamed0() => ['foo', 'foo']; |
| |
| void checkUnnamed0(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 buildCounterApplyParametersRequest = 0; |
| api.ApplyParametersRequest buildApplyParametersRequest() { |
| final o = api.ApplyParametersRequest(); |
| buildCounterApplyParametersRequest++; |
| if (buildCounterApplyParametersRequest < 3) { |
| o.applyAll = true; |
| o.nodeIds = buildUnnamed0(); |
| } |
| buildCounterApplyParametersRequest--; |
| return o; |
| } |
| |
| void checkApplyParametersRequest(api.ApplyParametersRequest o) { |
| buildCounterApplyParametersRequest++; |
| if (buildCounterApplyParametersRequest < 3) { |
| unittest.expect(o.applyAll!, unittest.isTrue); |
| checkUnnamed0(o.nodeIds!); |
| } |
| buildCounterApplyParametersRequest--; |
| } |
| |
| 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.Map<core.String, core.String> buildUnnamed1() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed1(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterGetTagsResponse = 0; |
| api.GetTagsResponse buildGetTagsResponse() { |
| final o = api.GetTagsResponse(); |
| buildCounterGetTagsResponse++; |
| if (buildCounterGetTagsResponse < 3) { |
| o.etag = 'foo'; |
| o.name = 'foo'; |
| o.tags = buildUnnamed1(); |
| } |
| buildCounterGetTagsResponse--; |
| return o; |
| } |
| |
| void checkGetTagsResponse(api.GetTagsResponse o) { |
| buildCounterGetTagsResponse++; |
| if (buildCounterGetTagsResponse < 3) { |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkUnnamed1(o.tags!); |
| } |
| buildCounterGetTagsResponse--; |
| } |
| |
| core.List<api.WeeklyMaintenanceWindow> buildUnnamed2() => [ |
| buildWeeklyMaintenanceWindow(), |
| buildWeeklyMaintenanceWindow(), |
| ]; |
| |
| void checkUnnamed2(core.List<api.WeeklyMaintenanceWindow> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkWeeklyMaintenanceWindow(o[0]); |
| checkWeeklyMaintenanceWindow(o[1]); |
| } |
| |
| core.int buildCounterGoogleCloudMemcacheV1MaintenancePolicy = 0; |
| api.GoogleCloudMemcacheV1MaintenancePolicy |
| buildGoogleCloudMemcacheV1MaintenancePolicy() { |
| final o = api.GoogleCloudMemcacheV1MaintenancePolicy(); |
| buildCounterGoogleCloudMemcacheV1MaintenancePolicy++; |
| if (buildCounterGoogleCloudMemcacheV1MaintenancePolicy < 3) { |
| o.createTime = 'foo'; |
| o.description = 'foo'; |
| o.updateTime = 'foo'; |
| o.weeklyMaintenanceWindow = buildUnnamed2(); |
| } |
| buildCounterGoogleCloudMemcacheV1MaintenancePolicy--; |
| return o; |
| } |
| |
| void checkGoogleCloudMemcacheV1MaintenancePolicy( |
| api.GoogleCloudMemcacheV1MaintenancePolicy o, |
| ) { |
| buildCounterGoogleCloudMemcacheV1MaintenancePolicy++; |
| if (buildCounterGoogleCloudMemcacheV1MaintenancePolicy < 3) { |
| unittest.expect(o.createTime!, unittest.equals('foo')); |
| unittest.expect(o.description!, unittest.equals('foo')); |
| unittest.expect(o.updateTime!, unittest.equals('foo')); |
| checkUnnamed2(o.weeklyMaintenanceWindow!); |
| } |
| buildCounterGoogleCloudMemcacheV1MaintenancePolicy--; |
| } |
| |
| core.int buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest = 0; |
| api.GoogleCloudMemcacheV1UpgradeInstanceRequest |
| buildGoogleCloudMemcacheV1UpgradeInstanceRequest() { |
| final o = api.GoogleCloudMemcacheV1UpgradeInstanceRequest(); |
| buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest++; |
| if (buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest < 3) { |
| o.memcacheVersion = 'foo'; |
| } |
| buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest--; |
| return o; |
| } |
| |
| void checkGoogleCloudMemcacheV1UpgradeInstanceRequest( |
| api.GoogleCloudMemcacheV1UpgradeInstanceRequest o, |
| ) { |
| buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest++; |
| if (buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest < 3) { |
| unittest.expect(o.memcacheVersion!, unittest.equals('foo')); |
| } |
| buildCounterGoogleCloudMemcacheV1UpgradeInstanceRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed3() => ['foo', 'foo']; |
| |
| void checkUnnamed3(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<api.InstanceMessage> buildUnnamed4() => [ |
| buildInstanceMessage(), |
| buildInstanceMessage(), |
| ]; |
| |
| void checkUnnamed4(core.List<api.InstanceMessage> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkInstanceMessage(o[0]); |
| checkInstanceMessage(o[1]); |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed5() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed5(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.Node> buildUnnamed6() => [buildNode(), buildNode()]; |
| |
| void checkUnnamed6(core.List<api.Node> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNode(o[0]); |
| checkNode(o[1]); |
| } |
| |
| core.List<core.String> buildUnnamed7() => ['foo', 'foo']; |
| |
| void checkUnnamed7(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed8() => ['foo', 'foo']; |
| |
| void checkUnnamed8(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterInstance = 0; |
| api.Instance buildInstance() { |
| final o = api.Instance(); |
| buildCounterInstance++; |
| if (buildCounterInstance < 3) { |
| o.authorizedNetwork = 'foo'; |
| o.availableMaintenanceVersions = buildUnnamed3(); |
| o.createTime = 'foo'; |
| o.discoveryEndpoint = 'foo'; |
| o.displayName = 'foo'; |
| o.effectiveMaintenanceVersion = 'foo'; |
| o.instanceMessages = buildUnnamed4(); |
| o.labels = buildUnnamed5(); |
| o.maintenancePolicy = buildGoogleCloudMemcacheV1MaintenancePolicy(); |
| o.maintenanceSchedule = buildMaintenanceSchedule(); |
| o.maintenanceVersion = 'foo'; |
| o.memcacheFullVersion = 'foo'; |
| o.memcacheNodes = buildUnnamed6(); |
| o.memcacheVersion = 'foo'; |
| o.name = 'foo'; |
| o.nodeConfig = buildNodeConfig(); |
| o.nodeCount = 42; |
| o.parameters = buildMemcacheParameters(); |
| o.reservedIpRangeId = buildUnnamed7(); |
| o.satisfiesPzi = true; |
| o.satisfiesPzs = true; |
| o.state = 'foo'; |
| o.updateTime = 'foo'; |
| o.zones = buildUnnamed8(); |
| } |
| buildCounterInstance--; |
| return o; |
| } |
| |
| void checkInstance(api.Instance o) { |
| buildCounterInstance++; |
| if (buildCounterInstance < 3) { |
| unittest.expect(o.authorizedNetwork!, unittest.equals('foo')); |
| checkUnnamed3(o.availableMaintenanceVersions!); |
| unittest.expect(o.createTime!, unittest.equals('foo')); |
| unittest.expect(o.discoveryEndpoint!, unittest.equals('foo')); |
| unittest.expect(o.displayName!, unittest.equals('foo')); |
| unittest.expect(o.effectiveMaintenanceVersion!, unittest.equals('foo')); |
| checkUnnamed4(o.instanceMessages!); |
| checkUnnamed5(o.labels!); |
| checkGoogleCloudMemcacheV1MaintenancePolicy(o.maintenancePolicy!); |
| checkMaintenanceSchedule(o.maintenanceSchedule!); |
| unittest.expect(o.maintenanceVersion!, unittest.equals('foo')); |
| unittest.expect(o.memcacheFullVersion!, unittest.equals('foo')); |
| checkUnnamed6(o.memcacheNodes!); |
| unittest.expect(o.memcacheVersion!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkNodeConfig(o.nodeConfig!); |
| unittest.expect(o.nodeCount!, unittest.equals(42)); |
| checkMemcacheParameters(o.parameters!); |
| checkUnnamed7(o.reservedIpRangeId!); |
| unittest.expect(o.satisfiesPzi!, unittest.isTrue); |
| unittest.expect(o.satisfiesPzs!, unittest.isTrue); |
| unittest.expect(o.state!, unittest.equals('foo')); |
| unittest.expect(o.updateTime!, unittest.equals('foo')); |
| checkUnnamed8(o.zones!); |
| } |
| buildCounterInstance--; |
| } |
| |
| core.int buildCounterInstanceMessage = 0; |
| api.InstanceMessage buildInstanceMessage() { |
| final o = api.InstanceMessage(); |
| buildCounterInstanceMessage++; |
| if (buildCounterInstanceMessage < 3) { |
| o.code = 'foo'; |
| o.message = 'foo'; |
| } |
| buildCounterInstanceMessage--; |
| return o; |
| } |
| |
| void checkInstanceMessage(api.InstanceMessage o) { |
| buildCounterInstanceMessage++; |
| if (buildCounterInstanceMessage < 3) { |
| unittest.expect(o.code!, unittest.equals('foo')); |
| unittest.expect(o.message!, unittest.equals('foo')); |
| } |
| buildCounterInstanceMessage--; |
| } |
| |
| core.List<api.Instance> buildUnnamed9() => [buildInstance(), buildInstance()]; |
| |
| void checkUnnamed9(core.List<api.Instance> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkInstance(o[0]); |
| checkInstance(o[1]); |
| } |
| |
| core.List<core.String> buildUnnamed10() => ['foo', 'foo']; |
| |
| void checkUnnamed10(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 = buildUnnamed9(); |
| o.nextPageToken = 'foo'; |
| o.unreachable = buildUnnamed10(); |
| } |
| buildCounterListInstancesResponse--; |
| return o; |
| } |
| |
| void checkListInstancesResponse(api.ListInstancesResponse o) { |
| buildCounterListInstancesResponse++; |
| if (buildCounterListInstancesResponse < 3) { |
| checkUnnamed9(o.instances!); |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| checkUnnamed10(o.unreachable!); |
| } |
| buildCounterListInstancesResponse--; |
| } |
| |
| core.List<api.Location> buildUnnamed11() => [buildLocation(), buildLocation()]; |
| |
| void checkUnnamed11(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 = buildUnnamed11(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| void checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed11(o.locations!); |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| core.List<api.Operation> buildUnnamed12() => [ |
| buildOperation(), |
| buildOperation(), |
| ]; |
| |
| void checkUnnamed12(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0]); |
| checkOperation(o[1]); |
| } |
| |
| core.List<core.String> buildUnnamed13() => ['foo', 'foo']; |
| |
| void checkUnnamed13(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 buildCounterListOperationsResponse = 0; |
| api.ListOperationsResponse buildListOperationsResponse() { |
| final o = api.ListOperationsResponse(); |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.operations = buildUnnamed12(); |
| o.unreachable = buildUnnamed13(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| void checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| unittest.expect(o.nextPageToken!, unittest.equals('foo')); |
| checkUnnamed12(o.operations!); |
| checkUnnamed13(o.unreachable!); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed14() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed14(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?> buildUnnamed15() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed15(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 = buildUnnamed14(); |
| o.locationId = 'foo'; |
| o.metadata = buildUnnamed15(); |
| o.name = 'foo'; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| void checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| unittest.expect(o.displayName!, unittest.equals('foo')); |
| checkUnnamed14(o.labels!); |
| unittest.expect(o.locationId!, unittest.equals('foo')); |
| checkUnnamed15(o.metadata!); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| } |
| buildCounterLocation--; |
| } |
| |
| core.int buildCounterMaintenanceSchedule = 0; |
| api.MaintenanceSchedule buildMaintenanceSchedule() { |
| final o = api.MaintenanceSchedule(); |
| buildCounterMaintenanceSchedule++; |
| if (buildCounterMaintenanceSchedule < 3) { |
| o.endTime = 'foo'; |
| o.scheduleDeadlineTime = 'foo'; |
| o.startTime = 'foo'; |
| } |
| buildCounterMaintenanceSchedule--; |
| return o; |
| } |
| |
| void checkMaintenanceSchedule(api.MaintenanceSchedule o) { |
| buildCounterMaintenanceSchedule++; |
| if (buildCounterMaintenanceSchedule < 3) { |
| unittest.expect(o.endTime!, unittest.equals('foo')); |
| unittest.expect(o.scheduleDeadlineTime!, unittest.equals('foo')); |
| unittest.expect(o.startTime!, unittest.equals('foo')); |
| } |
| buildCounterMaintenanceSchedule--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed16() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed16(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterMemcacheParameters = 0; |
| api.MemcacheParameters buildMemcacheParameters() { |
| final o = api.MemcacheParameters(); |
| buildCounterMemcacheParameters++; |
| if (buildCounterMemcacheParameters < 3) { |
| o.id = 'foo'; |
| o.params = buildUnnamed16(); |
| } |
| buildCounterMemcacheParameters--; |
| return o; |
| } |
| |
| void checkMemcacheParameters(api.MemcacheParameters o) { |
| buildCounterMemcacheParameters++; |
| if (buildCounterMemcacheParameters < 3) { |
| unittest.expect(o.id!, unittest.equals('foo')); |
| checkUnnamed16(o.params!); |
| } |
| buildCounterMemcacheParameters--; |
| } |
| |
| core.int buildCounterNode = 0; |
| api.Node buildNode() { |
| final o = api.Node(); |
| buildCounterNode++; |
| if (buildCounterNode < 3) { |
| o.host = 'foo'; |
| o.memcacheFullVersion = 'foo'; |
| o.memcacheVersion = 'foo'; |
| o.nodeId = 'foo'; |
| o.parameters = buildMemcacheParameters(); |
| o.port = 42; |
| o.state = 'foo'; |
| o.zone = 'foo'; |
| } |
| buildCounterNode--; |
| return o; |
| } |
| |
| void checkNode(api.Node o) { |
| buildCounterNode++; |
| if (buildCounterNode < 3) { |
| unittest.expect(o.host!, unittest.equals('foo')); |
| unittest.expect(o.memcacheFullVersion!, unittest.equals('foo')); |
| unittest.expect(o.memcacheVersion!, unittest.equals('foo')); |
| unittest.expect(o.nodeId!, unittest.equals('foo')); |
| checkMemcacheParameters(o.parameters!); |
| unittest.expect(o.port!, unittest.equals(42)); |
| unittest.expect(o.state!, unittest.equals('foo')); |
| unittest.expect(o.zone!, unittest.equals('foo')); |
| } |
| buildCounterNode--; |
| } |
| |
| core.int buildCounterNodeConfig = 0; |
| api.NodeConfig buildNodeConfig() { |
| final o = api.NodeConfig(); |
| buildCounterNodeConfig++; |
| if (buildCounterNodeConfig < 3) { |
| o.cpuCount = 42; |
| o.memorySizeMb = 42; |
| } |
| buildCounterNodeConfig--; |
| return o; |
| } |
| |
| void checkNodeConfig(api.NodeConfig o) { |
| buildCounterNodeConfig++; |
| if (buildCounterNodeConfig < 3) { |
| unittest.expect(o.cpuCount!, unittest.equals(42)); |
| unittest.expect(o.memorySizeMb!, unittest.equals(42)); |
| } |
| buildCounterNodeConfig--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed17() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed17(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?> buildUnnamed18() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed18(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 = buildUnnamed17(); |
| o.name = 'foo'; |
| o.response = buildUnnamed18(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done!, unittest.isTrue); |
| checkStatus(o.error!); |
| checkUnnamed17(o.metadata!); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkUnnamed18(o.response!); |
| } |
| buildCounterOperation--; |
| } |
| |
| 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.String> buildUnnamed19() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed19(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterSetTagsRequest = 0; |
| api.SetTagsRequest buildSetTagsRequest() { |
| final o = api.SetTagsRequest(); |
| buildCounterSetTagsRequest++; |
| if (buildCounterSetTagsRequest < 3) { |
| o.etag = 'foo'; |
| o.name = 'foo'; |
| o.requestId = 'foo'; |
| o.tags = buildUnnamed19(); |
| } |
| buildCounterSetTagsRequest--; |
| return o; |
| } |
| |
| void checkSetTagsRequest(api.SetTagsRequest o) { |
| buildCounterSetTagsRequest++; |
| if (buildCounterSetTagsRequest < 3) { |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| unittest.expect(o.requestId!, unittest.equals('foo')); |
| checkUnnamed19(o.tags!); |
| } |
| buildCounterSetTagsRequest--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed20() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed20(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterSetTagsResponse = 0; |
| api.SetTagsResponse buildSetTagsResponse() { |
| final o = api.SetTagsResponse(); |
| buildCounterSetTagsResponse++; |
| if (buildCounterSetTagsResponse < 3) { |
| o.etag = 'foo'; |
| o.name = 'foo'; |
| o.tags = buildUnnamed20(); |
| } |
| buildCounterSetTagsResponse--; |
| return o; |
| } |
| |
| void checkSetTagsResponse(api.SetTagsResponse o) { |
| buildCounterSetTagsResponse++; |
| if (buildCounterSetTagsResponse < 3) { |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| checkUnnamed20(o.tags!); |
| } |
| buildCounterSetTagsResponse--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed21() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed21(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?>> buildUnnamed22() => [ |
| buildUnnamed21(), |
| buildUnnamed21(), |
| ]; |
| |
| void checkUnnamed22(core.List<core.Map<core.String, core.Object?>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed21(o[0]); |
| checkUnnamed21(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| final o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed22(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code!, unittest.equals(42)); |
| checkUnnamed22(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 buildCounterUpdateParametersRequest = 0; |
| api.UpdateParametersRequest buildUpdateParametersRequest() { |
| final o = api.UpdateParametersRequest(); |
| buildCounterUpdateParametersRequest++; |
| if (buildCounterUpdateParametersRequest < 3) { |
| o.parameters = buildMemcacheParameters(); |
| o.updateMask = 'foo'; |
| } |
| buildCounterUpdateParametersRequest--; |
| return o; |
| } |
| |
| void checkUpdateParametersRequest(api.UpdateParametersRequest o) { |
| buildCounterUpdateParametersRequest++; |
| if (buildCounterUpdateParametersRequest < 3) { |
| checkMemcacheParameters(o.parameters!); |
| unittest.expect(o.updateMask!, unittest.equals('foo')); |
| } |
| buildCounterUpdateParametersRequest--; |
| } |
| |
| 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--; |
| } |
| |
| core.List<core.String> buildUnnamed23() => ['foo', 'foo']; |
| |
| void checkUnnamed23(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')); |
| } |
| |
| void main() { |
| unittest.group('obj-schema-ApplyParametersRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildApplyParametersRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ApplyParametersRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkApplyParametersRequest(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-GetTagsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGetTagsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GetTagsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGetTagsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GoogleCloudMemcacheV1MaintenancePolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGoogleCloudMemcacheV1MaintenancePolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GoogleCloudMemcacheV1MaintenancePolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGoogleCloudMemcacheV1MaintenancePolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GoogleCloudMemcacheV1UpgradeInstanceRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildGoogleCloudMemcacheV1UpgradeInstanceRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.GoogleCloudMemcacheV1UpgradeInstanceRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkGoogleCloudMemcacheV1UpgradeInstanceRequest(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-InstanceMessage', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildInstanceMessage(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.InstanceMessage.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkInstanceMessage(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-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-MemcacheParameters', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildMemcacheParameters(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.MemcacheParameters.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkMemcacheParameters(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Node', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildNode(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Node.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkNode(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NodeConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildNodeConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.NodeConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkNodeConfig(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-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-SetTagsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSetTagsRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SetTagsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetTagsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetTagsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSetTagsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SetTagsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetTagsResponse(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-UpdateParametersRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUpdateParametersRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UpdateParametersRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkUpdateParametersRequest(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.CloudMemorystoreForMemcachedApi(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.CloudMemorystoreForMemcachedApi(mock).projects.locations; |
| final arg_name = 'foo'; |
| final arg_extraLocationTypes = buildUnnamed23(); |
| 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['extraLocationTypes']!, |
| unittest.equals(arg_extraLocationTypes), |
| ); |
| 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, |
| extraLocationTypes: arg_extraLocationTypes, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields, |
| ); |
| checkListLocationsResponse(response as api.ListLocationsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsInstancesResource', () { |
| unittest.test('method--applyParameters', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_request = buildApplyParametersRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ApplyParametersRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkApplyParametersRequest(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.applyParameters( |
| arg_request, |
| arg_name, |
| $fields: arg_$fields, |
| ); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| 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.CloudMemorystoreForMemcachedApi( |
| 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--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| 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--getTags', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| 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(buildGetTagsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.getTags(arg_name, $fields: arg_$fields); |
| checkGetTagsResponse(response as api.GetTagsResponse); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_parent = 'foo'; |
| final arg_filter = 'foo'; |
| final arg_orderBy = '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( |
| queryMap['orderBy']!.first, |
| unittest.equals(arg_orderBy), |
| ); |
| 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, |
| filter: arg_filter, |
| orderBy: arg_orderBy, |
| 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.CloudMemorystoreForMemcachedApi( |
| 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.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_request = buildRescheduleMaintenanceRequest(); |
| final arg_instance = '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_instance, |
| $fields: arg_$fields, |
| ); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--setTags', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_request = buildSetTagsRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetTagsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkSetTagsRequest(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(buildSetTagsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.setTags( |
| arg_request, |
| arg_name, |
| $fields: arg_$fields, |
| ); |
| checkSetTagsResponse(response as api.SetTagsResponse); |
| }); |
| |
| unittest.test('method--updateParameters', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_request = buildUpdateParametersRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UpdateParametersRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkUpdateParametersRequest(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.updateParameters( |
| arg_request, |
| arg_name, |
| $fields: arg_$fields, |
| ); |
| checkOperation(response as api.Operation); |
| }); |
| |
| unittest.test('method--upgrade', () async { |
| final mock = HttpServerMock(); |
| final res = api.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.instances; |
| final arg_request = buildGoogleCloudMemcacheV1UpgradeInstanceRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.GoogleCloudMemcacheV1UpgradeInstanceRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkGoogleCloudMemcacheV1UpgradeInstanceRequest(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.CloudMemorystoreForMemcachedApi( |
| 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.CloudMemorystoreForMemcachedApi( |
| 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.CloudMemorystoreForMemcachedApi( |
| 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.CloudMemorystoreForMemcachedApi( |
| mock, |
| ).projects.locations.operations; |
| final arg_name = 'foo'; |
| final arg_filter = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_returnPartialSuccess = true; |
| 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['returnPartialSuccess']!.first, |
| unittest.equals('$arg_returnPartialSuccess'), |
| ); |
| 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, |
| returnPartialSuccess: arg_returnPartialSuccess, |
| $fields: arg_$fields, |
| ); |
| checkListOperationsResponse(response as api.ListOperationsResponse); |
| }); |
| }); |
| } |