| // 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.cloudtasks.v2.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/cloudtasks/v2.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.Map<core.String, core.String> buildUnnamed5196() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed5196(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 buildCounterAppEngineHttpRequest = 0; |
| api.AppEngineHttpRequest buildAppEngineHttpRequest() { |
| var o = api.AppEngineHttpRequest(); |
| buildCounterAppEngineHttpRequest++; |
| if (buildCounterAppEngineHttpRequest < 3) { |
| o.appEngineRouting = buildAppEngineRouting(); |
| o.body = 'foo'; |
| o.headers = buildUnnamed5196(); |
| o.httpMethod = 'foo'; |
| o.relativeUri = 'foo'; |
| } |
| buildCounterAppEngineHttpRequest--; |
| return o; |
| } |
| |
| void checkAppEngineHttpRequest(api.AppEngineHttpRequest o) { |
| buildCounterAppEngineHttpRequest++; |
| if (buildCounterAppEngineHttpRequest < 3) { |
| checkAppEngineRouting(o.appEngineRouting); |
| unittest.expect(o.body, unittest.equals('foo')); |
| checkUnnamed5196(o.headers); |
| unittest.expect(o.httpMethod, unittest.equals('foo')); |
| unittest.expect(o.relativeUri, unittest.equals('foo')); |
| } |
| buildCounterAppEngineHttpRequest--; |
| } |
| |
| core.int buildCounterAppEngineRouting = 0; |
| api.AppEngineRouting buildAppEngineRouting() { |
| var o = api.AppEngineRouting(); |
| buildCounterAppEngineRouting++; |
| if (buildCounterAppEngineRouting < 3) { |
| o.host = 'foo'; |
| o.instance = 'foo'; |
| o.service = 'foo'; |
| o.version = 'foo'; |
| } |
| buildCounterAppEngineRouting--; |
| return o; |
| } |
| |
| void checkAppEngineRouting(api.AppEngineRouting o) { |
| buildCounterAppEngineRouting++; |
| if (buildCounterAppEngineRouting < 3) { |
| unittest.expect(o.host, unittest.equals('foo')); |
| unittest.expect(o.instance, unittest.equals('foo')); |
| unittest.expect(o.service, unittest.equals('foo')); |
| unittest.expect(o.version, unittest.equals('foo')); |
| } |
| buildCounterAppEngineRouting--; |
| } |
| |
| core.int buildCounterAttempt = 0; |
| api.Attempt buildAttempt() { |
| var o = api.Attempt(); |
| buildCounterAttempt++; |
| if (buildCounterAttempt < 3) { |
| o.dispatchTime = 'foo'; |
| o.responseStatus = buildStatus(); |
| o.responseTime = 'foo'; |
| o.scheduleTime = 'foo'; |
| } |
| buildCounterAttempt--; |
| return o; |
| } |
| |
| void checkAttempt(api.Attempt o) { |
| buildCounterAttempt++; |
| if (buildCounterAttempt < 3) { |
| unittest.expect(o.dispatchTime, unittest.equals('foo')); |
| checkStatus(o.responseStatus); |
| unittest.expect(o.responseTime, unittest.equals('foo')); |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| } |
| buildCounterAttempt--; |
| } |
| |
| core.List<core.String> buildUnnamed5197() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5197(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 buildCounterBinding = 0; |
| api.Binding buildBinding() { |
| var o = api.Binding(); |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| o.bindingId = 'foo'; |
| o.condition = buildExpr(); |
| o.members = buildUnnamed5197(); |
| o.role = 'foo'; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| void checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| unittest.expect(o.bindingId, unittest.equals('foo')); |
| checkExpr(o.condition); |
| checkUnnamed5197(o.members); |
| unittest.expect(o.role, unittest.equals('foo')); |
| } |
| buildCounterBinding--; |
| } |
| |
| core.int buildCounterCreateTaskRequest = 0; |
| api.CreateTaskRequest buildCreateTaskRequest() { |
| var o = api.CreateTaskRequest(); |
| buildCounterCreateTaskRequest++; |
| if (buildCounterCreateTaskRequest < 3) { |
| o.responseView = 'foo'; |
| o.task = buildTask(); |
| } |
| buildCounterCreateTaskRequest--; |
| return o; |
| } |
| |
| void checkCreateTaskRequest(api.CreateTaskRequest o) { |
| buildCounterCreateTaskRequest++; |
| if (buildCounterCreateTaskRequest < 3) { |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| checkTask(o.task); |
| } |
| buildCounterCreateTaskRequest--; |
| } |
| |
| 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.int buildCounterExpr = 0; |
| api.Expr buildExpr() { |
| var o = api.Expr(); |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| o.description = 'foo'; |
| o.expression = 'foo'; |
| o.location = 'foo'; |
| o.title = 'foo'; |
| } |
| buildCounterExpr--; |
| return o; |
| } |
| |
| void checkExpr(api.Expr o) { |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.expression, unittest.equals('foo')); |
| unittest.expect(o.location, unittest.equals('foo')); |
| unittest.expect(o.title, unittest.equals('foo')); |
| } |
| buildCounterExpr--; |
| } |
| |
| core.int buildCounterGetIamPolicyRequest = 0; |
| api.GetIamPolicyRequest buildGetIamPolicyRequest() { |
| var o = api.GetIamPolicyRequest(); |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) { |
| o.options = buildGetPolicyOptions(); |
| } |
| buildCounterGetIamPolicyRequest--; |
| return o; |
| } |
| |
| void checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) { |
| checkGetPolicyOptions(o.options); |
| } |
| buildCounterGetIamPolicyRequest--; |
| } |
| |
| core.int buildCounterGetPolicyOptions = 0; |
| api.GetPolicyOptions buildGetPolicyOptions() { |
| var o = api.GetPolicyOptions(); |
| buildCounterGetPolicyOptions++; |
| if (buildCounterGetPolicyOptions < 3) { |
| o.requestedPolicyVersion = 42; |
| } |
| buildCounterGetPolicyOptions--; |
| return o; |
| } |
| |
| void checkGetPolicyOptions(api.GetPolicyOptions o) { |
| buildCounterGetPolicyOptions++; |
| if (buildCounterGetPolicyOptions < 3) { |
| unittest.expect(o.requestedPolicyVersion, unittest.equals(42)); |
| } |
| buildCounterGetPolicyOptions--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed5198() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed5198(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 buildCounterHttpRequest = 0; |
| api.HttpRequest buildHttpRequest() { |
| var o = api.HttpRequest(); |
| buildCounterHttpRequest++; |
| if (buildCounterHttpRequest < 3) { |
| o.body = 'foo'; |
| o.headers = buildUnnamed5198(); |
| o.httpMethod = 'foo'; |
| o.oauthToken = buildOAuthToken(); |
| o.oidcToken = buildOidcToken(); |
| o.url = 'foo'; |
| } |
| buildCounterHttpRequest--; |
| return o; |
| } |
| |
| void checkHttpRequest(api.HttpRequest o) { |
| buildCounterHttpRequest++; |
| if (buildCounterHttpRequest < 3) { |
| unittest.expect(o.body, unittest.equals('foo')); |
| checkUnnamed5198(o.headers); |
| unittest.expect(o.httpMethod, unittest.equals('foo')); |
| checkOAuthToken(o.oauthToken); |
| checkOidcToken(o.oidcToken); |
| unittest.expect(o.url, unittest.equals('foo')); |
| } |
| buildCounterHttpRequest--; |
| } |
| |
| core.List<api.Location> buildUnnamed5199() { |
| var o = <api.Location>[]; |
| o.add(buildLocation()); |
| o.add(buildLocation()); |
| return o; |
| } |
| |
| void checkUnnamed5199(core.List<api.Location> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLocation(o[0]); |
| checkLocation(o[1]); |
| } |
| |
| core.int buildCounterListLocationsResponse = 0; |
| api.ListLocationsResponse buildListLocationsResponse() { |
| var o = api.ListLocationsResponse(); |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| o.locations = buildUnnamed5199(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| void checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed5199(o.locations); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| core.List<api.Queue> buildUnnamed5200() { |
| var o = <api.Queue>[]; |
| o.add(buildQueue()); |
| o.add(buildQueue()); |
| return o; |
| } |
| |
| void checkUnnamed5200(core.List<api.Queue> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkQueue(o[0]); |
| checkQueue(o[1]); |
| } |
| |
| core.int buildCounterListQueuesResponse = 0; |
| api.ListQueuesResponse buildListQueuesResponse() { |
| var o = api.ListQueuesResponse(); |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.queues = buildUnnamed5200(); |
| } |
| buildCounterListQueuesResponse--; |
| return o; |
| } |
| |
| void checkListQueuesResponse(api.ListQueuesResponse o) { |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed5200(o.queues); |
| } |
| buildCounterListQueuesResponse--; |
| } |
| |
| core.List<api.Task> buildUnnamed5201() { |
| var o = <api.Task>[]; |
| o.add(buildTask()); |
| o.add(buildTask()); |
| return o; |
| } |
| |
| void checkUnnamed5201(core.List<api.Task> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTask(o[0]); |
| checkTask(o[1]); |
| } |
| |
| core.int buildCounterListTasksResponse = 0; |
| api.ListTasksResponse buildListTasksResponse() { |
| var o = api.ListTasksResponse(); |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.tasks = buildUnnamed5201(); |
| } |
| buildCounterListTasksResponse--; |
| return o; |
| } |
| |
| void checkListTasksResponse(api.ListTasksResponse o) { |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed5201(o.tasks); |
| } |
| buildCounterListTasksResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed5202() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed5202(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.Map<core.String, core.Object> buildUnnamed5203() { |
| 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 checkUnnamed5203(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 buildCounterLocation = 0; |
| api.Location buildLocation() { |
| var o = api.Location(); |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| o.displayName = 'foo'; |
| o.labels = buildUnnamed5202(); |
| o.locationId = 'foo'; |
| o.metadata = buildUnnamed5203(); |
| o.name = 'foo'; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| void checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| unittest.expect(o.displayName, unittest.equals('foo')); |
| checkUnnamed5202(o.labels); |
| unittest.expect(o.locationId, unittest.equals('foo')); |
| checkUnnamed5203(o.metadata); |
| unittest.expect(o.name, unittest.equals('foo')); |
| } |
| buildCounterLocation--; |
| } |
| |
| core.int buildCounterOAuthToken = 0; |
| api.OAuthToken buildOAuthToken() { |
| var o = api.OAuthToken(); |
| buildCounterOAuthToken++; |
| if (buildCounterOAuthToken < 3) { |
| o.scope = 'foo'; |
| o.serviceAccountEmail = 'foo'; |
| } |
| buildCounterOAuthToken--; |
| return o; |
| } |
| |
| void checkOAuthToken(api.OAuthToken o) { |
| buildCounterOAuthToken++; |
| if (buildCounterOAuthToken < 3) { |
| unittest.expect(o.scope, unittest.equals('foo')); |
| unittest.expect(o.serviceAccountEmail, unittest.equals('foo')); |
| } |
| buildCounterOAuthToken--; |
| } |
| |
| core.int buildCounterOidcToken = 0; |
| api.OidcToken buildOidcToken() { |
| var o = api.OidcToken(); |
| buildCounterOidcToken++; |
| if (buildCounterOidcToken < 3) { |
| o.audience = 'foo'; |
| o.serviceAccountEmail = 'foo'; |
| } |
| buildCounterOidcToken--; |
| return o; |
| } |
| |
| void checkOidcToken(api.OidcToken o) { |
| buildCounterOidcToken++; |
| if (buildCounterOidcToken < 3) { |
| unittest.expect(o.audience, unittest.equals('foo')); |
| unittest.expect(o.serviceAccountEmail, unittest.equals('foo')); |
| } |
| buildCounterOidcToken--; |
| } |
| |
| core.int buildCounterPauseQueueRequest = 0; |
| api.PauseQueueRequest buildPauseQueueRequest() { |
| var o = api.PauseQueueRequest(); |
| buildCounterPauseQueueRequest++; |
| if (buildCounterPauseQueueRequest < 3) {} |
| buildCounterPauseQueueRequest--; |
| return o; |
| } |
| |
| void checkPauseQueueRequest(api.PauseQueueRequest o) { |
| buildCounterPauseQueueRequest++; |
| if (buildCounterPauseQueueRequest < 3) {} |
| buildCounterPauseQueueRequest--; |
| } |
| |
| core.List<api.Binding> buildUnnamed5204() { |
| var o = <api.Binding>[]; |
| o.add(buildBinding()); |
| o.add(buildBinding()); |
| return o; |
| } |
| |
| void checkUnnamed5204(core.List<api.Binding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBinding(o[0]); |
| checkBinding(o[1]); |
| } |
| |
| core.int buildCounterPolicy = 0; |
| api.Policy buildPolicy() { |
| var o = api.Policy(); |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| o.bindings = buildUnnamed5204(); |
| o.etag = 'foo'; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| void checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed5204(o.bindings); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.version, unittest.equals(42)); |
| } |
| buildCounterPolicy--; |
| } |
| |
| core.int buildCounterPurgeQueueRequest = 0; |
| api.PurgeQueueRequest buildPurgeQueueRequest() { |
| var o = api.PurgeQueueRequest(); |
| buildCounterPurgeQueueRequest++; |
| if (buildCounterPurgeQueueRequest < 3) {} |
| buildCounterPurgeQueueRequest--; |
| return o; |
| } |
| |
| void checkPurgeQueueRequest(api.PurgeQueueRequest o) { |
| buildCounterPurgeQueueRequest++; |
| if (buildCounterPurgeQueueRequest < 3) {} |
| buildCounterPurgeQueueRequest--; |
| } |
| |
| core.int buildCounterQueue = 0; |
| api.Queue buildQueue() { |
| var o = api.Queue(); |
| buildCounterQueue++; |
| if (buildCounterQueue < 3) { |
| o.appEngineRoutingOverride = buildAppEngineRouting(); |
| o.name = 'foo'; |
| o.purgeTime = 'foo'; |
| o.rateLimits = buildRateLimits(); |
| o.retryConfig = buildRetryConfig(); |
| o.stackdriverLoggingConfig = buildStackdriverLoggingConfig(); |
| o.state = 'foo'; |
| } |
| buildCounterQueue--; |
| return o; |
| } |
| |
| void checkQueue(api.Queue o) { |
| buildCounterQueue++; |
| if (buildCounterQueue < 3) { |
| checkAppEngineRouting(o.appEngineRoutingOverride); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.purgeTime, unittest.equals('foo')); |
| checkRateLimits(o.rateLimits); |
| checkRetryConfig(o.retryConfig); |
| checkStackdriverLoggingConfig(o.stackdriverLoggingConfig); |
| unittest.expect(o.state, unittest.equals('foo')); |
| } |
| buildCounterQueue--; |
| } |
| |
| core.int buildCounterRateLimits = 0; |
| api.RateLimits buildRateLimits() { |
| var o = api.RateLimits(); |
| buildCounterRateLimits++; |
| if (buildCounterRateLimits < 3) { |
| o.maxBurstSize = 42; |
| o.maxConcurrentDispatches = 42; |
| o.maxDispatchesPerSecond = 42.0; |
| } |
| buildCounterRateLimits--; |
| return o; |
| } |
| |
| void checkRateLimits(api.RateLimits o) { |
| buildCounterRateLimits++; |
| if (buildCounterRateLimits < 3) { |
| unittest.expect(o.maxBurstSize, unittest.equals(42)); |
| unittest.expect(o.maxConcurrentDispatches, unittest.equals(42)); |
| unittest.expect(o.maxDispatchesPerSecond, unittest.equals(42.0)); |
| } |
| buildCounterRateLimits--; |
| } |
| |
| core.int buildCounterResumeQueueRequest = 0; |
| api.ResumeQueueRequest buildResumeQueueRequest() { |
| var o = api.ResumeQueueRequest(); |
| buildCounterResumeQueueRequest++; |
| if (buildCounterResumeQueueRequest < 3) {} |
| buildCounterResumeQueueRequest--; |
| return o; |
| } |
| |
| void checkResumeQueueRequest(api.ResumeQueueRequest o) { |
| buildCounterResumeQueueRequest++; |
| if (buildCounterResumeQueueRequest < 3) {} |
| buildCounterResumeQueueRequest--; |
| } |
| |
| core.int buildCounterRetryConfig = 0; |
| api.RetryConfig buildRetryConfig() { |
| var o = api.RetryConfig(); |
| buildCounterRetryConfig++; |
| if (buildCounterRetryConfig < 3) { |
| o.maxAttempts = 42; |
| o.maxBackoff = 'foo'; |
| o.maxDoublings = 42; |
| o.maxRetryDuration = 'foo'; |
| o.minBackoff = 'foo'; |
| } |
| buildCounterRetryConfig--; |
| return o; |
| } |
| |
| void checkRetryConfig(api.RetryConfig o) { |
| buildCounterRetryConfig++; |
| if (buildCounterRetryConfig < 3) { |
| unittest.expect(o.maxAttempts, unittest.equals(42)); |
| unittest.expect(o.maxBackoff, unittest.equals('foo')); |
| unittest.expect(o.maxDoublings, unittest.equals(42)); |
| unittest.expect(o.maxRetryDuration, unittest.equals('foo')); |
| unittest.expect(o.minBackoff, unittest.equals('foo')); |
| } |
| buildCounterRetryConfig--; |
| } |
| |
| core.int buildCounterRunTaskRequest = 0; |
| api.RunTaskRequest buildRunTaskRequest() { |
| var o = api.RunTaskRequest(); |
| buildCounterRunTaskRequest++; |
| if (buildCounterRunTaskRequest < 3) { |
| o.responseView = 'foo'; |
| } |
| buildCounterRunTaskRequest--; |
| return o; |
| } |
| |
| void checkRunTaskRequest(api.RunTaskRequest o) { |
| buildCounterRunTaskRequest++; |
| if (buildCounterRunTaskRequest < 3) { |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| } |
| buildCounterRunTaskRequest--; |
| } |
| |
| core.int buildCounterSetIamPolicyRequest = 0; |
| api.SetIamPolicyRequest buildSetIamPolicyRequest() { |
| var o = api.SetIamPolicyRequest(); |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| o.policy = buildPolicy(); |
| } |
| buildCounterSetIamPolicyRequest--; |
| return o; |
| } |
| |
| void checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| checkPolicy(o.policy); |
| } |
| buildCounterSetIamPolicyRequest--; |
| } |
| |
| core.int buildCounterStackdriverLoggingConfig = 0; |
| api.StackdriverLoggingConfig buildStackdriverLoggingConfig() { |
| var o = api.StackdriverLoggingConfig(); |
| buildCounterStackdriverLoggingConfig++; |
| if (buildCounterStackdriverLoggingConfig < 3) { |
| o.samplingRatio = 42.0; |
| } |
| buildCounterStackdriverLoggingConfig--; |
| return o; |
| } |
| |
| void checkStackdriverLoggingConfig(api.StackdriverLoggingConfig o) { |
| buildCounterStackdriverLoggingConfig++; |
| if (buildCounterStackdriverLoggingConfig < 3) { |
| unittest.expect(o.samplingRatio, unittest.equals(42.0)); |
| } |
| buildCounterStackdriverLoggingConfig--; |
| } |
| |
| core.Map<core.String, core.Object> buildUnnamed5205() { |
| 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 checkUnnamed5205(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.List<core.Map<core.String, core.Object>> buildUnnamed5206() { |
| var o = <core.Map<core.String, core.Object>>[]; |
| o.add(buildUnnamed5205()); |
| o.add(buildUnnamed5205()); |
| return o; |
| } |
| |
| void checkUnnamed5206(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed5205(o[0]); |
| checkUnnamed5205(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| var o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed5206(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code, unittest.equals(42)); |
| checkUnnamed5206(o.details); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.int buildCounterTask = 0; |
| api.Task buildTask() { |
| var o = api.Task(); |
| buildCounterTask++; |
| if (buildCounterTask < 3) { |
| o.appEngineHttpRequest = buildAppEngineHttpRequest(); |
| o.createTime = 'foo'; |
| o.dispatchCount = 42; |
| o.dispatchDeadline = 'foo'; |
| o.firstAttempt = buildAttempt(); |
| o.httpRequest = buildHttpRequest(); |
| o.lastAttempt = buildAttempt(); |
| o.name = 'foo'; |
| o.responseCount = 42; |
| o.scheduleTime = 'foo'; |
| o.view = 'foo'; |
| } |
| buildCounterTask--; |
| return o; |
| } |
| |
| void checkTask(api.Task o) { |
| buildCounterTask++; |
| if (buildCounterTask < 3) { |
| checkAppEngineHttpRequest(o.appEngineHttpRequest); |
| unittest.expect(o.createTime, unittest.equals('foo')); |
| unittest.expect(o.dispatchCount, unittest.equals(42)); |
| unittest.expect(o.dispatchDeadline, unittest.equals('foo')); |
| checkAttempt(o.firstAttempt); |
| checkHttpRequest(o.httpRequest); |
| checkAttempt(o.lastAttempt); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.responseCount, unittest.equals(42)); |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| unittest.expect(o.view, unittest.equals('foo')); |
| } |
| buildCounterTask--; |
| } |
| |
| core.List<core.String> buildUnnamed5207() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5207(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 buildCounterTestIamPermissionsRequest = 0; |
| api.TestIamPermissionsRequest buildTestIamPermissionsRequest() { |
| var o = api.TestIamPermissionsRequest(); |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| o.permissions = buildUnnamed5207(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed5207(o.permissions); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed5208() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed5208(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 buildCounterTestIamPermissionsResponse = 0; |
| api.TestIamPermissionsResponse buildTestIamPermissionsResponse() { |
| var o = api.TestIamPermissionsResponse(); |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| o.permissions = buildUnnamed5208(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed5208(o.permissions); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-AppEngineHttpRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildAppEngineHttpRequest(); |
| var od = api.AppEngineHttpRequest.fromJson(o.toJson()); |
| checkAppEngineHttpRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AppEngineRouting', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildAppEngineRouting(); |
| var od = api.AppEngineRouting.fromJson(o.toJson()); |
| checkAppEngineRouting(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Attempt', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildAttempt(); |
| var od = api.Attempt.fromJson(o.toJson()); |
| checkAttempt(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Binding', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildBinding(); |
| var od = api.Binding.fromJson(o.toJson()); |
| checkBinding(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CreateTaskRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildCreateTaskRequest(); |
| var od = api.CreateTaskRequest.fromJson(o.toJson()); |
| checkCreateTaskRequest(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-Expr', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildExpr(); |
| var od = api.Expr.fromJson(o.toJson()); |
| checkExpr(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildGetIamPolicyRequest(); |
| var od = api.GetIamPolicyRequest.fromJson(o.toJson()); |
| checkGetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetPolicyOptions', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildGetPolicyOptions(); |
| var od = api.GetPolicyOptions.fromJson(o.toJson()); |
| checkGetPolicyOptions(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-HttpRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildHttpRequest(); |
| var od = api.HttpRequest.fromJson(o.toJson()); |
| checkHttpRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListLocationsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListLocationsResponse(); |
| var od = api.ListLocationsResponse.fromJson(o.toJson()); |
| checkListLocationsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListQueuesResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListQueuesResponse(); |
| var od = api.ListQueuesResponse.fromJson(o.toJson()); |
| checkListQueuesResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListTasksResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildListTasksResponse(); |
| var od = api.ListTasksResponse.fromJson(o.toJson()); |
| checkListTasksResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Location', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildLocation(); |
| var od = api.Location.fromJson(o.toJson()); |
| checkLocation(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OAuthToken', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildOAuthToken(); |
| var od = api.OAuthToken.fromJson(o.toJson()); |
| checkOAuthToken(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OidcToken', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildOidcToken(); |
| var od = api.OidcToken.fromJson(o.toJson()); |
| checkOidcToken(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PauseQueueRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildPauseQueueRequest(); |
| var od = api.PauseQueueRequest.fromJson(o.toJson()); |
| checkPauseQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Policy', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildPolicy(); |
| var od = api.Policy.fromJson(o.toJson()); |
| checkPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PurgeQueueRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildPurgeQueueRequest(); |
| var od = api.PurgeQueueRequest.fromJson(o.toJson()); |
| checkPurgeQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Queue', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildQueue(); |
| var od = api.Queue.fromJson(o.toJson()); |
| checkQueue(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RateLimits', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildRateLimits(); |
| var od = api.RateLimits.fromJson(o.toJson()); |
| checkRateLimits(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ResumeQueueRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildResumeQueueRequest(); |
| var od = api.ResumeQueueRequest.fromJson(o.toJson()); |
| checkResumeQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RetryConfig', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildRetryConfig(); |
| var od = api.RetryConfig.fromJson(o.toJson()); |
| checkRetryConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RunTaskRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildRunTaskRequest(); |
| var od = api.RunTaskRequest.fromJson(o.toJson()); |
| checkRunTaskRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildSetIamPolicyRequest(); |
| var od = api.SetIamPolicyRequest.fromJson(o.toJson()); |
| checkSetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-StackdriverLoggingConfig', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildStackdriverLoggingConfig(); |
| var od = api.StackdriverLoggingConfig.fromJson(o.toJson()); |
| checkStackdriverLoggingConfig(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-Task', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildTask(); |
| var od = api.Task.fromJson(o.toJson()); |
| checkTask(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsRequest', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildTestIamPermissionsRequest(); |
| var od = api.TestIamPermissionsRequest.fromJson(o.toJson()); |
| checkTestIamPermissionsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsResponse', () { |
| unittest.test('to-json--from-json', () { |
| var o = buildTestIamPermissionsResponse(); |
| var od = api.TestIamPermissionsResponse.fromJson(o.toJson()); |
| checkTestIamPermissionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsResourceApi', () { |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsResourceApi res = |
| api.CloudtasksApi(mock).projects.locations; |
| 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("v2/")); |
| 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(buildLocation()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkLocation(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsResourceApi res = |
| api.CloudtasksApi(mock).projects.locations; |
| var arg_name = 'foo'; |
| var arg_filter = '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 + 3), unittest.equals("v2/")); |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListLocationsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_name, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListLocationsResponse(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsQueuesResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildQueue(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.Queue.fromJson(json); |
| checkQueue(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("v2/")); |
| 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(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| 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("v2/")); |
| 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 |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| 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("v2/")); |
| 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(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--getIamPolicy', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildGetIamPolicyRequest(); |
| var arg_resource = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.GetIamPolicyRequest.fromJson(json); |
| checkGetIamPolicyRequest(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("v2/")); |
| 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(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .getIamPolicy(arg_request, arg_resource, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkPolicy(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_parent = 'foo'; |
| var arg_filter = '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 + 3), unittest.equals("v2/")); |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListQueuesResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListQueuesResponse(response); |
| }))); |
| }); |
| |
| unittest.test('method--patch', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildQueue(); |
| var arg_name = 'foo'; |
| var arg_updateMask = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.Queue.fromJson(json); |
| checkQueue(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("v2/")); |
| 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["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--pause', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildPauseQueueRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.PauseQueueRequest.fromJson(json); |
| checkPauseQueueRequest(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("v2/")); |
| 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(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .pause(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--purge', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildPurgeQueueRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.PurgeQueueRequest.fromJson(json); |
| checkPurgeQueueRequest(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("v2/")); |
| 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(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .purge(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--resume', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildResumeQueueRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.ResumeQueueRequest.fromJson(json); |
| checkResumeQueueRequest(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("v2/")); |
| 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(buildQueue()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .resume(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test('method--setIamPolicy', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildSetIamPolicyRequest(); |
| var arg_resource = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.SetIamPolicyRequest.fromJson(json); |
| checkSetIamPolicyRequest(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("v2/")); |
| 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(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setIamPolicy(arg_request, arg_resource, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkPolicy(response); |
| }))); |
| }); |
| |
| unittest.test('method--testIamPermissions', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_request = buildTestIamPermissionsRequest(); |
| var arg_resource = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.TestIamPermissionsRequest.fromJson(json); |
| checkTestIamPermissionsRequest(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("v2/")); |
| 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(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .testIamPermissions(arg_request, arg_resource, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkTestIamPermissionsResponse(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsQueuesTasksResourceApi', () { |
| unittest.test('method--create', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildCreateTaskRequest(); |
| var arg_parent = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.CreateTaskRequest.fromJson(json); |
| checkCreateTaskRequest(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("v2/")); |
| 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(buildTask()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test('method--delete', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| 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("v2/")); |
| 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 |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test('method--get', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_name = 'foo'; |
| var arg_responseView = '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("v2/")); |
| 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["responseView"].first, unittest.equals(arg_responseView)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildTask()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, responseView: arg_responseView, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test('method--list', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_parent = 'foo'; |
| var arg_pageSize = 42; |
| var arg_pageToken = 'foo'; |
| var arg_responseView = '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("v2/")); |
| 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(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect( |
| queryMap["responseView"].first, unittest.equals(arg_responseView)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| var resp = convert.json.encode(buildListTasksResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| responseView: arg_responseView, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkListTasksResponse(response); |
| }))); |
| }); |
| |
| unittest.test('method--run', () { |
| var mock = HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildRunTaskRequest(); |
| var arg_name = 'foo'; |
| var arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = api.RunTaskRequest.fromJson(json); |
| checkRunTaskRequest(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("v2/")); |
| 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(buildTask()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .run(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((response) { |
| checkTask(response); |
| }))); |
| }); |
| }); |
| } |