| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: constant_identifier_names |
| // ignore_for_file: directives_ordering |
| // ignore_for_file: file_names |
| // ignore_for_file: library_names |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: omit_local_variable_types |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_parenthesis |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: avoid_returning_null |
| // ignore_for_file: cascade_invocations |
| // ignore_for_file: prefer_single_quotes |
| // ignore_for_file: unused_local_variable |
| |
| library googleapis.cloudbuild.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/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; |
| } |
| |
| @core.override |
| async.Future<http.StreamedResponse> send(http.BaseRequest request) async { |
| if (_expectJson) { |
| final jsonString = |
| await request.finalize().transform(convert.utf8.decoder).join(''); |
| 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 { |
| final data = await stream.toBytes(); |
| return _callback(request, data); |
| } |
| } |
| } |
| } |
| |
| http.StreamedResponse stringResponse(core.int status, |
| core.Map<core.String, core.String> headers, core.String body) { |
| var stream = async.Stream.fromIterable([convert.utf8.encode(body)]); |
| return http.StreamedResponse(stream, status, headers: headers); |
| } |
| |
| core.List<core.String> buildUnnamed1642() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1642(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 buildCounterArtifactObjects = 0; |
| api.ArtifactObjects buildArtifactObjects() { |
| var o = api.ArtifactObjects(); |
| buildCounterArtifactObjects++; |
| if (buildCounterArtifactObjects < 3) { |
| o.location = 'foo'; |
| o.paths = buildUnnamed1642(); |
| o.timing = buildTimeSpan(); |
| } |
| buildCounterArtifactObjects--; |
| return o; |
| } |
| |
| void checkArtifactObjects(api.ArtifactObjects o) { |
| buildCounterArtifactObjects++; |
| if (buildCounterArtifactObjects < 3) { |
| unittest.expect(o.location, unittest.equals('foo')); |
| checkUnnamed1642(o.paths); |
| checkTimeSpan(o.timing); |
| } |
| buildCounterArtifactObjects--; |
| } |
| |
| core.List<api.FileHashes> buildUnnamed1643() { |
| var o = <api.FileHashes>[]; |
| o.add(buildFileHashes()); |
| o.add(buildFileHashes()); |
| return o; |
| } |
| |
| void checkUnnamed1643(core.List<api.FileHashes> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkFileHashes(o[0]); |
| checkFileHashes(o[1]); |
| } |
| |
| core.int buildCounterArtifactResult = 0; |
| api.ArtifactResult buildArtifactResult() { |
| var o = api.ArtifactResult(); |
| buildCounterArtifactResult++; |
| if (buildCounterArtifactResult < 3) { |
| o.fileHash = buildUnnamed1643(); |
| o.location = 'foo'; |
| } |
| buildCounterArtifactResult--; |
| return o; |
| } |
| |
| void checkArtifactResult(api.ArtifactResult o) { |
| buildCounterArtifactResult++; |
| if (buildCounterArtifactResult < 3) { |
| checkUnnamed1643(o.fileHash); |
| unittest.expect(o.location, unittest.equals('foo')); |
| } |
| buildCounterArtifactResult--; |
| } |
| |
| core.List<core.String> buildUnnamed1644() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1644(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 buildCounterArtifacts = 0; |
| api.Artifacts buildArtifacts() { |
| var o = api.Artifacts(); |
| buildCounterArtifacts++; |
| if (buildCounterArtifacts < 3) { |
| o.images = buildUnnamed1644(); |
| o.objects = buildArtifactObjects(); |
| } |
| buildCounterArtifacts--; |
| return o; |
| } |
| |
| void checkArtifacts(api.Artifacts o) { |
| buildCounterArtifacts++; |
| if (buildCounterArtifacts < 3) { |
| checkUnnamed1644(o.images); |
| checkArtifactObjects(o.objects); |
| } |
| buildCounterArtifacts--; |
| } |
| |
| core.List<core.String> buildUnnamed1645() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1645(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<api.Secret> buildUnnamed1646() { |
| var o = <api.Secret>[]; |
| o.add(buildSecret()); |
| o.add(buildSecret()); |
| return o; |
| } |
| |
| void checkUnnamed1646(core.List<api.Secret> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkSecret(o[0]); |
| checkSecret(o[1]); |
| } |
| |
| core.List<api.BuildStep> buildUnnamed1647() { |
| var o = <api.BuildStep>[]; |
| o.add(buildBuildStep()); |
| o.add(buildBuildStep()); |
| return o; |
| } |
| |
| void checkUnnamed1647(core.List<api.BuildStep> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBuildStep(o[0]); |
| checkBuildStep(o[1]); |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed1648() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed1648(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x'], unittest.equals('foo')); |
| unittest.expect(o['y'], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1649() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1649(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.Map<core.String, api.TimeSpan> buildUnnamed1650() { |
| var o = <core.String, api.TimeSpan>{}; |
| o['x'] = buildTimeSpan(); |
| o['y'] = buildTimeSpan(); |
| return o; |
| } |
| |
| void checkUnnamed1650(core.Map<core.String, api.TimeSpan> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTimeSpan(o['x']); |
| checkTimeSpan(o['y']); |
| } |
| |
| core.int buildCounterBuild = 0; |
| api.Build buildBuild() { |
| var o = api.Build(); |
| buildCounterBuild++; |
| if (buildCounterBuild < 3) { |
| o.artifacts = buildArtifacts(); |
| o.buildTriggerId = 'foo'; |
| o.createTime = 'foo'; |
| o.finishTime = 'foo'; |
| o.id = 'foo'; |
| o.images = buildUnnamed1645(); |
| o.logUrl = 'foo'; |
| o.logsBucket = 'foo'; |
| o.name = 'foo'; |
| o.options = buildBuildOptions(); |
| o.projectId = 'foo'; |
| o.queueTtl = 'foo'; |
| o.results = buildResults(); |
| o.secrets = buildUnnamed1646(); |
| o.serviceAccount = 'foo'; |
| o.source = buildSource(); |
| o.sourceProvenance = buildSourceProvenance(); |
| o.startTime = 'foo'; |
| o.status = 'foo'; |
| o.statusDetail = 'foo'; |
| o.steps = buildUnnamed1647(); |
| o.substitutions = buildUnnamed1648(); |
| o.tags = buildUnnamed1649(); |
| o.timeout = 'foo'; |
| o.timing = buildUnnamed1650(); |
| } |
| buildCounterBuild--; |
| return o; |
| } |
| |
| void checkBuild(api.Build o) { |
| buildCounterBuild++; |
| if (buildCounterBuild < 3) { |
| checkArtifacts(o.artifacts); |
| unittest.expect(o.buildTriggerId, unittest.equals('foo')); |
| unittest.expect(o.createTime, unittest.equals('foo')); |
| unittest.expect(o.finishTime, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkUnnamed1645(o.images); |
| unittest.expect(o.logUrl, unittest.equals('foo')); |
| unittest.expect(o.logsBucket, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkBuildOptions(o.options); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| unittest.expect(o.queueTtl, unittest.equals('foo')); |
| checkResults(o.results); |
| checkUnnamed1646(o.secrets); |
| unittest.expect(o.serviceAccount, unittest.equals('foo')); |
| checkSource(o.source); |
| checkSourceProvenance(o.sourceProvenance); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.statusDetail, unittest.equals('foo')); |
| checkUnnamed1647(o.steps); |
| checkUnnamed1648(o.substitutions); |
| checkUnnamed1649(o.tags); |
| unittest.expect(o.timeout, unittest.equals('foo')); |
| checkUnnamed1650(o.timing); |
| } |
| buildCounterBuild--; |
| } |
| |
| core.int buildCounterBuildOperationMetadata = 0; |
| api.BuildOperationMetadata buildBuildOperationMetadata() { |
| var o = api.BuildOperationMetadata(); |
| buildCounterBuildOperationMetadata++; |
| if (buildCounterBuildOperationMetadata < 3) { |
| o.build = buildBuild(); |
| } |
| buildCounterBuildOperationMetadata--; |
| return o; |
| } |
| |
| void checkBuildOperationMetadata(api.BuildOperationMetadata o) { |
| buildCounterBuildOperationMetadata++; |
| if (buildCounterBuildOperationMetadata < 3) { |
| checkBuild(o.build); |
| } |
| buildCounterBuildOperationMetadata--; |
| } |
| |
| core.List<core.String> buildUnnamed1651() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1651(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1652() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1652(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1653() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1653(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<api.Volume> buildUnnamed1654() { |
| var o = <api.Volume>[]; |
| o.add(buildVolume()); |
| o.add(buildVolume()); |
| return o; |
| } |
| |
| void checkUnnamed1654(core.List<api.Volume> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkVolume(o[0]); |
| checkVolume(o[1]); |
| } |
| |
| core.int buildCounterBuildOptions = 0; |
| api.BuildOptions buildBuildOptions() { |
| var o = api.BuildOptions(); |
| buildCounterBuildOptions++; |
| if (buildCounterBuildOptions < 3) { |
| o.diskSizeGb = 'foo'; |
| o.dynamicSubstitutions = true; |
| o.env = buildUnnamed1651(); |
| o.logStreamingOption = 'foo'; |
| o.logging = 'foo'; |
| o.machineType = 'foo'; |
| o.requestedVerifyOption = 'foo'; |
| o.secretEnv = buildUnnamed1652(); |
| o.sourceProvenanceHash = buildUnnamed1653(); |
| o.substitutionOption = 'foo'; |
| o.volumes = buildUnnamed1654(); |
| o.workerPool = 'foo'; |
| } |
| buildCounterBuildOptions--; |
| return o; |
| } |
| |
| void checkBuildOptions(api.BuildOptions o) { |
| buildCounterBuildOptions++; |
| if (buildCounterBuildOptions < 3) { |
| unittest.expect(o.diskSizeGb, unittest.equals('foo')); |
| unittest.expect(o.dynamicSubstitutions, unittest.isTrue); |
| checkUnnamed1651(o.env); |
| unittest.expect(o.logStreamingOption, unittest.equals('foo')); |
| unittest.expect(o.logging, unittest.equals('foo')); |
| unittest.expect(o.machineType, unittest.equals('foo')); |
| unittest.expect(o.requestedVerifyOption, unittest.equals('foo')); |
| checkUnnamed1652(o.secretEnv); |
| checkUnnamed1653(o.sourceProvenanceHash); |
| unittest.expect(o.substitutionOption, unittest.equals('foo')); |
| checkUnnamed1654(o.volumes); |
| unittest.expect(o.workerPool, unittest.equals('foo')); |
| } |
| buildCounterBuildOptions--; |
| } |
| |
| core.List<core.String> buildUnnamed1655() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1655(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1656() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1656(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1657() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1657(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<api.Volume> buildUnnamed1658() { |
| var o = <api.Volume>[]; |
| o.add(buildVolume()); |
| o.add(buildVolume()); |
| return o; |
| } |
| |
| void checkUnnamed1658(core.List<api.Volume> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkVolume(o[0]); |
| checkVolume(o[1]); |
| } |
| |
| core.List<core.String> buildUnnamed1659() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1659(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; |
| api.BuildStep buildBuildStep() { |
| var o = api.BuildStep(); |
| buildCounterBuildStep++; |
| if (buildCounterBuildStep < 3) { |
| o.args = buildUnnamed1655(); |
| o.dir = 'foo'; |
| o.entrypoint = 'foo'; |
| o.env = buildUnnamed1656(); |
| o.id = 'foo'; |
| o.name = 'foo'; |
| o.pullTiming = buildTimeSpan(); |
| o.secretEnv = buildUnnamed1657(); |
| o.status = 'foo'; |
| o.timeout = 'foo'; |
| o.timing = buildTimeSpan(); |
| o.volumes = buildUnnamed1658(); |
| o.waitFor = buildUnnamed1659(); |
| } |
| buildCounterBuildStep--; |
| return o; |
| } |
| |
| void checkBuildStep(api.BuildStep o) { |
| buildCounterBuildStep++; |
| if (buildCounterBuildStep < 3) { |
| checkUnnamed1655(o.args); |
| unittest.expect(o.dir, unittest.equals('foo')); |
| unittest.expect(o.entrypoint, unittest.equals('foo')); |
| checkUnnamed1656(o.env); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkTimeSpan(o.pullTiming); |
| checkUnnamed1657(o.secretEnv); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.timeout, unittest.equals('foo')); |
| checkTimeSpan(o.timing); |
| checkUnnamed1658(o.volumes); |
| checkUnnamed1659(o.waitFor); |
| } |
| buildCounterBuildStep--; |
| } |
| |
| core.List<core.String> buildUnnamed1660() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1660(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1661() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1661(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.Map<core.String, core.String> buildUnnamed1662() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed1662(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x'], unittest.equals('foo')); |
| unittest.expect(o['y'], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1663() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1663(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 buildCounterBuildTrigger = 0; |
| api.BuildTrigger buildBuildTrigger() { |
| var o = api.BuildTrigger(); |
| buildCounterBuildTrigger++; |
| if (buildCounterBuildTrigger < 3) { |
| o.build = buildBuild(); |
| o.createTime = 'foo'; |
| o.description = 'foo'; |
| o.disabled = true; |
| o.filename = 'foo'; |
| o.github = buildGitHubEventsConfig(); |
| o.id = 'foo'; |
| o.ignoredFiles = buildUnnamed1660(); |
| o.includedFiles = buildUnnamed1661(); |
| o.name = 'foo'; |
| o.substitutions = buildUnnamed1662(); |
| o.tags = buildUnnamed1663(); |
| o.triggerTemplate = buildRepoSource(); |
| } |
| buildCounterBuildTrigger--; |
| return o; |
| } |
| |
| void checkBuildTrigger(api.BuildTrigger o) { |
| buildCounterBuildTrigger++; |
| if (buildCounterBuildTrigger < 3) { |
| checkBuild(o.build); |
| unittest.expect(o.createTime, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.disabled, unittest.isTrue); |
| unittest.expect(o.filename, unittest.equals('foo')); |
| checkGitHubEventsConfig(o.github); |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkUnnamed1660(o.ignoredFiles); |
| checkUnnamed1661(o.includedFiles); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkUnnamed1662(o.substitutions); |
| checkUnnamed1663(o.tags); |
| checkRepoSource(o.triggerTemplate); |
| } |
| buildCounterBuildTrigger--; |
| } |
| |
| core.int buildCounterBuiltImage = 0; |
| api.BuiltImage buildBuiltImage() { |
| var o = api.BuiltImage(); |
| buildCounterBuiltImage++; |
| if (buildCounterBuiltImage < 3) { |
| o.digest = 'foo'; |
| o.name = 'foo'; |
| o.pushTiming = buildTimeSpan(); |
| } |
| buildCounterBuiltImage--; |
| return o; |
| } |
| |
| void checkBuiltImage(api.BuiltImage o) { |
| buildCounterBuiltImage++; |
| if (buildCounterBuiltImage < 3) { |
| unittest.expect(o.digest, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkTimeSpan(o.pushTiming); |
| } |
| buildCounterBuiltImage--; |
| } |
| |
| core.int buildCounterCancelBuildRequest = 0; |
| api.CancelBuildRequest buildCancelBuildRequest() { |
| var o = api.CancelBuildRequest(); |
| buildCounterCancelBuildRequest++; |
| if (buildCounterCancelBuildRequest < 3) { |
| o.id = 'foo'; |
| o.name = 'foo'; |
| o.projectId = 'foo'; |
| } |
| buildCounterCancelBuildRequest--; |
| return o; |
| } |
| |
| void checkCancelBuildRequest(api.CancelBuildRequest o) { |
| buildCounterCancelBuildRequest++; |
| if (buildCounterCancelBuildRequest < 3) { |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterCancelBuildRequest--; |
| } |
| |
| core.int buildCounterCancelOperationRequest = 0; |
| api.CancelOperationRequest buildCancelOperationRequest() { |
| var o = api.CancelOperationRequest(); |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| return o; |
| } |
| |
| void checkCancelOperationRequest(api.CancelOperationRequest o) { |
| buildCounterCancelOperationRequest++; |
| if (buildCounterCancelOperationRequest < 3) {} |
| buildCounterCancelOperationRequest--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| api.Empty buildEmpty() { |
| var o = api.Empty(); |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| return o; |
| } |
| |
| void checkEmpty(api.Empty o) { |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| } |
| |
| core.List<api.Hash> buildUnnamed1664() { |
| var o = <api.Hash>[]; |
| o.add(buildHash()); |
| o.add(buildHash()); |
| return o; |
| } |
| |
| void checkUnnamed1664(core.List<api.Hash> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkHash(o[0]); |
| checkHash(o[1]); |
| } |
| |
| core.int buildCounterFileHashes = 0; |
| api.FileHashes buildFileHashes() { |
| var o = api.FileHashes(); |
| buildCounterFileHashes++; |
| if (buildCounterFileHashes < 3) { |
| o.fileHash = buildUnnamed1664(); |
| } |
| buildCounterFileHashes--; |
| return o; |
| } |
| |
| void checkFileHashes(api.FileHashes o) { |
| buildCounterFileHashes++; |
| if (buildCounterFileHashes < 3) { |
| checkUnnamed1664(o.fileHash); |
| } |
| buildCounterFileHashes--; |
| } |
| |
| core.int buildCounterGitHubEventsConfig = 0; |
| api.GitHubEventsConfig buildGitHubEventsConfig() { |
| var o = api.GitHubEventsConfig(); |
| buildCounterGitHubEventsConfig++; |
| if (buildCounterGitHubEventsConfig < 3) { |
| o.installationId = 'foo'; |
| o.name = 'foo'; |
| o.owner = 'foo'; |
| o.pullRequest = buildPullRequestFilter(); |
| o.push = buildPushFilter(); |
| } |
| buildCounterGitHubEventsConfig--; |
| return o; |
| } |
| |
| void checkGitHubEventsConfig(api.GitHubEventsConfig o) { |
| buildCounterGitHubEventsConfig++; |
| if (buildCounterGitHubEventsConfig < 3) { |
| unittest.expect(o.installationId, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.owner, unittest.equals('foo')); |
| checkPullRequestFilter(o.pullRequest); |
| checkPushFilter(o.push); |
| } |
| buildCounterGitHubEventsConfig--; |
| } |
| |
| core.int buildCounterHTTPDelivery = 0; |
| api.HTTPDelivery buildHTTPDelivery() { |
| var o = api.HTTPDelivery(); |
| buildCounterHTTPDelivery++; |
| if (buildCounterHTTPDelivery < 3) { |
| o.uri = 'foo'; |
| } |
| buildCounterHTTPDelivery--; |
| return o; |
| } |
| |
| void checkHTTPDelivery(api.HTTPDelivery o) { |
| buildCounterHTTPDelivery++; |
| if (buildCounterHTTPDelivery < 3) { |
| unittest.expect(o.uri, unittest.equals('foo')); |
| } |
| buildCounterHTTPDelivery--; |
| } |
| |
| core.int buildCounterHash = 0; |
| api.Hash buildHash() { |
| var o = api.Hash(); |
| buildCounterHash++; |
| if (buildCounterHash < 3) { |
| o.type = 'foo'; |
| o.value = 'foo'; |
| } |
| buildCounterHash--; |
| return o; |
| } |
| |
| void checkHash(api.Hash o) { |
| buildCounterHash++; |
| if (buildCounterHash < 3) { |
| unittest.expect(o.type, unittest.equals('foo')); |
| unittest.expect(o.value, unittest.equals('foo')); |
| } |
| buildCounterHash--; |
| } |
| |
| core.List<api.BuildTrigger> buildUnnamed1665() { |
| var o = <api.BuildTrigger>[]; |
| o.add(buildBuildTrigger()); |
| o.add(buildBuildTrigger()); |
| return o; |
| } |
| |
| void checkUnnamed1665(core.List<api.BuildTrigger> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBuildTrigger(o[0]); |
| checkBuildTrigger(o[1]); |
| } |
| |
| core.int buildCounterListBuildTriggersResponse = 0; |
| api.ListBuildTriggersResponse buildListBuildTriggersResponse() { |
| var o = api.ListBuildTriggersResponse(); |
| buildCounterListBuildTriggersResponse++; |
| if (buildCounterListBuildTriggersResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.triggers = buildUnnamed1665(); |
| } |
| buildCounterListBuildTriggersResponse--; |
| return o; |
| } |
| |
| void checkListBuildTriggersResponse(api.ListBuildTriggersResponse o) { |
| buildCounterListBuildTriggersResponse++; |
| if (buildCounterListBuildTriggersResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed1665(o.triggers); |
| } |
| buildCounterListBuildTriggersResponse--; |
| } |
| |
| core.List<api.Build> buildUnnamed1666() { |
| var o = <api.Build>[]; |
| o.add(buildBuild()); |
| o.add(buildBuild()); |
| return o; |
| } |
| |
| void checkUnnamed1666(core.List<api.Build> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBuild(o[0]); |
| checkBuild(o[1]); |
| } |
| |
| core.int buildCounterListBuildsResponse = 0; |
| api.ListBuildsResponse buildListBuildsResponse() { |
| var o = api.ListBuildsResponse(); |
| buildCounterListBuildsResponse++; |
| if (buildCounterListBuildsResponse < 3) { |
| o.builds = buildUnnamed1666(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListBuildsResponse--; |
| return o; |
| } |
| |
| void checkListBuildsResponse(api.ListBuildsResponse o) { |
| buildCounterListBuildsResponse++; |
| if (buildCounterListBuildsResponse < 3) { |
| checkUnnamed1666(o.builds); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListBuildsResponse--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed1667() { |
| var o = <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; |
| } |
| |
| void checkUnnamed1667(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted1 = (o['x']) as core.Map; |
| unittest.expect(casted1, unittest.hasLength(3)); |
| unittest.expect(casted1['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted1['bool'], unittest.equals(true)); |
| unittest.expect(casted1['string'], unittest.equals('foo')); |
| var casted2 = (o['y']) as core.Map; |
| unittest.expect(casted2, unittest.hasLength(3)); |
| unittest.expect(casted2['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted2['bool'], unittest.equals(true)); |
| unittest.expect(casted2['string'], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterNotification = 0; |
| api.Notification buildNotification() { |
| var o = api.Notification(); |
| buildCounterNotification++; |
| if (buildCounterNotification < 3) { |
| o.filter = 'foo'; |
| o.httpDelivery = buildHTTPDelivery(); |
| o.slackDelivery = buildSlackDelivery(); |
| o.smtpDelivery = buildSMTPDelivery(); |
| o.structDelivery = buildUnnamed1667(); |
| } |
| buildCounterNotification--; |
| return o; |
| } |
| |
| void checkNotification(api.Notification o) { |
| buildCounterNotification++; |
| if (buildCounterNotification < 3) { |
| unittest.expect(o.filter, unittest.equals('foo')); |
| checkHTTPDelivery(o.httpDelivery); |
| checkSlackDelivery(o.slackDelivery); |
| checkSMTPDelivery(o.smtpDelivery); |
| checkUnnamed1667(o.structDelivery); |
| } |
| buildCounterNotification--; |
| } |
| |
| core.int buildCounterNotifierConfig = 0; |
| api.NotifierConfig buildNotifierConfig() { |
| var o = api.NotifierConfig(); |
| buildCounterNotifierConfig++; |
| if (buildCounterNotifierConfig < 3) { |
| o.apiVersion = 'foo'; |
| o.kind = 'foo'; |
| o.metadata = buildNotifierMetadata(); |
| o.spec = buildNotifierSpec(); |
| } |
| buildCounterNotifierConfig--; |
| return o; |
| } |
| |
| void checkNotifierConfig(api.NotifierConfig o) { |
| buildCounterNotifierConfig++; |
| if (buildCounterNotifierConfig < 3) { |
| unittest.expect(o.apiVersion, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| checkNotifierMetadata(o.metadata); |
| checkNotifierSpec(o.spec); |
| } |
| buildCounterNotifierConfig--; |
| } |
| |
| core.int buildCounterNotifierMetadata = 0; |
| api.NotifierMetadata buildNotifierMetadata() { |
| var o = api.NotifierMetadata(); |
| buildCounterNotifierMetadata++; |
| if (buildCounterNotifierMetadata < 3) { |
| o.name = 'foo'; |
| o.notifier = 'foo'; |
| } |
| buildCounterNotifierMetadata--; |
| return o; |
| } |
| |
| void checkNotifierMetadata(api.NotifierMetadata o) { |
| buildCounterNotifierMetadata++; |
| if (buildCounterNotifierMetadata < 3) { |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.notifier, unittest.equals('foo')); |
| } |
| buildCounterNotifierMetadata--; |
| } |
| |
| core.int buildCounterNotifierSecret = 0; |
| api.NotifierSecret buildNotifierSecret() { |
| var o = api.NotifierSecret(); |
| buildCounterNotifierSecret++; |
| if (buildCounterNotifierSecret < 3) { |
| o.name = 'foo'; |
| o.value = 'foo'; |
| } |
| buildCounterNotifierSecret--; |
| return o; |
| } |
| |
| void checkNotifierSecret(api.NotifierSecret o) { |
| buildCounterNotifierSecret++; |
| if (buildCounterNotifierSecret < 3) { |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.value, unittest.equals('foo')); |
| } |
| buildCounterNotifierSecret--; |
| } |
| |
| core.int buildCounterNotifierSecretRef = 0; |
| api.NotifierSecretRef buildNotifierSecretRef() { |
| var o = api.NotifierSecretRef(); |
| buildCounterNotifierSecretRef++; |
| if (buildCounterNotifierSecretRef < 3) { |
| o.secretRef = 'foo'; |
| } |
| buildCounterNotifierSecretRef--; |
| return o; |
| } |
| |
| void checkNotifierSecretRef(api.NotifierSecretRef o) { |
| buildCounterNotifierSecretRef++; |
| if (buildCounterNotifierSecretRef < 3) { |
| unittest.expect(o.secretRef, unittest.equals('foo')); |
| } |
| buildCounterNotifierSecretRef--; |
| } |
| |
| core.List<api.NotifierSecret> buildUnnamed1668() { |
| var o = <api.NotifierSecret>[]; |
| o.add(buildNotifierSecret()); |
| o.add(buildNotifierSecret()); |
| return o; |
| } |
| |
| void checkUnnamed1668(core.List<api.NotifierSecret> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNotifierSecret(o[0]); |
| checkNotifierSecret(o[1]); |
| } |
| |
| core.int buildCounterNotifierSpec = 0; |
| api.NotifierSpec buildNotifierSpec() { |
| var o = api.NotifierSpec(); |
| buildCounterNotifierSpec++; |
| if (buildCounterNotifierSpec < 3) { |
| o.notification = buildNotification(); |
| o.secrets = buildUnnamed1668(); |
| } |
| buildCounterNotifierSpec--; |
| return o; |
| } |
| |
| void checkNotifierSpec(api.NotifierSpec o) { |
| buildCounterNotifierSpec++; |
| if (buildCounterNotifierSpec < 3) { |
| checkNotification(o.notification); |
| checkUnnamed1668(o.secrets); |
| } |
| buildCounterNotifierSpec--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed1669() { |
| var o = <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; |
| } |
| |
| void checkUnnamed1669(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted3 = (o['x']) as core.Map; |
| unittest.expect(casted3, unittest.hasLength(3)); |
| unittest.expect(casted3['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted3['bool'], unittest.equals(true)); |
| unittest.expect(casted3['string'], unittest.equals('foo')); |
| var casted4 = (o['y']) as core.Map; |
| unittest.expect(casted4, unittest.hasLength(3)); |
| unittest.expect(casted4['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted4['bool'], unittest.equals(true)); |
| unittest.expect(casted4['string'], unittest.equals('foo')); |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed1670() { |
| var o = <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; |
| } |
| |
| void checkUnnamed1670(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted5 = (o['x']) as core.Map; |
| unittest.expect(casted5, unittest.hasLength(3)); |
| unittest.expect(casted5['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted5['bool'], unittest.equals(true)); |
| unittest.expect(casted5['string'], unittest.equals('foo')); |
| var casted6 = (o['y']) as core.Map; |
| unittest.expect(casted6, unittest.hasLength(3)); |
| unittest.expect(casted6['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted6['bool'], unittest.equals(true)); |
| unittest.expect(casted6['string'], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterOperation = 0; |
| api.Operation buildOperation() { |
| var o = api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.done = true; |
| o.error = buildStatus(); |
| o.metadata = buildUnnamed1669(); |
| o.name = 'foo'; |
| o.response = buildUnnamed1670(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| void checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done, unittest.isTrue); |
| checkStatus(o.error); |
| checkUnnamed1669(o.metadata); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkUnnamed1670(o.response); |
| } |
| buildCounterOperation--; |
| } |
| |
| core.int buildCounterPullRequestFilter = 0; |
| api.PullRequestFilter buildPullRequestFilter() { |
| var o = api.PullRequestFilter(); |
| buildCounterPullRequestFilter++; |
| if (buildCounterPullRequestFilter < 3) { |
| o.branch = 'foo'; |
| o.commentControl = 'foo'; |
| o.invertRegex = true; |
| } |
| buildCounterPullRequestFilter--; |
| return o; |
| } |
| |
| void checkPullRequestFilter(api.PullRequestFilter o) { |
| buildCounterPullRequestFilter++; |
| if (buildCounterPullRequestFilter < 3) { |
| unittest.expect(o.branch, unittest.equals('foo')); |
| unittest.expect(o.commentControl, unittest.equals('foo')); |
| unittest.expect(o.invertRegex, unittest.isTrue); |
| } |
| buildCounterPullRequestFilter--; |
| } |
| |
| core.int buildCounterPushFilter = 0; |
| api.PushFilter buildPushFilter() { |
| var o = api.PushFilter(); |
| buildCounterPushFilter++; |
| if (buildCounterPushFilter < 3) { |
| o.branch = 'foo'; |
| o.invertRegex = true; |
| o.tag = 'foo'; |
| } |
| buildCounterPushFilter--; |
| return o; |
| } |
| |
| void checkPushFilter(api.PushFilter o) { |
| buildCounterPushFilter++; |
| if (buildCounterPushFilter < 3) { |
| unittest.expect(o.branch, unittest.equals('foo')); |
| unittest.expect(o.invertRegex, unittest.isTrue); |
| unittest.expect(o.tag, unittest.equals('foo')); |
| } |
| buildCounterPushFilter--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed1671() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed1671(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 buildCounterRepoSource = 0; |
| api.RepoSource buildRepoSource() { |
| var o = api.RepoSource(); |
| buildCounterRepoSource++; |
| if (buildCounterRepoSource < 3) { |
| o.branchName = 'foo'; |
| o.commitSha = 'foo'; |
| o.dir = 'foo'; |
| o.invertRegex = true; |
| o.projectId = 'foo'; |
| o.repoName = 'foo'; |
| o.substitutions = buildUnnamed1671(); |
| o.tagName = 'foo'; |
| } |
| buildCounterRepoSource--; |
| return o; |
| } |
| |
| void checkRepoSource(api.RepoSource o) { |
| buildCounterRepoSource++; |
| if (buildCounterRepoSource < 3) { |
| unittest.expect(o.branchName, unittest.equals('foo')); |
| unittest.expect(o.commitSha, unittest.equals('foo')); |
| unittest.expect(o.dir, unittest.equals('foo')); |
| unittest.expect(o.invertRegex, unittest.isTrue); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| unittest.expect(o.repoName, unittest.equals('foo')); |
| checkUnnamed1671(o.substitutions); |
| unittest.expect(o.tagName, unittest.equals('foo')); |
| } |
| buildCounterRepoSource--; |
| } |
| |
| core.List<core.String> buildUnnamed1672() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1672(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed1673() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1673(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<api.BuiltImage> buildUnnamed1674() { |
| var o = <api.BuiltImage>[]; |
| o.add(buildBuiltImage()); |
| o.add(buildBuiltImage()); |
| return o; |
| } |
| |
| void checkUnnamed1674(core.List<api.BuiltImage> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBuiltImage(o[0]); |
| checkBuiltImage(o[1]); |
| } |
| |
| core.int buildCounterResults = 0; |
| api.Results buildResults() { |
| var o = api.Results(); |
| buildCounterResults++; |
| if (buildCounterResults < 3) { |
| o.artifactManifest = 'foo'; |
| o.artifactTiming = buildTimeSpan(); |
| o.buildStepImages = buildUnnamed1672(); |
| o.buildStepOutputs = buildUnnamed1673(); |
| o.images = buildUnnamed1674(); |
| o.numArtifacts = 'foo'; |
| } |
| buildCounterResults--; |
| return o; |
| } |
| |
| void checkResults(api.Results o) { |
| buildCounterResults++; |
| if (buildCounterResults < 3) { |
| unittest.expect(o.artifactManifest, unittest.equals('foo')); |
| checkTimeSpan(o.artifactTiming); |
| checkUnnamed1672(o.buildStepImages); |
| checkUnnamed1673(o.buildStepOutputs); |
| checkUnnamed1674(o.images); |
| unittest.expect(o.numArtifacts, unittest.equals('foo')); |
| } |
| buildCounterResults--; |
| } |
| |
| core.int buildCounterRetryBuildRequest = 0; |
| api.RetryBuildRequest buildRetryBuildRequest() { |
| var o = api.RetryBuildRequest(); |
| buildCounterRetryBuildRequest++; |
| if (buildCounterRetryBuildRequest < 3) { |
| o.id = 'foo'; |
| o.name = 'foo'; |
| o.projectId = 'foo'; |
| } |
| buildCounterRetryBuildRequest--; |
| return o; |
| } |
| |
| void checkRetryBuildRequest(api.RetryBuildRequest o) { |
| buildCounterRetryBuildRequest++; |
| if (buildCounterRetryBuildRequest < 3) { |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterRetryBuildRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed1675() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed1675(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 buildCounterSMTPDelivery = 0; |
| api.SMTPDelivery buildSMTPDelivery() { |
| var o = api.SMTPDelivery(); |
| buildCounterSMTPDelivery++; |
| if (buildCounterSMTPDelivery < 3) { |
| o.fromAddress = 'foo'; |
| o.password = buildNotifierSecretRef(); |
| o.port = 'foo'; |
| o.recipientAddresses = buildUnnamed1675(); |
| o.senderAddress = 'foo'; |
| o.server = 'foo'; |
| } |
| buildCounterSMTPDelivery--; |
| return o; |
| } |
| |
| void checkSMTPDelivery(api.SMTPDelivery o) { |
| buildCounterSMTPDelivery++; |
| if (buildCounterSMTPDelivery < 3) { |
| unittest.expect(o.fromAddress, unittest.equals('foo')); |
| checkNotifierSecretRef(o.password); |
| unittest.expect(o.port, unittest.equals('foo')); |
| checkUnnamed1675(o.recipientAddresses); |
| unittest.expect(o.senderAddress, unittest.equals('foo')); |
| unittest.expect(o.server, unittest.equals('foo')); |
| } |
| buildCounterSMTPDelivery--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed1676() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed1676(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 buildCounterSecret = 0; |
| api.Secret buildSecret() { |
| var o = api.Secret(); |
| buildCounterSecret++; |
| if (buildCounterSecret < 3) { |
| o.kmsKeyName = 'foo'; |
| o.secretEnv = buildUnnamed1676(); |
| } |
| buildCounterSecret--; |
| return o; |
| } |
| |
| void checkSecret(api.Secret o) { |
| buildCounterSecret++; |
| if (buildCounterSecret < 3) { |
| unittest.expect(o.kmsKeyName, unittest.equals('foo')); |
| checkUnnamed1676(o.secretEnv); |
| } |
| buildCounterSecret--; |
| } |
| |
| core.int buildCounterSlackDelivery = 0; |
| api.SlackDelivery buildSlackDelivery() { |
| var o = api.SlackDelivery(); |
| buildCounterSlackDelivery++; |
| if (buildCounterSlackDelivery < 3) { |
| o.webhookUri = buildNotifierSecretRef(); |
| } |
| buildCounterSlackDelivery--; |
| return o; |
| } |
| |
| void checkSlackDelivery(api.SlackDelivery o) { |
| buildCounterSlackDelivery++; |
| if (buildCounterSlackDelivery < 3) { |
| checkNotifierSecretRef(o.webhookUri); |
| } |
| buildCounterSlackDelivery--; |
| } |
| |
| core.int buildCounterSource = 0; |
| api.Source buildSource() { |
| var o = api.Source(); |
| buildCounterSource++; |
| if (buildCounterSource < 3) { |
| o.repoSource = buildRepoSource(); |
| o.storageSource = buildStorageSource(); |
| } |
| buildCounterSource--; |
| return o; |
| } |
| |
| void checkSource(api.Source o) { |
| buildCounterSource++; |
| if (buildCounterSource < 3) { |
| checkRepoSource(o.repoSource); |
| checkStorageSource(o.storageSource); |
| } |
| buildCounterSource--; |
| } |
| |
| core.Map<core.String, api.FileHashes> buildUnnamed1677() { |
| var o = <core.String, api.FileHashes>{}; |
| o['x'] = buildFileHashes(); |
| o['y'] = buildFileHashes(); |
| return o; |
| } |
| |
| void checkUnnamed1677(core.Map<core.String, api.FileHashes> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkFileHashes(o['x']); |
| checkFileHashes(o['y']); |
| } |
| |
| core.int buildCounterSourceProvenance = 0; |
| api.SourceProvenance buildSourceProvenance() { |
| var o = api.SourceProvenance(); |
| buildCounterSourceProvenance++; |
| if (buildCounterSourceProvenance < 3) { |
| o.fileHashes = buildUnnamed1677(); |
| o.resolvedRepoSource = buildRepoSource(); |
| o.resolvedStorageSource = buildStorageSource(); |
| } |
| buildCounterSourceProvenance--; |
| return o; |
| } |
| |
| void checkSourceProvenance(api.SourceProvenance o) { |
| buildCounterSourceProvenance++; |
| if (buildCounterSourceProvenance < 3) { |
| checkUnnamed1677(o.fileHashes); |
| checkRepoSource(o.resolvedRepoSource); |
| checkStorageSource(o.resolvedStorageSource); |
| } |
| buildCounterSourceProvenance--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed1678() { |
| var o = <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; |
| } |
| |
| void checkUnnamed1678(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted7 = (o['x']) as core.Map; |
| unittest.expect(casted7, unittest.hasLength(3)); |
| unittest.expect(casted7['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted7['bool'], unittest.equals(true)); |
| unittest.expect(casted7['string'], unittest.equals('foo')); |
| var casted8 = (o['y']) as core.Map; |
| unittest.expect(casted8, unittest.hasLength(3)); |
| unittest.expect(casted8['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted8['bool'], unittest.equals(true)); |
| unittest.expect(casted8['string'], unittest.equals('foo')); |
| } |
| |
| core.List<core.Map<core.String, core.Object>> buildUnnamed1679() { |
| var o = <core.Map<core.String, core.Object>>[]; |
| o.add(buildUnnamed1678()); |
| o.add(buildUnnamed1678()); |
| return o; |
| } |
| |
| void checkUnnamed1679(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed1678(o[0]); |
| checkUnnamed1678(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| var o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed1679(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code, unittest.equals(42)); |
| checkUnnamed1679(o.details); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.int buildCounterStorageSource = 0; |
| api.StorageSource buildStorageSource() { |
| var o = api.StorageSource(); |
| buildCounterStorageSource++; |
| if (buildCounterStorageSource < 3) { |
| o.bucket = 'foo'; |
| o.generation = 'foo'; |
| o.object = 'foo'; |
| } |
| buildCounterStorageSource--; |
| return o; |
| } |
| |
| void 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--; |
| } |
| |
| core.int buildCounterTimeSpan = 0; |
| api.TimeSpan buildTimeSpan() { |
| var o = api.TimeSpan(); |
| buildCounterTimeSpan++; |
| if (buildCounterTimeSpan < 3) { |
| o.endTime = 'foo'; |
| o.startTime = 'foo'; |
| } |
| buildCounterTimeSpan--; |
| return o; |
| } |
| |
| void checkTimeSpan(api.TimeSpan o) { |
| buildCounterTimeSpan++; |
| if (buildCounterTimeSpan < 3) { |
| unittest.expect(o.endTime, unittest.equals('foo')); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| } |
| buildCounterTimeSpan--; |
| } |
| |
| core.int buildCounterVolume = 0; |
| api.Volume buildVolume() { |
| var o = api.Volume(); |
| buildCounterVolume++; |
| if (buildCounterVolume < 3) { |
| o.name = 'foo'; |
| o.path = 'foo'; |
| } |
| buildCounterVolume--; |
| return o; |
| } |
| |
| void checkVolume(api.Volume o) { |
| buildCounterVolume++; |
| if (buildCounterVolume < 3) { |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.path, unittest.equals('foo')); |
| } |
| buildCounterVolume--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-ArtifactObjects', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildArtifactObjects(); |
| var od = api.ArtifactObjects.fromJson(o.toJson()); |
| checkArtifactObjects(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ArtifactResult', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildArtifactResult(); |
| var od = api.ArtifactResult.fromJson(o.toJson()); |
| checkArtifactResult(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Artifacts', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildArtifacts(); |
| var od = api.Artifacts.fromJson(o.toJson()); |
| checkArtifacts(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Build', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuild(); |
| var od = api.Build.fromJson(o.toJson()); |
| checkBuild(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BuildOperationMetadata', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuildOperationMetadata(); |
| var od = api.BuildOperationMetadata.fromJson(o.toJson()); |
| checkBuildOperationMetadata(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BuildOptions', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuildOptions(); |
| var od = api.BuildOptions.fromJson(o.toJson()); |
| checkBuildOptions(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BuildStep', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuildStep(); |
| var od = api.BuildStep.fromJson(o.toJson()); |
| checkBuildStep(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BuildTrigger', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuildTrigger(); |
| var od = api.BuildTrigger.fromJson(o.toJson()); |
| checkBuildTrigger(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-BuiltImage', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBuiltImage(); |
| var od = api.BuiltImage.fromJson(o.toJson()); |
| checkBuiltImage(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CancelBuildRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCancelBuildRequest(); |
| var od = api.CancelBuildRequest.fromJson(o.toJson()); |
| checkCancelBuildRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CancelOperationRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCancelOperationRequest(); |
| var od = api.CancelOperationRequest.fromJson(o.toJson()); |
| checkCancelOperationRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Empty', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildEmpty(); |
| var od = api.Empty.fromJson(o.toJson()); |
| checkEmpty(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-FileHashes', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildFileHashes(); |
| var od = api.FileHashes.fromJson(o.toJson()); |
| checkFileHashes(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GitHubEventsConfig', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildGitHubEventsConfig(); |
| var od = api.GitHubEventsConfig.fromJson(o.toJson()); |
| checkGitHubEventsConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-HTTPDelivery', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildHTTPDelivery(); |
| var od = api.HTTPDelivery.fromJson(o.toJson()); |
| checkHTTPDelivery(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Hash', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildHash(); |
| var od = api.Hash.fromJson(o.toJson()); |
| checkHash(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListBuildTriggersResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListBuildTriggersResponse(); |
| var od = api.ListBuildTriggersResponse.fromJson(o.toJson()); |
| checkListBuildTriggersResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListBuildsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListBuildsResponse(); |
| var od = api.ListBuildsResponse.fromJson(o.toJson()); |
| checkListBuildsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Notification', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotification(); |
| var od = api.Notification.fromJson(o.toJson()); |
| checkNotification(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NotifierConfig', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotifierConfig(); |
| var od = api.NotifierConfig.fromJson(o.toJson()); |
| checkNotifierConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NotifierMetadata', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotifierMetadata(); |
| var od = api.NotifierMetadata.fromJson(o.toJson()); |
| checkNotifierMetadata(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NotifierSecret', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotifierSecret(); |
| var od = api.NotifierSecret.fromJson(o.toJson()); |
| checkNotifierSecret(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NotifierSecretRef', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotifierSecretRef(); |
| var od = api.NotifierSecretRef.fromJson(o.toJson()); |
| checkNotifierSecretRef(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-NotifierSpec', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildNotifierSpec(); |
| var od = api.NotifierSpec.fromJson(o.toJson()); |
| checkNotifierSpec(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Operation', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildOperation(); |
| var od = api.Operation.fromJson(o.toJson()); |
| checkOperation(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PullRequestFilter', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildPullRequestFilter(); |
| var od = api.PullRequestFilter.fromJson(o.toJson()); |
| checkPullRequestFilter(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PushFilter', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildPushFilter(); |
| var od = api.PushFilter.fromJson(o.toJson()); |
| checkPushFilter(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RepoSource', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildRepoSource(); |
| var od = api.RepoSource.fromJson(o.toJson()); |
| checkRepoSource(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Results', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildResults(); |
| var od = api.Results.fromJson(o.toJson()); |
| checkResults(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RetryBuildRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildRetryBuildRequest(); |
| var od = api.RetryBuildRequest.fromJson(o.toJson()); |
| checkRetryBuildRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SMTPDelivery', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSMTPDelivery(); |
| var od = api.SMTPDelivery.fromJson(o.toJson()); |
| checkSMTPDelivery(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Secret', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSecret(); |
| var od = api.Secret.fromJson(o.toJson()); |
| checkSecret(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SlackDelivery', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSlackDelivery(); |
| var od = api.SlackDelivery.fromJson(o.toJson()); |
| checkSlackDelivery(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Source', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSource(); |
| var od = api.Source.fromJson(o.toJson()); |
| checkSource(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SourceProvenance', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSourceProvenance(); |
| var od = api.SourceProvenance.fromJson(o.toJson()); |
| checkSourceProvenance(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Status', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildStatus(); |
| var od = api.Status.fromJson(o.toJson()); |
| checkStatus(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-StorageSource', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildStorageSource(); |
| var od = api.StorageSource.fromJson(o.toJson()); |
| checkStorageSource(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TimeSpan', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildTimeSpan(); |
| var od = api.TimeSpan.fromJson(o.toJson()); |
| checkTimeSpan(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Volume', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildVolume(); |
| var od = api.Volume.fromJson(o.toJson()); |
| checkVolume(od); |
| }); |
| }); |
| |
| unittest.group('resource-OperationsResourceApi', () { |
| unittest.test('method--cancel', () { |
| var mock = HttpServerMock(); |
| api.OperationsResourceApi res = api.CloudbuildApi(mock).operations; |
| var arg_request = buildCancelOperationRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CancelOperationRequest.fromJson(json); |
| checkCancelOperationRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.OperationsResourceApi res = api.CloudbuildApi(mock).operations; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsBuildsResourceApi', () { |
| unittest.test('method--cancel', () { |
| var mock = HttpServerMock(); |
| api.ProjectsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.builds; |
| var arg_request = buildCancelBuildRequest(); |
| var arg_projectId = 'foo'; |
| var arg_id = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CancelBuildRequest.fromJson(json); |
| checkCancelBuildRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 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 = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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(buildBuild()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_projectId, arg_id, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuild(response); |
| }))); |
| }); |
| |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| api.ProjectsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.builds; |
| var arg_request = buildBuild(); |
| var arg_projectId = 'foo'; |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.Build.fromJson(json); |
| checkBuild(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 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 = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_projectId, |
| parent: arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.builds; |
| var arg_projectId = 'foo'; |
| var arg_id = 'foo'; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 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 = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildBuild()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_id, name: arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuild(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.builds; |
| var arg_projectId = 'foo'; |
| var arg_filter = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 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 = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListBuildsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| parent: arg_parent, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListBuildsResponse(response); |
| }))); |
| }); |
| |
| unittest.test('method--retry', () { |
| var mock = HttpServerMock(); |
| api.ProjectsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.builds; |
| var arg_request = buildRetryBuildRequest(); |
| var arg_projectId = 'foo'; |
| var arg_id = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.RetryBuildRequest.fromJson(json); |
| checkRetryBuildRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 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(':retry', 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 + 6), |
| unittest.equals(":retry")); |
| pathOffset += 6; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .retry(arg_request, arg_projectId, arg_id, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsBuildsResourceApi', () { |
| unittest.test('method--cancel', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.builds; |
| var arg_request = buildCancelBuildRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CancelBuildRequest.fromJson(json); |
| checkCancelBuildRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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(buildBuild()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuild(response); |
| }))); |
| }); |
| |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.builds; |
| var arg_request = buildBuild(); |
| var arg_parent = 'foo'; |
| var arg_projectId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.Build.fromJson(json); |
| checkBuild(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap["projectId"].first, unittest.equals(arg_projectId)); |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, |
| projectId: arg_projectId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.builds; |
| var arg_name = 'foo'; |
| var arg_id = 'foo'; |
| var arg_projectId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["id"].first, unittest.equals(arg_id)); |
| unittest.expect( |
| queryMap["projectId"].first, unittest.equals(arg_projectId)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildBuild()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, |
| id: arg_id, projectId: arg_projectId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuild(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.builds; |
| var arg_parent = 'foo'; |
| var arg_filter = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_projectId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| var keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect( |
| queryMap["projectId"].first, unittest.equals(arg_projectId)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListBuildsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| projectId: arg_projectId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListBuildsResponse(response); |
| }))); |
| }); |
| |
| unittest.test('method--retry', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsBuildsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.builds; |
| var arg_request = buildRetryBuildRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.RetryBuildRequest.fromJson(json); |
| checkRetryBuildRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .retry(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsOperationsResourceApi', () { |
| unittest.test('method--cancel', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsOperationsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.operations; |
| var arg_request = buildCancelOperationRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CancelOperationRequest.fromJson(json); |
| checkCancelOperationRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsOperationsResourceApi res = |
| api.CloudbuildApi(mock).projects.locations.operations; |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsTriggersResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_request = buildBuildTrigger(); |
| var arg_projectId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.BuildTrigger.fromJson(json); |
| checkBuildTrigger(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers', 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 + 9), |
| unittest.equals("/triggers")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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(buildBuildTrigger()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_projectId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuildTrigger(response); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_projectId = 'foo'; |
| var arg_triggerId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers/', 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 + 10), |
| unittest.equals("/triggers/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_triggerId')); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_projectId, arg_triggerId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_projectId = 'foo'; |
| var arg_triggerId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers/', 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 + 10), |
| unittest.equals("/triggers/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_triggerId')); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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(buildBuildTrigger()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_triggerId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuildTrigger(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_projectId = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers', 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 + 9), |
| unittest.equals("/triggers")); |
| pathOffset += 9; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListBuildTriggersResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListBuildTriggersResponse(response); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_request = buildBuildTrigger(); |
| var arg_projectId = 'foo'; |
| var arg_triggerId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.BuildTrigger.fromJson(json); |
| checkBuildTrigger(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers/', 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 + 10), |
| unittest.equals("/triggers/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals('$arg_triggerId')); |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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(buildBuildTrigger()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_projectId, arg_triggerId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkBuildTrigger(response); |
| }))); |
| }); |
| |
| unittest.test('method--run', () { |
| var mock = HttpServerMock(); |
| api.ProjectsTriggersResourceApi res = |
| api.CloudbuildApi(mock).projects.triggers; |
| var arg_request = buildRepoSource(); |
| var arg_projectId = 'foo'; |
| var arg_triggerId = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.RepoSource.fromJson(json); |
| checkRepoSource(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf('/triggers/', 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 + 10), |
| unittest.equals("/triggers/")); |
| pathOffset += 10; |
| index = path.indexOf(':run', pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals('$arg_triggerId')); |
| unittest.expect(path.substring(pathOffset, pathOffset + 4), |
| unittest.equals(":run")); |
| pathOffset += 4; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| 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 async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .run(arg_request, arg_projectId, arg_triggerId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| } |