| // ignore_for_file: camel_case_types |
| // ignore_for_file: cascade_invocations |
| // ignore_for_file: comment_references |
| // 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: prefer_const_declarations |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: 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: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/workflowexecutions/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.int buildCounterCancelExecutionRequest = 0; |
| api.CancelExecutionRequest buildCancelExecutionRequest() { |
| final o = api.CancelExecutionRequest(); |
| buildCounterCancelExecutionRequest++; |
| if (buildCounterCancelExecutionRequest < 3) {} |
| buildCounterCancelExecutionRequest--; |
| return o; |
| } |
| |
| void checkCancelExecutionRequest(api.CancelExecutionRequest o) { |
| buildCounterCancelExecutionRequest++; |
| if (buildCounterCancelExecutionRequest < 3) {} |
| buildCounterCancelExecutionRequest--; |
| } |
| |
| core.int buildCounterError = 0; |
| api.Error buildError() { |
| final o = api.Error(); |
| buildCounterError++; |
| if (buildCounterError < 3) { |
| o.context = 'foo'; |
| o.payload = 'foo'; |
| o.stackTrace = buildStackTrace(); |
| } |
| buildCounterError--; |
| return o; |
| } |
| |
| void checkError(api.Error o) { |
| buildCounterError++; |
| if (buildCounterError < 3) { |
| unittest.expect( |
| o.context!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.payload!, |
| unittest.equals('foo'), |
| ); |
| checkStackTrace(o.stackTrace!); |
| } |
| buildCounterError--; |
| } |
| |
| core.int buildCounterExecution = 0; |
| api.Execution buildExecution() { |
| final o = api.Execution(); |
| buildCounterExecution++; |
| if (buildCounterExecution < 3) { |
| o.argument = 'foo'; |
| o.endTime = 'foo'; |
| o.error = buildError(); |
| o.name = 'foo'; |
| o.result = 'foo'; |
| o.startTime = 'foo'; |
| o.state = 'foo'; |
| o.workflowRevisionId = 'foo'; |
| } |
| buildCounterExecution--; |
| return o; |
| } |
| |
| void checkExecution(api.Execution o) { |
| buildCounterExecution++; |
| if (buildCounterExecution < 3) { |
| unittest.expect( |
| o.argument!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.endTime!, |
| unittest.equals('foo'), |
| ); |
| checkError(o.error!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.result!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.startTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.state!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.workflowRevisionId!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterExecution--; |
| } |
| |
| core.List<api.Execution> buildUnnamed6142() => [ |
| buildExecution(), |
| buildExecution(), |
| ]; |
| |
| void checkUnnamed6142(core.List<api.Execution> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkExecution(o[0]); |
| checkExecution(o[1]); |
| } |
| |
| core.int buildCounterListExecutionsResponse = 0; |
| api.ListExecutionsResponse buildListExecutionsResponse() { |
| final o = api.ListExecutionsResponse(); |
| buildCounterListExecutionsResponse++; |
| if (buildCounterListExecutionsResponse < 3) { |
| o.executions = buildUnnamed6142(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListExecutionsResponse--; |
| return o; |
| } |
| |
| void checkListExecutionsResponse(api.ListExecutionsResponse o) { |
| buildCounterListExecutionsResponse++; |
| if (buildCounterListExecutionsResponse < 3) { |
| checkUnnamed6142(o.executions!); |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterListExecutionsResponse--; |
| } |
| |
| core.int buildCounterPosition = 0; |
| api.Position buildPosition() { |
| final o = api.Position(); |
| buildCounterPosition++; |
| if (buildCounterPosition < 3) { |
| o.column = 'foo'; |
| o.length = 'foo'; |
| o.line = 'foo'; |
| } |
| buildCounterPosition--; |
| return o; |
| } |
| |
| void checkPosition(api.Position o) { |
| buildCounterPosition++; |
| if (buildCounterPosition < 3) { |
| unittest.expect( |
| o.column!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.length!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.line!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterPosition--; |
| } |
| |
| core.List<api.StackTraceElement> buildUnnamed6143() => [ |
| buildStackTraceElement(), |
| buildStackTraceElement(), |
| ]; |
| |
| void checkUnnamed6143(core.List<api.StackTraceElement> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkStackTraceElement(o[0]); |
| checkStackTraceElement(o[1]); |
| } |
| |
| core.int buildCounterStackTrace = 0; |
| api.StackTrace buildStackTrace() { |
| final o = api.StackTrace(); |
| buildCounterStackTrace++; |
| if (buildCounterStackTrace < 3) { |
| o.elements = buildUnnamed6143(); |
| } |
| buildCounterStackTrace--; |
| return o; |
| } |
| |
| void checkStackTrace(api.StackTrace o) { |
| buildCounterStackTrace++; |
| if (buildCounterStackTrace < 3) { |
| checkUnnamed6143(o.elements!); |
| } |
| buildCounterStackTrace--; |
| } |
| |
| core.int buildCounterStackTraceElement = 0; |
| api.StackTraceElement buildStackTraceElement() { |
| final o = api.StackTraceElement(); |
| buildCounterStackTraceElement++; |
| if (buildCounterStackTraceElement < 3) { |
| o.position = buildPosition(); |
| o.routine = 'foo'; |
| o.step = 'foo'; |
| } |
| buildCounterStackTraceElement--; |
| return o; |
| } |
| |
| void checkStackTraceElement(api.StackTraceElement o) { |
| buildCounterStackTraceElement++; |
| if (buildCounterStackTraceElement < 3) { |
| checkPosition(o.position!); |
| unittest.expect( |
| o.routine!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.step!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterStackTraceElement--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-CancelExecutionRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildCancelExecutionRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.CancelExecutionRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkCancelExecutionRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Error', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildError(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Error.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkError(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Execution', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildExecution(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Execution.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkExecution(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListExecutionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListExecutionsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListExecutionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListExecutionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Position', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPosition(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Position.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkPosition(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-StackTrace', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildStackTrace(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.StackTrace.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkStackTrace(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-StackTraceElement', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildStackTraceElement(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.StackTraceElement.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkStackTraceElement(od); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsWorkflowsExecutionsResource', () { |
| unittest.test('method--cancel', () async { |
| final mock = HttpServerMock(); |
| final res = api.WorkflowExecutionsApi(mock) |
| .projects |
| .locations |
| .workflows |
| .executions; |
| final arg_request = buildCancelExecutionRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.CancelExecutionRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkCancelExecutionRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildExecution()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.cancel(arg_request, arg_name, $fields: arg_$fields); |
| checkExecution(response as api.Execution); |
| }); |
| |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.WorkflowExecutionsApi(mock) |
| .projects |
| .locations |
| .workflows |
| .executions; |
| final arg_request = buildExecution(); |
| final arg_parent = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = |
| api.Execution.fromJson(json as core.Map<core.String, core.dynamic>); |
| checkExecution(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildExecution()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.create(arg_request, arg_parent, $fields: arg_$fields); |
| checkExecution(response as api.Execution); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.WorkflowExecutionsApi(mock) |
| .projects |
| .locations |
| .workflows |
| .executions; |
| final arg_name = 'foo'; |
| final arg_view = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['view']!.first, |
| unittest.equals(arg_view), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildExecution()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.get(arg_name, view: arg_view, $fields: arg_$fields); |
| checkExecution(response as api.Execution); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.WorkflowExecutionsApi(mock) |
| .projects |
| .locations |
| .workflows |
| .executions; |
| final arg_parent = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_view = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['view']!.first, |
| unittest.equals(arg_view), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListExecutionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| view: arg_view, |
| $fields: arg_$fields); |
| checkListExecutionsResponse(response as api.ListExecutionsResponse); |
| }); |
| }); |
| } |