| library googleapis_beta.cloudtasks.v2beta2.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_beta/cloudtasks/v2beta2.dart' as api; |
| |
| class HttpServerMock extends http.BaseClient { |
| core.Function _callback; |
| core.bool _expectJson; |
| |
| void register(core.Function callback, core.bool expectJson) { |
| _callback = callback; |
| _expectJson = expectJson; |
| } |
| |
| async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| if (_expectJson) { |
| return request |
| .finalize() |
| .transform(convert.UTF8.decoder) |
| .join('') |
| .then((core.String jsonString) { |
| if (jsonString.isEmpty) { |
| return _callback(request, null); |
| } else { |
| return _callback(request, convert.JSON.decode(jsonString)); |
| } |
| }); |
| } else { |
| var stream = request.finalize(); |
| if (stream == null) { |
| return _callback(request, []); |
| } else { |
| return stream.toBytes().then((data) { |
| return _callback(request, data); |
| }); |
| } |
| } |
| } |
| } |
| |
| http.StreamedResponse stringResponse(core.int status, |
| core.Map<core.String, core.String> headers, core.String body) { |
| var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| return new http.StreamedResponse(stream, status, headers: headers); |
| } |
| |
| core.int buildCounterAcknowledgeTaskRequest = 0; |
| buildAcknowledgeTaskRequest() { |
| var o = new api.AcknowledgeTaskRequest(); |
| buildCounterAcknowledgeTaskRequest++; |
| if (buildCounterAcknowledgeTaskRequest < 3) { |
| o.scheduleTime = "foo"; |
| } |
| buildCounterAcknowledgeTaskRequest--; |
| return o; |
| } |
| |
| checkAcknowledgeTaskRequest(api.AcknowledgeTaskRequest o) { |
| buildCounterAcknowledgeTaskRequest++; |
| if (buildCounterAcknowledgeTaskRequest < 3) { |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| } |
| buildCounterAcknowledgeTaskRequest--; |
| } |
| |
| buildUnnamed3808() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed3808(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; |
| buildAppEngineHttpRequest() { |
| var o = new api.AppEngineHttpRequest(); |
| buildCounterAppEngineHttpRequest++; |
| if (buildCounterAppEngineHttpRequest < 3) { |
| o.appEngineRouting = buildAppEngineRouting(); |
| o.headers = buildUnnamed3808(); |
| o.httpMethod = "foo"; |
| o.payload = "foo"; |
| o.relativeUrl = "foo"; |
| } |
| buildCounterAppEngineHttpRequest--; |
| return o; |
| } |
| |
| checkAppEngineHttpRequest(api.AppEngineHttpRequest o) { |
| buildCounterAppEngineHttpRequest++; |
| if (buildCounterAppEngineHttpRequest < 3) { |
| checkAppEngineRouting(o.appEngineRouting); |
| checkUnnamed3808(o.headers); |
| unittest.expect(o.httpMethod, unittest.equals('foo')); |
| unittest.expect(o.payload, unittest.equals('foo')); |
| unittest.expect(o.relativeUrl, unittest.equals('foo')); |
| } |
| buildCounterAppEngineHttpRequest--; |
| } |
| |
| core.int buildCounterAppEngineHttpTarget = 0; |
| buildAppEngineHttpTarget() { |
| var o = new api.AppEngineHttpTarget(); |
| buildCounterAppEngineHttpTarget++; |
| if (buildCounterAppEngineHttpTarget < 3) { |
| o.appEngineRoutingOverride = buildAppEngineRouting(); |
| } |
| buildCounterAppEngineHttpTarget--; |
| return o; |
| } |
| |
| checkAppEngineHttpTarget(api.AppEngineHttpTarget o) { |
| buildCounterAppEngineHttpTarget++; |
| if (buildCounterAppEngineHttpTarget < 3) { |
| checkAppEngineRouting(o.appEngineRoutingOverride); |
| } |
| buildCounterAppEngineHttpTarget--; |
| } |
| |
| core.int buildCounterAppEngineQueueConfig = 0; |
| buildAppEngineQueueConfig() { |
| var o = new api.AppEngineQueueConfig(); |
| buildCounterAppEngineQueueConfig++; |
| if (buildCounterAppEngineQueueConfig < 3) { |
| o.appEngineRoutingOverride = buildAppEngineRouting(); |
| } |
| buildCounterAppEngineQueueConfig--; |
| return o; |
| } |
| |
| checkAppEngineQueueConfig(api.AppEngineQueueConfig o) { |
| buildCounterAppEngineQueueConfig++; |
| if (buildCounterAppEngineQueueConfig < 3) { |
| checkAppEngineRouting(o.appEngineRoutingOverride); |
| } |
| buildCounterAppEngineQueueConfig--; |
| } |
| |
| core.int buildCounterAppEngineRouting = 0; |
| buildAppEngineRouting() { |
| var o = new api.AppEngineRouting(); |
| buildCounterAppEngineRouting++; |
| if (buildCounterAppEngineRouting < 3) { |
| o.host = "foo"; |
| o.instance = "foo"; |
| o.service = "foo"; |
| o.version = "foo"; |
| } |
| buildCounterAppEngineRouting--; |
| return o; |
| } |
| |
| 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--; |
| } |
| |
| buildUnnamed3809() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed3809(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 buildCounterAppEngineTaskTarget = 0; |
| buildAppEngineTaskTarget() { |
| var o = new api.AppEngineTaskTarget(); |
| buildCounterAppEngineTaskTarget++; |
| if (buildCounterAppEngineTaskTarget < 3) { |
| o.appEngineRouting = buildAppEngineRouting(); |
| o.headers = buildUnnamed3809(); |
| o.httpMethod = "foo"; |
| o.payload = "foo"; |
| o.relativeUrl = "foo"; |
| } |
| buildCounterAppEngineTaskTarget--; |
| return o; |
| } |
| |
| checkAppEngineTaskTarget(api.AppEngineTaskTarget o) { |
| buildCounterAppEngineTaskTarget++; |
| if (buildCounterAppEngineTaskTarget < 3) { |
| checkAppEngineRouting(o.appEngineRouting); |
| checkUnnamed3809(o.headers); |
| unittest.expect(o.httpMethod, unittest.equals('foo')); |
| unittest.expect(o.payload, unittest.equals('foo')); |
| unittest.expect(o.relativeUrl, unittest.equals('foo')); |
| } |
| buildCounterAppEngineTaskTarget--; |
| } |
| |
| core.int buildCounterAttemptStatus = 0; |
| buildAttemptStatus() { |
| var o = new api.AttemptStatus(); |
| buildCounterAttemptStatus++; |
| if (buildCounterAttemptStatus < 3) { |
| o.dispatchTime = "foo"; |
| o.responseStatus = buildStatus(); |
| o.responseTime = "foo"; |
| o.scheduleTime = "foo"; |
| } |
| buildCounterAttemptStatus--; |
| return o; |
| } |
| |
| checkAttemptStatus(api.AttemptStatus o) { |
| buildCounterAttemptStatus++; |
| if (buildCounterAttemptStatus < 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')); |
| } |
| buildCounterAttemptStatus--; |
| } |
| |
| buildUnnamed3810() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3810(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; |
| buildBinding() { |
| var o = new api.Binding(); |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| o.members = buildUnnamed3810(); |
| o.role = "foo"; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| checkUnnamed3810(o.members); |
| unittest.expect(o.role, unittest.equals('foo')); |
| } |
| buildCounterBinding--; |
| } |
| |
| core.int buildCounterCancelLeaseRequest = 0; |
| buildCancelLeaseRequest() { |
| var o = new api.CancelLeaseRequest(); |
| buildCounterCancelLeaseRequest++; |
| if (buildCounterCancelLeaseRequest < 3) { |
| o.responseView = "foo"; |
| o.scheduleTime = "foo"; |
| } |
| buildCounterCancelLeaseRequest--; |
| return o; |
| } |
| |
| checkCancelLeaseRequest(api.CancelLeaseRequest o) { |
| buildCounterCancelLeaseRequest++; |
| if (buildCounterCancelLeaseRequest < 3) { |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| } |
| buildCounterCancelLeaseRequest--; |
| } |
| |
| core.int buildCounterCreateTaskRequest = 0; |
| buildCreateTaskRequest() { |
| var o = new api.CreateTaskRequest(); |
| buildCounterCreateTaskRequest++; |
| if (buildCounterCreateTaskRequest < 3) { |
| o.responseView = "foo"; |
| o.task = buildTask(); |
| } |
| buildCounterCreateTaskRequest--; |
| return o; |
| } |
| |
| checkCreateTaskRequest(api.CreateTaskRequest o) { |
| buildCounterCreateTaskRequest++; |
| if (buildCounterCreateTaskRequest < 3) { |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| checkTask(o.task); |
| } |
| buildCounterCreateTaskRequest--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| buildEmpty() { |
| var o = new api.Empty(); |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| return o; |
| } |
| |
| checkEmpty(api.Empty o) { |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| } |
| |
| core.int buildCounterGetIamPolicyRequest = 0; |
| buildGetIamPolicyRequest() { |
| var o = new api.GetIamPolicyRequest(); |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) {} |
| buildCounterGetIamPolicyRequest--; |
| return o; |
| } |
| |
| checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
| buildCounterGetIamPolicyRequest++; |
| if (buildCounterGetIamPolicyRequest < 3) {} |
| buildCounterGetIamPolicyRequest--; |
| } |
| |
| buildUnnamed3811() { |
| var o = new core.List<api.Location>(); |
| o.add(buildLocation()); |
| o.add(buildLocation()); |
| return o; |
| } |
| |
| checkUnnamed3811(core.List<api.Location> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLocation(o[0]); |
| checkLocation(o[1]); |
| } |
| |
| core.int buildCounterListLocationsResponse = 0; |
| buildListLocationsResponse() { |
| var o = new api.ListLocationsResponse(); |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| o.locations = buildUnnamed3811(); |
| o.nextPageToken = "foo"; |
| } |
| buildCounterListLocationsResponse--; |
| return o; |
| } |
| |
| checkListLocationsResponse(api.ListLocationsResponse o) { |
| buildCounterListLocationsResponse++; |
| if (buildCounterListLocationsResponse < 3) { |
| checkUnnamed3811(o.locations); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListLocationsResponse--; |
| } |
| |
| buildUnnamed3812() { |
| var o = new core.List<api.Queue>(); |
| o.add(buildQueue()); |
| o.add(buildQueue()); |
| return o; |
| } |
| |
| checkUnnamed3812(core.List<api.Queue> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkQueue(o[0]); |
| checkQueue(o[1]); |
| } |
| |
| core.int buildCounterListQueuesResponse = 0; |
| buildListQueuesResponse() { |
| var o = new api.ListQueuesResponse(); |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| o.nextPageToken = "foo"; |
| o.queues = buildUnnamed3812(); |
| } |
| buildCounterListQueuesResponse--; |
| return o; |
| } |
| |
| checkListQueuesResponse(api.ListQueuesResponse o) { |
| buildCounterListQueuesResponse++; |
| if (buildCounterListQueuesResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed3812(o.queues); |
| } |
| buildCounterListQueuesResponse--; |
| } |
| |
| buildUnnamed3813() { |
| var o = new core.List<api.Task>(); |
| o.add(buildTask()); |
| o.add(buildTask()); |
| return o; |
| } |
| |
| checkUnnamed3813(core.List<api.Task> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTask(o[0]); |
| checkTask(o[1]); |
| } |
| |
| core.int buildCounterListTasksResponse = 0; |
| buildListTasksResponse() { |
| var o = new api.ListTasksResponse(); |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| o.nextPageToken = "foo"; |
| o.tasks = buildUnnamed3813(); |
| } |
| buildCounterListTasksResponse--; |
| return o; |
| } |
| |
| checkListTasksResponse(api.ListTasksResponse o) { |
| buildCounterListTasksResponse++; |
| if (buildCounterListTasksResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed3813(o.tasks); |
| } |
| buildCounterListTasksResponse--; |
| } |
| |
| buildUnnamed3814() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed3814(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')); |
| } |
| |
| buildUnnamed3815() { |
| var o = new core.Map<core.String, core.Object>(); |
| o["x"] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| o["y"] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| return o; |
| } |
| |
| checkUnnamed3815(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; |
| buildLocation() { |
| var o = new api.Location(); |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| o.labels = buildUnnamed3814(); |
| o.locationId = "foo"; |
| o.metadata = buildUnnamed3815(); |
| o.name = "foo"; |
| } |
| buildCounterLocation--; |
| return o; |
| } |
| |
| checkLocation(api.Location o) { |
| buildCounterLocation++; |
| if (buildCounterLocation < 3) { |
| checkUnnamed3814(o.labels); |
| unittest.expect(o.locationId, unittest.equals('foo')); |
| checkUnnamed3815(o.metadata); |
| unittest.expect(o.name, unittest.equals('foo')); |
| } |
| buildCounterLocation--; |
| } |
| |
| core.int buildCounterPauseQueueRequest = 0; |
| buildPauseQueueRequest() { |
| var o = new api.PauseQueueRequest(); |
| buildCounterPauseQueueRequest++; |
| if (buildCounterPauseQueueRequest < 3) {} |
| buildCounterPauseQueueRequest--; |
| return o; |
| } |
| |
| checkPauseQueueRequest(api.PauseQueueRequest o) { |
| buildCounterPauseQueueRequest++; |
| if (buildCounterPauseQueueRequest < 3) {} |
| buildCounterPauseQueueRequest--; |
| } |
| |
| buildUnnamed3816() { |
| var o = new core.List<api.Binding>(); |
| o.add(buildBinding()); |
| o.add(buildBinding()); |
| return o; |
| } |
| |
| checkUnnamed3816(core.List<api.Binding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBinding(o[0]); |
| checkBinding(o[1]); |
| } |
| |
| core.int buildCounterPolicy = 0; |
| buildPolicy() { |
| var o = new api.Policy(); |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| o.bindings = buildUnnamed3816(); |
| o.etag = "foo"; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed3816(o.bindings); |
| unittest.expect(o.etag, unittest.equals('foo')); |
| unittest.expect(o.version, unittest.equals(42)); |
| } |
| buildCounterPolicy--; |
| } |
| |
| core.int buildCounterPullMessage = 0; |
| buildPullMessage() { |
| var o = new api.PullMessage(); |
| buildCounterPullMessage++; |
| if (buildCounterPullMessage < 3) { |
| o.payload = "foo"; |
| o.tag = "foo"; |
| } |
| buildCounterPullMessage--; |
| return o; |
| } |
| |
| checkPullMessage(api.PullMessage o) { |
| buildCounterPullMessage++; |
| if (buildCounterPullMessage < 3) { |
| unittest.expect(o.payload, unittest.equals('foo')); |
| unittest.expect(o.tag, unittest.equals('foo')); |
| } |
| buildCounterPullMessage--; |
| } |
| |
| core.int buildCounterPullQueueConfig = 0; |
| buildPullQueueConfig() { |
| var o = new api.PullQueueConfig(); |
| buildCounterPullQueueConfig++; |
| if (buildCounterPullQueueConfig < 3) {} |
| buildCounterPullQueueConfig--; |
| return o; |
| } |
| |
| checkPullQueueConfig(api.PullQueueConfig o) { |
| buildCounterPullQueueConfig++; |
| if (buildCounterPullQueueConfig < 3) {} |
| buildCounterPullQueueConfig--; |
| } |
| |
| core.int buildCounterPullTarget = 0; |
| buildPullTarget() { |
| var o = new api.PullTarget(); |
| buildCounterPullTarget++; |
| if (buildCounterPullTarget < 3) {} |
| buildCounterPullTarget--; |
| return o; |
| } |
| |
| checkPullTarget(api.PullTarget o) { |
| buildCounterPullTarget++; |
| if (buildCounterPullTarget < 3) {} |
| buildCounterPullTarget--; |
| } |
| |
| core.int buildCounterPullTaskTarget = 0; |
| buildPullTaskTarget() { |
| var o = new api.PullTaskTarget(); |
| buildCounterPullTaskTarget++; |
| if (buildCounterPullTaskTarget < 3) { |
| o.payload = "foo"; |
| o.tag = "foo"; |
| } |
| buildCounterPullTaskTarget--; |
| return o; |
| } |
| |
| checkPullTaskTarget(api.PullTaskTarget o) { |
| buildCounterPullTaskTarget++; |
| if (buildCounterPullTaskTarget < 3) { |
| unittest.expect(o.payload, unittest.equals('foo')); |
| unittest.expect(o.tag, unittest.equals('foo')); |
| } |
| buildCounterPullTaskTarget--; |
| } |
| |
| core.int buildCounterPullTasksRequest = 0; |
| buildPullTasksRequest() { |
| var o = new api.PullTasksRequest(); |
| buildCounterPullTasksRequest++; |
| if (buildCounterPullTasksRequest < 3) { |
| o.filter = "foo"; |
| o.leaseDuration = "foo"; |
| o.maxTasks = 42; |
| o.responseView = "foo"; |
| } |
| buildCounterPullTasksRequest--; |
| return o; |
| } |
| |
| checkPullTasksRequest(api.PullTasksRequest o) { |
| buildCounterPullTasksRequest++; |
| if (buildCounterPullTasksRequest < 3) { |
| unittest.expect(o.filter, unittest.equals('foo')); |
| unittest.expect(o.leaseDuration, unittest.equals('foo')); |
| unittest.expect(o.maxTasks, unittest.equals(42)); |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| } |
| buildCounterPullTasksRequest--; |
| } |
| |
| buildUnnamed3817() { |
| var o = new core.List<api.Task>(); |
| o.add(buildTask()); |
| o.add(buildTask()); |
| return o; |
| } |
| |
| checkUnnamed3817(core.List<api.Task> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTask(o[0]); |
| checkTask(o[1]); |
| } |
| |
| core.int buildCounterPullTasksResponse = 0; |
| buildPullTasksResponse() { |
| var o = new api.PullTasksResponse(); |
| buildCounterPullTasksResponse++; |
| if (buildCounterPullTasksResponse < 3) { |
| o.tasks = buildUnnamed3817(); |
| } |
| buildCounterPullTasksResponse--; |
| return o; |
| } |
| |
| checkPullTasksResponse(api.PullTasksResponse o) { |
| buildCounterPullTasksResponse++; |
| if (buildCounterPullTasksResponse < 3) { |
| checkUnnamed3817(o.tasks); |
| } |
| buildCounterPullTasksResponse--; |
| } |
| |
| core.int buildCounterPurgeQueueRequest = 0; |
| buildPurgeQueueRequest() { |
| var o = new api.PurgeQueueRequest(); |
| buildCounterPurgeQueueRequest++; |
| if (buildCounterPurgeQueueRequest < 3) {} |
| buildCounterPurgeQueueRequest--; |
| return o; |
| } |
| |
| checkPurgeQueueRequest(api.PurgeQueueRequest o) { |
| buildCounterPurgeQueueRequest++; |
| if (buildCounterPurgeQueueRequest < 3) {} |
| buildCounterPurgeQueueRequest--; |
| } |
| |
| core.int buildCounterQueue = 0; |
| buildQueue() { |
| var o = new api.Queue(); |
| buildCounterQueue++; |
| if (buildCounterQueue < 3) { |
| o.appEngineHttpTarget = buildAppEngineHttpTarget(); |
| o.appEngineQueueConfig = buildAppEngineQueueConfig(); |
| o.name = "foo"; |
| o.pullQueueConfig = buildPullQueueConfig(); |
| o.pullTarget = buildPullTarget(); |
| o.purgeTime = "foo"; |
| o.rateLimits = buildRateLimits(); |
| o.retryConfig = buildRetryConfig(); |
| o.state = "foo"; |
| } |
| buildCounterQueue--; |
| return o; |
| } |
| |
| checkQueue(api.Queue o) { |
| buildCounterQueue++; |
| if (buildCounterQueue < 3) { |
| checkAppEngineHttpTarget(o.appEngineHttpTarget); |
| checkAppEngineQueueConfig(o.appEngineQueueConfig); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkPullQueueConfig(o.pullQueueConfig); |
| checkPullTarget(o.pullTarget); |
| unittest.expect(o.purgeTime, unittest.equals('foo')); |
| checkRateLimits(o.rateLimits); |
| checkRetryConfig(o.retryConfig); |
| unittest.expect(o.state, unittest.equals('foo')); |
| } |
| buildCounterQueue--; |
| } |
| |
| core.int buildCounterRateLimits = 0; |
| buildRateLimits() { |
| var o = new api.RateLimits(); |
| buildCounterRateLimits++; |
| if (buildCounterRateLimits < 3) { |
| o.maxBurstSize = 42; |
| o.maxConcurrentTasks = 42; |
| o.maxTasksDispatchedPerSecond = 42.0; |
| } |
| buildCounterRateLimits--; |
| return o; |
| } |
| |
| checkRateLimits(api.RateLimits o) { |
| buildCounterRateLimits++; |
| if (buildCounterRateLimits < 3) { |
| unittest.expect(o.maxBurstSize, unittest.equals(42)); |
| unittest.expect(o.maxConcurrentTasks, unittest.equals(42)); |
| unittest.expect(o.maxTasksDispatchedPerSecond, unittest.equals(42.0)); |
| } |
| buildCounterRateLimits--; |
| } |
| |
| core.int buildCounterRenewLeaseRequest = 0; |
| buildRenewLeaseRequest() { |
| var o = new api.RenewLeaseRequest(); |
| buildCounterRenewLeaseRequest++; |
| if (buildCounterRenewLeaseRequest < 3) { |
| o.leaseDuration = "foo"; |
| o.responseView = "foo"; |
| o.scheduleTime = "foo"; |
| } |
| buildCounterRenewLeaseRequest--; |
| return o; |
| } |
| |
| checkRenewLeaseRequest(api.RenewLeaseRequest o) { |
| buildCounterRenewLeaseRequest++; |
| if (buildCounterRenewLeaseRequest < 3) { |
| unittest.expect(o.leaseDuration, unittest.equals('foo')); |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| } |
| buildCounterRenewLeaseRequest--; |
| } |
| |
| core.int buildCounterResumeQueueRequest = 0; |
| buildResumeQueueRequest() { |
| var o = new api.ResumeQueueRequest(); |
| buildCounterResumeQueueRequest++; |
| if (buildCounterResumeQueueRequest < 3) {} |
| buildCounterResumeQueueRequest--; |
| return o; |
| } |
| |
| checkResumeQueueRequest(api.ResumeQueueRequest o) { |
| buildCounterResumeQueueRequest++; |
| if (buildCounterResumeQueueRequest < 3) {} |
| buildCounterResumeQueueRequest--; |
| } |
| |
| core.int buildCounterRetryConfig = 0; |
| buildRetryConfig() { |
| var o = new api.RetryConfig(); |
| buildCounterRetryConfig++; |
| if (buildCounterRetryConfig < 3) { |
| o.maxAttempts = 42; |
| o.maxBackoff = "foo"; |
| o.maxDoublings = 42; |
| o.maxRetryDuration = "foo"; |
| o.minBackoff = "foo"; |
| o.unlimitedAttempts = true; |
| } |
| buildCounterRetryConfig--; |
| return o; |
| } |
| |
| 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')); |
| unittest.expect(o.unlimitedAttempts, unittest.isTrue); |
| } |
| buildCounterRetryConfig--; |
| } |
| |
| core.int buildCounterRunTaskRequest = 0; |
| buildRunTaskRequest() { |
| var o = new api.RunTaskRequest(); |
| buildCounterRunTaskRequest++; |
| if (buildCounterRunTaskRequest < 3) { |
| o.responseView = "foo"; |
| } |
| buildCounterRunTaskRequest--; |
| return o; |
| } |
| |
| checkRunTaskRequest(api.RunTaskRequest o) { |
| buildCounterRunTaskRequest++; |
| if (buildCounterRunTaskRequest < 3) { |
| unittest.expect(o.responseView, unittest.equals('foo')); |
| } |
| buildCounterRunTaskRequest--; |
| } |
| |
| core.int buildCounterSetIamPolicyRequest = 0; |
| buildSetIamPolicyRequest() { |
| var o = new api.SetIamPolicyRequest(); |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| o.policy = buildPolicy(); |
| } |
| buildCounterSetIamPolicyRequest--; |
| return o; |
| } |
| |
| checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| checkPolicy(o.policy); |
| } |
| buildCounterSetIamPolicyRequest--; |
| } |
| |
| buildUnnamed3818() { |
| var o = new core.Map<core.String, core.Object>(); |
| o["x"] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| o["y"] = { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo' |
| }; |
| return o; |
| } |
| |
| checkUnnamed3818(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')); |
| } |
| |
| buildUnnamed3819() { |
| var o = new core.List<core.Map<core.String, core.Object>>(); |
| o.add(buildUnnamed3818()); |
| o.add(buildUnnamed3818()); |
| return o; |
| } |
| |
| checkUnnamed3819(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed3818(o[0]); |
| checkUnnamed3818(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| buildStatus() { |
| var o = new api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed3819(); |
| o.message = "foo"; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code, unittest.equals(42)); |
| checkUnnamed3819(o.details); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.int buildCounterTask = 0; |
| buildTask() { |
| var o = new api.Task(); |
| buildCounterTask++; |
| if (buildCounterTask < 3) { |
| o.appEngineHttpRequest = buildAppEngineHttpRequest(); |
| o.appEngineTaskTarget = buildAppEngineTaskTarget(); |
| o.createTime = "foo"; |
| o.name = "foo"; |
| o.pullMessage = buildPullMessage(); |
| o.pullTaskTarget = buildPullTaskTarget(); |
| o.scheduleTime = "foo"; |
| o.taskStatus = buildTaskStatus(); |
| o.view = "foo"; |
| } |
| buildCounterTask--; |
| return o; |
| } |
| |
| checkTask(api.Task o) { |
| buildCounterTask++; |
| if (buildCounterTask < 3) { |
| checkAppEngineHttpRequest(o.appEngineHttpRequest); |
| checkAppEngineTaskTarget(o.appEngineTaskTarget); |
| unittest.expect(o.createTime, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkPullMessage(o.pullMessage); |
| checkPullTaskTarget(o.pullTaskTarget); |
| unittest.expect(o.scheduleTime, unittest.equals('foo')); |
| checkTaskStatus(o.taskStatus); |
| unittest.expect(o.view, unittest.equals('foo')); |
| } |
| buildCounterTask--; |
| } |
| |
| core.int buildCounterTaskStatus = 0; |
| buildTaskStatus() { |
| var o = new api.TaskStatus(); |
| buildCounterTaskStatus++; |
| if (buildCounterTaskStatus < 3) { |
| o.attemptDispatchCount = "foo"; |
| o.attemptResponseCount = "foo"; |
| o.firstAttemptStatus = buildAttemptStatus(); |
| o.lastAttemptStatus = buildAttemptStatus(); |
| } |
| buildCounterTaskStatus--; |
| return o; |
| } |
| |
| checkTaskStatus(api.TaskStatus o) { |
| buildCounterTaskStatus++; |
| if (buildCounterTaskStatus < 3) { |
| unittest.expect(o.attemptDispatchCount, unittest.equals('foo')); |
| unittest.expect(o.attemptResponseCount, unittest.equals('foo')); |
| checkAttemptStatus(o.firstAttemptStatus); |
| checkAttemptStatus(o.lastAttemptStatus); |
| } |
| buildCounterTaskStatus--; |
| } |
| |
| buildUnnamed3820() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3820(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; |
| buildTestIamPermissionsRequest() { |
| var o = new api.TestIamPermissionsRequest(); |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| o.permissions = buildUnnamed3820(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed3820(o.permissions); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| buildUnnamed3821() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3821(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; |
| buildTestIamPermissionsResponse() { |
| var o = new api.TestIamPermissionsResponse(); |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| o.permissions = buildUnnamed3821(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed3821(o.permissions); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| main() { |
| unittest.group("obj-schema-AcknowledgeTaskRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAcknowledgeTaskRequest(); |
| var od = new api.AcknowledgeTaskRequest.fromJson(o.toJson()); |
| checkAcknowledgeTaskRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AppEngineHttpRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAppEngineHttpRequest(); |
| var od = new api.AppEngineHttpRequest.fromJson(o.toJson()); |
| checkAppEngineHttpRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AppEngineHttpTarget", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAppEngineHttpTarget(); |
| var od = new api.AppEngineHttpTarget.fromJson(o.toJson()); |
| checkAppEngineHttpTarget(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AppEngineQueueConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAppEngineQueueConfig(); |
| var od = new api.AppEngineQueueConfig.fromJson(o.toJson()); |
| checkAppEngineQueueConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AppEngineRouting", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAppEngineRouting(); |
| var od = new api.AppEngineRouting.fromJson(o.toJson()); |
| checkAppEngineRouting(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AppEngineTaskTarget", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAppEngineTaskTarget(); |
| var od = new api.AppEngineTaskTarget.fromJson(o.toJson()); |
| checkAppEngineTaskTarget(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-AttemptStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAttemptStatus(); |
| var od = new api.AttemptStatus.fromJson(o.toJson()); |
| checkAttemptStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Binding", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildBinding(); |
| var od = new api.Binding.fromJson(o.toJson()); |
| checkBinding(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CancelLeaseRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCancelLeaseRequest(); |
| var od = new api.CancelLeaseRequest.fromJson(o.toJson()); |
| checkCancelLeaseRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CreateTaskRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCreateTaskRequest(); |
| var od = new api.CreateTaskRequest.fromJson(o.toJson()); |
| checkCreateTaskRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Empty", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildEmpty(); |
| var od = new api.Empty.fromJson(o.toJson()); |
| checkEmpty(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-GetIamPolicyRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGetIamPolicyRequest(); |
| var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
| checkGetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListLocationsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListLocationsResponse(); |
| var od = new api.ListLocationsResponse.fromJson(o.toJson()); |
| checkListLocationsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListQueuesResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListQueuesResponse(); |
| var od = new api.ListQueuesResponse.fromJson(o.toJson()); |
| checkListQueuesResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListTasksResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListTasksResponse(); |
| var od = new api.ListTasksResponse.fromJson(o.toJson()); |
| checkListTasksResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Location", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLocation(); |
| var od = new api.Location.fromJson(o.toJson()); |
| checkLocation(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PauseQueueRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPauseQueueRequest(); |
| var od = new api.PauseQueueRequest.fromJson(o.toJson()); |
| checkPauseQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Policy", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPolicy(); |
| var od = new api.Policy.fromJson(o.toJson()); |
| checkPolicy(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullMessage", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullMessage(); |
| var od = new api.PullMessage.fromJson(o.toJson()); |
| checkPullMessage(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullQueueConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullQueueConfig(); |
| var od = new api.PullQueueConfig.fromJson(o.toJson()); |
| checkPullQueueConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullTarget", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullTarget(); |
| var od = new api.PullTarget.fromJson(o.toJson()); |
| checkPullTarget(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullTaskTarget", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullTaskTarget(); |
| var od = new api.PullTaskTarget.fromJson(o.toJson()); |
| checkPullTaskTarget(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullTasksRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullTasksRequest(); |
| var od = new api.PullTasksRequest.fromJson(o.toJson()); |
| checkPullTasksRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PullTasksResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPullTasksResponse(); |
| var od = new api.PullTasksResponse.fromJson(o.toJson()); |
| checkPullTasksResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PurgeQueueRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPurgeQueueRequest(); |
| var od = new api.PurgeQueueRequest.fromJson(o.toJson()); |
| checkPurgeQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Queue", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildQueue(); |
| var od = new api.Queue.fromJson(o.toJson()); |
| checkQueue(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-RateLimits", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildRateLimits(); |
| var od = new api.RateLimits.fromJson(o.toJson()); |
| checkRateLimits(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-RenewLeaseRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildRenewLeaseRequest(); |
| var od = new api.RenewLeaseRequest.fromJson(o.toJson()); |
| checkRenewLeaseRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ResumeQueueRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildResumeQueueRequest(); |
| var od = new api.ResumeQueueRequest.fromJson(o.toJson()); |
| checkResumeQueueRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-RetryConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildRetryConfig(); |
| var od = new api.RetryConfig.fromJson(o.toJson()); |
| checkRetryConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-RunTaskRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildRunTaskRequest(); |
| var od = new api.RunTaskRequest.fromJson(o.toJson()); |
| checkRunTaskRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SetIamPolicyRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSetIamPolicyRequest(); |
| var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
| checkSetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Status", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildStatus(); |
| var od = new api.Status.fromJson(o.toJson()); |
| checkStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Task", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTask(); |
| var od = new api.Task.fromJson(o.toJson()); |
| checkTask(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-TaskStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTaskStatus(); |
| var od = new api.TaskStatus.fromJson(o.toJson()); |
| checkTaskStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-TestIamPermissionsRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTestIamPermissionsRequest(); |
| var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
| checkTestIamPermissionsRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-TestIamPermissionsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildTestIamPermissionsResponse(); |
| var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
| checkTestIamPermissionsResponse(od); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsLocationsResourceApi", () { |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsResourceApi res = |
| new 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; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildLocation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Location response) { |
| checkLocation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations; |
| var arg_name = "foo"; |
| var arg_pageSize = 42; |
| var arg_filter = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_name, |
| pageSize: arg_pageSize, |
| filter: arg_filter, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListLocationsResponse response) { |
| checkListLocationsResponse(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsLocationsQueuesResourceApi", () { |
| unittest.test("method--create", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.Queue.fromJson(json); |
| checkQueue(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueue()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildEmpty()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueue()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--getIamPolicy", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.GetIamPolicyRequest.fromJson(json); |
| checkGetIamPolicyRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildPolicy()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .getIamPolicy(arg_request, arg_resource, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Policy response) { |
| checkPolicy(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues; |
| var arg_parent = "foo"; |
| var arg_filter = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_pageSize = 42; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| filter: arg_filter, |
| pageToken: arg_pageToken, |
| pageSize: arg_pageSize, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListQueuesResponse response) { |
| checkListQueuesResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--patch", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.Queue.fromJson(json); |
| checkQueue(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect( |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_name, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--pause", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.PauseQueueRequest.fromJson(json); |
| checkPauseQueueRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueue()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .pause(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--purge", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.PurgeQueueRequest.fromJson(json); |
| checkPurgeQueueRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueue()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .purge(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--resume", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.ResumeQueueRequest.fromJson(json); |
| checkResumeQueueRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildQueue()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .resume(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Queue response) { |
| checkQueue(response); |
| }))); |
| }); |
| |
| unittest.test("method--setIamPolicy", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.SetIamPolicyRequest.fromJson(json); |
| checkSetIamPolicyRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildPolicy()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .setIamPolicy(arg_request, arg_resource, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Policy response) { |
| checkPolicy(response); |
| }))); |
| }); |
| |
| unittest.test("method--testIamPermissions", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesResourceApi res = |
| new 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 = new api.TestIamPermissionsRequest.fromJson(json); |
| checkTestIamPermissionsRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .testIamPermissions(arg_request, arg_resource, $fields: arg_$fields) |
| .then( |
| unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
| checkTestIamPermissionsResponse(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsLocationsQueuesTasksResourceApi", () { |
| unittest.test("method--acknowledge", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildAcknowledgeTaskRequest(); |
| var arg_name = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.AcknowledgeTaskRequest.fromJson(json); |
| checkAcknowledgeTaskRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildEmpty()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .acknowledge(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--cancelLease", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildCancelLeaseRequest(); |
| var arg_name = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CancelLeaseRequest.fromJson(json); |
| checkCancelLeaseRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTask()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancelLease(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Task response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test("method--create", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new 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 = new api.CreateTaskRequest.fromJson(json); |
| checkCreateTaskRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTask()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_parent, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Task response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new 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; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildEmpty()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new 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; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect( |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, responseView: arg_responseView, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Task response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_parent = "foo"; |
| var arg_responseView = "foo"; |
| var arg_orderBy = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_pageSize = 42; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect( |
| queryMap["responseView"].first, unittest.equals(arg_responseView)); |
| unittest.expect( |
| queryMap["orderBy"].first, unittest.equals(arg_orderBy)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_parent, |
| responseView: arg_responseView, |
| orderBy: arg_orderBy, |
| pageToken: arg_pageToken, |
| pageSize: arg_pageSize, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListTasksResponse response) { |
| checkListTasksResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--pull", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildPullTasksRequest(); |
| var arg_name = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.PullTasksRequest.fromJson(json); |
| checkPullTasksRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildPullTasksResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .pull(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.PullTasksResponse response) { |
| checkPullTasksResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--renewLease", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new api.CloudtasksApi(mock).projects.locations.queues.tasks; |
| var arg_request = buildRenewLeaseRequest(); |
| var arg_name = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.RenewLeaseRequest.fromJson(json); |
| checkRenewLeaseRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTask()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .renewLease(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Task response) { |
| checkTask(response); |
| }))); |
| }); |
| |
| unittest.test("method--run", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsLocationsQueuesTasksResourceApi res = |
| new 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 = new api.RunTaskRequest.fromJson(json); |
| checkRunTaskRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| unittest.equals("v2beta2/")); |
| pathOffset += 8; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| var query = (req.url).query; |
| var queryOffset = 0; |
| var queryMap = {}; |
| addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| parseBool(n) { |
| if (n == "true") return true; |
| if (n == "false") return false; |
| if (n == null) return null; |
| throw new core.ArgumentError("Invalid boolean: $n"); |
| } |
| |
| if (query.length > 0) { |
| for (var part in query.split("&")) { |
| var keyvalue = part.split("="); |
| addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| core.Uri.decodeQueryComponent(keyvalue[1])); |
| } |
| } |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildTask()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .run(arg_request, arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Task response) { |
| checkTask(response); |
| }))); |
| }); |
| }); |
| } |