| // ignore_for_file: avoid_returning_null |
| // 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_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: prefer_single_quotes |
| // 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/cloudtasks/v2.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.Map<core.String, core.String> buildUnnamed6851() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed6851(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 = buildUnnamed6851(); |
| o.httpMethod = 'foo'; |
| o.relativeUri = 'foo'; |
| } |
| buildCounterAppEngineHttpRequest--; |
| return o; |
| } |
| |
| void checkAppEngineHttpRequest(api.AppEngineHttpRequest o) { |
| buildCounterAppEngineHttpRequest++; |
| if (buildCounterAppEngineHttpRequest < 3) { |
| checkAppEngineRouting(o.appEngineRouting! as api.AppEngineRouting); |
| unittest.expect( |
| o.body!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed6851(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! as api.Status); |
| unittest.expect( |
| o.responseTime!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.scheduleTime!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterAttempt--; |
| } |
| |
| core.List<core.String> buildUnnamed6852() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed6852(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.condition = buildExpr(); |
| o.members = buildUnnamed6852(); |
| o.role = 'foo'; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| void checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| checkExpr(o.condition! as api.Expr); |
| checkUnnamed6852(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! as api.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! as api.GetPolicyOptions); |
| } |
| 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> buildUnnamed6853() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed6853(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 = buildUnnamed6853(); |
| 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'), |
| ); |
| checkUnnamed6853(o.headers!); |
| unittest.expect( |
| o.httpMethod!, |
| unittest.equals('foo'), |
| ); |
| checkOAuthToken(o.oauthToken! as api.OAuthToken); |
| checkOidcToken(o.oidcToken! as api.OidcToken); |
| unittest.expect( |
| o.url!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterHttpRequest--; |
| } |
| |
| core.List<api.Location> buildUnnamed6854() { |
| var o = <api.Location>[]; |
| o.add(buildLocation()); |
| o.add(buildLocation()); |
| return o; |
| } |
| |
| void checkUnnamed6854(core.List<api.Location> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLocation(o[0] as api.Location); |
| checkLocation(o[1] as api.Location); |
| } |
| |
| core.int buildCounterListLocationsResponse = 0; |
| api.ListLocationsResponse buildListLocationsResponse() { |
| var o = api.ListLocationsResponse(); |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| o.locations = buildUnnamed6854(); |
| o.nextPageToken = 'foo'; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| void checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed6854(o.locations!); |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| core.List<api.Queue> buildUnnamed6855() { |
| var o = <api.Queue>[]; |
| o.add(buildQueue()); |
| o.add(buildQueue()); |
| return o; |
| } |
| |
| void checkUnnamed6855(core.List<api.Queue> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkQueue(o[0] as api.Queue); |
| checkQueue(o[1] as api.Queue); |
| } |
| |
| core.int buildCounterListQueuesResponse = 0; |
| api.ListQueuesResponse buildListQueuesResponse() { |
| var o = api.ListQueuesResponse(); |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.queues = buildUnnamed6855(); |
| } |
| buildCounterListQueuesResponse--; |
| return o; |
| } |
| |
| void checkListQueuesResponse(api.ListQueuesResponse o) { |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed6855(o.queues!); |
| } |
| buildCounterListQueuesResponse--; |
| } |
| |
| core.List<api.Task> buildUnnamed6856() { |
| var o = <api.Task>[]; |
| o.add(buildTask()); |
| o.add(buildTask()); |
| return o; |
| } |
| |
| void checkUnnamed6856(core.List<api.Task> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTask(o[0] as api.Task); |
| checkTask(o[1] as api.Task); |
| } |
| |
| core.int buildCounterListTasksResponse = 0; |
| api.ListTasksResponse buildListTasksResponse() { |
| var o = api.ListTasksResponse(); |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.tasks = buildUnnamed6856(); |
| } |
| buildCounterListTasksResponse--; |
| return o; |
| } |
| |
| void checkListTasksResponse(api.ListTasksResponse o) { |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed6856(o.tasks!); |
| } |
| buildCounterListTasksResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed6857() { |
| var o = <core.String, core.String>{}; |
| o['x'] = 'foo'; |
| o['y'] = 'foo'; |
| return o; |
| } |
| |
| void checkUnnamed6857(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> buildUnnamed6858() { |
| 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 checkUnnamed6858(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 = buildUnnamed6857(); |
| o.locationId = 'foo'; |
| o.metadata = buildUnnamed6858(); |
| o.name = 'foo'; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| void checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| unittest.expect( |
| o.displayName!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed6857(o.labels!); |
| unittest.expect( |
| o.locationId!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed6858(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> buildUnnamed6859() { |
| var o = <api.Binding>[]; |
| o.add(buildBinding()); |
| o.add(buildBinding()); |
| return o; |
| } |
| |
| void checkUnnamed6859(core.List<api.Binding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBinding(o[0] as api.Binding); |
| checkBinding(o[1] as api.Binding); |
| } |
| |
| core.int buildCounterPolicy = 0; |
| api.Policy buildPolicy() { |
| var o = api.Policy(); |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| o.bindings = buildUnnamed6859(); |
| o.etag = 'foo'; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| void checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed6859(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! as api.AppEngineRouting); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.purgeTime!, |
| unittest.equals('foo'), |
| ); |
| checkRateLimits(o.rateLimits! as api.RateLimits); |
| checkRetryConfig(o.retryConfig! as api.RetryConfig); |
| checkStackdriverLoggingConfig( |
| o.stackdriverLoggingConfig! as api.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! as api.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> buildUnnamed6860() { |
| 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 checkUnnamed6860(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>> buildUnnamed6861() { |
| var o = <core.Map<core.String, core.Object>>[]; |
| o.add(buildUnnamed6860()); |
| o.add(buildUnnamed6860()); |
| return o; |
| } |
| |
| void checkUnnamed6861(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed6860(o[0]); |
| checkUnnamed6860(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| var o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed6861(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect( |
| o.code!, |
| unittest.equals(42), |
| ); |
| checkUnnamed6861(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! as api.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! as api.Attempt); |
| checkHttpRequest(o.httpRequest! as api.HttpRequest); |
| checkAttempt(o.lastAttempt! as api.Attempt); |
| 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> buildUnnamed6862() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed6862(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 = buildUnnamed6862(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed6862(o.permissions!); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed6863() { |
| var o = <core.String>[]; |
| o.add('foo'); |
| o.add('foo'); |
| return o; |
| } |
| |
| void checkUnnamed6863(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 = buildUnnamed6863(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed6863(o.permissions!); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-AppEngineHttpRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildAppEngineHttpRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.AppEngineHttpRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkAppEngineHttpRequest(od as api.AppEngineHttpRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AppEngineRouting', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildAppEngineRouting(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.AppEngineRouting.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkAppEngineRouting(od as api.AppEngineRouting); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Attempt', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildAttempt(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.Attempt.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkAttempt(od as api.Attempt); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Binding', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildBinding(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.Binding.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkBinding(od as api.Binding); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CreateTaskRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildCreateTaskRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.CreateTaskRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkCreateTaskRequest(od as api.CreateTaskRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Empty', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildEmpty(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.Empty.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkEmpty(od as api.Empty); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Expr', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildExpr(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.Expr.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkExpr(od as api.Expr); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildGetIamPolicyRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.GetIamPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkGetIamPolicyRequest(od as api.GetIamPolicyRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-GetPolicyOptions', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildGetPolicyOptions(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.GetPolicyOptions.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkGetPolicyOptions(od as api.GetPolicyOptions); |
| }); |
| }); |
| |
| unittest.group('obj-schema-HttpRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildHttpRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.HttpRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkHttpRequest(od as api.HttpRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListLocationsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildListLocationsResponse(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.ListLocationsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListLocationsResponse(od as api.ListLocationsResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListQueuesResponse', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildListQueuesResponse(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.ListQueuesResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListQueuesResponse(od as api.ListQueuesResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListTasksResponse', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildListTasksResponse(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.ListTasksResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListTasksResponse(od as api.ListTasksResponse); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Location', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildLocation(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.Location.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkLocation(od as api.Location); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OAuthToken', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildOAuthToken(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.OAuthToken.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkOAuthToken(od as api.OAuthToken); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OidcToken', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildOidcToken(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.OidcToken.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkOidcToken(od as api.OidcToken); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PauseQueueRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildPauseQueueRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.PauseQueueRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPauseQueueRequest(od as api.PauseQueueRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Policy', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildPolicy(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.Policy.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkPolicy(od as api.Policy); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PurgeQueueRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildPurgeQueueRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.PurgeQueueRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPurgeQueueRequest(od as api.PurgeQueueRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Queue', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildQueue(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.Queue.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkQueue(od as api.Queue); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RateLimits', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildRateLimits(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.RateLimits.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkRateLimits(od as api.RateLimits); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ResumeQueueRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildResumeQueueRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.ResumeQueueRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkResumeQueueRequest(od as api.ResumeQueueRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RetryConfig', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildRetryConfig(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.RetryConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkRetryConfig(od as api.RetryConfig); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RunTaskRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildRunTaskRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.RunTaskRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkRunTaskRequest(od as api.RunTaskRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildSetIamPolicyRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.SetIamPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(od as api.SetIamPolicyRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-StackdriverLoggingConfig', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildStackdriverLoggingConfig(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.StackdriverLoggingConfig.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkStackdriverLoggingConfig(od as api.StackdriverLoggingConfig); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Status', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildStatus(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = |
| api.Status.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkStatus(od as api.Status); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Task', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildTask(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.Task.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkTask(od as api.Task); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildTestIamPermissionsRequest(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.TestIamPermissionsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(od as api.TestIamPermissionsRequest); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| var o = buildTestIamPermissionsResponse(); |
| var oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| var od = api.TestIamPermissionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsResponse(od as api.TestIamPermissionsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsResource', () { |
| unittest.test('method--get', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkLocation(response as api.Location); |
| }); |
| |
| unittest.test('method--list', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.list(arg_name, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListLocationsResponse(response as api.ListLocationsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsQueuesResource', () { |
| unittest.test('method--create', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkQueue(obj as api.Queue); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.create(arg_request, arg_parent, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--delete', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.delete(arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.get(arg_name, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkGetIamPolicyRequest(obj as api.GetIamPolicyRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = await res.getIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--list', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.list(arg_parent, |
| filter: arg_filter, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListQueuesResponse(response as api.ListQueuesResponse); |
| }); |
| |
| unittest.test('method--patch', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkQueue(obj as api.Queue); |
| |
| 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(core.String n, core.String 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); |
| final response = await res.patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--pause', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkPauseQueueRequest(obj as api.PauseQueueRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.pause(arg_request, arg_name, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--purge', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkPurgeQueueRequest(obj as api.PurgeQueueRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.purge(arg_request, arg_name, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--resume', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkResumeQueueRequest(obj as api.ResumeQueueRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.resume(arg_request, arg_name, $fields: arg_$fields); |
| checkQueue(response as api.Queue); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(obj as api.SetIamPolicyRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = await res.setIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(obj as api.TestIamPermissionsRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = await res.testIamPermissions(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsLocationsQueuesTasksResource', () { |
| unittest.test('method--create', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkCreateTaskRequest(obj as api.CreateTaskRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.create(arg_request, arg_parent, $fields: arg_$fields); |
| checkTask(response as api.Task); |
| }); |
| |
| unittest.test('method--delete', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.delete(arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.get(arg_name, |
| responseView: arg_responseView, $fields: arg_$fields); |
| checkTask(response as api.Task); |
| }); |
| |
| unittest.test('method--list', () async { |
| var mock = HttpServerMock(); |
| var 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(core.String n, core.String 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); |
| final response = await res.list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| responseView: arg_responseView, |
| $fields: arg_$fields); |
| checkListTasksResponse(response as api.ListTasksResponse); |
| }); |
| |
| unittest.test('method--run', () async { |
| var mock = HttpServerMock(); |
| var 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 as core.Map<core.String, core.dynamic>); |
| checkRunTaskRequest(obj as api.RunTaskRequest); |
| |
| 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(core.String n, core.String 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); |
| final response = |
| await res.run(arg_request, arg_name, $fields: arg_$fields); |
| checkTask(response as api.Task); |
| }); |
| }); |
| } |