Index: generated/googleapis_beta/test/container/v1beta1_test.dart |
diff --git a/generated/googleapis_beta/test/container/v1beta1_test.dart b/generated/googleapis_beta/test/container/v1beta1_test.dart |
deleted file mode 100644 |
index 7d2dc97245de463bd7c56fd0ef54f74d0e02096e..0000000000000000000000000000000000000000 |
--- a/generated/googleapis_beta/test/container/v1beta1_test.dart |
+++ /dev/null |
@@ -1,859 +0,0 @@ |
-library googleapis_beta.container.v1beta1.test; |
- |
-import "dart:core" as core; |
-import "dart:collection" as collection; |
-import "dart:async" as async; |
-import "dart:convert" as convert; |
- |
-import 'package:http/http.dart' as http; |
-import 'package:http/testing.dart' as http_testing; |
-import 'package:unittest/unittest.dart' as unittest; |
- |
-import 'package:googleapis_beta/container/v1beta1.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 headers, core.String body) { |
- var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
- return new http.StreamedResponse(stream, status, headers: headers); |
-} |
- |
-buildUnnamed2314() { |
- var o = new core.List<core.String>(); |
- o.add("foo"); |
- o.add("foo"); |
- return o; |
-} |
- |
-checkUnnamed2314(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 buildCounterCluster = 0; |
-buildCluster() { |
- var o = new api.Cluster(); |
- buildCounterCluster++; |
- if (buildCounterCluster < 3) { |
- o.clusterApiVersion = "foo"; |
- o.containerIpv4Cidr = "foo"; |
- o.creationTimestamp = "foo"; |
- o.description = "foo"; |
- o.enableCloudLogging = true; |
- o.enableCloudMonitoring = true; |
- o.endpoint = "foo"; |
- o.instanceGroupUrls = buildUnnamed2314(); |
- o.masterAuth = buildMasterAuth(); |
- o.name = "foo"; |
- o.network = "foo"; |
- o.nodeConfig = buildNodeConfig(); |
- o.nodeRoutingPrefixSize = 42; |
- o.numNodes = 42; |
- o.selfLink = "foo"; |
- o.servicesIpv4Cidr = "foo"; |
- o.status = "foo"; |
- o.statusMessage = "foo"; |
- o.zone = "foo"; |
- } |
- buildCounterCluster--; |
- return o; |
-} |
- |
-checkCluster(api.Cluster o) { |
- buildCounterCluster++; |
- if (buildCounterCluster < 3) { |
- unittest.expect(o.clusterApiVersion, unittest.equals('foo')); |
- unittest.expect(o.containerIpv4Cidr, unittest.equals('foo')); |
- unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
- unittest.expect(o.description, unittest.equals('foo')); |
- unittest.expect(o.enableCloudLogging, unittest.isTrue); |
- unittest.expect(o.enableCloudMonitoring, unittest.isTrue); |
- unittest.expect(o.endpoint, unittest.equals('foo')); |
- checkUnnamed2314(o.instanceGroupUrls); |
- checkMasterAuth(o.masterAuth); |
- unittest.expect(o.name, unittest.equals('foo')); |
- unittest.expect(o.network, unittest.equals('foo')); |
- checkNodeConfig(o.nodeConfig); |
- unittest.expect(o.nodeRoutingPrefixSize, unittest.equals(42)); |
- unittest.expect(o.numNodes, unittest.equals(42)); |
- 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.zone, unittest.equals('foo')); |
- } |
- buildCounterCluster--; |
-} |
- |
-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--; |
-} |
- |
-buildUnnamed2315() { |
- var o = new core.List<api.Cluster>(); |
- o.add(buildCluster()); |
- o.add(buildCluster()); |
- return o; |
-} |
- |
-checkUnnamed2315(core.List<api.Cluster> o) { |
- unittest.expect(o, unittest.hasLength(2)); |
- checkCluster(o[0]); |
- checkCluster(o[1]); |
-} |
- |
-core.int buildCounterListAggregatedClustersResponse = 0; |
-buildListAggregatedClustersResponse() { |
- var o = new api.ListAggregatedClustersResponse(); |
- buildCounterListAggregatedClustersResponse++; |
- if (buildCounterListAggregatedClustersResponse < 3) { |
- o.clusters = buildUnnamed2315(); |
- } |
- buildCounterListAggregatedClustersResponse--; |
- return o; |
-} |
- |
-checkListAggregatedClustersResponse(api.ListAggregatedClustersResponse o) { |
- buildCounterListAggregatedClustersResponse++; |
- if (buildCounterListAggregatedClustersResponse < 3) { |
- checkUnnamed2315(o.clusters); |
- } |
- buildCounterListAggregatedClustersResponse--; |
-} |
- |
-buildUnnamed2316() { |
- var o = new core.List<api.Operation>(); |
- o.add(buildOperation()); |
- o.add(buildOperation()); |
- return o; |
-} |
- |
-checkUnnamed2316(core.List<api.Operation> o) { |
- unittest.expect(o, unittest.hasLength(2)); |
- checkOperation(o[0]); |
- checkOperation(o[1]); |
-} |
- |
-core.int buildCounterListAggregatedOperationsResponse = 0; |
-buildListAggregatedOperationsResponse() { |
- var o = new api.ListAggregatedOperationsResponse(); |
- buildCounterListAggregatedOperationsResponse++; |
- if (buildCounterListAggregatedOperationsResponse < 3) { |
- o.operations = buildUnnamed2316(); |
- } |
- buildCounterListAggregatedOperationsResponse--; |
- return o; |
-} |
- |
-checkListAggregatedOperationsResponse(api.ListAggregatedOperationsResponse o) { |
- buildCounterListAggregatedOperationsResponse++; |
- if (buildCounterListAggregatedOperationsResponse < 3) { |
- checkUnnamed2316(o.operations); |
- } |
- buildCounterListAggregatedOperationsResponse--; |
-} |
- |
-buildUnnamed2317() { |
- var o = new core.List<api.Cluster>(); |
- o.add(buildCluster()); |
- o.add(buildCluster()); |
- return o; |
-} |
- |
-checkUnnamed2317(core.List<api.Cluster> o) { |
- unittest.expect(o, unittest.hasLength(2)); |
- checkCluster(o[0]); |
- checkCluster(o[1]); |
-} |
- |
-core.int buildCounterListClustersResponse = 0; |
-buildListClustersResponse() { |
- var o = new api.ListClustersResponse(); |
- buildCounterListClustersResponse++; |
- if (buildCounterListClustersResponse < 3) { |
- o.clusters = buildUnnamed2317(); |
- } |
- buildCounterListClustersResponse--; |
- return o; |
-} |
- |
-checkListClustersResponse(api.ListClustersResponse o) { |
- buildCounterListClustersResponse++; |
- if (buildCounterListClustersResponse < 3) { |
- checkUnnamed2317(o.clusters); |
- } |
- buildCounterListClustersResponse--; |
-} |
- |
-buildUnnamed2318() { |
- var o = new core.List<api.Operation>(); |
- o.add(buildOperation()); |
- o.add(buildOperation()); |
- return o; |
-} |
- |
-checkUnnamed2318(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.operations = buildUnnamed2318(); |
- } |
- buildCounterListOperationsResponse--; |
- return o; |
-} |
- |
-checkListOperationsResponse(api.ListOperationsResponse o) { |
- buildCounterListOperationsResponse++; |
- if (buildCounterListOperationsResponse < 3) { |
- checkUnnamed2318(o.operations); |
- } |
- buildCounterListOperationsResponse--; |
-} |
- |
-core.int buildCounterMasterAuth = 0; |
-buildMasterAuth() { |
- var o = new api.MasterAuth(); |
- buildCounterMasterAuth++; |
- if (buildCounterMasterAuth < 3) { |
- o.bearerToken = "foo"; |
- o.clientCertificate = "foo"; |
- o.clientKey = "foo"; |
- o.clusterCaCertificate = "foo"; |
- o.password = "foo"; |
- o.user = "foo"; |
- } |
- buildCounterMasterAuth--; |
- return o; |
-} |
- |
-checkMasterAuth(api.MasterAuth o) { |
- buildCounterMasterAuth++; |
- if (buildCounterMasterAuth < 3) { |
- unittest.expect(o.bearerToken, unittest.equals('foo')); |
- unittest.expect(o.clientCertificate, unittest.equals('foo')); |
- unittest.expect(o.clientKey, unittest.equals('foo')); |
- unittest.expect(o.clusterCaCertificate, unittest.equals('foo')); |
- unittest.expect(o.password, unittest.equals('foo')); |
- unittest.expect(o.user, unittest.equals('foo')); |
- } |
- buildCounterMasterAuth--; |
-} |
- |
-buildUnnamed2319() { |
- var o = new core.List<api.ServiceAccount>(); |
- o.add(buildServiceAccount()); |
- o.add(buildServiceAccount()); |
- return o; |
-} |
- |
-checkUnnamed2319(core.List<api.ServiceAccount> o) { |
- unittest.expect(o, unittest.hasLength(2)); |
- checkServiceAccount(o[0]); |
- checkServiceAccount(o[1]); |
-} |
- |
-core.int buildCounterNodeConfig = 0; |
-buildNodeConfig() { |
- var o = new api.NodeConfig(); |
- buildCounterNodeConfig++; |
- if (buildCounterNodeConfig < 3) { |
- o.machineType = "foo"; |
- o.serviceAccounts = buildUnnamed2319(); |
- o.sourceImage = "foo"; |
- } |
- buildCounterNodeConfig--; |
- return o; |
-} |
- |
-checkNodeConfig(api.NodeConfig o) { |
- buildCounterNodeConfig++; |
- if (buildCounterNodeConfig < 3) { |
- unittest.expect(o.machineType, unittest.equals('foo')); |
- checkUnnamed2319(o.serviceAccounts); |
- unittest.expect(o.sourceImage, unittest.equals('foo')); |
- } |
- buildCounterNodeConfig--; |
-} |
- |
-core.int buildCounterOperation = 0; |
-buildOperation() { |
- var o = new api.Operation(); |
- buildCounterOperation++; |
- if (buildCounterOperation < 3) { |
- o.errorMessage = "foo"; |
- o.name = "foo"; |
- o.operationType = "foo"; |
- o.selfLink = "foo"; |
- o.status = "foo"; |
- o.target = "foo"; |
- o.targetLink = "foo"; |
- o.zone = "foo"; |
- } |
- buildCounterOperation--; |
- return o; |
-} |
- |
-checkOperation(api.Operation o) { |
- buildCounterOperation++; |
- if (buildCounterOperation < 3) { |
- unittest.expect(o.errorMessage, 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.status, unittest.equals('foo')); |
- unittest.expect(o.target, unittest.equals('foo')); |
- unittest.expect(o.targetLink, unittest.equals('foo')); |
- unittest.expect(o.zone, unittest.equals('foo')); |
- } |
- buildCounterOperation--; |
-} |
- |
-buildUnnamed2320() { |
- var o = new core.List<core.String>(); |
- o.add("foo"); |
- o.add("foo"); |
- return o; |
-} |
- |
-checkUnnamed2320(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 buildCounterServiceAccount = 0; |
-buildServiceAccount() { |
- var o = new api.ServiceAccount(); |
- buildCounterServiceAccount++; |
- if (buildCounterServiceAccount < 3) { |
- o.email = "foo"; |
- o.scopes = buildUnnamed2320(); |
- } |
- buildCounterServiceAccount--; |
- return o; |
-} |
- |
-checkServiceAccount(api.ServiceAccount o) { |
- buildCounterServiceAccount++; |
- if (buildCounterServiceAccount < 3) { |
- unittest.expect(o.email, unittest.equals('foo')); |
- checkUnnamed2320(o.scopes); |
- } |
- buildCounterServiceAccount--; |
-} |
- |
- |
-main() { |
- 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-CreateClusterRequest", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildCreateClusterRequest(); |
- var od = new api.CreateClusterRequest.fromJson(o.toJson()); |
- checkCreateClusterRequest(od); |
- }); |
- }); |
- |
- |
- unittest.group("obj-schema-ListAggregatedClustersResponse", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildListAggregatedClustersResponse(); |
- var od = new api.ListAggregatedClustersResponse.fromJson(o.toJson()); |
- checkListAggregatedClustersResponse(od); |
- }); |
- }); |
- |
- |
- unittest.group("obj-schema-ListAggregatedOperationsResponse", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildListAggregatedOperationsResponse(); |
- var od = new api.ListAggregatedOperationsResponse.fromJson(o.toJson()); |
- checkListAggregatedOperationsResponse(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-ListOperationsResponse", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildListOperationsResponse(); |
- var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
- checkListOperationsResponse(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-NodeConfig", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildNodeConfig(); |
- var od = new api.NodeConfig.fromJson(o.toJson()); |
- checkNodeConfig(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-ServiceAccount", () { |
- unittest.test("to-json--from-json", () { |
- var o = buildServiceAccount(); |
- var od = new api.ServiceAccount.fromJson(o.toJson()); |
- checkServiceAccount(od); |
- }); |
- }); |
- |
- |
- unittest.group("resource-ProjectsClustersResourceApi", () { |
- unittest.test("method--list", () { |
- |
- var mock = new HttpServerMock(); |
- api.ProjectsClustersResourceApi res = new api.ContainerApi(mock).projects.clusters; |
- var arg_projectId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- var h = { |
- "content-type" : "application/json; charset=utf-8", |
- }; |
- var resp = convert.JSON.encode(buildListAggregatedClustersResponse()); |
- return new async.Future.value(stringResponse(200, h, resp)); |
- }), true); |
- res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedClustersResponse response) { |
- checkListAggregatedClustersResponse(response); |
- }))); |
- }); |
- |
- }); |
- |
- |
- unittest.group("resource-ProjectsOperationsResourceApi", () { |
- unittest.test("method--list", () { |
- |
- var mock = new HttpServerMock(); |
- api.ProjectsOperationsResourceApi res = new api.ContainerApi(mock).projects.operations; |
- var arg_projectId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- var h = { |
- "content-type" : "application/json; charset=utf-8", |
- }; |
- var resp = convert.JSON.encode(buildListAggregatedOperationsResponse()); |
- return new async.Future.value(stringResponse(200, h, resp)); |
- }), true); |
- res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedOperationsResponse response) { |
- checkListAggregatedOperationsResponse(response); |
- }))); |
- }); |
- |
- }); |
- |
- |
- unittest.group("resource-ProjectsZonesClustersResourceApi", () { |
- 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_zoneId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId).then(unittest.expectAsync(((api.Operation 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_zoneId = "foo"; |
- var arg_clusterId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId, arg_clusterId).then(unittest.expectAsync(((api.Operation 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_zoneId = "foo"; |
- var arg_clusterId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId, arg_clusterId).then(unittest.expectAsync(((api.Cluster response) { |
- checkCluster(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_zoneId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId).then(unittest.expectAsync(((api.ListClustersResponse response) { |
- checkListClustersResponse(response); |
- }))); |
- }); |
- |
- }); |
- |
- |
- unittest.group("resource-ProjectsZonesOperationsResourceApi", () { |
- unittest.test("method--get", () { |
- |
- var mock = new HttpServerMock(); |
- api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).projects.zones.operations; |
- var arg_projectId = "foo"; |
- var arg_zoneId = "foo"; |
- var arg_operationId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId, arg_operationId).then(unittest.expectAsync(((api.Operation 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_zoneId = "foo"; |
- mock.register(unittest.expectAsync((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; |
- |
- 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])); |
- } |
- } |
- |
- |
- 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_zoneId).then(unittest.expectAsync(((api.ListOperationsResponse response) { |
- checkListOperationsResponse(response); |
- }))); |
- }); |
- |
- }); |
- |
- |
-} |
- |