| library googleapis.container.v1.test; |
| |
| import "dart:core" as core; |
| import "dart:async" as async; |
| import "dart:convert" as convert; |
| |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import 'package:googleapis/container/v1.dart' as api; |
| |
| class HttpServerMock extends http.BaseClient { |
| core.Function _callback; |
| core.bool _expectJson; |
| |
| void register(core.Function callback, core.bool expectJson) { |
| _callback = callback; |
| _expectJson = expectJson; |
| } |
| |
| async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| if (_expectJson) { |
| return request |
| .finalize() |
| .transform(convert.UTF8.decoder) |
| .join('') |
| .then((core.String jsonString) { |
| if (jsonString.isEmpty) { |
| return _callback(request, null); |
| } else { |
| return _callback(request, convert.JSON.decode(jsonString)); |
| } |
| }); |
| } else { |
| var stream = request.finalize(); |
| if (stream == null) { |
| return _callback(request, []); |
| } else { |
| return stream.toBytes().then((data) { |
| return _callback(request, data); |
| }); |
| } |
| } |
| } |
| } |
| |
| http.StreamedResponse stringResponse(core.int status, |
| core.Map<core.String, core.String> headers, core.String body) { |
| var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| return new http.StreamedResponse(stream, status, headers: headers); |
| } |
| |
| core.int buildCounterAcceleratorConfig = 0; |
| buildAcceleratorConfig() { |
| var o = new api.AcceleratorConfig(); |
| buildCounterAcceleratorConfig++; |
| if (buildCounterAcceleratorConfig < 3) { |
| o.acceleratorCount = "foo"; |
| o.acceleratorType = "foo"; |
| } |
| buildCounterAcceleratorConfig--; |
| return o; |
| } |
| |
| checkAcceleratorConfig(api.AcceleratorConfig o) { |
| buildCounterAcceleratorConfig++; |
| if (buildCounterAcceleratorConfig < 3) { |
| unittest.expect(o.acceleratorCount, unittest.equals('foo')); |
| unittest.expect(o.acceleratorType, unittest.equals('foo')); |
| } |
| buildCounterAcceleratorConfig--; |
| } |
| |
| core.int buildCounterAddonsConfig = 0; |
| buildAddonsConfig() { |
| var o = new api.AddonsConfig(); |
| buildCounterAddonsConfig++; |
| if (buildCounterAddonsConfig < 3) { |
| o.horizontalPodAutoscaling = buildHorizontalPodAutoscaling(); |
| o.httpLoadBalancing = buildHttpLoadBalancing(); |
| o.kubernetesDashboard = buildKubernetesDashboard(); |
| o.networkPolicyConfig = buildNetworkPolicyConfig(); |
| } |
| buildCounterAddonsConfig--; |
| return o; |
| } |
| |
| checkAddonsConfig(api.AddonsConfig o) { |
| buildCounterAddonsConfig++; |
| if (buildCounterAddonsConfig < 3) { |
| checkHorizontalPodAutoscaling(o.horizontalPodAutoscaling); |
| checkHttpLoadBalancing(o.httpLoadBalancing); |
| checkKubernetesDashboard(o.kubernetesDashboard); |
| checkNetworkPolicyConfig(o.networkPolicyConfig); |
| } |
| buildCounterAddonsConfig--; |
| } |
| |
| core.int buildCounterAutoUpgradeOptions = 0; |
| buildAutoUpgradeOptions() { |
| var o = new api.AutoUpgradeOptions(); |
| buildCounterAutoUpgradeOptions++; |
| if (buildCounterAutoUpgradeOptions < 3) { |
| o.autoUpgradeStartTime = "foo"; |
| o.description = "foo"; |
| } |
| buildCounterAutoUpgradeOptions--; |
| return o; |
| } |
| |
| checkAutoUpgradeOptions(api.AutoUpgradeOptions o) { |
| buildCounterAutoUpgradeOptions++; |
| if (buildCounterAutoUpgradeOptions < 3) { |
| unittest.expect(o.autoUpgradeStartTime, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| } |
| buildCounterAutoUpgradeOptions--; |
| } |
| |
| core.int buildCounterCancelOperationRequest = 0; |
| buildCancelOperationRequest() { |
| var o = new api.CancelOperationRequest(); |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| return o; |
| } |
| |
| checkCancelOperationRequest(api.CancelOperationRequest o) { |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| } |
| |
| core.int buildCounterCidrBlock = 0; |
| buildCidrBlock() { |
| var o = new api.CidrBlock(); |
| buildCounterCidrBlock++; |
| if (buildCounterCidrBlock < 3) { |
| o.cidrBlock = "foo"; |
| o.displayName = "foo"; |
| } |
| buildCounterCidrBlock--; |
| return o; |
| } |
| |
| checkCidrBlock(api.CidrBlock o) { |
| buildCounterCidrBlock++; |
| if (buildCounterCidrBlock < 3) { |
| unittest.expect(o.cidrBlock, unittest.equals('foo')); |
| unittest.expect(o.displayName, unittest.equals('foo')); |
| } |
| buildCounterCidrBlock--; |
| } |
| |
| core.int buildCounterClientCertificateConfig = 0; |
| buildClientCertificateConfig() { |
| var o = new api.ClientCertificateConfig(); |
| buildCounterClientCertificateConfig++; |
| if (buildCounterClientCertificateConfig < 3) { |
| o.issueClientCertificate = true; |
| } |
| buildCounterClientCertificateConfig--; |
| return o; |
| } |
| |
| checkClientCertificateConfig(api.ClientCertificateConfig o) { |
| buildCounterClientCertificateConfig++; |
| if (buildCounterClientCertificateConfig < 3) { |
| unittest.expect(o.issueClientCertificate, unittest.isTrue); |
| } |
| buildCounterClientCertificateConfig--; |
| } |
| |
| buildUnnamed2854() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2854(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')); |
| } |
| |
| buildUnnamed2855() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2855(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')); |
| } |
| |
| buildUnnamed2856() { |
| var o = new core.List<api.NodePool>(); |
| o.add(buildNodePool()); |
| o.add(buildNodePool()); |
| return o; |
| } |
| |
| checkUnnamed2856(core.List<api.NodePool> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNodePool(o[0]); |
| checkNodePool(o[1]); |
| } |
| |
| buildUnnamed2857() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed2857(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 buildCounterCluster = 0; |
| buildCluster() { |
| var o = new api.Cluster(); |
| buildCounterCluster++; |
| if (buildCounterCluster < 3) { |
| o.addonsConfig = buildAddonsConfig(); |
| o.clusterIpv4Cidr = "foo"; |
| o.createTime = "foo"; |
| o.currentMasterVersion = "foo"; |
| o.currentNodeCount = 42; |
| o.currentNodeVersion = "foo"; |
| o.description = "foo"; |
| o.enableKubernetesAlpha = true; |
| o.endpoint = "foo"; |
| o.expireTime = "foo"; |
| o.initialClusterVersion = "foo"; |
| o.initialNodeCount = 42; |
| o.instanceGroupUrls = buildUnnamed2854(); |
| o.ipAllocationPolicy = buildIPAllocationPolicy(); |
| o.labelFingerprint = "foo"; |
| o.legacyAbac = buildLegacyAbac(); |
| o.locations = buildUnnamed2855(); |
| o.loggingService = "foo"; |
| o.maintenancePolicy = buildMaintenancePolicy(); |
| o.masterAuth = buildMasterAuth(); |
| o.masterAuthorizedNetworksConfig = buildMasterAuthorizedNetworksConfig(); |
| o.monitoringService = "foo"; |
| o.name = "foo"; |
| o.network = "foo"; |
| o.networkPolicy = buildNetworkPolicy(); |
| o.nodeConfig = buildNodeConfig(); |
| o.nodeIpv4CidrSize = 42; |
| o.nodePools = buildUnnamed2856(); |
| o.resourceLabels = buildUnnamed2857(); |
| o.selfLink = "foo"; |
| o.servicesIpv4Cidr = "foo"; |
| o.status = "foo"; |
| o.statusMessage = "foo"; |
| o.subnetwork = "foo"; |
| o.zone = "foo"; |
| } |
| buildCounterCluster--; |
| return o; |
| } |
| |
| checkCluster(api.Cluster o) { |
| buildCounterCluster++; |
| if (buildCounterCluster < 3) { |
| checkAddonsConfig(o.addonsConfig); |
| unittest.expect(o.clusterIpv4Cidr, unittest.equals('foo')); |
| unittest.expect(o.createTime, unittest.equals('foo')); |
| unittest.expect(o.currentMasterVersion, unittest.equals('foo')); |
| unittest.expect(o.currentNodeCount, unittest.equals(42)); |
| unittest.expect(o.currentNodeVersion, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.enableKubernetesAlpha, unittest.isTrue); |
| unittest.expect(o.endpoint, unittest.equals('foo')); |
| unittest.expect(o.expireTime, unittest.equals('foo')); |
| unittest.expect(o.initialClusterVersion, unittest.equals('foo')); |
| unittest.expect(o.initialNodeCount, unittest.equals(42)); |
| checkUnnamed2854(o.instanceGroupUrls); |
| checkIPAllocationPolicy(o.ipAllocationPolicy); |
| unittest.expect(o.labelFingerprint, unittest.equals('foo')); |
| checkLegacyAbac(o.legacyAbac); |
| checkUnnamed2855(o.locations); |
| unittest.expect(o.loggingService, unittest.equals('foo')); |
| checkMaintenancePolicy(o.maintenancePolicy); |
| checkMasterAuth(o.masterAuth); |
| checkMasterAuthorizedNetworksConfig(o.masterAuthorizedNetworksConfig); |
| unittest.expect(o.monitoringService, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.network, unittest.equals('foo')); |
| checkNetworkPolicy(o.networkPolicy); |
| checkNodeConfig(o.nodeConfig); |
| unittest.expect(o.nodeIpv4CidrSize, unittest.equals(42)); |
| checkUnnamed2856(o.nodePools); |
| checkUnnamed2857(o.resourceLabels); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.statusMessage, unittest.equals('foo')); |
| unittest.expect(o.subnetwork, unittest.equals('foo')); |
| unittest.expect(o.zone, unittest.equals('foo')); |
| } |
| buildCounterCluster--; |
| } |
| |
| buildUnnamed2858() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2858(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 buildCounterClusterUpdate = 0; |
| buildClusterUpdate() { |
| var o = new api.ClusterUpdate(); |
| buildCounterClusterUpdate++; |
| if (buildCounterClusterUpdate < 3) { |
| o.desiredAddonsConfig = buildAddonsConfig(); |
| o.desiredImageType = "foo"; |
| o.desiredLocations = buildUnnamed2858(); |
| o.desiredMasterAuthorizedNetworksConfig = |
| buildMasterAuthorizedNetworksConfig(); |
| o.desiredMasterVersion = "foo"; |
| o.desiredMonitoringService = "foo"; |
| o.desiredNodePoolAutoscaling = buildNodePoolAutoscaling(); |
| o.desiredNodePoolId = "foo"; |
| o.desiredNodeVersion = "foo"; |
| } |
| buildCounterClusterUpdate--; |
| return o; |
| } |
| |
| checkClusterUpdate(api.ClusterUpdate o) { |
| buildCounterClusterUpdate++; |
| if (buildCounterClusterUpdate < 3) { |
| checkAddonsConfig(o.desiredAddonsConfig); |
| unittest.expect(o.desiredImageType, unittest.equals('foo')); |
| checkUnnamed2858(o.desiredLocations); |
| checkMasterAuthorizedNetworksConfig( |
| o.desiredMasterAuthorizedNetworksConfig); |
| unittest.expect(o.desiredMasterVersion, unittest.equals('foo')); |
| unittest.expect(o.desiredMonitoringService, unittest.equals('foo')); |
| checkNodePoolAutoscaling(o.desiredNodePoolAutoscaling); |
| unittest.expect(o.desiredNodePoolId, unittest.equals('foo')); |
| unittest.expect(o.desiredNodeVersion, unittest.equals('foo')); |
| } |
| buildCounterClusterUpdate--; |
| } |
| |
| core.int buildCounterCompleteIPRotationRequest = 0; |
| buildCompleteIPRotationRequest() { |
| var o = new api.CompleteIPRotationRequest(); |
| buildCounterCompleteIPRotationRequest++; |
| if (buildCounterCompleteIPRotationRequest < 3) {} |
| buildCounterCompleteIPRotationRequest--; |
| return o; |
| } |
| |
| checkCompleteIPRotationRequest(api.CompleteIPRotationRequest o) { |
| buildCounterCompleteIPRotationRequest++; |
| if (buildCounterCompleteIPRotationRequest < 3) {} |
| buildCounterCompleteIPRotationRequest--; |
| } |
| |
| core.int buildCounterCreateClusterRequest = 0; |
| buildCreateClusterRequest() { |
| var o = new api.CreateClusterRequest(); |
| buildCounterCreateClusterRequest++; |
| if (buildCounterCreateClusterRequest < 3) { |
| o.cluster = buildCluster(); |
| } |
| buildCounterCreateClusterRequest--; |
| return o; |
| } |
| |
| checkCreateClusterRequest(api.CreateClusterRequest o) { |
| buildCounterCreateClusterRequest++; |
| if (buildCounterCreateClusterRequest < 3) { |
| checkCluster(o.cluster); |
| } |
| buildCounterCreateClusterRequest--; |
| } |
| |
| core.int buildCounterCreateNodePoolRequest = 0; |
| buildCreateNodePoolRequest() { |
| var o = new api.CreateNodePoolRequest(); |
| buildCounterCreateNodePoolRequest++; |
| if (buildCounterCreateNodePoolRequest < 3) { |
| o.nodePool = buildNodePool(); |
| } |
| buildCounterCreateNodePoolRequest--; |
| return o; |
| } |
| |
| checkCreateNodePoolRequest(api.CreateNodePoolRequest o) { |
| buildCounterCreateNodePoolRequest++; |
| if (buildCounterCreateNodePoolRequest < 3) { |
| checkNodePool(o.nodePool); |
| } |
| buildCounterCreateNodePoolRequest--; |
| } |
| |
| core.int buildCounterDailyMaintenanceWindow = 0; |
| buildDailyMaintenanceWindow() { |
| var o = new api.DailyMaintenanceWindow(); |
| buildCounterDailyMaintenanceWindow++; |
| if (buildCounterDailyMaintenanceWindow < 3) { |
| o.duration = "foo"; |
| o.startTime = "foo"; |
| } |
| buildCounterDailyMaintenanceWindow--; |
| return o; |
| } |
| |
| checkDailyMaintenanceWindow(api.DailyMaintenanceWindow o) { |
| buildCounterDailyMaintenanceWindow++; |
| if (buildCounterDailyMaintenanceWindow < 3) { |
| unittest.expect(o.duration, unittest.equals('foo')); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| } |
| buildCounterDailyMaintenanceWindow--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| buildEmpty() { |
| var o = new api.Empty(); |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| return o; |
| } |
| |
| checkEmpty(api.Empty o) { |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| } |
| |
| core.int buildCounterHorizontalPodAutoscaling = 0; |
| buildHorizontalPodAutoscaling() { |
| var o = new api.HorizontalPodAutoscaling(); |
| buildCounterHorizontalPodAutoscaling++; |
| if (buildCounterHorizontalPodAutoscaling < 3) { |
| o.disabled = true; |
| } |
| buildCounterHorizontalPodAutoscaling--; |
| return o; |
| } |
| |
| checkHorizontalPodAutoscaling(api.HorizontalPodAutoscaling o) { |
| buildCounterHorizontalPodAutoscaling++; |
| if (buildCounterHorizontalPodAutoscaling < 3) { |
| unittest.expect(o.disabled, unittest.isTrue); |
| } |
| buildCounterHorizontalPodAutoscaling--; |
| } |
| |
| core.int buildCounterHttpLoadBalancing = 0; |
| buildHttpLoadBalancing() { |
| var o = new api.HttpLoadBalancing(); |
| buildCounterHttpLoadBalancing++; |
| if (buildCounterHttpLoadBalancing < 3) { |
| o.disabled = true; |
| } |
| buildCounterHttpLoadBalancing--; |
| return o; |
| } |
| |
| checkHttpLoadBalancing(api.HttpLoadBalancing o) { |
| buildCounterHttpLoadBalancing++; |
| if (buildCounterHttpLoadBalancing < 3) { |
| unittest.expect(o.disabled, unittest.isTrue); |
| } |
| buildCounterHttpLoadBalancing--; |
| } |
| |
| core.int buildCounterIPAllocationPolicy = 0; |
| buildIPAllocationPolicy() { |
| var o = new api.IPAllocationPolicy(); |
| buildCounterIPAllocationPolicy++; |
| if (buildCounterIPAllocationPolicy < 3) { |
| o.clusterIpv4Cidr = "foo"; |
| o.clusterIpv4CidrBlock = "foo"; |
| o.clusterSecondaryRangeName = "foo"; |
| o.createSubnetwork = true; |
| o.nodeIpv4Cidr = "foo"; |
| o.nodeIpv4CidrBlock = "foo"; |
| o.servicesIpv4Cidr = "foo"; |
| o.servicesIpv4CidrBlock = "foo"; |
| o.servicesSecondaryRangeName = "foo"; |
| o.subnetworkName = "foo"; |
| o.useIpAliases = true; |
| } |
| buildCounterIPAllocationPolicy--; |
| return o; |
| } |
| |
| checkIPAllocationPolicy(api.IPAllocationPolicy o) { |
| buildCounterIPAllocationPolicy++; |
| if (buildCounterIPAllocationPolicy < 3) { |
| unittest.expect(o.clusterIpv4Cidr, unittest.equals('foo')); |
| unittest.expect(o.clusterIpv4CidrBlock, unittest.equals('foo')); |
| unittest.expect(o.clusterSecondaryRangeName, unittest.equals('foo')); |
| unittest.expect(o.createSubnetwork, unittest.isTrue); |
| unittest.expect(o.nodeIpv4Cidr, unittest.equals('foo')); |
| unittest.expect(o.nodeIpv4CidrBlock, unittest.equals('foo')); |
| unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); |
| unittest.expect(o.servicesIpv4CidrBlock, unittest.equals('foo')); |
| unittest.expect(o.servicesSecondaryRangeName, unittest.equals('foo')); |
| unittest.expect(o.subnetworkName, unittest.equals('foo')); |
| unittest.expect(o.useIpAliases, unittest.isTrue); |
| } |
| buildCounterIPAllocationPolicy--; |
| } |
| |
| core.int buildCounterKubernetesDashboard = 0; |
| buildKubernetesDashboard() { |
| var o = new api.KubernetesDashboard(); |
| buildCounterKubernetesDashboard++; |
| if (buildCounterKubernetesDashboard < 3) { |
| o.disabled = true; |
| } |
| buildCounterKubernetesDashboard--; |
| return o; |
| } |
| |
| checkKubernetesDashboard(api.KubernetesDashboard o) { |
| buildCounterKubernetesDashboard++; |
| if (buildCounterKubernetesDashboard < 3) { |
| unittest.expect(o.disabled, unittest.isTrue); |
| } |
| buildCounterKubernetesDashboard--; |
| } |
| |
| core.int buildCounterLegacyAbac = 0; |
| buildLegacyAbac() { |
| var o = new api.LegacyAbac(); |
| buildCounterLegacyAbac++; |
| if (buildCounterLegacyAbac < 3) { |
| o.enabled = true; |
| } |
| buildCounterLegacyAbac--; |
| return o; |
| } |
| |
| checkLegacyAbac(api.LegacyAbac o) { |
| buildCounterLegacyAbac++; |
| if (buildCounterLegacyAbac < 3) { |
| unittest.expect(o.enabled, unittest.isTrue); |
| } |
| buildCounterLegacyAbac--; |
| } |
| |
| buildUnnamed2859() { |
| var o = new core.List<api.Cluster>(); |
| o.add(buildCluster()); |
| o.add(buildCluster()); |
| return o; |
| } |
| |
| checkUnnamed2859(core.List<api.Cluster> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkCluster(o[0]); |
| checkCluster(o[1]); |
| } |
| |
| buildUnnamed2860() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2860(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 buildCounterListClustersResponse = 0; |
| buildListClustersResponse() { |
| var o = new api.ListClustersResponse(); |
| buildCounterListClustersResponse++; |
| if (buildCounterListClustersResponse < 3) { |
| o.clusters = buildUnnamed2859(); |
| o.missingZones = buildUnnamed2860(); |
| } |
| buildCounterListClustersResponse--; |
| return o; |
| } |
| |
| checkListClustersResponse(api.ListClustersResponse o) { |
| buildCounterListClustersResponse++; |
| if (buildCounterListClustersResponse < 3) { |
| checkUnnamed2859(o.clusters); |
| checkUnnamed2860(o.missingZones); |
| } |
| buildCounterListClustersResponse--; |
| } |
| |
| buildUnnamed2861() { |
| var o = new core.List<api.NodePool>(); |
| o.add(buildNodePool()); |
| o.add(buildNodePool()); |
| return o; |
| } |
| |
| checkUnnamed2861(core.List<api.NodePool> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNodePool(o[0]); |
| checkNodePool(o[1]); |
| } |
| |
| core.int buildCounterListNodePoolsResponse = 0; |
| buildListNodePoolsResponse() { |
| var o = new api.ListNodePoolsResponse(); |
| buildCounterListNodePoolsResponse++; |
| if (buildCounterListNodePoolsResponse < 3) { |
| o.nodePools = buildUnnamed2861(); |
| } |
| buildCounterListNodePoolsResponse--; |
| return o; |
| } |
| |
| checkListNodePoolsResponse(api.ListNodePoolsResponse o) { |
| buildCounterListNodePoolsResponse++; |
| if (buildCounterListNodePoolsResponse < 3) { |
| checkUnnamed2861(o.nodePools); |
| } |
| buildCounterListNodePoolsResponse--; |
| } |
| |
| buildUnnamed2862() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2862(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')); |
| } |
| |
| buildUnnamed2863() { |
| var o = new core.List<api.Operation>(); |
| o.add(buildOperation()); |
| o.add(buildOperation()); |
| return o; |
| } |
| |
| checkUnnamed2863(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0]); |
| checkOperation(o[1]); |
| } |
| |
| core.int buildCounterListOperationsResponse = 0; |
| buildListOperationsResponse() { |
| var o = new api.ListOperationsResponse(); |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| o.missingZones = buildUnnamed2862(); |
| o.operations = buildUnnamed2863(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| checkUnnamed2862(o.missingZones); |
| checkUnnamed2863(o.operations); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| core.int buildCounterMaintenancePolicy = 0; |
| buildMaintenancePolicy() { |
| var o = new api.MaintenancePolicy(); |
| buildCounterMaintenancePolicy++; |
| if (buildCounterMaintenancePolicy < 3) { |
| o.window = buildMaintenanceWindow(); |
| } |
| buildCounterMaintenancePolicy--; |
| return o; |
| } |
| |
| checkMaintenancePolicy(api.MaintenancePolicy o) { |
| buildCounterMaintenancePolicy++; |
| if (buildCounterMaintenancePolicy < 3) { |
| checkMaintenanceWindow(o.window); |
| } |
| buildCounterMaintenancePolicy--; |
| } |
| |
| core.int buildCounterMaintenanceWindow = 0; |
| buildMaintenanceWindow() { |
| var o = new api.MaintenanceWindow(); |
| buildCounterMaintenanceWindow++; |
| if (buildCounterMaintenanceWindow < 3) { |
| o.dailyMaintenanceWindow = buildDailyMaintenanceWindow(); |
| } |
| buildCounterMaintenanceWindow--; |
| return o; |
| } |
| |
| checkMaintenanceWindow(api.MaintenanceWindow o) { |
| buildCounterMaintenanceWindow++; |
| if (buildCounterMaintenanceWindow < 3) { |
| checkDailyMaintenanceWindow(o.dailyMaintenanceWindow); |
| } |
| buildCounterMaintenanceWindow--; |
| } |
| |
| core.int buildCounterMasterAuth = 0; |
| buildMasterAuth() { |
| var o = new api.MasterAuth(); |
| buildCounterMasterAuth++; |
| if (buildCounterMasterAuth < 3) { |
| o.clientCertificate = "foo"; |
| o.clientCertificateConfig = buildClientCertificateConfig(); |
| o.clientKey = "foo"; |
| o.clusterCaCertificate = "foo"; |
| o.password = "foo"; |
| o.username = "foo"; |
| } |
| buildCounterMasterAuth--; |
| return o; |
| } |
| |
| checkMasterAuth(api.MasterAuth o) { |
| buildCounterMasterAuth++; |
| if (buildCounterMasterAuth < 3) { |
| unittest.expect(o.clientCertificate, unittest.equals('foo')); |
| checkClientCertificateConfig(o.clientCertificateConfig); |
| unittest.expect(o.clientKey, unittest.equals('foo')); |
| unittest.expect(o.clusterCaCertificate, unittest.equals('foo')); |
| unittest.expect(o.password, unittest.equals('foo')); |
| unittest.expect(o.username, unittest.equals('foo')); |
| } |
| buildCounterMasterAuth--; |
| } |
| |
| buildUnnamed2864() { |
| var o = new core.List<api.CidrBlock>(); |
| o.add(buildCidrBlock()); |
| o.add(buildCidrBlock()); |
| return o; |
| } |
| |
| checkUnnamed2864(core.List<api.CidrBlock> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkCidrBlock(o[0]); |
| checkCidrBlock(o[1]); |
| } |
| |
| core.int buildCounterMasterAuthorizedNetworksConfig = 0; |
| buildMasterAuthorizedNetworksConfig() { |
| var o = new api.MasterAuthorizedNetworksConfig(); |
| buildCounterMasterAuthorizedNetworksConfig++; |
| if (buildCounterMasterAuthorizedNetworksConfig < 3) { |
| o.cidrBlocks = buildUnnamed2864(); |
| o.enabled = true; |
| } |
| buildCounterMasterAuthorizedNetworksConfig--; |
| return o; |
| } |
| |
| checkMasterAuthorizedNetworksConfig(api.MasterAuthorizedNetworksConfig o) { |
| buildCounterMasterAuthorizedNetworksConfig++; |
| if (buildCounterMasterAuthorizedNetworksConfig < 3) { |
| checkUnnamed2864(o.cidrBlocks); |
| unittest.expect(o.enabled, unittest.isTrue); |
| } |
| buildCounterMasterAuthorizedNetworksConfig--; |
| } |
| |
| core.int buildCounterNetworkPolicy = 0; |
| buildNetworkPolicy() { |
| var o = new api.NetworkPolicy(); |
| buildCounterNetworkPolicy++; |
| if (buildCounterNetworkPolicy < 3) { |
| o.enabled = true; |
| o.provider = "foo"; |
| } |
| buildCounterNetworkPolicy--; |
| return o; |
| } |
| |
| checkNetworkPolicy(api.NetworkPolicy o) { |
| buildCounterNetworkPolicy++; |
| if (buildCounterNetworkPolicy < 3) { |
| unittest.expect(o.enabled, unittest.isTrue); |
| unittest.expect(o.provider, unittest.equals('foo')); |
| } |
| buildCounterNetworkPolicy--; |
| } |
| |
| core.int buildCounterNetworkPolicyConfig = 0; |
| buildNetworkPolicyConfig() { |
| var o = new api.NetworkPolicyConfig(); |
| buildCounterNetworkPolicyConfig++; |
| if (buildCounterNetworkPolicyConfig < 3) { |
| o.disabled = true; |
| } |
| buildCounterNetworkPolicyConfig--; |
| return o; |
| } |
| |
| checkNetworkPolicyConfig(api.NetworkPolicyConfig o) { |
| buildCounterNetworkPolicyConfig++; |
| if (buildCounterNetworkPolicyConfig < 3) { |
| unittest.expect(o.disabled, unittest.isTrue); |
| } |
| buildCounterNetworkPolicyConfig--; |
| } |
| |
| buildUnnamed2865() { |
| var o = new core.List<api.AcceleratorConfig>(); |
| o.add(buildAcceleratorConfig()); |
| o.add(buildAcceleratorConfig()); |
| return o; |
| } |
| |
| checkUnnamed2865(core.List<api.AcceleratorConfig> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAcceleratorConfig(o[0]); |
| checkAcceleratorConfig(o[1]); |
| } |
| |
| buildUnnamed2866() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed2866(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')); |
| } |
| |
| buildUnnamed2867() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed2867(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')); |
| } |
| |
| buildUnnamed2868() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2868(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')); |
| } |
| |
| buildUnnamed2869() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2869(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 buildCounterNodeConfig = 0; |
| buildNodeConfig() { |
| var o = new api.NodeConfig(); |
| buildCounterNodeConfig++; |
| if (buildCounterNodeConfig < 3) { |
| o.accelerators = buildUnnamed2865(); |
| o.diskSizeGb = 42; |
| o.imageType = "foo"; |
| o.labels = buildUnnamed2866(); |
| o.localSsdCount = 42; |
| o.machineType = "foo"; |
| o.metadata = buildUnnamed2867(); |
| o.minCpuPlatform = "foo"; |
| o.oauthScopes = buildUnnamed2868(); |
| o.preemptible = true; |
| o.serviceAccount = "foo"; |
| o.tags = buildUnnamed2869(); |
| } |
| buildCounterNodeConfig--; |
| return o; |
| } |
| |
| checkNodeConfig(api.NodeConfig o) { |
| buildCounterNodeConfig++; |
| if (buildCounterNodeConfig < 3) { |
| checkUnnamed2865(o.accelerators); |
| unittest.expect(o.diskSizeGb, unittest.equals(42)); |
| unittest.expect(o.imageType, unittest.equals('foo')); |
| checkUnnamed2866(o.labels); |
| unittest.expect(o.localSsdCount, unittest.equals(42)); |
| unittest.expect(o.machineType, unittest.equals('foo')); |
| checkUnnamed2867(o.metadata); |
| unittest.expect(o.minCpuPlatform, unittest.equals('foo')); |
| checkUnnamed2868(o.oauthScopes); |
| unittest.expect(o.preemptible, unittest.isTrue); |
| unittest.expect(o.serviceAccount, unittest.equals('foo')); |
| checkUnnamed2869(o.tags); |
| } |
| buildCounterNodeConfig--; |
| } |
| |
| core.int buildCounterNodeManagement = 0; |
| buildNodeManagement() { |
| var o = new api.NodeManagement(); |
| buildCounterNodeManagement++; |
| if (buildCounterNodeManagement < 3) { |
| o.autoRepair = true; |
| o.autoUpgrade = true; |
| o.upgradeOptions = buildAutoUpgradeOptions(); |
| } |
| buildCounterNodeManagement--; |
| return o; |
| } |
| |
| checkNodeManagement(api.NodeManagement o) { |
| buildCounterNodeManagement++; |
| if (buildCounterNodeManagement < 3) { |
| unittest.expect(o.autoRepair, unittest.isTrue); |
| unittest.expect(o.autoUpgrade, unittest.isTrue); |
| checkAutoUpgradeOptions(o.upgradeOptions); |
| } |
| buildCounterNodeManagement--; |
| } |
| |
| buildUnnamed2870() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2870(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 buildCounterNodePool = 0; |
| buildNodePool() { |
| var o = new api.NodePool(); |
| buildCounterNodePool++; |
| if (buildCounterNodePool < 3) { |
| o.autoscaling = buildNodePoolAutoscaling(); |
| o.config = buildNodeConfig(); |
| o.initialNodeCount = 42; |
| o.instanceGroupUrls = buildUnnamed2870(); |
| o.management = buildNodeManagement(); |
| o.name = "foo"; |
| o.selfLink = "foo"; |
| o.status = "foo"; |
| o.statusMessage = "foo"; |
| o.version = "foo"; |
| } |
| buildCounterNodePool--; |
| return o; |
| } |
| |
| checkNodePool(api.NodePool o) { |
| buildCounterNodePool++; |
| if (buildCounterNodePool < 3) { |
| checkNodePoolAutoscaling(o.autoscaling); |
| checkNodeConfig(o.config); |
| unittest.expect(o.initialNodeCount, unittest.equals(42)); |
| checkUnnamed2870(o.instanceGroupUrls); |
| checkNodeManagement(o.management); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.statusMessage, unittest.equals('foo')); |
| unittest.expect(o.version, unittest.equals('foo')); |
| } |
| buildCounterNodePool--; |
| } |
| |
| core.int buildCounterNodePoolAutoscaling = 0; |
| buildNodePoolAutoscaling() { |
| var o = new api.NodePoolAutoscaling(); |
| buildCounterNodePoolAutoscaling++; |
| if (buildCounterNodePoolAutoscaling < 3) { |
| o.enabled = true; |
| o.maxNodeCount = 42; |
| o.minNodeCount = 42; |
| } |
| buildCounterNodePoolAutoscaling--; |
| return o; |
| } |
| |
| checkNodePoolAutoscaling(api.NodePoolAutoscaling o) { |
| buildCounterNodePoolAutoscaling++; |
| if (buildCounterNodePoolAutoscaling < 3) { |
| unittest.expect(o.enabled, unittest.isTrue); |
| unittest.expect(o.maxNodeCount, unittest.equals(42)); |
| unittest.expect(o.minNodeCount, unittest.equals(42)); |
| } |
| buildCounterNodePoolAutoscaling--; |
| } |
| |
| core.int buildCounterOperation = 0; |
| buildOperation() { |
| var o = new api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.detail = "foo"; |
| o.endTime = "foo"; |
| o.name = "foo"; |
| o.operationType = "foo"; |
| o.selfLink = "foo"; |
| o.startTime = "foo"; |
| o.status = "foo"; |
| o.statusMessage = "foo"; |
| o.targetLink = "foo"; |
| o.zone = "foo"; |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.detail, unittest.equals('foo')); |
| unittest.expect(o.endTime, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.operationType, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.statusMessage, unittest.equals('foo')); |
| unittest.expect(o.targetLink, unittest.equals('foo')); |
| unittest.expect(o.zone, unittest.equals('foo')); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterRollbackNodePoolUpgradeRequest = 0; |
| buildRollbackNodePoolUpgradeRequest() { |
| var o = new api.RollbackNodePoolUpgradeRequest(); |
| buildCounterRollbackNodePoolUpgradeRequest++; |
| if (buildCounterRollbackNodePoolUpgradeRequest < 3) {} |
| buildCounterRollbackNodePoolUpgradeRequest--; |
| return o; |
| } |
| |
| checkRollbackNodePoolUpgradeRequest(api.RollbackNodePoolUpgradeRequest o) { |
| buildCounterRollbackNodePoolUpgradeRequest++; |
| if (buildCounterRollbackNodePoolUpgradeRequest < 3) {} |
| buildCounterRollbackNodePoolUpgradeRequest--; |
| } |
| |
| buildUnnamed2871() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2871(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')); |
| } |
| |
| buildUnnamed2872() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2872(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')); |
| } |
| |
| buildUnnamed2873() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2873(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 buildCounterServerConfig = 0; |
| buildServerConfig() { |
| var o = new api.ServerConfig(); |
| buildCounterServerConfig++; |
| if (buildCounterServerConfig < 3) { |
| o.defaultClusterVersion = "foo"; |
| o.defaultImageType = "foo"; |
| o.validImageTypes = buildUnnamed2871(); |
| o.validMasterVersions = buildUnnamed2872(); |
| o.validNodeVersions = buildUnnamed2873(); |
| } |
| buildCounterServerConfig--; |
| return o; |
| } |
| |
| checkServerConfig(api.ServerConfig o) { |
| buildCounterServerConfig++; |
| if (buildCounterServerConfig < 3) { |
| unittest.expect(o.defaultClusterVersion, unittest.equals('foo')); |
| unittest.expect(o.defaultImageType, unittest.equals('foo')); |
| checkUnnamed2871(o.validImageTypes); |
| checkUnnamed2872(o.validMasterVersions); |
| checkUnnamed2873(o.validNodeVersions); |
| } |
| buildCounterServerConfig--; |
| } |
| |
| core.int buildCounterSetAddonsConfigRequest = 0; |
| buildSetAddonsConfigRequest() { |
| var o = new api.SetAddonsConfigRequest(); |
| buildCounterSetAddonsConfigRequest++; |
| if (buildCounterSetAddonsConfigRequest < 3) { |
| o.addonsConfig = buildAddonsConfig(); |
| } |
| buildCounterSetAddonsConfigRequest--; |
| return o; |
| } |
| |
| checkSetAddonsConfigRequest(api.SetAddonsConfigRequest o) { |
| buildCounterSetAddonsConfigRequest++; |
| if (buildCounterSetAddonsConfigRequest < 3) { |
| checkAddonsConfig(o.addonsConfig); |
| } |
| buildCounterSetAddonsConfigRequest--; |
| } |
| |
| buildUnnamed2874() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed2874(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 buildCounterSetLabelsRequest = 0; |
| buildSetLabelsRequest() { |
| var o = new api.SetLabelsRequest(); |
| buildCounterSetLabelsRequest++; |
| if (buildCounterSetLabelsRequest < 3) { |
| o.labelFingerprint = "foo"; |
| o.resourceLabels = buildUnnamed2874(); |
| } |
| buildCounterSetLabelsRequest--; |
| return o; |
| } |
| |
| checkSetLabelsRequest(api.SetLabelsRequest o) { |
| buildCounterSetLabelsRequest++; |
| if (buildCounterSetLabelsRequest < 3) { |
| unittest.expect(o.labelFingerprint, unittest.equals('foo')); |
| checkUnnamed2874(o.resourceLabels); |
| } |
| buildCounterSetLabelsRequest--; |
| } |
| |
| core.int buildCounterSetLegacyAbacRequest = 0; |
| buildSetLegacyAbacRequest() { |
| var o = new api.SetLegacyAbacRequest(); |
| buildCounterSetLegacyAbacRequest++; |
| if (buildCounterSetLegacyAbacRequest < 3) { |
| o.enabled = true; |
| } |
| buildCounterSetLegacyAbacRequest--; |
| return o; |
| } |
| |
| checkSetLegacyAbacRequest(api.SetLegacyAbacRequest o) { |
| buildCounterSetLegacyAbacRequest++; |
| if (buildCounterSetLegacyAbacRequest < 3) { |
| unittest.expect(o.enabled, unittest.isTrue); |
| } |
| buildCounterSetLegacyAbacRequest--; |
| } |
| |
| buildUnnamed2875() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed2875(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 buildCounterSetLocationsRequest = 0; |
| buildSetLocationsRequest() { |
| var o = new api.SetLocationsRequest(); |
| buildCounterSetLocationsRequest++; |
| if (buildCounterSetLocationsRequest < 3) { |
| o.locations = buildUnnamed2875(); |
| } |
| buildCounterSetLocationsRequest--; |
| return o; |
| } |
| |
| checkSetLocationsRequest(api.SetLocationsRequest o) { |
| buildCounterSetLocationsRequest++; |
| if (buildCounterSetLocationsRequest < 3) { |
| checkUnnamed2875(o.locations); |
| } |
| buildCounterSetLocationsRequest--; |
| } |
| |
| core.int buildCounterSetLoggingServiceRequest = 0; |
| buildSetLoggingServiceRequest() { |
| var o = new api.SetLoggingServiceRequest(); |
| buildCounterSetLoggingServiceRequest++; |
| if (buildCounterSetLoggingServiceRequest < 3) { |
| o.loggingService = "foo"; |
| } |
| buildCounterSetLoggingServiceRequest--; |
| return o; |
| } |
| |
| checkSetLoggingServiceRequest(api.SetLoggingServiceRequest o) { |
| buildCounterSetLoggingServiceRequest++; |
| if (buildCounterSetLoggingServiceRequest < 3) { |
| unittest.expect(o.loggingService, unittest.equals('foo')); |
| } |
| buildCounterSetLoggingServiceRequest--; |
| } |
| |
| core.int buildCounterSetMaintenancePolicyRequest = 0; |
| buildSetMaintenancePolicyRequest() { |
| var o = new api.SetMaintenancePolicyRequest(); |
| buildCounterSetMaintenancePolicyRequest++; |
| if (buildCounterSetMaintenancePolicyRequest < 3) { |
| o.maintenancePolicy = buildMaintenancePolicy(); |
| } |
| buildCounterSetMaintenancePolicyRequest--; |
| return o; |
| } |
| |
| checkSetMaintenancePolicyRequest(api.SetMaintenancePolicyRequest o) { |
| buildCounterSetMaintenancePolicyRequest++; |
| if (buildCounterSetMaintenancePolicyRequest < 3) { |
| checkMaintenancePolicy(o.maintenancePolicy); |
| } |
| buildCounterSetMaintenancePolicyRequest--; |
| } |
| |
| core.int buildCounterSetMasterAuthRequest = 0; |
| buildSetMasterAuthRequest() { |
| var o = new api.SetMasterAuthRequest(); |
| buildCounterSetMasterAuthRequest++; |
| if (buildCounterSetMasterAuthRequest < 3) { |
| o.action = "foo"; |
| o.update = buildMasterAuth(); |
| } |
| buildCounterSetMasterAuthRequest--; |
| return o; |
| } |
| |
| checkSetMasterAuthRequest(api.SetMasterAuthRequest o) { |
| buildCounterSetMasterAuthRequest++; |
| if (buildCounterSetMasterAuthRequest < 3) { |
| unittest.expect(o.action, unittest.equals('foo')); |
| checkMasterAuth(o.update); |
| } |
| buildCounterSetMasterAuthRequest--; |
| } |
| |
| core.int buildCounterSetMonitoringServiceRequest = 0; |
| buildSetMonitoringServiceRequest() { |
| var o = new api.SetMonitoringServiceRequest(); |
| buildCounterSetMonitoringServiceRequest++; |
| if (buildCounterSetMonitoringServiceRequest < 3) { |
| o.monitoringService = "foo"; |
| } |
| buildCounterSetMonitoringServiceRequest--; |
| return o; |
| } |
| |
| checkSetMonitoringServiceRequest(api.SetMonitoringServiceRequest o) { |
| buildCounterSetMonitoringServiceRequest++; |
| if (buildCounterSetMonitoringServiceRequest < 3) { |
| unittest.expect(o.monitoringService, unittest.equals('foo')); |
| } |
| buildCounterSetMonitoringServiceRequest--; |
| } |
| |
| core.int buildCounterSetNetworkPolicyRequest = 0; |
| buildSetNetworkPolicyRequest() { |
| var o = new api.SetNetworkPolicyRequest(); |
| buildCounterSetNetworkPolicyRequest++; |
| if (buildCounterSetNetworkPolicyRequest < 3) { |
| o.networkPolicy = buildNetworkPolicy(); |
| } |
| buildCounterSetNetworkPolicyRequest--; |
| return o; |
| } |
| |
| checkSetNetworkPolicyRequest(api.SetNetworkPolicyRequest o) { |
| buildCounterSetNetworkPolicyRequest++; |
| if (buildCounterSetNetworkPolicyRequest < 3) { |
| checkNetworkPolicy(o.networkPolicy); |
| } |
| buildCounterSetNetworkPolicyRequest--; |
| } |
| |
| core.int buildCounterSetNodePoolAutoscalingRequest = 0; |
| buildSetNodePoolAutoscalingRequest() { |
| var o = new api.SetNodePoolAutoscalingRequest(); |
| buildCounterSetNodePoolAutoscalingRequest++; |
| if (buildCounterSetNodePoolAutoscalingRequest < 3) { |
| o.autoscaling = buildNodePoolAutoscaling(); |
| } |
| buildCounterSetNodePoolAutoscalingRequest--; |
| return o; |
| } |
| |
| checkSetNodePoolAutoscalingRequest(api.SetNodePoolAutoscalingRequest o) { |
| buildCounterSetNodePoolAutoscalingRequest++; |
| if (buildCounterSetNodePoolAutoscalingRequest < 3) { |
| checkNodePoolAutoscaling(o.autoscaling); |
| } |
| buildCounterSetNodePoolAutoscalingRequest--; |
| } |
| |
| core.int buildCounterSetNodePoolManagementRequest = 0; |
| buildSetNodePoolManagementRequest() { |
| var o = new api.SetNodePoolManagementRequest(); |
| buildCounterSetNodePoolManagementRequest++; |
| if (buildCounterSetNodePoolManagementRequest < 3) { |
| o.management = buildNodeManagement(); |
| } |
| buildCounterSetNodePoolManagementRequest--; |
| return o; |
| } |
| |
| checkSetNodePoolManagementRequest(api.SetNodePoolManagementRequest o) { |
| buildCounterSetNodePoolManagementRequest++; |
| if (buildCounterSetNodePoolManagementRequest < 3) { |
| checkNodeManagement(o.management); |
| } |
| buildCounterSetNodePoolManagementRequest--; |
| } |
| |
| core.int buildCounterSetNodePoolSizeRequest = 0; |
| buildSetNodePoolSizeRequest() { |
| var o = new api.SetNodePoolSizeRequest(); |
| buildCounterSetNodePoolSizeRequest++; |
| if (buildCounterSetNodePoolSizeRequest < 3) { |
| o.nodeCount = 42; |
| } |
| buildCounterSetNodePoolSizeRequest--; |
| return o; |
| } |
| |
| checkSetNodePoolSizeRequest(api.SetNodePoolSizeRequest o) { |
| buildCounterSetNodePoolSizeRequest++; |
| if (buildCounterSetNodePoolSizeRequest < 3) { |
| unittest.expect(o.nodeCount, unittest.equals(42)); |
| } |
| buildCounterSetNodePoolSizeRequest--; |
| } |
| |
| core.int buildCounterStartIPRotationRequest = 0; |
| buildStartIPRotationRequest() { |
| var o = new api.StartIPRotationRequest(); |
| buildCounterStartIPRotationRequest++; |
| if (buildCounterStartIPRotationRequest < 3) {} |
| buildCounterStartIPRotationRequest--; |
| return o; |
| } |
| |
| checkStartIPRotationRequest(api.StartIPRotationRequest o) { |
| buildCounterStartIPRotationRequest++; |
| if (buildCounterStartIPRotationRequest < 3) {} |
| buildCounterStartIPRotationRequest--; |
| } |
| |
| core.int buildCounterUpdateClusterRequest = 0; |
| buildUpdateClusterRequest() { |
| var o = new api.UpdateClusterRequest(); |
| buildCounterUpdateClusterRequest++; |
| if (buildCounterUpdateClusterRequest < 3) { |
| o.update = buildClusterUpdate(); |
| } |
| buildCounterUpdateClusterRequest--; |
| return o; |
| } |
| |
| checkUpdateClusterRequest(api.UpdateClusterRequest o) { |
| buildCounterUpdateClusterRequest++; |
| if (buildCounterUpdateClusterRequest < 3) { |
| checkClusterUpdate(o.update); |
| } |
| buildCounterUpdateClusterRequest--; |
| } |
| |
| core.int buildCounterUpdateMasterRequest = 0; |
| buildUpdateMasterRequest() { |
| var o = new api.UpdateMasterRequest(); |
| buildCounterUpdateMasterRequest++; |
| if (buildCounterUpdateMasterRequest < 3) { |
| o.masterVersion = "foo"; |
| } |
| buildCounterUpdateMasterRequest--; |
| return o; |
| } |
| |
| checkUpdateMasterRequest(api.UpdateMasterRequest o) { |
| buildCounterUpdateMasterRequest++; |
| if (buildCounterUpdateMasterRequest < 3) { |
| unittest.expect(o.masterVersion, unittest.equals('foo')); |
| } |
| buildCounterUpdateMasterRequest--; |
| } |
| |
| core.int buildCounterUpdateNodePoolRequest = 0; |
| buildUpdateNodePoolRequest() { |
| var o = new api.UpdateNodePoolRequest(); |
| buildCounterUpdateNodePoolRequest++; |
| if (buildCounterUpdateNodePoolRequest < 3) { |
| o.imageType = "foo"; |
| o.nodeVersion = "foo"; |
| } |
| buildCounterUpdateNodePoolRequest--; |
| return o; |
| } |
| |
| checkUpdateNodePoolRequest(api.UpdateNodePoolRequest o) { |
| buildCounterUpdateNodePoolRequest++; |
| if (buildCounterUpdateNodePoolRequest < 3) { |
| unittest.expect(o.imageType, unittest.equals('foo')); |
| unittest.expect(o.nodeVersion, unittest.equals('foo')); |
| } |
| buildCounterUpdateNodePoolRequest--; |
| } |
| |
| main() { |
| unittest.group("obj-schema-AcceleratorConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAcceleratorConfig(); |
| var od = new api.AcceleratorConfig.fromJson(o.toJson()); |
| checkAcceleratorConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AddonsConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAddonsConfig(); |
| var od = new api.AddonsConfig.fromJson(o.toJson()); |
| checkAddonsConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AutoUpgradeOptions", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAutoUpgradeOptions(); |
| var od = new api.AutoUpgradeOptions.fromJson(o.toJson()); |
| checkAutoUpgradeOptions(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CancelOperationRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCancelOperationRequest(); |
| var od = new api.CancelOperationRequest.fromJson(o.toJson()); |
| checkCancelOperationRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CidrBlock", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCidrBlock(); |
| var od = new api.CidrBlock.fromJson(o.toJson()); |
| checkCidrBlock(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClientCertificateConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClientCertificateConfig(); |
| var od = new api.ClientCertificateConfig.fromJson(o.toJson()); |
| checkClientCertificateConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Cluster", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCluster(); |
| var od = new api.Cluster.fromJson(o.toJson()); |
| checkCluster(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterUpdate", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterUpdate(); |
| var od = new api.ClusterUpdate.fromJson(o.toJson()); |
| checkClusterUpdate(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CompleteIPRotationRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCompleteIPRotationRequest(); |
| var od = new api.CompleteIPRotationRequest.fromJson(o.toJson()); |
| checkCompleteIPRotationRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CreateClusterRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCreateClusterRequest(); |
| var od = new api.CreateClusterRequest.fromJson(o.toJson()); |
| checkCreateClusterRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CreateNodePoolRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCreateNodePoolRequest(); |
| var od = new api.CreateNodePoolRequest.fromJson(o.toJson()); |
| checkCreateNodePoolRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-DailyMaintenanceWindow", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDailyMaintenanceWindow(); |
| var od = new api.DailyMaintenanceWindow.fromJson(o.toJson()); |
| checkDailyMaintenanceWindow(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Empty", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildEmpty(); |
| var od = new api.Empty.fromJson(o.toJson()); |
| checkEmpty(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-HorizontalPodAutoscaling", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildHorizontalPodAutoscaling(); |
| var od = new api.HorizontalPodAutoscaling.fromJson(o.toJson()); |
| checkHorizontalPodAutoscaling(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-HttpLoadBalancing", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildHttpLoadBalancing(); |
| var od = new api.HttpLoadBalancing.fromJson(o.toJson()); |
| checkHttpLoadBalancing(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-IPAllocationPolicy", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildIPAllocationPolicy(); |
| var od = new api.IPAllocationPolicy.fromJson(o.toJson()); |
| checkIPAllocationPolicy(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-KubernetesDashboard", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildKubernetesDashboard(); |
| var od = new api.KubernetesDashboard.fromJson(o.toJson()); |
| checkKubernetesDashboard(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LegacyAbac", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLegacyAbac(); |
| var od = new api.LegacyAbac.fromJson(o.toJson()); |
| checkLegacyAbac(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListClustersResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListClustersResponse(); |
| var od = new api.ListClustersResponse.fromJson(o.toJson()); |
| checkListClustersResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListNodePoolsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListNodePoolsResponse(); |
| var od = new api.ListNodePoolsResponse.fromJson(o.toJson()); |
| checkListNodePoolsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListOperationsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListOperationsResponse(); |
| var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
| checkListOperationsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-MaintenancePolicy", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildMaintenancePolicy(); |
| var od = new api.MaintenancePolicy.fromJson(o.toJson()); |
| checkMaintenancePolicy(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-MaintenanceWindow", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildMaintenanceWindow(); |
| var od = new api.MaintenanceWindow.fromJson(o.toJson()); |
| checkMaintenanceWindow(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-MasterAuth", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildMasterAuth(); |
| var od = new api.MasterAuth.fromJson(o.toJson()); |
| checkMasterAuth(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-MasterAuthorizedNetworksConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildMasterAuthorizedNetworksConfig(); |
| var od = new api.MasterAuthorizedNetworksConfig.fromJson(o.toJson()); |
| checkMasterAuthorizedNetworksConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NetworkPolicy", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNetworkPolicy(); |
| var od = new api.NetworkPolicy.fromJson(o.toJson()); |
| checkNetworkPolicy(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NetworkPolicyConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNetworkPolicyConfig(); |
| var od = new api.NetworkPolicyConfig.fromJson(o.toJson()); |
| checkNetworkPolicyConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NodeConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNodeConfig(); |
| var od = new api.NodeConfig.fromJson(o.toJson()); |
| checkNodeConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NodeManagement", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNodeManagement(); |
| var od = new api.NodeManagement.fromJson(o.toJson()); |
| checkNodeManagement(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NodePool", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNodePool(); |
| var od = new api.NodePool.fromJson(o.toJson()); |
| checkNodePool(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NodePoolAutoscaling", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNodePoolAutoscaling(); |
| var od = new api.NodePoolAutoscaling.fromJson(o.toJson()); |
| checkNodePoolAutoscaling(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Operation", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperation(); |
| var od = new api.Operation.fromJson(o.toJson()); |
| checkOperation(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-RollbackNodePoolUpgradeRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildRollbackNodePoolUpgradeRequest(); |
| var od = new api.RollbackNodePoolUpgradeRequest.fromJson(o.toJson()); |
| checkRollbackNodePoolUpgradeRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ServerConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildServerConfig(); |
| var od = new api.ServerConfig.fromJson(o.toJson()); |
| checkServerConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetAddonsConfigRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetAddonsConfigRequest(); |
| var od = new api.SetAddonsConfigRequest.fromJson(o.toJson()); |
| checkSetAddonsConfigRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetLabelsRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetLabelsRequest(); |
| var od = new api.SetLabelsRequest.fromJson(o.toJson()); |
| checkSetLabelsRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetLegacyAbacRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetLegacyAbacRequest(); |
| var od = new api.SetLegacyAbacRequest.fromJson(o.toJson()); |
| checkSetLegacyAbacRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetLocationsRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetLocationsRequest(); |
| var od = new api.SetLocationsRequest.fromJson(o.toJson()); |
| checkSetLocationsRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetLoggingServiceRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetLoggingServiceRequest(); |
| var od = new api.SetLoggingServiceRequest.fromJson(o.toJson()); |
| checkSetLoggingServiceRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetMaintenancePolicyRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetMaintenancePolicyRequest(); |
| var od = new api.SetMaintenancePolicyRequest.fromJson(o.toJson()); |
| checkSetMaintenancePolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetMasterAuthRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetMasterAuthRequest(); |
| var od = new api.SetMasterAuthRequest.fromJson(o.toJson()); |
| checkSetMasterAuthRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetMonitoringServiceRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetMonitoringServiceRequest(); |
| var od = new api.SetMonitoringServiceRequest.fromJson(o.toJson()); |
| checkSetMonitoringServiceRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetNetworkPolicyRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetNetworkPolicyRequest(); |
| var od = new api.SetNetworkPolicyRequest.fromJson(o.toJson()); |
| checkSetNetworkPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetNodePoolAutoscalingRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetNodePoolAutoscalingRequest(); |
| var od = new api.SetNodePoolAutoscalingRequest.fromJson(o.toJson()); |
| checkSetNodePoolAutoscalingRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetNodePoolManagementRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetNodePoolManagementRequest(); |
| var od = new api.SetNodePoolManagementRequest.fromJson(o.toJson()); |
| checkSetNodePoolManagementRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetNodePoolSizeRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetNodePoolSizeRequest(); |
| var od = new api.SetNodePoolSizeRequest.fromJson(o.toJson()); |
| checkSetNodePoolSizeRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-StartIPRotationRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildStartIPRotationRequest(); |
| var od = new api.StartIPRotationRequest.fromJson(o.toJson()); |
| checkStartIPRotationRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-UpdateClusterRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildUpdateClusterRequest(); |
| var od = new api.UpdateClusterRequest.fromJson(o.toJson()); |
| checkUpdateClusterRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-UpdateMasterRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildUpdateMasterRequest(); |
| var od = new api.UpdateMasterRequest.fromJson(o.toJson()); |
| checkUpdateMasterRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-UpdateNodePoolRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildUpdateNodePoolRequest(); |
| var od = new api.UpdateNodePoolRequest.fromJson(o.toJson()); |
| checkUpdateNodePoolRequest(od); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsZonesResourceApi", () { |
| unittest.test("method--getServerconfig", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesResourceApi res = |
| new api.ContainerApi(mock).projects.zones; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/serverconfig", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| unittest.equals("/serverconfig")); |
| pathOffset += 13; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildServerConfig()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .getServerconfig(arg_projectId, arg_zone, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkServerConfig(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsZonesClustersResourceApi", () { |
| unittest.test("method--addons", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetAddonsConfigRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetAddonsConfigRequest.fromJson(json); |
| checkSetAddonsConfigRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/addons", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/addons")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .addons(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--completeIpRotation", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildCompleteIPRotationRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CompleteIPRotationRequest.fromJson(json); |
| checkCompleteIPRotationRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":completeIpRotation", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| unittest.equals(":completeIpRotation")); |
| pathOffset += 19; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .completeIpRotation( |
| arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--create", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildCreateClusterRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CreateClusterRequest.fromJson(json); |
| checkCreateClusterRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/clusters")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_projectId, arg_zone, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_projectId, arg_zone, arg_clusterId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildCluster()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_zone, arg_clusterId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkCluster(response); |
| }))); |
| }); |
| |
| unittest.test("method--legacyAbac", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetLegacyAbacRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetLegacyAbacRequest.fromJson(json); |
| checkSetLegacyAbacRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/legacyAbac", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/legacyAbac")); |
| pathOffset += 11; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .legacyAbac(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/clusters")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListClustersResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, arg_zone, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListClustersResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--locations", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetLocationsRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetLocationsRequest.fromJson(json); |
| checkSetLocationsRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/locations", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/locations")); |
| pathOffset += 10; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .locations(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--logging", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetLoggingServiceRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetLoggingServiceRequest.fromJson(json); |
| checkSetLoggingServiceRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/logging", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("/logging")); |
| pathOffset += 8; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .logging(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--master", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildUpdateMasterRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.UpdateMasterRequest.fromJson(json); |
| checkUpdateMasterRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/master", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/master")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .master(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--monitoring", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetMonitoringServiceRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetMonitoringServiceRequest.fromJson(json); |
| checkSetMonitoringServiceRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/monitoring", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/monitoring")); |
| pathOffset += 11; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .monitoring(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--resourceLabels", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetLabelsRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetLabelsRequest.fromJson(json); |
| checkSetLabelsRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/resourceLabels", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| unittest.equals("/resourceLabels")); |
| pathOffset += 15; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .resourceLabels(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--setMaintenancePolicy", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetMaintenancePolicyRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetMaintenancePolicyRequest.fromJson(json); |
| checkSetMaintenancePolicyRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":setMaintenancePolicy", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 21), |
| unittest.equals(":setMaintenancePolicy")); |
| pathOffset += 21; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setMaintenancePolicy( |
| arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--setMasterAuth", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetMasterAuthRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetMasterAuthRequest.fromJson(json); |
| checkSetMasterAuthRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":setMasterAuth", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 14), |
| unittest.equals(":setMasterAuth")); |
| pathOffset += 14; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setMasterAuth(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--setNetworkPolicy", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildSetNetworkPolicyRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetNetworkPolicyRequest.fromJson(json); |
| checkSetNetworkPolicyRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":setNetworkPolicy", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| unittest.equals(":setNetworkPolicy")); |
| pathOffset += 17; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setNetworkPolicy(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--startIpRotation", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildStartIPRotationRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.StartIPRotationRequest.fromJson(json); |
| checkStartIPRotationRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":startIpRotation", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 16), |
| unittest.equals(":startIpRotation")); |
| pathOffset += 16; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .startIpRotation(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--update", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters; |
| var arg_request = buildUpdateClusterRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.UpdateClusterRequest.fromJson(json); |
| checkUpdateClusterRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .update(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsZonesClustersNodePoolsResourceApi", () { |
| unittest.test("method--autoscaling", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildSetNodePoolAutoscalingRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetNodePoolAutoscalingRequest.fromJson(json); |
| checkSetNodePoolAutoscalingRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| index = path.indexOf("/autoscaling", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("/autoscaling")); |
| pathOffset += 12; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .autoscaling(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--create", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildCreateNodePoolRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CreateNodePoolRequest.fromJson(json); |
| checkCreateNodePoolRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/nodePools")); |
| pathOffset += 10; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_projectId, arg_zone, arg_clusterId, arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildNodePool()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_zone, arg_clusterId, arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkNodePool(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/nodePools")); |
| pathOffset += 10; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListNodePoolsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, arg_zone, arg_clusterId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListNodePoolsResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--rollback", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildRollbackNodePoolUpgradeRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.RollbackNodePoolUpgradeRequest.fromJson(json); |
| checkRollbackNodePoolUpgradeRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| index = path.indexOf(":rollback", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals(":rollback")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .rollback(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--setManagement", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildSetNodePoolManagementRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetNodePoolManagementRequest.fromJson(json); |
| checkSetNodePoolManagementRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| index = path.indexOf("/setManagement", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 14), |
| unittest.equals("/setManagement")); |
| pathOffset += 14; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setManagement(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--setSize", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildSetNodePoolSizeRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SetNodePoolSizeRequest.fromJson(json); |
| checkSetNodePoolSizeRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| index = path.indexOf("/setSize", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("/setSize")); |
| pathOffset += 8; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setSize(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--update", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesClustersNodePoolsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.clusters.nodePools; |
| var arg_request = buildUpdateNodePoolRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_clusterId = "foo"; |
| var arg_nodePoolId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.UpdateNodePoolRequest.fromJson(json); |
| checkUpdateNodePoolRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf("/nodePools/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/nodePools/")); |
| pathOffset += 11; |
| index = path.indexOf("/update", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_nodePoolId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/update")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .update(arg_request, arg_projectId, arg_zone, arg_clusterId, |
| arg_nodePoolId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsZonesOperationsResourceApi", () { |
| unittest.test("method--cancel", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesOperationsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.operations; |
| var arg_request = buildCancelOperationRequest(); |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_operationId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CancelOperationRequest.fromJson(json); |
| checkCancelOperationRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/operations/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("/operations/")); |
| pathOffset += 12; |
| index = path.indexOf(":cancel", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_operationId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals(":cancel")); |
| pathOffset += 7; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildEmpty()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_projectId, arg_zone, arg_operationId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesOperationsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.operations; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_operationId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/operations/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("/operations/")); |
| pathOffset += 12; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_operationId")); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_zone, arg_operationId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsZonesOperationsResourceApi res = |
| new api.ContainerApi(mock).projects.zones.operations; |
| var arg_projectId = "foo"; |
| var arg_zone = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/zones/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals("/zones/")); |
| pathOffset += 7; |
| index = path.indexOf("/operations", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_zone")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| unittest.equals("/operations")); |
| pathOffset += 11; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListOperationsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, arg_zone, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListOperationsResponse(response); |
| }))); |
| }); |
| }); |
| } |