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

Side by Side Diff: generated/googleapis/test/tasks/v1_test.dart

Issue 1078053002: Roll of googleapis as of 4/7/2015. (Closed) Base URL: https://github.com/dart-lang/googleapis.git@master
Patch Set: Created 5 years, 8 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.tasks.v1.test; 1 library googleapis.tasks.v1.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:unittest/unittest.dart' as unittest;
11 import 'package:googleapis/common/common.dart' as common;
12 import 'package:googleapis/src/common_internal.dart' as common_internal;
13 import '../common/common_internal_test.dart' as common_test;
14 11
15 import 'package:googleapis/tasks/v1.dart' as api; 12 import 'package:googleapis/tasks/v1.dart' as api;
16 13
14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback;
16 core.bool _expectJson;
17 17
18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback;
20 _expectJson = expectJson;
21 }
22
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) {
24 if (_expectJson) {
25 return request.finalize()
26 .transform(convert.UTF8.decoder)
27 .join('')
28 .then((core.String jsonString) {
29 if (jsonString.isEmpty) {
30 return _callback(request, null);
31 } else {
32 return _callback(request, convert.JSON.decode(jsonString));
33 }
34 });
35 } else {
36 var stream = request.finalize();
37 if (stream == null) {
38 return _callback(request, []);
39 } else {
40 return stream.toBytes().then((data) {
41 return _callback(request, data);
42 });
43 }
44 }
45 }
46 }
47
48 http.StreamedResponse stringResponse(
49 core.int status, core.Map headers, core.String body) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers);
52 }
18 53
19 core.int buildCounterTaskLinks = 0; 54 core.int buildCounterTaskLinks = 0;
20 buildTaskLinks() { 55 buildTaskLinks() {
21 var o = new api.TaskLinks(); 56 var o = new api.TaskLinks();
22 buildCounterTaskLinks++; 57 buildCounterTaskLinks++;
23 if (buildCounterTaskLinks < 3) { 58 if (buildCounterTaskLinks < 3) {
24 o.description = "foo"; 59 o.description = "foo";
25 o.link = "foo"; 60 o.link = "foo";
26 o.type = "foo"; 61 o.type = "foo";
27 } 62 }
28 buildCounterTaskLinks--; 63 buildCounterTaskLinks--;
29 return o; 64 return o;
30 } 65 }
31 66
32 checkTaskLinks(api.TaskLinks o) { 67 checkTaskLinks(api.TaskLinks o) {
33 buildCounterTaskLinks++; 68 buildCounterTaskLinks++;
34 if (buildCounterTaskLinks < 3) { 69 if (buildCounterTaskLinks < 3) {
35 unittest.expect(o.description, unittest.equals('foo')); 70 unittest.expect(o.description, unittest.equals('foo'));
36 unittest.expect(o.link, unittest.equals('foo')); 71 unittest.expect(o.link, unittest.equals('foo'));
37 unittest.expect(o.type, unittest.equals('foo')); 72 unittest.expect(o.type, unittest.equals('foo'));
38 } 73 }
39 buildCounterTaskLinks--; 74 buildCounterTaskLinks--;
40 } 75 }
41 76
42 buildUnnamed1454() { 77 buildUnnamed1384() {
43 var o = new core.List<api.TaskLinks>(); 78 var o = new core.List<api.TaskLinks>();
44 o.add(buildTaskLinks()); 79 o.add(buildTaskLinks());
45 o.add(buildTaskLinks()); 80 o.add(buildTaskLinks());
46 return o; 81 return o;
47 } 82 }
48 83
49 checkUnnamed1454(core.List<api.TaskLinks> o) { 84 checkUnnamed1384(core.List<api.TaskLinks> o) {
50 unittest.expect(o, unittest.hasLength(2)); 85 unittest.expect(o, unittest.hasLength(2));
51 checkTaskLinks(o[0]); 86 checkTaskLinks(o[0]);
52 checkTaskLinks(o[1]); 87 checkTaskLinks(o[1]);
53 } 88 }
54 89
55 core.int buildCounterTask = 0; 90 core.int buildCounterTask = 0;
56 buildTask() { 91 buildTask() {
57 var o = new api.Task(); 92 var o = new api.Task();
58 buildCounterTask++; 93 buildCounterTask++;
59 if (buildCounterTask < 3) { 94 if (buildCounterTask < 3) {
60 o.completed = core.DateTime.parse("2002-02-27T14:01:02"); 95 o.completed = core.DateTime.parse("2002-02-27T14:01:02");
61 o.deleted = true; 96 o.deleted = true;
62 o.due = core.DateTime.parse("2002-02-27T14:01:02"); 97 o.due = core.DateTime.parse("2002-02-27T14:01:02");
63 o.etag = "foo"; 98 o.etag = "foo";
64 o.hidden = true; 99 o.hidden = true;
65 o.id = "foo"; 100 o.id = "foo";
66 o.kind = "foo"; 101 o.kind = "foo";
67 o.links = buildUnnamed1454(); 102 o.links = buildUnnamed1384();
68 o.notes = "foo"; 103 o.notes = "foo";
69 o.parent = "foo"; 104 o.parent = "foo";
70 o.position = "foo"; 105 o.position = "foo";
71 o.selfLink = "foo"; 106 o.selfLink = "foo";
72 o.status = "foo"; 107 o.status = "foo";
73 o.title = "foo"; 108 o.title = "foo";
74 o.updated = core.DateTime.parse("2002-02-27T14:01:02"); 109 o.updated = core.DateTime.parse("2002-02-27T14:01:02");
75 } 110 }
76 buildCounterTask--; 111 buildCounterTask--;
77 return o; 112 return o;
78 } 113 }
79 114
80 checkTask(api.Task o) { 115 checkTask(api.Task o) {
81 buildCounterTask++; 116 buildCounterTask++;
82 if (buildCounterTask < 3) { 117 if (buildCounterTask < 3) {
83 unittest.expect(o.completed, unittest.equals(core.DateTime.parse("2002-02-27 T14:01:02"))); 118 unittest.expect(o.completed, unittest.equals(core.DateTime.parse("2002-02-27 T14:01:02")));
84 unittest.expect(o.deleted, unittest.isTrue); 119 unittest.expect(o.deleted, unittest.isTrue);
85 unittest.expect(o.due, unittest.equals(core.DateTime.parse("2002-02-27T14:01 :02"))); 120 unittest.expect(o.due, unittest.equals(core.DateTime.parse("2002-02-27T14:01 :02")));
86 unittest.expect(o.etag, unittest.equals('foo')); 121 unittest.expect(o.etag, unittest.equals('foo'));
87 unittest.expect(o.hidden, unittest.isTrue); 122 unittest.expect(o.hidden, unittest.isTrue);
88 unittest.expect(o.id, unittest.equals('foo')); 123 unittest.expect(o.id, unittest.equals('foo'));
89 unittest.expect(o.kind, unittest.equals('foo')); 124 unittest.expect(o.kind, unittest.equals('foo'));
90 checkUnnamed1454(o.links); 125 checkUnnamed1384(o.links);
91 unittest.expect(o.notes, unittest.equals('foo')); 126 unittest.expect(o.notes, unittest.equals('foo'));
92 unittest.expect(o.parent, unittest.equals('foo')); 127 unittest.expect(o.parent, unittest.equals('foo'));
93 unittest.expect(o.position, unittest.equals('foo')); 128 unittest.expect(o.position, unittest.equals('foo'));
94 unittest.expect(o.selfLink, unittest.equals('foo')); 129 unittest.expect(o.selfLink, unittest.equals('foo'));
95 unittest.expect(o.status, unittest.equals('foo')); 130 unittest.expect(o.status, unittest.equals('foo'));
96 unittest.expect(o.title, unittest.equals('foo')); 131 unittest.expect(o.title, unittest.equals('foo'));
97 unittest.expect(o.updated, unittest.equals(core.DateTime.parse("2002-02-27T1 4:01:02"))); 132 unittest.expect(o.updated, unittest.equals(core.DateTime.parse("2002-02-27T1 4:01:02")));
98 } 133 }
99 buildCounterTask--; 134 buildCounterTask--;
100 } 135 }
(...skipping 20 matching lines...) Expand all
121 unittest.expect(o.etag, unittest.equals('foo')); 156 unittest.expect(o.etag, unittest.equals('foo'));
122 unittest.expect(o.id, unittest.equals('foo')); 157 unittest.expect(o.id, unittest.equals('foo'));
123 unittest.expect(o.kind, unittest.equals('foo')); 158 unittest.expect(o.kind, unittest.equals('foo'));
124 unittest.expect(o.selfLink, unittest.equals('foo')); 159 unittest.expect(o.selfLink, unittest.equals('foo'));
125 unittest.expect(o.title, unittest.equals('foo')); 160 unittest.expect(o.title, unittest.equals('foo'));
126 unittest.expect(o.updated, unittest.equals(core.DateTime.parse("2002-02-27T1 4:01:02"))); 161 unittest.expect(o.updated, unittest.equals(core.DateTime.parse("2002-02-27T1 4:01:02")));
127 } 162 }
128 buildCounterTaskList--; 163 buildCounterTaskList--;
129 } 164 }
130 165
131 buildUnnamed1455() { 166 buildUnnamed1385() {
132 var o = new core.List<api.TaskList>(); 167 var o = new core.List<api.TaskList>();
133 o.add(buildTaskList()); 168 o.add(buildTaskList());
134 o.add(buildTaskList()); 169 o.add(buildTaskList());
135 return o; 170 return o;
136 } 171 }
137 172
138 checkUnnamed1455(core.List<api.TaskList> o) { 173 checkUnnamed1385(core.List<api.TaskList> o) {
139 unittest.expect(o, unittest.hasLength(2)); 174 unittest.expect(o, unittest.hasLength(2));
140 checkTaskList(o[0]); 175 checkTaskList(o[0]);
141 checkTaskList(o[1]); 176 checkTaskList(o[1]);
142 } 177 }
143 178
144 core.int buildCounterTaskLists = 0; 179 core.int buildCounterTaskLists = 0;
145 buildTaskLists() { 180 buildTaskLists() {
146 var o = new api.TaskLists(); 181 var o = new api.TaskLists();
147 buildCounterTaskLists++; 182 buildCounterTaskLists++;
148 if (buildCounterTaskLists < 3) { 183 if (buildCounterTaskLists < 3) {
149 o.etag = "foo"; 184 o.etag = "foo";
150 o.items = buildUnnamed1455(); 185 o.items = buildUnnamed1385();
151 o.kind = "foo"; 186 o.kind = "foo";
152 o.nextPageToken = "foo"; 187 o.nextPageToken = "foo";
153 } 188 }
154 buildCounterTaskLists--; 189 buildCounterTaskLists--;
155 return o; 190 return o;
156 } 191 }
157 192
158 checkTaskLists(api.TaskLists o) { 193 checkTaskLists(api.TaskLists o) {
159 buildCounterTaskLists++; 194 buildCounterTaskLists++;
160 if (buildCounterTaskLists < 3) { 195 if (buildCounterTaskLists < 3) {
161 unittest.expect(o.etag, unittest.equals('foo')); 196 unittest.expect(o.etag, unittest.equals('foo'));
162 checkUnnamed1455(o.items); 197 checkUnnamed1385(o.items);
163 unittest.expect(o.kind, unittest.equals('foo')); 198 unittest.expect(o.kind, unittest.equals('foo'));
164 unittest.expect(o.nextPageToken, unittest.equals('foo')); 199 unittest.expect(o.nextPageToken, unittest.equals('foo'));
165 } 200 }
166 buildCounterTaskLists--; 201 buildCounterTaskLists--;
167 } 202 }
168 203
169 buildUnnamed1456() { 204 buildUnnamed1386() {
170 var o = new core.List<api.Task>(); 205 var o = new core.List<api.Task>();
171 o.add(buildTask()); 206 o.add(buildTask());
172 o.add(buildTask()); 207 o.add(buildTask());
173 return o; 208 return o;
174 } 209 }
175 210
176 checkUnnamed1456(core.List<api.Task> o) { 211 checkUnnamed1386(core.List<api.Task> o) {
177 unittest.expect(o, unittest.hasLength(2)); 212 unittest.expect(o, unittest.hasLength(2));
178 checkTask(o[0]); 213 checkTask(o[0]);
179 checkTask(o[1]); 214 checkTask(o[1]);
180 } 215 }
181 216
182 core.int buildCounterTasks = 0; 217 core.int buildCounterTasks = 0;
183 buildTasks() { 218 buildTasks() {
184 var o = new api.Tasks(); 219 var o = new api.Tasks();
185 buildCounterTasks++; 220 buildCounterTasks++;
186 if (buildCounterTasks < 3) { 221 if (buildCounterTasks < 3) {
187 o.etag = "foo"; 222 o.etag = "foo";
188 o.items = buildUnnamed1456(); 223 o.items = buildUnnamed1386();
189 o.kind = "foo"; 224 o.kind = "foo";
190 o.nextPageToken = "foo"; 225 o.nextPageToken = "foo";
191 } 226 }
192 buildCounterTasks--; 227 buildCounterTasks--;
193 return o; 228 return o;
194 } 229 }
195 230
196 checkTasks(api.Tasks o) { 231 checkTasks(api.Tasks o) {
197 buildCounterTasks++; 232 buildCounterTasks++;
198 if (buildCounterTasks < 3) { 233 if (buildCounterTasks < 3) {
199 unittest.expect(o.etag, unittest.equals('foo')); 234 unittest.expect(o.etag, unittest.equals('foo'));
200 checkUnnamed1456(o.items); 235 checkUnnamed1386(o.items);
201 unittest.expect(o.kind, unittest.equals('foo')); 236 unittest.expect(o.kind, unittest.equals('foo'));
202 unittest.expect(o.nextPageToken, unittest.equals('foo')); 237 unittest.expect(o.nextPageToken, unittest.equals('foo'));
203 } 238 }
204 buildCounterTasks--; 239 buildCounterTasks--;
205 } 240 }
206 241
207 242
208 main() { 243 main() {
209 unittest.group("obj-schema-TaskLinks", () { 244 unittest.group("obj-schema-TaskLinks", () {
210 unittest.test("to-json--from-json", () { 245 unittest.test("to-json--from-json", () {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 var o = buildTasks(); 282 var o = buildTasks();
248 var od = new api.Tasks.fromJson(o.toJson()); 283 var od = new api.Tasks.fromJson(o.toJson());
249 checkTasks(od); 284 checkTasks(od);
250 }); 285 });
251 }); 286 });
252 287
253 288
254 unittest.group("resource-TasklistsResourceApi", () { 289 unittest.group("resource-TasklistsResourceApi", () {
255 unittest.test("method--delete", () { 290 unittest.test("method--delete", () {
256 291
257 var mock = new common_test.HttpServerMock(); 292 var mock = new HttpServerMock();
258 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 293 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
259 var arg_tasklist = "foo"; 294 var arg_tasklist = "foo";
260 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 295 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
261 var path = (req.url).path; 296 var path = (req.url).path;
262 var pathOffset = 0; 297 var pathOffset = 0;
263 var index; 298 var index;
264 var subPart; 299 var subPart;
265 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 300 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
266 pathOffset += 1; 301 pathOffset += 1;
267 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/")); 302 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/"));
(...skipping 19 matching lines...) Expand all
287 var keyvalue = part.split("="); 322 var keyvalue = part.split("=");
288 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 323 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
289 } 324 }
290 } 325 }
291 326
292 327
293 var h = { 328 var h = {
294 "content-type" : "application/json; charset=utf-8", 329 "content-type" : "application/json; charset=utf-8",
295 }; 330 };
296 var resp = ""; 331 var resp = "";
297 return new async.Future.value(common_test.stringResponse(200, h, resp)); 332 return new async.Future.value(stringResponse(200, h, resp));
298 }), true); 333 }), true);
299 res.delete(arg_tasklist).then(unittest.expectAsync((_) {})); 334 res.delete(arg_tasklist).then(unittest.expectAsync((_) {}));
300 }); 335 });
301 336
302 unittest.test("method--get", () { 337 unittest.test("method--get", () {
303 338
304 var mock = new common_test.HttpServerMock(); 339 var mock = new HttpServerMock();
305 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 340 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
306 var arg_tasklist = "foo"; 341 var arg_tasklist = "foo";
307 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 342 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
308 var path = (req.url).path; 343 var path = (req.url).path;
309 var pathOffset = 0; 344 var pathOffset = 0;
310 var index; 345 var index;
311 var subPart; 346 var subPart;
312 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 347 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
313 pathOffset += 1; 348 pathOffset += 1;
314 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/")); 349 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/"));
(...skipping 19 matching lines...) Expand all
334 var keyvalue = part.split("="); 369 var keyvalue = part.split("=");
335 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 370 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
336 } 371 }
337 } 372 }
338 373
339 374
340 var h = { 375 var h = {
341 "content-type" : "application/json; charset=utf-8", 376 "content-type" : "application/json; charset=utf-8",
342 }; 377 };
343 var resp = convert.JSON.encode(buildTaskList()); 378 var resp = convert.JSON.encode(buildTaskList());
344 return new async.Future.value(common_test.stringResponse(200, h, resp)); 379 return new async.Future.value(stringResponse(200, h, resp));
345 }), true); 380 }), true);
346 res.get(arg_tasklist).then(unittest.expectAsync(((api.TaskList response) { 381 res.get(arg_tasklist).then(unittest.expectAsync(((api.TaskList response) {
347 checkTaskList(response); 382 checkTaskList(response);
348 }))); 383 })));
349 }); 384 });
350 385
351 unittest.test("method--insert", () { 386 unittest.test("method--insert", () {
352 387
353 var mock = new common_test.HttpServerMock(); 388 var mock = new HttpServerMock();
354 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 389 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
355 var arg_request = buildTaskList(); 390 var arg_request = buildTaskList();
356 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 391 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
357 var obj = new api.TaskList.fromJson(json); 392 var obj = new api.TaskList.fromJson(json);
358 checkTaskList(obj); 393 checkTaskList(obj);
359 394
360 var path = (req.url).path; 395 var path = (req.url).path;
361 var pathOffset = 0; 396 var pathOffset = 0;
362 var index; 397 var index;
363 var subPart; 398 var subPart;
(...skipping 19 matching lines...) Expand all
383 var keyvalue = part.split("="); 418 var keyvalue = part.split("=");
384 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 419 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
385 } 420 }
386 } 421 }
387 422
388 423
389 var h = { 424 var h = {
390 "content-type" : "application/json; charset=utf-8", 425 "content-type" : "application/json; charset=utf-8",
391 }; 426 };
392 var resp = convert.JSON.encode(buildTaskList()); 427 var resp = convert.JSON.encode(buildTaskList());
393 return new async.Future.value(common_test.stringResponse(200, h, resp)); 428 return new async.Future.value(stringResponse(200, h, resp));
394 }), true); 429 }), true);
395 res.insert(arg_request).then(unittest.expectAsync(((api.TaskList response) { 430 res.insert(arg_request).then(unittest.expectAsync(((api.TaskList response) {
396 checkTaskList(response); 431 checkTaskList(response);
397 }))); 432 })));
398 }); 433 });
399 434
400 unittest.test("method--list", () { 435 unittest.test("method--list", () {
401 436
402 var mock = new common_test.HttpServerMock(); 437 var mock = new HttpServerMock();
403 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 438 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
404 var arg_maxResults = "foo"; 439 var arg_maxResults = "foo";
405 var arg_pageToken = "foo"; 440 var arg_pageToken = "foo";
406 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 441 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
407 var path = (req.url).path; 442 var path = (req.url).path;
408 var pathOffset = 0; 443 var pathOffset = 0;
409 var index; 444 var index;
410 var subPart; 445 var subPart;
411 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 446 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
412 pathOffset += 1; 447 pathOffset += 1;
(...skipping 19 matching lines...) Expand all
432 } 467 }
433 } 468 }
434 unittest.expect(queryMap["maxResults"].first, unittest.equals(arg_maxRes ults)); 469 unittest.expect(queryMap["maxResults"].first, unittest.equals(arg_maxRes ults));
435 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 470 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
436 471
437 472
438 var h = { 473 var h = {
439 "content-type" : "application/json; charset=utf-8", 474 "content-type" : "application/json; charset=utf-8",
440 }; 475 };
441 var resp = convert.JSON.encode(buildTaskLists()); 476 var resp = convert.JSON.encode(buildTaskLists());
442 return new async.Future.value(common_test.stringResponse(200, h, resp)); 477 return new async.Future.value(stringResponse(200, h, resp));
443 }), true); 478 }), true);
444 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken).then(unitte st.expectAsync(((api.TaskLists response) { 479 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken).then(unitte st.expectAsync(((api.TaskLists response) {
445 checkTaskLists(response); 480 checkTaskLists(response);
446 }))); 481 })));
447 }); 482 });
448 483
449 unittest.test("method--patch", () { 484 unittest.test("method--patch", () {
450 485
451 var mock = new common_test.HttpServerMock(); 486 var mock = new HttpServerMock();
452 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 487 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
453 var arg_request = buildTaskList(); 488 var arg_request = buildTaskList();
454 var arg_tasklist = "foo"; 489 var arg_tasklist = "foo";
455 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 490 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
456 var obj = new api.TaskList.fromJson(json); 491 var obj = new api.TaskList.fromJson(json);
457 checkTaskList(obj); 492 checkTaskList(obj);
458 493
459 var path = (req.url).path; 494 var path = (req.url).path;
460 var pathOffset = 0; 495 var pathOffset = 0;
461 var index; 496 var index;
(...skipping 23 matching lines...) Expand all
485 var keyvalue = part.split("="); 520 var keyvalue = part.split("=");
486 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 521 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
487 } 522 }
488 } 523 }
489 524
490 525
491 var h = { 526 var h = {
492 "content-type" : "application/json; charset=utf-8", 527 "content-type" : "application/json; charset=utf-8",
493 }; 528 };
494 var resp = convert.JSON.encode(buildTaskList()); 529 var resp = convert.JSON.encode(buildTaskList());
495 return new async.Future.value(common_test.stringResponse(200, h, resp)); 530 return new async.Future.value(stringResponse(200, h, resp));
496 }), true); 531 }), true);
497 res.patch(arg_request, arg_tasklist).then(unittest.expectAsync(((api.TaskL ist response) { 532 res.patch(arg_request, arg_tasklist).then(unittest.expectAsync(((api.TaskL ist response) {
498 checkTaskList(response); 533 checkTaskList(response);
499 }))); 534 })));
500 }); 535 });
501 536
502 unittest.test("method--update", () { 537 unittest.test("method--update", () {
503 538
504 var mock = new common_test.HttpServerMock(); 539 var mock = new HttpServerMock();
505 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; 540 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists;
506 var arg_request = buildTaskList(); 541 var arg_request = buildTaskList();
507 var arg_tasklist = "foo"; 542 var arg_tasklist = "foo";
508 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 543 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
509 var obj = new api.TaskList.fromJson(json); 544 var obj = new api.TaskList.fromJson(json);
510 checkTaskList(obj); 545 checkTaskList(obj);
511 546
512 var path = (req.url).path; 547 var path = (req.url).path;
513 var pathOffset = 0; 548 var pathOffset = 0;
514 var index; 549 var index;
(...skipping 23 matching lines...) Expand all
538 var keyvalue = part.split("="); 573 var keyvalue = part.split("=");
539 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 574 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
540 } 575 }
541 } 576 }
542 577
543 578
544 var h = { 579 var h = {
545 "content-type" : "application/json; charset=utf-8", 580 "content-type" : "application/json; charset=utf-8",
546 }; 581 };
547 var resp = convert.JSON.encode(buildTaskList()); 582 var resp = convert.JSON.encode(buildTaskList());
548 return new async.Future.value(common_test.stringResponse(200, h, resp)); 583 return new async.Future.value(stringResponse(200, h, resp));
549 }), true); 584 }), true);
550 res.update(arg_request, arg_tasklist).then(unittest.expectAsync(((api.Task List response) { 585 res.update(arg_request, arg_tasklist).then(unittest.expectAsync(((api.Task List response) {
551 checkTaskList(response); 586 checkTaskList(response);
552 }))); 587 })));
553 }); 588 });
554 589
555 }); 590 });
556 591
557 592
558 unittest.group("resource-TasksResourceApi", () { 593 unittest.group("resource-TasksResourceApi", () {
559 unittest.test("method--clear", () { 594 unittest.test("method--clear", () {
560 595
561 var mock = new common_test.HttpServerMock(); 596 var mock = new HttpServerMock();
562 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 597 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
563 var arg_tasklist = "foo"; 598 var arg_tasklist = "foo";
564 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 599 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
565 var path = (req.url).path; 600 var path = (req.url).path;
566 var pathOffset = 0; 601 var pathOffset = 0;
567 var index; 602 var index;
568 var subPart; 603 var subPart;
569 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 604 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
570 pathOffset += 1; 605 pathOffset += 1;
571 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/")); 606 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ als("tasks/v1/"));
(...skipping 23 matching lines...) Expand all
595 var keyvalue = part.split("="); 630 var keyvalue = part.split("=");
596 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 631 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
597 } 632 }
598 } 633 }
599 634
600 635
601 var h = { 636 var h = {
602 "content-type" : "application/json; charset=utf-8", 637 "content-type" : "application/json; charset=utf-8",
603 }; 638 };
604 var resp = ""; 639 var resp = "";
605 return new async.Future.value(common_test.stringResponse(200, h, resp)); 640 return new async.Future.value(stringResponse(200, h, resp));
606 }), true); 641 }), true);
607 res.clear(arg_tasklist).then(unittest.expectAsync((_) {})); 642 res.clear(arg_tasklist).then(unittest.expectAsync((_) {}));
608 }); 643 });
609 644
610 unittest.test("method--delete", () { 645 unittest.test("method--delete", () {
611 646
612 var mock = new common_test.HttpServerMock(); 647 var mock = new HttpServerMock();
613 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 648 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
614 var arg_tasklist = "foo"; 649 var arg_tasklist = "foo";
615 var arg_task = "foo"; 650 var arg_task = "foo";
616 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 651 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
617 var path = (req.url).path; 652 var path = (req.url).path;
618 var pathOffset = 0; 653 var pathOffset = 0;
619 var index; 654 var index;
620 var subPart; 655 var subPart;
621 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 656 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
622 pathOffset += 1; 657 pathOffset += 1;
(...skipping 27 matching lines...) Expand all
650 var keyvalue = part.split("="); 685 var keyvalue = part.split("=");
651 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 686 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
652 } 687 }
653 } 688 }
654 689
655 690
656 var h = { 691 var h = {
657 "content-type" : "application/json; charset=utf-8", 692 "content-type" : "application/json; charset=utf-8",
658 }; 693 };
659 var resp = ""; 694 var resp = "";
660 return new async.Future.value(common_test.stringResponse(200, h, resp)); 695 return new async.Future.value(stringResponse(200, h, resp));
661 }), true); 696 }), true);
662 res.delete(arg_tasklist, arg_task).then(unittest.expectAsync((_) {})); 697 res.delete(arg_tasklist, arg_task).then(unittest.expectAsync((_) {}));
663 }); 698 });
664 699
665 unittest.test("method--get", () { 700 unittest.test("method--get", () {
666 701
667 var mock = new common_test.HttpServerMock(); 702 var mock = new HttpServerMock();
668 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 703 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
669 var arg_tasklist = "foo"; 704 var arg_tasklist = "foo";
670 var arg_task = "foo"; 705 var arg_task = "foo";
671 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 706 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
672 var path = (req.url).path; 707 var path = (req.url).path;
673 var pathOffset = 0; 708 var pathOffset = 0;
674 var index; 709 var index;
675 var subPart; 710 var subPart;
676 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 711 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
677 pathOffset += 1; 712 pathOffset += 1;
(...skipping 27 matching lines...) Expand all
705 var keyvalue = part.split("="); 740 var keyvalue = part.split("=");
706 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 741 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
707 } 742 }
708 } 743 }
709 744
710 745
711 var h = { 746 var h = {
712 "content-type" : "application/json; charset=utf-8", 747 "content-type" : "application/json; charset=utf-8",
713 }; 748 };
714 var resp = convert.JSON.encode(buildTask()); 749 var resp = convert.JSON.encode(buildTask());
715 return new async.Future.value(common_test.stringResponse(200, h, resp)); 750 return new async.Future.value(stringResponse(200, h, resp));
716 }), true); 751 }), true);
717 res.get(arg_tasklist, arg_task).then(unittest.expectAsync(((api.Task respo nse) { 752 res.get(arg_tasklist, arg_task).then(unittest.expectAsync(((api.Task respo nse) {
718 checkTask(response); 753 checkTask(response);
719 }))); 754 })));
720 }); 755 });
721 756
722 unittest.test("method--insert", () { 757 unittest.test("method--insert", () {
723 758
724 var mock = new common_test.HttpServerMock(); 759 var mock = new HttpServerMock();
725 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 760 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
726 var arg_request = buildTask(); 761 var arg_request = buildTask();
727 var arg_tasklist = "foo"; 762 var arg_tasklist = "foo";
728 var arg_parent = "foo"; 763 var arg_parent = "foo";
729 var arg_previous = "foo"; 764 var arg_previous = "foo";
730 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 765 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
731 var obj = new api.Task.fromJson(json); 766 var obj = new api.Task.fromJson(json);
732 checkTask(obj); 767 checkTask(obj);
733 768
734 var path = (req.url).path; 769 var path = (req.url).path;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 801 }
767 } 802 }
768 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); 803 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent));
769 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous )); 804 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous ));
770 805
771 806
772 var h = { 807 var h = {
773 "content-type" : "application/json; charset=utf-8", 808 "content-type" : "application/json; charset=utf-8",
774 }; 809 };
775 var resp = convert.JSON.encode(buildTask()); 810 var resp = convert.JSON.encode(buildTask());
776 return new async.Future.value(common_test.stringResponse(200, h, resp)); 811 return new async.Future.value(stringResponse(200, h, resp));
777 }), true); 812 }), true);
778 res.insert(arg_request, arg_tasklist, parent: arg_parent, previous: arg_pr evious).then(unittest.expectAsync(((api.Task response) { 813 res.insert(arg_request, arg_tasklist, parent: arg_parent, previous: arg_pr evious).then(unittest.expectAsync(((api.Task response) {
779 checkTask(response); 814 checkTask(response);
780 }))); 815 })));
781 }); 816 });
782 817
783 unittest.test("method--list", () { 818 unittest.test("method--list", () {
784 819
785 var mock = new common_test.HttpServerMock(); 820 var mock = new HttpServerMock();
786 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 821 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
787 var arg_tasklist = "foo"; 822 var arg_tasklist = "foo";
788 var arg_completedMax = "foo"; 823 var arg_completedMax = "foo";
789 var arg_completedMin = "foo"; 824 var arg_completedMin = "foo";
790 var arg_dueMax = "foo"; 825 var arg_dueMax = "foo";
791 var arg_dueMin = "foo"; 826 var arg_dueMin = "foo";
792 var arg_maxResults = "foo"; 827 var arg_maxResults = "foo";
793 var arg_pageToken = "foo"; 828 var arg_pageToken = "foo";
794 var arg_showCompleted = true; 829 var arg_showCompleted = true;
795 var arg_showDeleted = true; 830 var arg_showDeleted = true;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 unittest.expect(queryMap["showCompleted"].first, unittest.equals("$arg_s howCompleted")); 874 unittest.expect(queryMap["showCompleted"].first, unittest.equals("$arg_s howCompleted"));
840 unittest.expect(queryMap["showDeleted"].first, unittest.equals("$arg_sho wDeleted")); 875 unittest.expect(queryMap["showDeleted"].first, unittest.equals("$arg_sho wDeleted"));
841 unittest.expect(queryMap["showHidden"].first, unittest.equals("$arg_show Hidden")); 876 unittest.expect(queryMap["showHidden"].first, unittest.equals("$arg_show Hidden"));
842 unittest.expect(queryMap["updatedMin"].first, unittest.equals(arg_update dMin)); 877 unittest.expect(queryMap["updatedMin"].first, unittest.equals(arg_update dMin));
843 878
844 879
845 var h = { 880 var h = {
846 "content-type" : "application/json; charset=utf-8", 881 "content-type" : "application/json; charset=utf-8",
847 }; 882 };
848 var resp = convert.JSON.encode(buildTasks()); 883 var resp = convert.JSON.encode(buildTasks());
849 return new async.Future.value(common_test.stringResponse(200, h, resp)); 884 return new async.Future.value(stringResponse(200, h, resp));
850 }), true); 885 }), true);
851 res.list(arg_tasklist, completedMax: arg_completedMax, completedMin: arg_c ompletedMin, dueMax: arg_dueMax, dueMin: arg_dueMin, maxResults: arg_maxResults, pageToken: arg_pageToken, showCompleted: arg_showCompleted, showDeleted: arg_sh owDeleted, showHidden: arg_showHidden, updatedMin: arg_updatedMin).then(unittest .expectAsync(((api.Tasks response) { 886 res.list(arg_tasklist, completedMax: arg_completedMax, completedMin: arg_c ompletedMin, dueMax: arg_dueMax, dueMin: arg_dueMin, maxResults: arg_maxResults, pageToken: arg_pageToken, showCompleted: arg_showCompleted, showDeleted: arg_sh owDeleted, showHidden: arg_showHidden, updatedMin: arg_updatedMin).then(unittest .expectAsync(((api.Tasks response) {
852 checkTasks(response); 887 checkTasks(response);
853 }))); 888 })));
854 }); 889 });
855 890
856 unittest.test("method--move", () { 891 unittest.test("method--move", () {
857 892
858 var mock = new common_test.HttpServerMock(); 893 var mock = new HttpServerMock();
859 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 894 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
860 var arg_tasklist = "foo"; 895 var arg_tasklist = "foo";
861 var arg_task = "foo"; 896 var arg_task = "foo";
862 var arg_parent = "foo"; 897 var arg_parent = "foo";
863 var arg_previous = "foo"; 898 var arg_previous = "foo";
864 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 899 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
865 var path = (req.url).path; 900 var path = (req.url).path;
866 var pathOffset = 0; 901 var pathOffset = 0;
867 var index; 902 var index;
868 var subPart; 903 var subPart;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 } 939 }
905 } 940 }
906 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); 941 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent));
907 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous )); 942 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous ));
908 943
909 944
910 var h = { 945 var h = {
911 "content-type" : "application/json; charset=utf-8", 946 "content-type" : "application/json; charset=utf-8",
912 }; 947 };
913 var resp = convert.JSON.encode(buildTask()); 948 var resp = convert.JSON.encode(buildTask());
914 return new async.Future.value(common_test.stringResponse(200, h, resp)); 949 return new async.Future.value(stringResponse(200, h, resp));
915 }), true); 950 }), true);
916 res.move(arg_tasklist, arg_task, parent: arg_parent, previous: arg_previou s).then(unittest.expectAsync(((api.Task response) { 951 res.move(arg_tasklist, arg_task, parent: arg_parent, previous: arg_previou s).then(unittest.expectAsync(((api.Task response) {
917 checkTask(response); 952 checkTask(response);
918 }))); 953 })));
919 }); 954 });
920 955
921 unittest.test("method--patch", () { 956 unittest.test("method--patch", () {
922 957
923 var mock = new common_test.HttpServerMock(); 958 var mock = new HttpServerMock();
924 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 959 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
925 var arg_request = buildTask(); 960 var arg_request = buildTask();
926 var arg_tasklist = "foo"; 961 var arg_tasklist = "foo";
927 var arg_task = "foo"; 962 var arg_task = "foo";
928 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 963 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
929 var obj = new api.Task.fromJson(json); 964 var obj = new api.Task.fromJson(json);
930 checkTask(obj); 965 checkTask(obj);
931 966
932 var path = (req.url).path; 967 var path = (req.url).path;
933 var pathOffset = 0; 968 var pathOffset = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 var keyvalue = part.split("="); 1000 var keyvalue = part.split("=");
966 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1001 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
967 } 1002 }
968 } 1003 }
969 1004
970 1005
971 var h = { 1006 var h = {
972 "content-type" : "application/json; charset=utf-8", 1007 "content-type" : "application/json; charset=utf-8",
973 }; 1008 };
974 var resp = convert.JSON.encode(buildTask()); 1009 var resp = convert.JSON.encode(buildTask());
975 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1010 return new async.Future.value(stringResponse(200, h, resp));
976 }), true); 1011 }), true);
977 res.patch(arg_request, arg_tasklist, arg_task).then(unittest.expectAsync(( (api.Task response) { 1012 res.patch(arg_request, arg_tasklist, arg_task).then(unittest.expectAsync(( (api.Task response) {
978 checkTask(response); 1013 checkTask(response);
979 }))); 1014 })));
980 }); 1015 });
981 1016
982 unittest.test("method--update", () { 1017 unittest.test("method--update", () {
983 1018
984 var mock = new common_test.HttpServerMock(); 1019 var mock = new HttpServerMock();
985 api.TasksResourceApi res = new api.TasksApi(mock).tasks; 1020 api.TasksResourceApi res = new api.TasksApi(mock).tasks;
986 var arg_request = buildTask(); 1021 var arg_request = buildTask();
987 var arg_tasklist = "foo"; 1022 var arg_tasklist = "foo";
988 var arg_task = "foo"; 1023 var arg_task = "foo";
989 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 1024 mock.register(unittest.expectAsync((http.BaseRequest req, json) {
990 var obj = new api.Task.fromJson(json); 1025 var obj = new api.Task.fromJson(json);
991 checkTask(obj); 1026 checkTask(obj);
992 1027
993 var path = (req.url).path; 1028 var path = (req.url).path;
994 var pathOffset = 0; 1029 var pathOffset = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 var keyvalue = part.split("="); 1061 var keyvalue = part.split("=");
1027 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1062 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1028 } 1063 }
1029 } 1064 }
1030 1065
1031 1066
1032 var h = { 1067 var h = {
1033 "content-type" : "application/json; charset=utf-8", 1068 "content-type" : "application/json; charset=utf-8",
1034 }; 1069 };
1035 var resp = convert.JSON.encode(buildTask()); 1070 var resp = convert.JSON.encode(buildTask());
1036 return new async.Future.value(common_test.stringResponse(200, h, resp)); 1071 return new async.Future.value(stringResponse(200, h, resp));
1037 }), true); 1072 }), true);
1038 res.update(arg_request, arg_tasklist, arg_task).then(unittest.expectAsync( ((api.Task response) { 1073 res.update(arg_request, arg_tasklist, arg_task).then(unittest.expectAsync( ((api.Task response) {
1039 checkTask(response); 1074 checkTask(response);
1040 }))); 1075 })));
1041 }); 1076 });
1042 1077
1043 }); 1078 });
1044 1079
1045 1080
1046 } 1081 }
1047 1082
OLDNEW
« no previous file with comments | « generated/googleapis/test/tagmanager/v1_test.dart ('k') | generated/googleapis/test/translate/v2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698