Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: generated/googleapis_beta/test/taskqueue/v1beta2_test.dart

Issue 2936613002: Api-Roll 50: 2017-06-12 (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis_beta.taskqueue.v1beta2.test; 1 library googleapis_beta.taskqueue.v1beta2.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:unittest/unittest.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
11 11
12 import 'package:googleapis_beta/taskqueue/v1beta2.dart' as api; 12 import 'package:googleapis_beta/taskqueue/v1beta2.dart' as api;
13 13
14 class HttpServerMock extends http.BaseClient { 14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback; 15 core.Function _callback;
16 core.bool _expectJson; 16 core.bool _expectJson;
17 17
18 void register(core.Function callback, core.bool expectJson) { 18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback; 19 _callback = callback;
20 _expectJson = expectJson; 20 _expectJson = expectJson;
(...skipping 18 matching lines...) Expand all
39 } else { 39 } else {
40 return stream.toBytes().then((data) { 40 return stream.toBytes().then((data) {
41 return _callback(request, data); 41 return _callback(request, data);
42 }); 42 });
43 } 43 }
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 http.StreamedResponse stringResponse( 48 http.StreamedResponse stringResponse(
49 core.int status, core.Map headers, core.String body) { 49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 51 return new http.StreamedResponse(stream, status, headers: headers);
52 } 52 }
53 53
54 core.int buildCounterTask = 0; 54 core.int buildCounterTask = 0;
55 buildTask() { 55 buildTask() {
56 var o = new api.Task(); 56 var o = new api.Task();
57 buildCounterTask++; 57 buildCounterTask++;
58 if (buildCounterTask < 3) { 58 if (buildCounterTask < 3) {
59 o.enqueueTimestamp = "foo"; 59 o.enqueueTimestamp = "foo";
(...skipping 17 matching lines...) Expand all
77 unittest.expect(o.kind, unittest.equals('foo')); 77 unittest.expect(o.kind, unittest.equals('foo'));
78 unittest.expect(o.leaseTimestamp, unittest.equals('foo')); 78 unittest.expect(o.leaseTimestamp, unittest.equals('foo'));
79 unittest.expect(o.payloadBase64, unittest.equals('foo')); 79 unittest.expect(o.payloadBase64, unittest.equals('foo'));
80 unittest.expect(o.queueName, unittest.equals('foo')); 80 unittest.expect(o.queueName, unittest.equals('foo'));
81 unittest.expect(o.retryCount, unittest.equals(42)); 81 unittest.expect(o.retryCount, unittest.equals(42));
82 unittest.expect(o.tag, unittest.equals('foo')); 82 unittest.expect(o.tag, unittest.equals('foo'));
83 } 83 }
84 buildCounterTask--; 84 buildCounterTask--;
85 } 85 }
86 86
87 buildUnnamed3713() { 87 buildUnnamed3187() {
88 var o = new core.List<core.String>(); 88 var o = new core.List<core.String>();
89 o.add("foo"); 89 o.add("foo");
90 o.add("foo"); 90 o.add("foo");
91 return o; 91 return o;
92 } 92 }
93 93
94 checkUnnamed3713(core.List<core.String> o) { 94 checkUnnamed3187(core.List<core.String> o) {
95 unittest.expect(o, unittest.hasLength(2)); 95 unittest.expect(o, unittest.hasLength(2));
96 unittest.expect(o[0], unittest.equals('foo')); 96 unittest.expect(o[0], unittest.equals('foo'));
97 unittest.expect(o[1], unittest.equals('foo')); 97 unittest.expect(o[1], unittest.equals('foo'));
98 } 98 }
99 99
100 buildUnnamed3714() { 100 buildUnnamed3188() {
101 var o = new core.List<core.String>(); 101 var o = new core.List<core.String>();
102 o.add("foo"); 102 o.add("foo");
103 o.add("foo"); 103 o.add("foo");
104 return o; 104 return o;
105 } 105 }
106 106
107 checkUnnamed3714(core.List<core.String> o) { 107 checkUnnamed3188(core.List<core.String> o) {
108 unittest.expect(o, unittest.hasLength(2)); 108 unittest.expect(o, unittest.hasLength(2));
109 unittest.expect(o[0], unittest.equals('foo')); 109 unittest.expect(o[0], unittest.equals('foo'));
110 unittest.expect(o[1], unittest.equals('foo')); 110 unittest.expect(o[1], unittest.equals('foo'));
111 } 111 }
112 112
113 buildUnnamed3715() { 113 buildUnnamed3189() {
114 var o = new core.List<core.String>(); 114 var o = new core.List<core.String>();
115 o.add("foo"); 115 o.add("foo");
116 o.add("foo"); 116 o.add("foo");
117 return o; 117 return o;
118 } 118 }
119 119
120 checkUnnamed3715(core.List<core.String> o) { 120 checkUnnamed3189(core.List<core.String> o) {
121 unittest.expect(o, unittest.hasLength(2)); 121 unittest.expect(o, unittest.hasLength(2));
122 unittest.expect(o[0], unittest.equals('foo')); 122 unittest.expect(o[0], unittest.equals('foo'));
123 unittest.expect(o[1], unittest.equals('foo')); 123 unittest.expect(o[1], unittest.equals('foo'));
124 } 124 }
125 125
126 core.int buildCounterTaskQueueAcl = 0; 126 core.int buildCounterTaskQueueAcl = 0;
127 buildTaskQueueAcl() { 127 buildTaskQueueAcl() {
128 var o = new api.TaskQueueAcl(); 128 var o = new api.TaskQueueAcl();
129 buildCounterTaskQueueAcl++; 129 buildCounterTaskQueueAcl++;
130 if (buildCounterTaskQueueAcl < 3) { 130 if (buildCounterTaskQueueAcl < 3) {
131 o.adminEmails = buildUnnamed3713(); 131 o.adminEmails = buildUnnamed3187();
132 o.consumerEmails = buildUnnamed3714(); 132 o.consumerEmails = buildUnnamed3188();
133 o.producerEmails = buildUnnamed3715(); 133 o.producerEmails = buildUnnamed3189();
134 } 134 }
135 buildCounterTaskQueueAcl--; 135 buildCounterTaskQueueAcl--;
136 return o; 136 return o;
137 } 137 }
138 138
139 checkTaskQueueAcl(api.TaskQueueAcl o) { 139 checkTaskQueueAcl(api.TaskQueueAcl o) {
140 buildCounterTaskQueueAcl++; 140 buildCounterTaskQueueAcl++;
141 if (buildCounterTaskQueueAcl < 3) { 141 if (buildCounterTaskQueueAcl < 3) {
142 checkUnnamed3713(o.adminEmails); 142 checkUnnamed3187(o.adminEmails);
143 checkUnnamed3714(o.consumerEmails); 143 checkUnnamed3188(o.consumerEmails);
144 checkUnnamed3715(o.producerEmails); 144 checkUnnamed3189(o.producerEmails);
145 } 145 }
146 buildCounterTaskQueueAcl--; 146 buildCounterTaskQueueAcl--;
147 } 147 }
148 148
149 core.int buildCounterTaskQueueStats = 0; 149 core.int buildCounterTaskQueueStats = 0;
150 buildTaskQueueStats() { 150 buildTaskQueueStats() {
151 var o = new api.TaskQueueStats(); 151 var o = new api.TaskQueueStats();
152 buildCounterTaskQueueStats++; 152 buildCounterTaskQueueStats++;
153 if (buildCounterTaskQueueStats < 3) { 153 if (buildCounterTaskQueueStats < 3) {
154 o.leasedLastHour = "foo"; 154 o.leasedLastHour = "foo";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (buildCounterTaskQueue < 3) { 191 if (buildCounterTaskQueue < 3) {
192 checkTaskQueueAcl(o.acl); 192 checkTaskQueueAcl(o.acl);
193 unittest.expect(o.id, unittest.equals('foo')); 193 unittest.expect(o.id, unittest.equals('foo'));
194 unittest.expect(o.kind, unittest.equals('foo')); 194 unittest.expect(o.kind, unittest.equals('foo'));
195 unittest.expect(o.maxLeases, unittest.equals(42)); 195 unittest.expect(o.maxLeases, unittest.equals(42));
196 checkTaskQueueStats(o.stats); 196 checkTaskQueueStats(o.stats);
197 } 197 }
198 buildCounterTaskQueue--; 198 buildCounterTaskQueue--;
199 } 199 }
200 200
201 buildUnnamed3716() { 201 buildUnnamed3190() {
202 var o = new core.List<api.Task>(); 202 var o = new core.List<api.Task>();
203 o.add(buildTask()); 203 o.add(buildTask());
204 o.add(buildTask()); 204 o.add(buildTask());
205 return o; 205 return o;
206 } 206 }
207 207
208 checkUnnamed3716(core.List<api.Task> o) { 208 checkUnnamed3190(core.List<api.Task> o) {
209 unittest.expect(o, unittest.hasLength(2)); 209 unittest.expect(o, unittest.hasLength(2));
210 checkTask(o[0]); 210 checkTask(o[0]);
211 checkTask(o[1]); 211 checkTask(o[1]);
212 } 212 }
213 213
214 core.int buildCounterTasks = 0; 214 core.int buildCounterTasks = 0;
215 buildTasks() { 215 buildTasks() {
216 var o = new api.Tasks(); 216 var o = new api.Tasks();
217 buildCounterTasks++; 217 buildCounterTasks++;
218 if (buildCounterTasks < 3) { 218 if (buildCounterTasks < 3) {
219 o.items = buildUnnamed3716(); 219 o.items = buildUnnamed3190();
220 o.kind = "foo"; 220 o.kind = "foo";
221 } 221 }
222 buildCounterTasks--; 222 buildCounterTasks--;
223 return o; 223 return o;
224 } 224 }
225 225
226 checkTasks(api.Tasks o) { 226 checkTasks(api.Tasks o) {
227 buildCounterTasks++; 227 buildCounterTasks++;
228 if (buildCounterTasks < 3) { 228 if (buildCounterTasks < 3) {
229 checkUnnamed3716(o.items); 229 checkUnnamed3190(o.items);
230 unittest.expect(o.kind, unittest.equals('foo')); 230 unittest.expect(o.kind, unittest.equals('foo'));
231 } 231 }
232 buildCounterTasks--; 232 buildCounterTasks--;
233 } 233 }
234 234
235 buildUnnamed3717() { 235 buildUnnamed3191() {
236 var o = new core.List<api.Task>(); 236 var o = new core.List<api.Task>();
237 o.add(buildTask()); 237 o.add(buildTask());
238 o.add(buildTask()); 238 o.add(buildTask());
239 return o; 239 return o;
240 } 240 }
241 241
242 checkUnnamed3717(core.List<api.Task> o) { 242 checkUnnamed3191(core.List<api.Task> o) {
243 unittest.expect(o, unittest.hasLength(2)); 243 unittest.expect(o, unittest.hasLength(2));
244 checkTask(o[0]); 244 checkTask(o[0]);
245 checkTask(o[1]); 245 checkTask(o[1]);
246 } 246 }
247 247
248 core.int buildCounterTasks2 = 0; 248 core.int buildCounterTasks2 = 0;
249 buildTasks2() { 249 buildTasks2() {
250 var o = new api.Tasks2(); 250 var o = new api.Tasks2();
251 buildCounterTasks2++; 251 buildCounterTasks2++;
252 if (buildCounterTasks2 < 3) { 252 if (buildCounterTasks2 < 3) {
253 o.items = buildUnnamed3717(); 253 o.items = buildUnnamed3191();
254 o.kind = "foo"; 254 o.kind = "foo";
255 } 255 }
256 buildCounterTasks2--; 256 buildCounterTasks2--;
257 return o; 257 return o;
258 } 258 }
259 259
260 checkTasks2(api.Tasks2 o) { 260 checkTasks2(api.Tasks2 o) {
261 buildCounterTasks2++; 261 buildCounterTasks2++;
262 if (buildCounterTasks2 < 3) { 262 if (buildCounterTasks2 < 3) {
263 checkUnnamed3717(o.items); 263 checkUnnamed3191(o.items);
264 unittest.expect(o.kind, unittest.equals('foo')); 264 unittest.expect(o.kind, unittest.equals('foo'));
265 } 265 }
266 buildCounterTasks2--; 266 buildCounterTasks2--;
267 } 267 }
268 268
269 269
270 main() { 270 main() {
271 unittest.group("obj-schema-Task", () { 271 unittest.group("obj-schema-Task", () {
272 unittest.test("to-json--from-json", () { 272 unittest.test("to-json--from-json", () {
273 var o = buildTask(); 273 var o = buildTask();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 324
325 unittest.group("resource-TaskqueuesResourceApi", () { 325 unittest.group("resource-TaskqueuesResourceApi", () {
326 unittest.test("method--get", () { 326 unittest.test("method--get", () {
327 327
328 var mock = new HttpServerMock(); 328 var mock = new HttpServerMock();
329 api.TaskqueuesResourceApi res = new api.TaskqueueApi(mock).taskqueues; 329 api.TaskqueuesResourceApi res = new api.TaskqueueApi(mock).taskqueues;
330 var arg_project = "foo"; 330 var arg_project = "foo";
331 var arg_taskqueue = "foo"; 331 var arg_taskqueue = "foo";
332 var arg_getStats = true; 332 var arg_getStats = true;
333 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 333 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
334 var path = (req.url).path; 334 var path = (req.url).path;
335 var pathOffset = 0; 335 var pathOffset = 0;
336 var index; 336 var index;
337 var subPart; 337 var subPart;
338 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 338 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
339 pathOffset += 1; 339 pathOffset += 1;
340 340
341 var query = (req.url).query; 341 var query = (req.url).query;
342 var queryOffset = 0; 342 var queryOffset = 0;
343 var queryMap = {}; 343 var queryMap = {};
(...skipping 12 matching lines...) Expand all
356 } 356 }
357 unittest.expect(queryMap["getStats"].first, unittest.equals("$arg_getSta ts")); 357 unittest.expect(queryMap["getStats"].first, unittest.equals("$arg_getSta ts"));
358 358
359 359
360 var h = { 360 var h = {
361 "content-type" : "application/json; charset=utf-8", 361 "content-type" : "application/json; charset=utf-8",
362 }; 362 };
363 var resp = convert.JSON.encode(buildTaskQueue()); 363 var resp = convert.JSON.encode(buildTaskQueue());
364 return new async.Future.value(stringResponse(200, h, resp)); 364 return new async.Future.value(stringResponse(200, h, resp));
365 }), true); 365 }), true);
366 res.get(arg_project, arg_taskqueue, getStats: arg_getStats).then(unittest. expectAsync(((api.TaskQueue response) { 366 res.get(arg_project, arg_taskqueue, getStats: arg_getStats).then(unittest. expectAsync1(((api.TaskQueue response) {
367 checkTaskQueue(response); 367 checkTaskQueue(response);
368 }))); 368 })));
369 }); 369 });
370 370
371 }); 371 });
372 372
373 373
374 unittest.group("resource-TasksResourceApi", () { 374 unittest.group("resource-TasksResourceApi", () {
375 unittest.test("method--delete", () { 375 unittest.test("method--delete", () {
376 376
377 var mock = new HttpServerMock(); 377 var mock = new HttpServerMock();
378 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 378 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
379 var arg_project = "foo"; 379 var arg_project = "foo";
380 var arg_taskqueue = "foo"; 380 var arg_taskqueue = "foo";
381 var arg_task = "foo"; 381 var arg_task = "foo";
382 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 382 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
383 var path = (req.url).path; 383 var path = (req.url).path;
384 var pathOffset = 0; 384 var pathOffset = 0;
385 var index; 385 var index;
386 var subPart; 386 var subPart;
387 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 387 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
388 pathOffset += 1; 388 pathOffset += 1;
389 389
390 var query = (req.url).query; 390 var query = (req.url).query;
391 var queryOffset = 0; 391 var queryOffset = 0;
392 var queryMap = {}; 392 var queryMap = {};
(...skipping 11 matching lines...) Expand all
404 } 404 }
405 } 405 }
406 406
407 407
408 var h = { 408 var h = {
409 "content-type" : "application/json; charset=utf-8", 409 "content-type" : "application/json; charset=utf-8",
410 }; 410 };
411 var resp = ""; 411 var resp = "";
412 return new async.Future.value(stringResponse(200, h, resp)); 412 return new async.Future.value(stringResponse(200, h, resp));
413 }), true); 413 }), true);
414 res.delete(arg_project, arg_taskqueue, arg_task).then(unittest.expectAsync ((_) {})); 414 res.delete(arg_project, arg_taskqueue, arg_task).then(unittest.expectAsync 1((_) {}));
415 }); 415 });
416 416
417 unittest.test("method--get", () { 417 unittest.test("method--get", () {
418 418
419 var mock = new HttpServerMock(); 419 var mock = new HttpServerMock();
420 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 420 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
421 var arg_project = "foo"; 421 var arg_project = "foo";
422 var arg_taskqueue = "foo"; 422 var arg_taskqueue = "foo";
423 var arg_task = "foo"; 423 var arg_task = "foo";
424 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 424 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
425 var path = (req.url).path; 425 var path = (req.url).path;
426 var pathOffset = 0; 426 var pathOffset = 0;
427 var index; 427 var index;
428 var subPart; 428 var subPart;
429 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 429 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
430 pathOffset += 1; 430 pathOffset += 1;
431 431
432 var query = (req.url).query; 432 var query = (req.url).query;
433 var queryOffset = 0; 433 var queryOffset = 0;
434 var queryMap = {}; 434 var queryMap = {};
(...skipping 11 matching lines...) Expand all
446 } 446 }
447 } 447 }
448 448
449 449
450 var h = { 450 var h = {
451 "content-type" : "application/json; charset=utf-8", 451 "content-type" : "application/json; charset=utf-8",
452 }; 452 };
453 var resp = convert.JSON.encode(buildTask()); 453 var resp = convert.JSON.encode(buildTask());
454 return new async.Future.value(stringResponse(200, h, resp)); 454 return new async.Future.value(stringResponse(200, h, resp));
455 }), true); 455 }), true);
456 res.get(arg_project, arg_taskqueue, arg_task).then(unittest.expectAsync((( api.Task response) { 456 res.get(arg_project, arg_taskqueue, arg_task).then(unittest.expectAsync1(( (api.Task response) {
457 checkTask(response); 457 checkTask(response);
458 }))); 458 })));
459 }); 459 });
460 460
461 unittest.test("method--insert", () { 461 unittest.test("method--insert", () {
462 462
463 var mock = new HttpServerMock(); 463 var mock = new HttpServerMock();
464 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 464 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
465 var arg_request = buildTask(); 465 var arg_request = buildTask();
466 var arg_project = "foo"; 466 var arg_project = "foo";
467 var arg_taskqueue = "foo"; 467 var arg_taskqueue = "foo";
468 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 468 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
469 var obj = new api.Task.fromJson(json); 469 var obj = new api.Task.fromJson(json);
470 checkTask(obj); 470 checkTask(obj);
471 471
472 var path = (req.url).path; 472 var path = (req.url).path;
473 var pathOffset = 0; 473 var pathOffset = 0;
474 var index; 474 var index;
475 var subPart; 475 var subPart;
476 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 476 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
477 pathOffset += 1; 477 pathOffset += 1;
478 478
(...skipping 14 matching lines...) Expand all
493 } 493 }
494 } 494 }
495 495
496 496
497 var h = { 497 var h = {
498 "content-type" : "application/json; charset=utf-8", 498 "content-type" : "application/json; charset=utf-8",
499 }; 499 };
500 var resp = convert.JSON.encode(buildTask()); 500 var resp = convert.JSON.encode(buildTask());
501 return new async.Future.value(stringResponse(200, h, resp)); 501 return new async.Future.value(stringResponse(200, h, resp));
502 }), true); 502 }), true);
503 res.insert(arg_request, arg_project, arg_taskqueue).then(unittest.expectAs ync(((api.Task response) { 503 res.insert(arg_request, arg_project, arg_taskqueue).then(unittest.expectAs ync1(((api.Task response) {
504 checkTask(response); 504 checkTask(response);
505 }))); 505 })));
506 }); 506 });
507 507
508 unittest.test("method--lease", () { 508 unittest.test("method--lease", () {
509 509
510 var mock = new HttpServerMock(); 510 var mock = new HttpServerMock();
511 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 511 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
512 var arg_project = "foo"; 512 var arg_project = "foo";
513 var arg_taskqueue = "foo"; 513 var arg_taskqueue = "foo";
514 var arg_numTasks = 42; 514 var arg_numTasks = 42;
515 var arg_leaseSecs = 42; 515 var arg_leaseSecs = 42;
516 var arg_groupByTag = true; 516 var arg_groupByTag = true;
517 var arg_tag = "foo"; 517 var arg_tag = "foo";
518 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 518 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
519 var path = (req.url).path; 519 var path = (req.url).path;
520 var pathOffset = 0; 520 var pathOffset = 0;
521 var index; 521 var index;
522 var subPart; 522 var subPart;
523 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 523 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
524 pathOffset += 1; 524 pathOffset += 1;
525 525
526 var query = (req.url).query; 526 var query = (req.url).query;
527 var queryOffset = 0; 527 var queryOffset = 0;
528 var queryMap = {}; 528 var queryMap = {};
(...skipping 15 matching lines...) Expand all
544 unittest.expect(queryMap["groupByTag"].first, unittest.equals("$arg_grou pByTag")); 544 unittest.expect(queryMap["groupByTag"].first, unittest.equals("$arg_grou pByTag"));
545 unittest.expect(queryMap["tag"].first, unittest.equals(arg_tag)); 545 unittest.expect(queryMap["tag"].first, unittest.equals(arg_tag));
546 546
547 547
548 var h = { 548 var h = {
549 "content-type" : "application/json; charset=utf-8", 549 "content-type" : "application/json; charset=utf-8",
550 }; 550 };
551 var resp = convert.JSON.encode(buildTasks()); 551 var resp = convert.JSON.encode(buildTasks());
552 return new async.Future.value(stringResponse(200, h, resp)); 552 return new async.Future.value(stringResponse(200, h, resp));
553 }), true); 553 }), true);
554 res.lease(arg_project, arg_taskqueue, arg_numTasks, arg_leaseSecs, groupBy Tag: arg_groupByTag, tag: arg_tag).then(unittest.expectAsync(((api.Tasks respons e) { 554 res.lease(arg_project, arg_taskqueue, arg_numTasks, arg_leaseSecs, groupBy Tag: arg_groupByTag, tag: arg_tag).then(unittest.expectAsync1(((api.Tasks respon se) {
555 checkTasks(response); 555 checkTasks(response);
556 }))); 556 })));
557 }); 557 });
558 558
559 unittest.test("method--list", () { 559 unittest.test("method--list", () {
560 560
561 var mock = new HttpServerMock(); 561 var mock = new HttpServerMock();
562 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 562 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
563 var arg_project = "foo"; 563 var arg_project = "foo";
564 var arg_taskqueue = "foo"; 564 var arg_taskqueue = "foo";
565 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 565 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
566 var path = (req.url).path; 566 var path = (req.url).path;
567 var pathOffset = 0; 567 var pathOffset = 0;
568 var index; 568 var index;
569 var subPart; 569 var subPart;
570 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 570 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
571 pathOffset += 1; 571 pathOffset += 1;
572 572
573 var query = (req.url).query; 573 var query = (req.url).query;
574 var queryOffset = 0; 574 var queryOffset = 0;
575 var queryMap = {}; 575 var queryMap = {};
(...skipping 11 matching lines...) Expand all
587 } 587 }
588 } 588 }
589 589
590 590
591 var h = { 591 var h = {
592 "content-type" : "application/json; charset=utf-8", 592 "content-type" : "application/json; charset=utf-8",
593 }; 593 };
594 var resp = convert.JSON.encode(buildTasks2()); 594 var resp = convert.JSON.encode(buildTasks2());
595 return new async.Future.value(stringResponse(200, h, resp)); 595 return new async.Future.value(stringResponse(200, h, resp));
596 }), true); 596 }), true);
597 res.list(arg_project, arg_taskqueue).then(unittest.expectAsync(((api.Tasks 2 response) { 597 res.list(arg_project, arg_taskqueue).then(unittest.expectAsync1(((api.Task s2 response) {
598 checkTasks2(response); 598 checkTasks2(response);
599 }))); 599 })));
600 }); 600 });
601 601
602 unittest.test("method--patch", () { 602 unittest.test("method--patch", () {
603 603
604 var mock = new HttpServerMock(); 604 var mock = new HttpServerMock();
605 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 605 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
606 var arg_request = buildTask(); 606 var arg_request = buildTask();
607 var arg_project = "foo"; 607 var arg_project = "foo";
608 var arg_taskqueue = "foo"; 608 var arg_taskqueue = "foo";
609 var arg_task = "foo"; 609 var arg_task = "foo";
610 var arg_newLeaseSeconds = 42; 610 var arg_newLeaseSeconds = 42;
611 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 611 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
612 var obj = new api.Task.fromJson(json); 612 var obj = new api.Task.fromJson(json);
613 checkTask(obj); 613 checkTask(obj);
614 614
615 var path = (req.url).path; 615 var path = (req.url).path;
616 var pathOffset = 0; 616 var pathOffset = 0;
617 var index; 617 var index;
618 var subPart; 618 var subPart;
619 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 619 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
620 pathOffset += 1; 620 pathOffset += 1;
621 621
(...skipping 15 matching lines...) Expand all
637 } 637 }
638 unittest.expect(core.int.parse(queryMap["newLeaseSeconds"].first), unitt est.equals(arg_newLeaseSeconds)); 638 unittest.expect(core.int.parse(queryMap["newLeaseSeconds"].first), unitt est.equals(arg_newLeaseSeconds));
639 639
640 640
641 var h = { 641 var h = {
642 "content-type" : "application/json; charset=utf-8", 642 "content-type" : "application/json; charset=utf-8",
643 }; 643 };
644 var resp = convert.JSON.encode(buildTask()); 644 var resp = convert.JSON.encode(buildTask());
645 return new async.Future.value(stringResponse(200, h, resp)); 645 return new async.Future.value(stringResponse(200, h, resp));
646 }), true); 646 }), true);
647 res.patch(arg_request, arg_project, arg_taskqueue, arg_task, arg_newLeaseS econds).then(unittest.expectAsync(((api.Task response) { 647 res.patch(arg_request, arg_project, arg_taskqueue, arg_task, arg_newLeaseS econds).then(unittest.expectAsync1(((api.Task response) {
648 checkTask(response); 648 checkTask(response);
649 }))); 649 })));
650 }); 650 });
651 651
652 unittest.test("method--update", () { 652 unittest.test("method--update", () {
653 653
654 var mock = new HttpServerMock(); 654 var mock = new HttpServerMock();
655 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks; 655 api.TasksResourceApi res = new api.TaskqueueApi(mock).tasks;
656 var arg_request = buildTask(); 656 var arg_request = buildTask();
657 var arg_project = "foo"; 657 var arg_project = "foo";
658 var arg_taskqueue = "foo"; 658 var arg_taskqueue = "foo";
659 var arg_task = "foo"; 659 var arg_task = "foo";
660 var arg_newLeaseSeconds = 42; 660 var arg_newLeaseSeconds = 42;
661 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 661 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
662 var obj = new api.Task.fromJson(json); 662 var obj = new api.Task.fromJson(json);
663 checkTask(obj); 663 checkTask(obj);
664 664
665 var path = (req.url).path; 665 var path = (req.url).path;
666 var pathOffset = 0; 666 var pathOffset = 0;
667 var index; 667 var index;
668 var subPart; 668 var subPart;
669 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 669 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
670 pathOffset += 1; 670 pathOffset += 1;
671 671
(...skipping 15 matching lines...) Expand all
687 } 687 }
688 unittest.expect(core.int.parse(queryMap["newLeaseSeconds"].first), unitt est.equals(arg_newLeaseSeconds)); 688 unittest.expect(core.int.parse(queryMap["newLeaseSeconds"].first), unitt est.equals(arg_newLeaseSeconds));
689 689
690 690
691 var h = { 691 var h = {
692 "content-type" : "application/json; charset=utf-8", 692 "content-type" : "application/json; charset=utf-8",
693 }; 693 };
694 var resp = convert.JSON.encode(buildTask()); 694 var resp = convert.JSON.encode(buildTask());
695 return new async.Future.value(stringResponse(200, h, resp)); 695 return new async.Future.value(stringResponse(200, h, resp));
696 }), true); 696 }), true);
697 res.update(arg_request, arg_project, arg_taskqueue, arg_task, arg_newLease Seconds).then(unittest.expectAsync(((api.Task response) { 697 res.update(arg_request, arg_project, arg_taskqueue, arg_task, arg_newLease Seconds).then(unittest.expectAsync1(((api.Task response) {
698 checkTask(response); 698 checkTask(response);
699 }))); 699 })));
700 }); 700 });
701 701
702 }); 702 });
703 703
704 704
705 } 705 }
706 706
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698