OLD | NEW |
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:test/test.dart' as unittest; |
11 | 11 |
12 import 'package:googleapis/tasks/v1.dart' as api; | 12 import 'package:googleapis/tasks/v1.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 Loading... |
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 buildCounterTaskLinks = 0; | 54 core.int buildCounterTaskLinks = 0; |
55 buildTaskLinks() { | 55 buildTaskLinks() { |
56 var o = new api.TaskLinks(); | 56 var o = new api.TaskLinks(); |
57 buildCounterTaskLinks++; | 57 buildCounterTaskLinks++; |
58 if (buildCounterTaskLinks < 3) { | 58 if (buildCounterTaskLinks < 3) { |
59 o.description = "foo"; | 59 o.description = "foo"; |
60 o.link = "foo"; | 60 o.link = "foo"; |
61 o.type = "foo"; | 61 o.type = "foo"; |
62 } | 62 } |
63 buildCounterTaskLinks--; | 63 buildCounterTaskLinks--; |
64 return o; | 64 return o; |
65 } | 65 } |
66 | 66 |
67 checkTaskLinks(api.TaskLinks o) { | 67 checkTaskLinks(api.TaskLinks o) { |
68 buildCounterTaskLinks++; | 68 buildCounterTaskLinks++; |
69 if (buildCounterTaskLinks < 3) { | 69 if (buildCounterTaskLinks < 3) { |
70 unittest.expect(o.description, unittest.equals('foo')); | 70 unittest.expect(o.description, unittest.equals('foo')); |
71 unittest.expect(o.link, unittest.equals('foo')); | 71 unittest.expect(o.link, unittest.equals('foo')); |
72 unittest.expect(o.type, unittest.equals('foo')); | 72 unittest.expect(o.type, unittest.equals('foo')); |
73 } | 73 } |
74 buildCounterTaskLinks--; | 74 buildCounterTaskLinks--; |
75 } | 75 } |
76 | 76 |
77 buildUnnamed3088() { | 77 buildUnnamed2559() { |
78 var o = new core.List<api.TaskLinks>(); | 78 var o = new core.List<api.TaskLinks>(); |
79 o.add(buildTaskLinks()); | 79 o.add(buildTaskLinks()); |
80 o.add(buildTaskLinks()); | 80 o.add(buildTaskLinks()); |
81 return o; | 81 return o; |
82 } | 82 } |
83 | 83 |
84 checkUnnamed3088(core.List<api.TaskLinks> o) { | 84 checkUnnamed2559(core.List<api.TaskLinks> o) { |
85 unittest.expect(o, unittest.hasLength(2)); | 85 unittest.expect(o, unittest.hasLength(2)); |
86 checkTaskLinks(o[0]); | 86 checkTaskLinks(o[0]); |
87 checkTaskLinks(o[1]); | 87 checkTaskLinks(o[1]); |
88 } | 88 } |
89 | 89 |
90 core.int buildCounterTask = 0; | 90 core.int buildCounterTask = 0; |
91 buildTask() { | 91 buildTask() { |
92 var o = new api.Task(); | 92 var o = new api.Task(); |
93 buildCounterTask++; | 93 buildCounterTask++; |
94 if (buildCounterTask < 3) { | 94 if (buildCounterTask < 3) { |
95 o.completed = core.DateTime.parse("2002-02-27T14:01:02"); | 95 o.completed = core.DateTime.parse("2002-02-27T14:01:02"); |
96 o.deleted = true; | 96 o.deleted = true; |
97 o.due = core.DateTime.parse("2002-02-27T14:01:02"); | 97 o.due = core.DateTime.parse("2002-02-27T14:01:02"); |
98 o.etag = "foo"; | 98 o.etag = "foo"; |
99 o.hidden = true; | 99 o.hidden = true; |
100 o.id = "foo"; | 100 o.id = "foo"; |
101 o.kind = "foo"; | 101 o.kind = "foo"; |
102 o.links = buildUnnamed3088(); | 102 o.links = buildUnnamed2559(); |
103 o.notes = "foo"; | 103 o.notes = "foo"; |
104 o.parent = "foo"; | 104 o.parent = "foo"; |
105 o.position = "foo"; | 105 o.position = "foo"; |
106 o.selfLink = "foo"; | 106 o.selfLink = "foo"; |
107 o.status = "foo"; | 107 o.status = "foo"; |
108 o.title = "foo"; | 108 o.title = "foo"; |
109 o.updated = core.DateTime.parse("2002-02-27T14:01:02"); | 109 o.updated = core.DateTime.parse("2002-02-27T14:01:02"); |
110 } | 110 } |
111 buildCounterTask--; | 111 buildCounterTask--; |
112 return o; | 112 return o; |
113 } | 113 } |
114 | 114 |
115 checkTask(api.Task o) { | 115 checkTask(api.Task o) { |
116 buildCounterTask++; | 116 buildCounterTask++; |
117 if (buildCounterTask < 3) { | 117 if (buildCounterTask < 3) { |
118 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"))); |
119 unittest.expect(o.deleted, unittest.isTrue); | 119 unittest.expect(o.deleted, unittest.isTrue); |
120 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"))); |
121 unittest.expect(o.etag, unittest.equals('foo')); | 121 unittest.expect(o.etag, unittest.equals('foo')); |
122 unittest.expect(o.hidden, unittest.isTrue); | 122 unittest.expect(o.hidden, unittest.isTrue); |
123 unittest.expect(o.id, unittest.equals('foo')); | 123 unittest.expect(o.id, unittest.equals('foo')); |
124 unittest.expect(o.kind, unittest.equals('foo')); | 124 unittest.expect(o.kind, unittest.equals('foo')); |
125 checkUnnamed3088(o.links); | 125 checkUnnamed2559(o.links); |
126 unittest.expect(o.notes, unittest.equals('foo')); | 126 unittest.expect(o.notes, unittest.equals('foo')); |
127 unittest.expect(o.parent, unittest.equals('foo')); | 127 unittest.expect(o.parent, unittest.equals('foo')); |
128 unittest.expect(o.position, unittest.equals('foo')); | 128 unittest.expect(o.position, unittest.equals('foo')); |
129 unittest.expect(o.selfLink, unittest.equals('foo')); | 129 unittest.expect(o.selfLink, unittest.equals('foo')); |
130 unittest.expect(o.status, unittest.equals('foo')); | 130 unittest.expect(o.status, unittest.equals('foo')); |
131 unittest.expect(o.title, unittest.equals('foo')); | 131 unittest.expect(o.title, unittest.equals('foo')); |
132 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"))); |
133 } | 133 } |
134 buildCounterTask--; | 134 buildCounterTask--; |
135 } | 135 } |
(...skipping 20 matching lines...) Expand all Loading... |
156 unittest.expect(o.etag, unittest.equals('foo')); | 156 unittest.expect(o.etag, unittest.equals('foo')); |
157 unittest.expect(o.id, unittest.equals('foo')); | 157 unittest.expect(o.id, unittest.equals('foo')); |
158 unittest.expect(o.kind, unittest.equals('foo')); | 158 unittest.expect(o.kind, unittest.equals('foo')); |
159 unittest.expect(o.selfLink, unittest.equals('foo')); | 159 unittest.expect(o.selfLink, unittest.equals('foo')); |
160 unittest.expect(o.title, unittest.equals('foo')); | 160 unittest.expect(o.title, unittest.equals('foo')); |
161 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"))); |
162 } | 162 } |
163 buildCounterTaskList--; | 163 buildCounterTaskList--; |
164 } | 164 } |
165 | 165 |
166 buildUnnamed3089() { | 166 buildUnnamed2560() { |
167 var o = new core.List<api.TaskList>(); | 167 var o = new core.List<api.TaskList>(); |
168 o.add(buildTaskList()); | 168 o.add(buildTaskList()); |
169 o.add(buildTaskList()); | 169 o.add(buildTaskList()); |
170 return o; | 170 return o; |
171 } | 171 } |
172 | 172 |
173 checkUnnamed3089(core.List<api.TaskList> o) { | 173 checkUnnamed2560(core.List<api.TaskList> o) { |
174 unittest.expect(o, unittest.hasLength(2)); | 174 unittest.expect(o, unittest.hasLength(2)); |
175 checkTaskList(o[0]); | 175 checkTaskList(o[0]); |
176 checkTaskList(o[1]); | 176 checkTaskList(o[1]); |
177 } | 177 } |
178 | 178 |
179 core.int buildCounterTaskLists = 0; | 179 core.int buildCounterTaskLists = 0; |
180 buildTaskLists() { | 180 buildTaskLists() { |
181 var o = new api.TaskLists(); | 181 var o = new api.TaskLists(); |
182 buildCounterTaskLists++; | 182 buildCounterTaskLists++; |
183 if (buildCounterTaskLists < 3) { | 183 if (buildCounterTaskLists < 3) { |
184 o.etag = "foo"; | 184 o.etag = "foo"; |
185 o.items = buildUnnamed3089(); | 185 o.items = buildUnnamed2560(); |
186 o.kind = "foo"; | 186 o.kind = "foo"; |
187 o.nextPageToken = "foo"; | 187 o.nextPageToken = "foo"; |
188 } | 188 } |
189 buildCounterTaskLists--; | 189 buildCounterTaskLists--; |
190 return o; | 190 return o; |
191 } | 191 } |
192 | 192 |
193 checkTaskLists(api.TaskLists o) { | 193 checkTaskLists(api.TaskLists o) { |
194 buildCounterTaskLists++; | 194 buildCounterTaskLists++; |
195 if (buildCounterTaskLists < 3) { | 195 if (buildCounterTaskLists < 3) { |
196 unittest.expect(o.etag, unittest.equals('foo')); | 196 unittest.expect(o.etag, unittest.equals('foo')); |
197 checkUnnamed3089(o.items); | 197 checkUnnamed2560(o.items); |
198 unittest.expect(o.kind, unittest.equals('foo')); | 198 unittest.expect(o.kind, unittest.equals('foo')); |
199 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 199 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
200 } | 200 } |
201 buildCounterTaskLists--; | 201 buildCounterTaskLists--; |
202 } | 202 } |
203 | 203 |
204 buildUnnamed3090() { | 204 buildUnnamed2561() { |
205 var o = new core.List<api.Task>(); | 205 var o = new core.List<api.Task>(); |
206 o.add(buildTask()); | 206 o.add(buildTask()); |
207 o.add(buildTask()); | 207 o.add(buildTask()); |
208 return o; | 208 return o; |
209 } | 209 } |
210 | 210 |
211 checkUnnamed3090(core.List<api.Task> o) { | 211 checkUnnamed2561(core.List<api.Task> o) { |
212 unittest.expect(o, unittest.hasLength(2)); | 212 unittest.expect(o, unittest.hasLength(2)); |
213 checkTask(o[0]); | 213 checkTask(o[0]); |
214 checkTask(o[1]); | 214 checkTask(o[1]); |
215 } | 215 } |
216 | 216 |
217 core.int buildCounterTasks = 0; | 217 core.int buildCounterTasks = 0; |
218 buildTasks() { | 218 buildTasks() { |
219 var o = new api.Tasks(); | 219 var o = new api.Tasks(); |
220 buildCounterTasks++; | 220 buildCounterTasks++; |
221 if (buildCounterTasks < 3) { | 221 if (buildCounterTasks < 3) { |
222 o.etag = "foo"; | 222 o.etag = "foo"; |
223 o.items = buildUnnamed3090(); | 223 o.items = buildUnnamed2561(); |
224 o.kind = "foo"; | 224 o.kind = "foo"; |
225 o.nextPageToken = "foo"; | 225 o.nextPageToken = "foo"; |
226 } | 226 } |
227 buildCounterTasks--; | 227 buildCounterTasks--; |
228 return o; | 228 return o; |
229 } | 229 } |
230 | 230 |
231 checkTasks(api.Tasks o) { | 231 checkTasks(api.Tasks o) { |
232 buildCounterTasks++; | 232 buildCounterTasks++; |
233 if (buildCounterTasks < 3) { | 233 if (buildCounterTasks < 3) { |
234 unittest.expect(o.etag, unittest.equals('foo')); | 234 unittest.expect(o.etag, unittest.equals('foo')); |
235 checkUnnamed3090(o.items); | 235 checkUnnamed2561(o.items); |
236 unittest.expect(o.kind, unittest.equals('foo')); | 236 unittest.expect(o.kind, unittest.equals('foo')); |
237 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 237 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
238 } | 238 } |
239 buildCounterTasks--; | 239 buildCounterTasks--; |
240 } | 240 } |
241 | 241 |
242 | 242 |
243 main() { | 243 main() { |
244 unittest.group("obj-schema-TaskLinks", () { | 244 unittest.group("obj-schema-TaskLinks", () { |
245 unittest.test("to-json--from-json", () { | 245 unittest.test("to-json--from-json", () { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 }); | 285 }); |
286 }); | 286 }); |
287 | 287 |
288 | 288 |
289 unittest.group("resource-TasklistsResourceApi", () { | 289 unittest.group("resource-TasklistsResourceApi", () { |
290 unittest.test("method--delete", () { | 290 unittest.test("method--delete", () { |
291 | 291 |
292 var mock = new HttpServerMock(); | 292 var mock = new HttpServerMock(); |
293 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 293 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
294 var arg_tasklist = "foo"; | 294 var arg_tasklist = "foo"; |
295 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 295 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
296 var path = (req.url).path; | 296 var path = (req.url).path; |
297 var pathOffset = 0; | 297 var pathOffset = 0; |
298 var index; | 298 var index; |
299 var subPart; | 299 var subPart; |
300 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 300 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
301 pathOffset += 1; | 301 pathOffset += 1; |
302 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/")); |
303 pathOffset += 9; | 303 pathOffset += 9; |
304 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("users/@me/lists/")); | 304 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("users/@me/lists/")); |
305 pathOffset += 16; | 305 pathOffset += 16; |
(...skipping 18 matching lines...) Expand all Loading... |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 var h = { | 328 var h = { |
329 "content-type" : "application/json; charset=utf-8", | 329 "content-type" : "application/json; charset=utf-8", |
330 }; | 330 }; |
331 var resp = ""; | 331 var resp = ""; |
332 return new async.Future.value(stringResponse(200, h, resp)); | 332 return new async.Future.value(stringResponse(200, h, resp)); |
333 }), true); | 333 }), true); |
334 res.delete(arg_tasklist).then(unittest.expectAsync((_) {})); | 334 res.delete(arg_tasklist).then(unittest.expectAsync1((_) {})); |
335 }); | 335 }); |
336 | 336 |
337 unittest.test("method--get", () { | 337 unittest.test("method--get", () { |
338 | 338 |
339 var mock = new HttpServerMock(); | 339 var mock = new HttpServerMock(); |
340 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 340 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
341 var arg_tasklist = "foo"; | 341 var arg_tasklist = "foo"; |
342 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 342 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
343 var path = (req.url).path; | 343 var path = (req.url).path; |
344 var pathOffset = 0; | 344 var pathOffset = 0; |
345 var index; | 345 var index; |
346 var subPart; | 346 var subPart; |
347 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 347 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
348 pathOffset += 1; | 348 pathOffset += 1; |
349 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/")); |
350 pathOffset += 9; | 350 pathOffset += 9; |
351 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("users/@me/lists/")); | 351 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("users/@me/lists/")); |
352 pathOffset += 16; | 352 pathOffset += 16; |
(...skipping 18 matching lines...) Expand all Loading... |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 | 374 |
375 var h = { | 375 var h = { |
376 "content-type" : "application/json; charset=utf-8", | 376 "content-type" : "application/json; charset=utf-8", |
377 }; | 377 }; |
378 var resp = convert.JSON.encode(buildTaskList()); | 378 var resp = convert.JSON.encode(buildTaskList()); |
379 return new async.Future.value(stringResponse(200, h, resp)); | 379 return new async.Future.value(stringResponse(200, h, resp)); |
380 }), true); | 380 }), true); |
381 res.get(arg_tasklist).then(unittest.expectAsync(((api.TaskList response) { | 381 res.get(arg_tasklist).then(unittest.expectAsync1(((api.TaskList response)
{ |
382 checkTaskList(response); | 382 checkTaskList(response); |
383 }))); | 383 }))); |
384 }); | 384 }); |
385 | 385 |
386 unittest.test("method--insert", () { | 386 unittest.test("method--insert", () { |
387 | 387 |
388 var mock = new HttpServerMock(); | 388 var mock = new HttpServerMock(); |
389 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 389 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
390 var arg_request = buildTaskList(); | 390 var arg_request = buildTaskList(); |
391 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 391 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
392 var obj = new api.TaskList.fromJson(json); | 392 var obj = new api.TaskList.fromJson(json); |
393 checkTaskList(obj); | 393 checkTaskList(obj); |
394 | 394 |
395 var path = (req.url).path; | 395 var path = (req.url).path; |
396 var pathOffset = 0; | 396 var pathOffset = 0; |
397 var index; | 397 var index; |
398 var subPart; | 398 var subPart; |
399 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 399 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
400 pathOffset += 1; | 400 pathOffset += 1; |
401 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 401 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 18 matching lines...) Expand all Loading... |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 | 423 |
424 var h = { | 424 var h = { |
425 "content-type" : "application/json; charset=utf-8", | 425 "content-type" : "application/json; charset=utf-8", |
426 }; | 426 }; |
427 var resp = convert.JSON.encode(buildTaskList()); | 427 var resp = convert.JSON.encode(buildTaskList()); |
428 return new async.Future.value(stringResponse(200, h, resp)); | 428 return new async.Future.value(stringResponse(200, h, resp)); |
429 }), true); | 429 }), true); |
430 res.insert(arg_request).then(unittest.expectAsync(((api.TaskList response)
{ | 430 res.insert(arg_request).then(unittest.expectAsync1(((api.TaskList response
) { |
431 checkTaskList(response); | 431 checkTaskList(response); |
432 }))); | 432 }))); |
433 }); | 433 }); |
434 | 434 |
435 unittest.test("method--list", () { | 435 unittest.test("method--list", () { |
436 | 436 |
437 var mock = new HttpServerMock(); | 437 var mock = new HttpServerMock(); |
438 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 438 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
439 var arg_maxResults = "foo"; | 439 var arg_maxResults = "foo"; |
440 var arg_pageToken = "foo"; | 440 var arg_pageToken = "foo"; |
441 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 441 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
442 var path = (req.url).path; | 442 var path = (req.url).path; |
443 var pathOffset = 0; | 443 var pathOffset = 0; |
444 var index; | 444 var index; |
445 var subPart; | 445 var subPart; |
446 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 446 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
447 pathOffset += 1; | 447 pathOffset += 1; |
448 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 448 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
449 pathOffset += 9; | 449 pathOffset += 9; |
450 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("users/@me/lists")); | 450 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("users/@me/lists")); |
451 pathOffset += 15; | 451 pathOffset += 15; |
(...skipping 17 matching lines...) Expand all Loading... |
469 unittest.expect(queryMap["maxResults"].first, unittest.equals(arg_maxRes
ults)); | 469 unittest.expect(queryMap["maxResults"].first, unittest.equals(arg_maxRes
ults)); |
470 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 470 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
471 | 471 |
472 | 472 |
473 var h = { | 473 var h = { |
474 "content-type" : "application/json; charset=utf-8", | 474 "content-type" : "application/json; charset=utf-8", |
475 }; | 475 }; |
476 var resp = convert.JSON.encode(buildTaskLists()); | 476 var resp = convert.JSON.encode(buildTaskLists()); |
477 return new async.Future.value(stringResponse(200, h, resp)); | 477 return new async.Future.value(stringResponse(200, h, resp)); |
478 }), true); | 478 }), true); |
479 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.expectAsync1(((api.TaskLists response) { |
480 checkTaskLists(response); | 480 checkTaskLists(response); |
481 }))); | 481 }))); |
482 }); | 482 }); |
483 | 483 |
484 unittest.test("method--patch", () { | 484 unittest.test("method--patch", () { |
485 | 485 |
486 var mock = new HttpServerMock(); | 486 var mock = new HttpServerMock(); |
487 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 487 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
488 var arg_request = buildTaskList(); | 488 var arg_request = buildTaskList(); |
489 var arg_tasklist = "foo"; | 489 var arg_tasklist = "foo"; |
490 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 490 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
491 var obj = new api.TaskList.fromJson(json); | 491 var obj = new api.TaskList.fromJson(json); |
492 checkTaskList(obj); | 492 checkTaskList(obj); |
493 | 493 |
494 var path = (req.url).path; | 494 var path = (req.url).path; |
495 var pathOffset = 0; | 495 var pathOffset = 0; |
496 var index; | 496 var index; |
497 var subPart; | 497 var subPart; |
498 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 498 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
499 pathOffset += 1; | 499 pathOffset += 1; |
500 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 500 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 21 matching lines...) Expand all Loading... |
522 } | 522 } |
523 } | 523 } |
524 | 524 |
525 | 525 |
526 var h = { | 526 var h = { |
527 "content-type" : "application/json; charset=utf-8", | 527 "content-type" : "application/json; charset=utf-8", |
528 }; | 528 }; |
529 var resp = convert.JSON.encode(buildTaskList()); | 529 var resp = convert.JSON.encode(buildTaskList()); |
530 return new async.Future.value(stringResponse(200, h, resp)); | 530 return new async.Future.value(stringResponse(200, h, resp)); |
531 }), true); | 531 }), true); |
532 res.patch(arg_request, arg_tasklist).then(unittest.expectAsync(((api.TaskL
ist response) { | 532 res.patch(arg_request, arg_tasklist).then(unittest.expectAsync1(((api.Task
List response) { |
533 checkTaskList(response); | 533 checkTaskList(response); |
534 }))); | 534 }))); |
535 }); | 535 }); |
536 | 536 |
537 unittest.test("method--update", () { | 537 unittest.test("method--update", () { |
538 | 538 |
539 var mock = new HttpServerMock(); | 539 var mock = new HttpServerMock(); |
540 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; | 540 api.TasklistsResourceApi res = new api.TasksApi(mock).tasklists; |
541 var arg_request = buildTaskList(); | 541 var arg_request = buildTaskList(); |
542 var arg_tasklist = "foo"; | 542 var arg_tasklist = "foo"; |
543 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 543 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
544 var obj = new api.TaskList.fromJson(json); | 544 var obj = new api.TaskList.fromJson(json); |
545 checkTaskList(obj); | 545 checkTaskList(obj); |
546 | 546 |
547 var path = (req.url).path; | 547 var path = (req.url).path; |
548 var pathOffset = 0; | 548 var pathOffset = 0; |
549 var index; | 549 var index; |
550 var subPart; | 550 var subPart; |
551 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 551 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
552 pathOffset += 1; | 552 pathOffset += 1; |
553 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 553 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 21 matching lines...) Expand all Loading... |
575 } | 575 } |
576 } | 576 } |
577 | 577 |
578 | 578 |
579 var h = { | 579 var h = { |
580 "content-type" : "application/json; charset=utf-8", | 580 "content-type" : "application/json; charset=utf-8", |
581 }; | 581 }; |
582 var resp = convert.JSON.encode(buildTaskList()); | 582 var resp = convert.JSON.encode(buildTaskList()); |
583 return new async.Future.value(stringResponse(200, h, resp)); | 583 return new async.Future.value(stringResponse(200, h, resp)); |
584 }), true); | 584 }), true); |
585 res.update(arg_request, arg_tasklist).then(unittest.expectAsync(((api.Task
List response) { | 585 res.update(arg_request, arg_tasklist).then(unittest.expectAsync1(((api.Tas
kList response) { |
586 checkTaskList(response); | 586 checkTaskList(response); |
587 }))); | 587 }))); |
588 }); | 588 }); |
589 | 589 |
590 }); | 590 }); |
591 | 591 |
592 | 592 |
593 unittest.group("resource-TasksResourceApi", () { | 593 unittest.group("resource-TasksResourceApi", () { |
594 unittest.test("method--clear", () { | 594 unittest.test("method--clear", () { |
595 | 595 |
596 var mock = new HttpServerMock(); | 596 var mock = new HttpServerMock(); |
597 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 597 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
598 var arg_tasklist = "foo"; | 598 var arg_tasklist = "foo"; |
599 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 599 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
600 var path = (req.url).path; | 600 var path = (req.url).path; |
601 var pathOffset = 0; | 601 var pathOffset = 0; |
602 var index; | 602 var index; |
603 var subPart; | 603 var subPart; |
604 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 604 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
605 pathOffset += 1; | 605 pathOffset += 1; |
606 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/")); |
607 pathOffset += 9; | 607 pathOffset += 9; |
608 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); | 608 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); |
609 pathOffset += 6; | 609 pathOffset += 6; |
(...skipping 22 matching lines...) Expand all Loading... |
632 } | 632 } |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 var h = { | 636 var h = { |
637 "content-type" : "application/json; charset=utf-8", | 637 "content-type" : "application/json; charset=utf-8", |
638 }; | 638 }; |
639 var resp = ""; | 639 var resp = ""; |
640 return new async.Future.value(stringResponse(200, h, resp)); | 640 return new async.Future.value(stringResponse(200, h, resp)); |
641 }), true); | 641 }), true); |
642 res.clear(arg_tasklist).then(unittest.expectAsync((_) {})); | 642 res.clear(arg_tasklist).then(unittest.expectAsync1((_) {})); |
643 }); | 643 }); |
644 | 644 |
645 unittest.test("method--delete", () { | 645 unittest.test("method--delete", () { |
646 | 646 |
647 var mock = new HttpServerMock(); | 647 var mock = new HttpServerMock(); |
648 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 648 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
649 var arg_tasklist = "foo"; | 649 var arg_tasklist = "foo"; |
650 var arg_task = "foo"; | 650 var arg_task = "foo"; |
651 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 651 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
652 var path = (req.url).path; | 652 var path = (req.url).path; |
653 var pathOffset = 0; | 653 var pathOffset = 0; |
654 var index; | 654 var index; |
655 var subPart; | 655 var subPart; |
656 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 656 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
657 pathOffset += 1; | 657 pathOffset += 1; |
658 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 658 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
659 pathOffset += 9; | 659 pathOffset += 9; |
660 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); | 660 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); |
661 pathOffset += 6; | 661 pathOffset += 6; |
(...skipping 25 matching lines...) Expand all Loading... |
687 } | 687 } |
688 } | 688 } |
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 = ""; | 694 var resp = ""; |
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.delete(arg_tasklist, arg_task).then(unittest.expectAsync((_) {})); | 697 res.delete(arg_tasklist, arg_task).then(unittest.expectAsync1((_) {})); |
698 }); | 698 }); |
699 | 699 |
700 unittest.test("method--get", () { | 700 unittest.test("method--get", () { |
701 | 701 |
702 var mock = new HttpServerMock(); | 702 var mock = new HttpServerMock(); |
703 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 703 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
704 var arg_tasklist = "foo"; | 704 var arg_tasklist = "foo"; |
705 var arg_task = "foo"; | 705 var arg_task = "foo"; |
706 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 706 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
707 var path = (req.url).path; | 707 var path = (req.url).path; |
708 var pathOffset = 0; | 708 var pathOffset = 0; |
709 var index; | 709 var index; |
710 var subPart; | 710 var subPart; |
711 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 711 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
712 pathOffset += 1; | 712 pathOffset += 1; |
713 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 713 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
714 pathOffset += 9; | 714 pathOffset += 9; |
715 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); | 715 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); |
716 pathOffset += 6; | 716 pathOffset += 6; |
(...skipping 25 matching lines...) Expand all Loading... |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 | 745 |
746 var h = { | 746 var h = { |
747 "content-type" : "application/json; charset=utf-8", | 747 "content-type" : "application/json; charset=utf-8", |
748 }; | 748 }; |
749 var resp = convert.JSON.encode(buildTask()); | 749 var resp = convert.JSON.encode(buildTask()); |
750 return new async.Future.value(stringResponse(200, h, resp)); | 750 return new async.Future.value(stringResponse(200, h, resp)); |
751 }), true); | 751 }), true); |
752 res.get(arg_tasklist, arg_task).then(unittest.expectAsync(((api.Task respo
nse) { | 752 res.get(arg_tasklist, arg_task).then(unittest.expectAsync1(((api.Task resp
onse) { |
753 checkTask(response); | 753 checkTask(response); |
754 }))); | 754 }))); |
755 }); | 755 }); |
756 | 756 |
757 unittest.test("method--insert", () { | 757 unittest.test("method--insert", () { |
758 | 758 |
759 var mock = new HttpServerMock(); | 759 var mock = new HttpServerMock(); |
760 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 760 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
761 var arg_request = buildTask(); | 761 var arg_request = buildTask(); |
762 var arg_tasklist = "foo"; | 762 var arg_tasklist = "foo"; |
763 var arg_parent = "foo"; | 763 var arg_parent = "foo"; |
764 var arg_previous = "foo"; | 764 var arg_previous = "foo"; |
765 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 765 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
766 var obj = new api.Task.fromJson(json); | 766 var obj = new api.Task.fromJson(json); |
767 checkTask(obj); | 767 checkTask(obj); |
768 | 768 |
769 var path = (req.url).path; | 769 var path = (req.url).path; |
770 var pathOffset = 0; | 770 var pathOffset = 0; |
771 var index; | 771 var index; |
772 var subPart; | 772 var subPart; |
773 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 773 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
774 pathOffset += 1; | 774 pathOffset += 1; |
775 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 775 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 27 matching lines...) Expand all Loading... |
803 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); | 803 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
804 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous
)); | 804 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous
)); |
805 | 805 |
806 | 806 |
807 var h = { | 807 var h = { |
808 "content-type" : "application/json; charset=utf-8", | 808 "content-type" : "application/json; charset=utf-8", |
809 }; | 809 }; |
810 var resp = convert.JSON.encode(buildTask()); | 810 var resp = convert.JSON.encode(buildTask()); |
811 return new async.Future.value(stringResponse(200, h, resp)); | 811 return new async.Future.value(stringResponse(200, h, resp)); |
812 }), true); | 812 }), true); |
813 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.expectAsync1(((api.Task response) { |
814 checkTask(response); | 814 checkTask(response); |
815 }))); | 815 }))); |
816 }); | 816 }); |
817 | 817 |
818 unittest.test("method--list", () { | 818 unittest.test("method--list", () { |
819 | 819 |
820 var mock = new HttpServerMock(); | 820 var mock = new HttpServerMock(); |
821 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 821 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
822 var arg_tasklist = "foo"; | 822 var arg_tasklist = "foo"; |
823 var arg_completedMax = "foo"; | 823 var arg_completedMax = "foo"; |
824 var arg_completedMin = "foo"; | 824 var arg_completedMin = "foo"; |
825 var arg_dueMax = "foo"; | 825 var arg_dueMax = "foo"; |
826 var arg_dueMin = "foo"; | 826 var arg_dueMin = "foo"; |
827 var arg_maxResults = "foo"; | 827 var arg_maxResults = "foo"; |
828 var arg_pageToken = "foo"; | 828 var arg_pageToken = "foo"; |
829 var arg_showCompleted = true; | 829 var arg_showCompleted = true; |
830 var arg_showDeleted = true; | 830 var arg_showDeleted = true; |
831 var arg_showHidden = true; | 831 var arg_showHidden = true; |
832 var arg_updatedMin = "foo"; | 832 var arg_updatedMin = "foo"; |
833 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 833 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
834 var path = (req.url).path; | 834 var path = (req.url).path; |
835 var pathOffset = 0; | 835 var pathOffset = 0; |
836 var index; | 836 var index; |
837 var subPart; | 837 var subPart; |
838 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 838 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
839 pathOffset += 1; | 839 pathOffset += 1; |
840 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 840 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
841 pathOffset += 9; | 841 pathOffset += 9; |
842 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); | 842 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); |
843 pathOffset += 6; | 843 pathOffset += 6; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 unittest.expect(queryMap["showHidden"].first, unittest.equals("$arg_show
Hidden")); | 876 unittest.expect(queryMap["showHidden"].first, unittest.equals("$arg_show
Hidden")); |
877 unittest.expect(queryMap["updatedMin"].first, unittest.equals(arg_update
dMin)); | 877 unittest.expect(queryMap["updatedMin"].first, unittest.equals(arg_update
dMin)); |
878 | 878 |
879 | 879 |
880 var h = { | 880 var h = { |
881 "content-type" : "application/json; charset=utf-8", | 881 "content-type" : "application/json; charset=utf-8", |
882 }; | 882 }; |
883 var resp = convert.JSON.encode(buildTasks()); | 883 var resp = convert.JSON.encode(buildTasks()); |
884 return new async.Future.value(stringResponse(200, h, resp)); | 884 return new async.Future.value(stringResponse(200, h, resp)); |
885 }), true); | 885 }), true); |
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) { | 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
.expectAsync1(((api.Tasks response) { |
887 checkTasks(response); | 887 checkTasks(response); |
888 }))); | 888 }))); |
889 }); | 889 }); |
890 | 890 |
891 unittest.test("method--move", () { | 891 unittest.test("method--move", () { |
892 | 892 |
893 var mock = new HttpServerMock(); | 893 var mock = new HttpServerMock(); |
894 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 894 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
895 var arg_tasklist = "foo"; | 895 var arg_tasklist = "foo"; |
896 var arg_task = "foo"; | 896 var arg_task = "foo"; |
897 var arg_parent = "foo"; | 897 var arg_parent = "foo"; |
898 var arg_previous = "foo"; | 898 var arg_previous = "foo"; |
899 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 899 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
900 var path = (req.url).path; | 900 var path = (req.url).path; |
901 var pathOffset = 0; | 901 var pathOffset = 0; |
902 var index; | 902 var index; |
903 var subPart; | 903 var subPart; |
904 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 904 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
905 pathOffset += 1; | 905 pathOffset += 1; |
906 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 906 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
907 pathOffset += 9; | 907 pathOffset += 9; |
908 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); | 908 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("lists/")); |
909 pathOffset += 6; | 909 pathOffset += 6; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); | 941 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
942 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous
)); | 942 unittest.expect(queryMap["previous"].first, unittest.equals(arg_previous
)); |
943 | 943 |
944 | 944 |
945 var h = { | 945 var h = { |
946 "content-type" : "application/json; charset=utf-8", | 946 "content-type" : "application/json; charset=utf-8", |
947 }; | 947 }; |
948 var resp = convert.JSON.encode(buildTask()); | 948 var resp = convert.JSON.encode(buildTask()); |
949 return new async.Future.value(stringResponse(200, h, resp)); | 949 return new async.Future.value(stringResponse(200, h, resp)); |
950 }), true); | 950 }), true); |
951 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.expectAsync1(((api.Task response) { |
952 checkTask(response); | 952 checkTask(response); |
953 }))); | 953 }))); |
954 }); | 954 }); |
955 | 955 |
956 unittest.test("method--patch", () { | 956 unittest.test("method--patch", () { |
957 | 957 |
958 var mock = new HttpServerMock(); | 958 var mock = new HttpServerMock(); |
959 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 959 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
960 var arg_request = buildTask(); | 960 var arg_request = buildTask(); |
961 var arg_tasklist = "foo"; | 961 var arg_tasklist = "foo"; |
962 var arg_task = "foo"; | 962 var arg_task = "foo"; |
963 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 963 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
964 var obj = new api.Task.fromJson(json); | 964 var obj = new api.Task.fromJson(json); |
965 checkTask(obj); | 965 checkTask(obj); |
966 | 966 |
967 var path = (req.url).path; | 967 var path = (req.url).path; |
968 var pathOffset = 0; | 968 var pathOffset = 0; |
969 var index; | 969 var index; |
970 var subPart; | 970 var subPart; |
971 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 971 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
972 pathOffset += 1; | 972 pathOffset += 1; |
973 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 973 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 28 matching lines...) Expand all Loading... |
1002 } | 1002 } |
1003 } | 1003 } |
1004 | 1004 |
1005 | 1005 |
1006 var h = { | 1006 var h = { |
1007 "content-type" : "application/json; charset=utf-8", | 1007 "content-type" : "application/json; charset=utf-8", |
1008 }; | 1008 }; |
1009 var resp = convert.JSON.encode(buildTask()); | 1009 var resp = convert.JSON.encode(buildTask()); |
1010 return new async.Future.value(stringResponse(200, h, resp)); | 1010 return new async.Future.value(stringResponse(200, h, resp)); |
1011 }), true); | 1011 }), true); |
1012 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.expectAsync1(
((api.Task response) { |
1013 checkTask(response); | 1013 checkTask(response); |
1014 }))); | 1014 }))); |
1015 }); | 1015 }); |
1016 | 1016 |
1017 unittest.test("method--update", () { | 1017 unittest.test("method--update", () { |
1018 | 1018 |
1019 var mock = new HttpServerMock(); | 1019 var mock = new HttpServerMock(); |
1020 api.TasksResourceApi res = new api.TasksApi(mock).tasks; | 1020 api.TasksResourceApi res = new api.TasksApi(mock).tasks; |
1021 var arg_request = buildTask(); | 1021 var arg_request = buildTask(); |
1022 var arg_tasklist = "foo"; | 1022 var arg_tasklist = "foo"; |
1023 var arg_task = "foo"; | 1023 var arg_task = "foo"; |
1024 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1024 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1025 var obj = new api.Task.fromJson(json); | 1025 var obj = new api.Task.fromJson(json); |
1026 checkTask(obj); | 1026 checkTask(obj); |
1027 | 1027 |
1028 var path = (req.url).path; | 1028 var path = (req.url).path; |
1029 var pathOffset = 0; | 1029 var pathOffset = 0; |
1030 var index; | 1030 var index; |
1031 var subPart; | 1031 var subPart; |
1032 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1032 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1033 pathOffset += 1; | 1033 pathOffset += 1; |
1034 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); | 1034 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("tasks/v1/")); |
(...skipping 28 matching lines...) Expand all Loading... |
1063 } | 1063 } |
1064 } | 1064 } |
1065 | 1065 |
1066 | 1066 |
1067 var h = { | 1067 var h = { |
1068 "content-type" : "application/json; charset=utf-8", | 1068 "content-type" : "application/json; charset=utf-8", |
1069 }; | 1069 }; |
1070 var resp = convert.JSON.encode(buildTask()); | 1070 var resp = convert.JSON.encode(buildTask()); |
1071 return new async.Future.value(stringResponse(200, h, resp)); | 1071 return new async.Future.value(stringResponse(200, h, resp)); |
1072 }), true); | 1072 }), true); |
1073 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.expectAsync1
(((api.Task response) { |
1074 checkTask(response); | 1074 checkTask(response); |
1075 }))); | 1075 }))); |
1076 }); | 1076 }); |
1077 | 1077 |
1078 }); | 1078 }); |
1079 | 1079 |
1080 | 1080 |
1081 } | 1081 } |
1082 | 1082 |
OLD | NEW |