| Index: generated/googleapis/test/cloudbuild/v1_test.dart
|
| diff --git a/generated/googleapis/test/cloudbuild/v1_test.dart b/generated/googleapis/test/cloudbuild/v1_test.dart
|
| deleted file mode 100644
|
| index f48cf5dc6767256a1d8fbbf7be7d66d47789cde0..0000000000000000000000000000000000000000
|
| --- a/generated/googleapis/test/cloudbuild/v1_test.dart
|
| +++ /dev/null
|
| @@ -1,918 +0,0 @@
|
| -library googleapis.cloudbuild.v1.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/cloudbuild/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 headers, core.String body) {
|
| - var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
|
| - return new http.StreamedResponse(stream, status, headers: headers);
|
| -}
|
| -
|
| -buildUnnamed630() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed630(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'));
|
| -}
|
| -
|
| -buildUnnamed631() {
|
| - var o = new core.List<api.BuildStep>();
|
| - o.add(buildBuildStep());
|
| - o.add(buildBuildStep());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed631(core.List<api.BuildStep> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkBuildStep(o[0]);
|
| - checkBuildStep(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterBuild = 0;
|
| -buildBuild() {
|
| - var o = new api.Build();
|
| - buildCounterBuild++;
|
| - if (buildCounterBuild < 3) {
|
| - o.createTime = "foo";
|
| - o.finishTime = "foo";
|
| - o.id = "foo";
|
| - o.images = buildUnnamed630();
|
| - o.logsBucket = "foo";
|
| - o.projectId = "foo";
|
| - o.results = buildResults();
|
| - o.source = buildSource();
|
| - o.startTime = "foo";
|
| - o.status = "foo";
|
| - o.statusDetail = "foo";
|
| - o.steps = buildUnnamed631();
|
| - o.timeout = "foo";
|
| - }
|
| - buildCounterBuild--;
|
| - return o;
|
| -}
|
| -
|
| -checkBuild(api.Build o) {
|
| - buildCounterBuild++;
|
| - if (buildCounterBuild < 3) {
|
| - unittest.expect(o.createTime, unittest.equals('foo'));
|
| - unittest.expect(o.finishTime, unittest.equals('foo'));
|
| - unittest.expect(o.id, unittest.equals('foo'));
|
| - checkUnnamed630(o.images);
|
| - unittest.expect(o.logsBucket, unittest.equals('foo'));
|
| - unittest.expect(o.projectId, unittest.equals('foo'));
|
| - checkResults(o.results);
|
| - checkSource(o.source);
|
| - unittest.expect(o.startTime, unittest.equals('foo'));
|
| - unittest.expect(o.status, unittest.equals('foo'));
|
| - unittest.expect(o.statusDetail, unittest.equals('foo'));
|
| - checkUnnamed631(o.steps);
|
| - unittest.expect(o.timeout, unittest.equals('foo'));
|
| - }
|
| - buildCounterBuild--;
|
| -}
|
| -
|
| -core.int buildCounterBuildOperationMetadata = 0;
|
| -buildBuildOperationMetadata() {
|
| - var o = new api.BuildOperationMetadata();
|
| - buildCounterBuildOperationMetadata++;
|
| - if (buildCounterBuildOperationMetadata < 3) {
|
| - o.build = buildBuild();
|
| - }
|
| - buildCounterBuildOperationMetadata--;
|
| - return o;
|
| -}
|
| -
|
| -checkBuildOperationMetadata(api.BuildOperationMetadata o) {
|
| - buildCounterBuildOperationMetadata++;
|
| - if (buildCounterBuildOperationMetadata < 3) {
|
| - checkBuild(o.build);
|
| - }
|
| - buildCounterBuildOperationMetadata--;
|
| -}
|
| -
|
| -buildUnnamed632() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed632(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'));
|
| -}
|
| -
|
| -buildUnnamed633() {
|
| - var o = new core.List<core.String>();
|
| - o.add("foo");
|
| - o.add("foo");
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed633(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 buildCounterBuildStep = 0;
|
| -buildBuildStep() {
|
| - var o = new api.BuildStep();
|
| - buildCounterBuildStep++;
|
| - if (buildCounterBuildStep < 3) {
|
| - o.args = buildUnnamed632();
|
| - o.dir = "foo";
|
| - o.env = buildUnnamed633();
|
| - o.name = "foo";
|
| - }
|
| - buildCounterBuildStep--;
|
| - return o;
|
| -}
|
| -
|
| -checkBuildStep(api.BuildStep o) {
|
| - buildCounterBuildStep++;
|
| - if (buildCounterBuildStep < 3) {
|
| - checkUnnamed632(o.args);
|
| - unittest.expect(o.dir, unittest.equals('foo'));
|
| - checkUnnamed633(o.env);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - }
|
| - buildCounterBuildStep--;
|
| -}
|
| -
|
| -core.int buildCounterBuiltImage = 0;
|
| -buildBuiltImage() {
|
| - var o = new api.BuiltImage();
|
| - buildCounterBuiltImage++;
|
| - if (buildCounterBuiltImage < 3) {
|
| - o.digest = "foo";
|
| - o.name = "foo";
|
| - }
|
| - buildCounterBuiltImage--;
|
| - return o;
|
| -}
|
| -
|
| -checkBuiltImage(api.BuiltImage o) {
|
| - buildCounterBuiltImage++;
|
| - if (buildCounterBuiltImage < 3) {
|
| - unittest.expect(o.digest, unittest.equals('foo'));
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - }
|
| - buildCounterBuiltImage--;
|
| -}
|
| -
|
| -core.int buildCounterCancelBuildRequest = 0;
|
| -buildCancelBuildRequest() {
|
| - var o = new api.CancelBuildRequest();
|
| - buildCounterCancelBuildRequest++;
|
| - if (buildCounterCancelBuildRequest < 3) {
|
| - }
|
| - buildCounterCancelBuildRequest--;
|
| - return o;
|
| -}
|
| -
|
| -checkCancelBuildRequest(api.CancelBuildRequest o) {
|
| - buildCounterCancelBuildRequest++;
|
| - if (buildCounterCancelBuildRequest < 3) {
|
| - }
|
| - buildCounterCancelBuildRequest--;
|
| -}
|
| -
|
| -buildUnnamed634() {
|
| - var o = new core.List<api.Build>();
|
| - o.add(buildBuild());
|
| - o.add(buildBuild());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed634(core.List<api.Build> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkBuild(o[0]);
|
| - checkBuild(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterListBuildsResponse = 0;
|
| -buildListBuildsResponse() {
|
| - var o = new api.ListBuildsResponse();
|
| - buildCounterListBuildsResponse++;
|
| - if (buildCounterListBuildsResponse < 3) {
|
| - o.builds = buildUnnamed634();
|
| - o.nextPageToken = "foo";
|
| - }
|
| - buildCounterListBuildsResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkListBuildsResponse(api.ListBuildsResponse o) {
|
| - buildCounterListBuildsResponse++;
|
| - if (buildCounterListBuildsResponse < 3) {
|
| - checkUnnamed634(o.builds);
|
| - unittest.expect(o.nextPageToken, unittest.equals('foo'));
|
| - }
|
| - buildCounterListBuildsResponse--;
|
| -}
|
| -
|
| -buildUnnamed635() {
|
| - var o = new core.List<api.Operation>();
|
| - o.add(buildOperation());
|
| - o.add(buildOperation());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed635(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.nextPageToken = "foo";
|
| - o.operations = buildUnnamed635();
|
| - }
|
| - buildCounterListOperationsResponse--;
|
| - return o;
|
| -}
|
| -
|
| -checkListOperationsResponse(api.ListOperationsResponse o) {
|
| - buildCounterListOperationsResponse++;
|
| - if (buildCounterListOperationsResponse < 3) {
|
| - unittest.expect(o.nextPageToken, unittest.equals('foo'));
|
| - checkUnnamed635(o.operations);
|
| - }
|
| - buildCounterListOperationsResponse--;
|
| -}
|
| -
|
| -buildUnnamed636() {
|
| - var o = new core.Map<core.String, core.Object>();
|
| - o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed636(core.Map<core.String, core.Object> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLength(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo'));
|
| - var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLength(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed637() {
|
| - var o = new core.Map<core.String, core.Object>();
|
| - o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed637(core.Map<core.String, core.Object> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLength(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.expect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], unittest.equals('foo'));
|
| - var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLength(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.expect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"], unittest.equals('foo'));
|
| -}
|
| -
|
| -core.int buildCounterOperation = 0;
|
| -buildOperation() {
|
| - var o = new api.Operation();
|
| - buildCounterOperation++;
|
| - if (buildCounterOperation < 3) {
|
| - o.done = true;
|
| - o.error = buildStatus();
|
| - o.metadata = buildUnnamed636();
|
| - o.name = "foo";
|
| - o.response = buildUnnamed637();
|
| - }
|
| - buildCounterOperation--;
|
| - return o;
|
| -}
|
| -
|
| -checkOperation(api.Operation o) {
|
| - buildCounterOperation++;
|
| - if (buildCounterOperation < 3) {
|
| - unittest.expect(o.done, unittest.isTrue);
|
| - checkStatus(o.error);
|
| - checkUnnamed636(o.metadata);
|
| - unittest.expect(o.name, unittest.equals('foo'));
|
| - checkUnnamed637(o.response);
|
| - }
|
| - buildCounterOperation--;
|
| -}
|
| -
|
| -buildUnnamed638() {
|
| - var o = new core.List<api.BuiltImage>();
|
| - o.add(buildBuiltImage());
|
| - o.add(buildBuiltImage());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed638(core.List<api.BuiltImage> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkBuiltImage(o[0]);
|
| - checkBuiltImage(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterResults = 0;
|
| -buildResults() {
|
| - var o = new api.Results();
|
| - buildCounterResults++;
|
| - if (buildCounterResults < 3) {
|
| - o.images = buildUnnamed638();
|
| - }
|
| - buildCounterResults--;
|
| - return o;
|
| -}
|
| -
|
| -checkResults(api.Results o) {
|
| - buildCounterResults++;
|
| - if (buildCounterResults < 3) {
|
| - checkUnnamed638(o.images);
|
| - }
|
| - buildCounterResults--;
|
| -}
|
| -
|
| -core.int buildCounterSource = 0;
|
| -buildSource() {
|
| - var o = new api.Source();
|
| - buildCounterSource++;
|
| - if (buildCounterSource < 3) {
|
| - o.storageSource = buildStorageSource();
|
| - }
|
| - buildCounterSource--;
|
| - return o;
|
| -}
|
| -
|
| -checkSource(api.Source o) {
|
| - buildCounterSource++;
|
| - if (buildCounterSource < 3) {
|
| - checkStorageSource(o.storageSource);
|
| - }
|
| - buildCounterSource--;
|
| -}
|
| -
|
| -buildUnnamed639() {
|
| - var o = new core.Map<core.String, core.Object>();
|
| - o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed639(core.Map<core.String, core.Object> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLength(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.expect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"], unittest.equals('foo'));
|
| - var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLength(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.expect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"], unittest.equals('foo'));
|
| -}
|
| -
|
| -buildUnnamed640() {
|
| - var o = new core.List<core.Map<core.String, core.Object>>();
|
| - o.add(buildUnnamed639());
|
| - o.add(buildUnnamed639());
|
| - return o;
|
| -}
|
| -
|
| -checkUnnamed640(core.List<core.Map<core.String, core.Object>> o) {
|
| - unittest.expect(o, unittest.hasLength(2));
|
| - checkUnnamed639(o[0]);
|
| - checkUnnamed639(o[1]);
|
| -}
|
| -
|
| -core.int buildCounterStatus = 0;
|
| -buildStatus() {
|
| - var o = new api.Status();
|
| - buildCounterStatus++;
|
| - if (buildCounterStatus < 3) {
|
| - o.code = 42;
|
| - o.details = buildUnnamed640();
|
| - o.message = "foo";
|
| - }
|
| - buildCounterStatus--;
|
| - return o;
|
| -}
|
| -
|
| -checkStatus(api.Status o) {
|
| - buildCounterStatus++;
|
| - if (buildCounterStatus < 3) {
|
| - unittest.expect(o.code, unittest.equals(42));
|
| - checkUnnamed640(o.details);
|
| - unittest.expect(o.message, unittest.equals('foo'));
|
| - }
|
| - buildCounterStatus--;
|
| -}
|
| -
|
| -core.int buildCounterStorageSource = 0;
|
| -buildStorageSource() {
|
| - var o = new api.StorageSource();
|
| - buildCounterStorageSource++;
|
| - if (buildCounterStorageSource < 3) {
|
| - o.bucket = "foo";
|
| - o.generation = "foo";
|
| - o.object = "foo";
|
| - }
|
| - buildCounterStorageSource--;
|
| - return o;
|
| -}
|
| -
|
| -checkStorageSource(api.StorageSource o) {
|
| - buildCounterStorageSource++;
|
| - if (buildCounterStorageSource < 3) {
|
| - unittest.expect(o.bucket, unittest.equals('foo'));
|
| - unittest.expect(o.generation, unittest.equals('foo'));
|
| - unittest.expect(o.object, unittest.equals('foo'));
|
| - }
|
| - buildCounterStorageSource--;
|
| -}
|
| -
|
| -
|
| -main() {
|
| - unittest.group("obj-schema-Build", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildBuild();
|
| - var od = new api.Build.fromJson(o.toJson());
|
| - checkBuild(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-BuildOperationMetadata", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildBuildOperationMetadata();
|
| - var od = new api.BuildOperationMetadata.fromJson(o.toJson());
|
| - checkBuildOperationMetadata(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-BuildStep", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildBuildStep();
|
| - var od = new api.BuildStep.fromJson(o.toJson());
|
| - checkBuildStep(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-BuiltImage", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildBuiltImage();
|
| - var od = new api.BuiltImage.fromJson(o.toJson());
|
| - checkBuiltImage(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-CancelBuildRequest", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildCancelBuildRequest();
|
| - var od = new api.CancelBuildRequest.fromJson(o.toJson());
|
| - checkCancelBuildRequest(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-ListBuildsResponse", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildListBuildsResponse();
|
| - var od = new api.ListBuildsResponse.fromJson(o.toJson());
|
| - checkListBuildsResponse(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-Operation", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildOperation();
|
| - var od = new api.Operation.fromJson(o.toJson());
|
| - checkOperation(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Results", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildResults();
|
| - var od = new api.Results.fromJson(o.toJson());
|
| - checkResults(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Source", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildSource();
|
| - var od = new api.Source.fromJson(o.toJson());
|
| - checkSource(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-Status", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildStatus();
|
| - var od = new api.Status.fromJson(o.toJson());
|
| - checkStatus(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("obj-schema-StorageSource", () {
|
| - unittest.test("to-json--from-json", () {
|
| - var o = buildStorageSource();
|
| - var od = new api.StorageSource.fromJson(o.toJson());
|
| - checkStorageSource(od);
|
| - });
|
| - });
|
| -
|
| -
|
| - unittest.group("resource-OperationsResourceApi", () {
|
| - unittest.test("method--get", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.OperationsResourceApi res = new api.CloudbuildApi(mock).operations;
|
| - var arg_name = "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;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
|
| - pathOffset += 3;
|
| - // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
|
| -
|
| - 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_name).then(unittest.expectAsync(((api.Operation response) {
|
| - checkOperation(response);
|
| - })));
|
| - });
|
| -
|
| - unittest.test("method--list", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.OperationsResourceApi res = new api.CloudbuildApi(mock).operations;
|
| - var arg_name = "foo";
|
| - var arg_pageSize = 42;
|
| - var arg_filter = "foo";
|
| - var arg_pageToken = "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;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
|
| - pathOffset += 3;
|
| - // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
|
| -
|
| - 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(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
|
| - unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter));
|
| - unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken));
|
| -
|
| -
|
| - 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_name, pageSize: arg_pageSize, filter: arg_filter, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse response) {
|
| - checkListOperationsResponse(response);
|
| - })));
|
| - });
|
| -
|
| - });
|
| -
|
| -
|
| - unittest.group("resource-ProjectsBuildsResourceApi", () {
|
| - unittest.test("method--cancel", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.ProjectsBuildsResourceApi res = new api.CloudbuildApi(mock).projects.builds;
|
| - var arg_request = buildCancelBuildRequest();
|
| - var arg_projectId = "foo";
|
| - var arg_id = "foo";
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var obj = new api.CancelBuildRequest.fromJson(json);
|
| - checkCancelBuildRequest(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("/builds/", 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 + 8), unittest.equals("/builds/"));
|
| - pathOffset += 8;
|
| - 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_id"));
|
| - 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]));
|
| - }
|
| - }
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildBuild());
|
| - return new async.Future.value(stringResponse(200, h, resp));
|
| - }), true);
|
| - res.cancel(arg_request, arg_projectId, arg_id).then(unittest.expectAsync(((api.Build response) {
|
| - checkBuild(response);
|
| - })));
|
| - });
|
| -
|
| - unittest.test("method--create", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.ProjectsBuildsResourceApi res = new api.CloudbuildApi(mock).projects.builds;
|
| - var arg_request = buildBuild();
|
| - var arg_projectId = "foo";
|
| - mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| - var obj = new api.Build.fromJson(json);
|
| - checkBuild(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("/builds", 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("/builds"));
|
| - 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]));
|
| - }
|
| - }
|
| -
|
| -
|
| - 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).then(unittest.expectAsync(((api.Operation response) {
|
| - checkOperation(response);
|
| - })));
|
| - });
|
| -
|
| - unittest.test("method--get", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.ProjectsBuildsResourceApi res = new api.CloudbuildApi(mock).projects.builds;
|
| - var arg_projectId = "foo";
|
| - var arg_id = "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;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.equals("v1/projects/"));
|
| - pathOffset += 12;
|
| - index = path.indexOf("/builds/", 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 + 8), unittest.equals("/builds/"));
|
| - pathOffset += 8;
|
| - subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
|
| - pathOffset = path.length;
|
| - unittest.expect(subPart, unittest.equals("$arg_id"));
|
| -
|
| - 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(buildBuild());
|
| - return new async.Future.value(stringResponse(200, h, resp));
|
| - }), true);
|
| - res.get(arg_projectId, arg_id).then(unittest.expectAsync(((api.Build response) {
|
| - checkBuild(response);
|
| - })));
|
| - });
|
| -
|
| - unittest.test("method--list", () {
|
| -
|
| - var mock = new HttpServerMock();
|
| - api.ProjectsBuildsResourceApi res = new api.CloudbuildApi(mock).projects.builds;
|
| - var arg_projectId = "foo";
|
| - var arg_pageSize = 42;
|
| - var arg_pageToken = "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;
|
| - unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.equals("v1/projects/"));
|
| - pathOffset += 12;
|
| - index = path.indexOf("/builds", 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("/builds"));
|
| - 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(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
|
| - unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken));
|
| -
|
| -
|
| - var h = {
|
| - "content-type" : "application/json; charset=utf-8",
|
| - };
|
| - var resp = convert.JSON.encode(buildListBuildsResponse());
|
| - return new async.Future.value(stringResponse(200, h, resp));
|
| - }), true);
|
| - res.list(arg_projectId, pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListBuildsResponse response) {
|
| - checkListBuildsResponse(response);
|
| - })));
|
| - });
|
| -
|
| - });
|
| -
|
| -
|
| -}
|
| -
|
|
|