OLD | NEW |
| (Empty) |
1 library googleapis.orkut.v2.test; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import 'package:http/http.dart' as http; | |
9 import 'package:http/testing.dart' as http_testing; | |
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 | |
15 import 'package:googleapis/orkut/v2.dart' as api; | |
16 | |
17 | |
18 | |
19 core.int buildCounterAclItems = 0; | |
20 buildAclItems() { | |
21 var o = new api.AclItems(); | |
22 buildCounterAclItems++; | |
23 if (buildCounterAclItems < 3) { | |
24 o.id = "foo"; | |
25 o.type = "foo"; | |
26 } | |
27 buildCounterAclItems--; | |
28 return o; | |
29 } | |
30 | |
31 checkAclItems(api.AclItems o) { | |
32 buildCounterAclItems++; | |
33 if (buildCounterAclItems < 3) { | |
34 unittest.expect(o.id, unittest.equals('foo')); | |
35 unittest.expect(o.type, unittest.equals('foo')); | |
36 } | |
37 buildCounterAclItems--; | |
38 } | |
39 | |
40 buildUnnamed181() { | |
41 var o = new core.List<api.AclItems>(); | |
42 o.add(buildAclItems()); | |
43 o.add(buildAclItems()); | |
44 return o; | |
45 } | |
46 | |
47 checkUnnamed181(core.List<api.AclItems> o) { | |
48 unittest.expect(o, unittest.hasLength(2)); | |
49 checkAclItems(o[0]); | |
50 checkAclItems(o[1]); | |
51 } | |
52 | |
53 core.int buildCounterAcl = 0; | |
54 buildAcl() { | |
55 var o = new api.Acl(); | |
56 buildCounterAcl++; | |
57 if (buildCounterAcl < 3) { | |
58 o.description = "foo"; | |
59 o.items = buildUnnamed181(); | |
60 o.kind = "foo"; | |
61 o.totalParticipants = 42; | |
62 } | |
63 buildCounterAcl--; | |
64 return o; | |
65 } | |
66 | |
67 checkAcl(api.Acl o) { | |
68 buildCounterAcl++; | |
69 if (buildCounterAcl < 3) { | |
70 unittest.expect(o.description, unittest.equals('foo')); | |
71 checkUnnamed181(o.items); | |
72 unittest.expect(o.kind, unittest.equals('foo')); | |
73 unittest.expect(o.totalParticipants, unittest.equals(42)); | |
74 } | |
75 buildCounterAcl--; | |
76 } | |
77 | |
78 buildUnnamed182() { | |
79 var o = new core.List<api.OrkutLinkResource>(); | |
80 o.add(buildOrkutLinkResource()); | |
81 o.add(buildOrkutLinkResource()); | |
82 return o; | |
83 } | |
84 | |
85 checkUnnamed182(core.List<api.OrkutLinkResource> o) { | |
86 unittest.expect(o, unittest.hasLength(2)); | |
87 checkOrkutLinkResource(o[0]); | |
88 checkOrkutLinkResource(o[1]); | |
89 } | |
90 | |
91 buildUnnamed183() { | |
92 var o = new core.List<api.OrkutActivityobjectsResource>(); | |
93 o.add(buildOrkutActivityobjectsResource()); | |
94 o.add(buildOrkutActivityobjectsResource()); | |
95 return o; | |
96 } | |
97 | |
98 checkUnnamed183(core.List<api.OrkutActivityobjectsResource> o) { | |
99 unittest.expect(o, unittest.hasLength(2)); | |
100 checkOrkutActivityobjectsResource(o[0]); | |
101 checkOrkutActivityobjectsResource(o[1]); | |
102 } | |
103 | |
104 buildUnnamed184() { | |
105 var o = new core.List<api.Comment>(); | |
106 o.add(buildComment()); | |
107 o.add(buildComment()); | |
108 return o; | |
109 } | |
110 | |
111 checkUnnamed184(core.List<api.Comment> o) { | |
112 unittest.expect(o, unittest.hasLength(2)); | |
113 checkComment(o[0]); | |
114 checkComment(o[1]); | |
115 } | |
116 | |
117 core.int buildCounterActivityObjectReplies = 0; | |
118 buildActivityObjectReplies() { | |
119 var o = new api.ActivityObjectReplies(); | |
120 buildCounterActivityObjectReplies++; | |
121 if (buildCounterActivityObjectReplies < 3) { | |
122 o.items = buildUnnamed184(); | |
123 o.totalItems = "foo"; | |
124 o.url = "foo"; | |
125 } | |
126 buildCounterActivityObjectReplies--; | |
127 return o; | |
128 } | |
129 | |
130 checkActivityObjectReplies(api.ActivityObjectReplies o) { | |
131 buildCounterActivityObjectReplies++; | |
132 if (buildCounterActivityObjectReplies < 3) { | |
133 checkUnnamed184(o.items); | |
134 unittest.expect(o.totalItems, unittest.equals('foo')); | |
135 unittest.expect(o.url, unittest.equals('foo')); | |
136 } | |
137 buildCounterActivityObjectReplies--; | |
138 } | |
139 | |
140 core.int buildCounterActivityObject = 0; | |
141 buildActivityObject() { | |
142 var o = new api.ActivityObject(); | |
143 buildCounterActivityObject++; | |
144 if (buildCounterActivityObject < 3) { | |
145 o.content = "foo"; | |
146 o.items = buildUnnamed183(); | |
147 o.objectType = "foo"; | |
148 o.replies = buildActivityObjectReplies(); | |
149 } | |
150 buildCounterActivityObject--; | |
151 return o; | |
152 } | |
153 | |
154 checkActivityObject(api.ActivityObject o) { | |
155 buildCounterActivityObject++; | |
156 if (buildCounterActivityObject < 3) { | |
157 unittest.expect(o.content, unittest.equals('foo')); | |
158 checkUnnamed183(o.items); | |
159 unittest.expect(o.objectType, unittest.equals('foo')); | |
160 checkActivityObjectReplies(o.replies); | |
161 } | |
162 buildCounterActivityObject--; | |
163 } | |
164 | |
165 core.int buildCounterActivity = 0; | |
166 buildActivity() { | |
167 var o = new api.Activity(); | |
168 buildCounterActivity++; | |
169 if (buildCounterActivity < 3) { | |
170 o.access = buildAcl(); | |
171 o.actor = buildOrkutAuthorResource(); | |
172 o.id = "foo"; | |
173 o.kind = "foo"; | |
174 o.links = buildUnnamed182(); | |
175 o.object = buildActivityObject(); | |
176 o.published = core.DateTime.parse("2002-02-27T14:01:02"); | |
177 o.title = "foo"; | |
178 o.updated = core.DateTime.parse("2002-02-27T14:01:02"); | |
179 o.verb = "foo"; | |
180 } | |
181 buildCounterActivity--; | |
182 return o; | |
183 } | |
184 | |
185 checkActivity(api.Activity o) { | |
186 buildCounterActivity++; | |
187 if (buildCounterActivity < 3) { | |
188 checkAcl(o.access); | |
189 checkOrkutAuthorResource(o.actor); | |
190 unittest.expect(o.id, unittest.equals('foo')); | |
191 unittest.expect(o.kind, unittest.equals('foo')); | |
192 checkUnnamed182(o.links); | |
193 checkActivityObject(o.object); | |
194 unittest.expect(o.published, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); | |
195 unittest.expect(o.title, unittest.equals('foo')); | |
196 unittest.expect(o.updated, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); | |
197 unittest.expect(o.verb, unittest.equals('foo')); | |
198 } | |
199 buildCounterActivity--; | |
200 } | |
201 | |
202 buildUnnamed185() { | |
203 var o = new core.List<api.Activity>(); | |
204 o.add(buildActivity()); | |
205 o.add(buildActivity()); | |
206 return o; | |
207 } | |
208 | |
209 checkUnnamed185(core.List<api.Activity> o) { | |
210 unittest.expect(o, unittest.hasLength(2)); | |
211 checkActivity(o[0]); | |
212 checkActivity(o[1]); | |
213 } | |
214 | |
215 core.int buildCounterActivityList = 0; | |
216 buildActivityList() { | |
217 var o = new api.ActivityList(); | |
218 buildCounterActivityList++; | |
219 if (buildCounterActivityList < 3) { | |
220 o.items = buildUnnamed185(); | |
221 o.kind = "foo"; | |
222 o.nextPageToken = "foo"; | |
223 } | |
224 buildCounterActivityList--; | |
225 return o; | |
226 } | |
227 | |
228 checkActivityList(api.ActivityList o) { | |
229 buildCounterActivityList++; | |
230 if (buildCounterActivityList < 3) { | |
231 checkUnnamed185(o.items); | |
232 unittest.expect(o.kind, unittest.equals('foo')); | |
233 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
234 } | |
235 buildCounterActivityList--; | |
236 } | |
237 | |
238 core.int buildCounterBadge = 0; | |
239 buildBadge() { | |
240 var o = new api.Badge(); | |
241 buildCounterBadge++; | |
242 if (buildCounterBadge < 3) { | |
243 o.badgeLargeLogo = "foo"; | |
244 o.badgeSmallLogo = "foo"; | |
245 o.caption = "foo"; | |
246 o.description = "foo"; | |
247 o.id = "foo"; | |
248 o.kind = "foo"; | |
249 o.sponsorLogo = "foo"; | |
250 o.sponsorName = "foo"; | |
251 o.sponsorUrl = "foo"; | |
252 } | |
253 buildCounterBadge--; | |
254 return o; | |
255 } | |
256 | |
257 checkBadge(api.Badge o) { | |
258 buildCounterBadge++; | |
259 if (buildCounterBadge < 3) { | |
260 unittest.expect(o.badgeLargeLogo, unittest.equals('foo')); | |
261 unittest.expect(o.badgeSmallLogo, unittest.equals('foo')); | |
262 unittest.expect(o.caption, unittest.equals('foo')); | |
263 unittest.expect(o.description, unittest.equals('foo')); | |
264 unittest.expect(o.id, unittest.equals('foo')); | |
265 unittest.expect(o.kind, unittest.equals('foo')); | |
266 unittest.expect(o.sponsorLogo, unittest.equals('foo')); | |
267 unittest.expect(o.sponsorName, unittest.equals('foo')); | |
268 unittest.expect(o.sponsorUrl, unittest.equals('foo')); | |
269 } | |
270 buildCounterBadge--; | |
271 } | |
272 | |
273 buildUnnamed186() { | |
274 var o = new core.List<api.Badge>(); | |
275 o.add(buildBadge()); | |
276 o.add(buildBadge()); | |
277 return o; | |
278 } | |
279 | |
280 checkUnnamed186(core.List<api.Badge> o) { | |
281 unittest.expect(o, unittest.hasLength(2)); | |
282 checkBadge(o[0]); | |
283 checkBadge(o[1]); | |
284 } | |
285 | |
286 core.int buildCounterBadgeList = 0; | |
287 buildBadgeList() { | |
288 var o = new api.BadgeList(); | |
289 buildCounterBadgeList++; | |
290 if (buildCounterBadgeList < 3) { | |
291 o.items = buildUnnamed186(); | |
292 o.kind = "foo"; | |
293 } | |
294 buildCounterBadgeList--; | |
295 return o; | |
296 } | |
297 | |
298 checkBadgeList(api.BadgeList o) { | |
299 buildCounterBadgeList++; | |
300 if (buildCounterBadgeList < 3) { | |
301 checkUnnamed186(o.items); | |
302 unittest.expect(o.kind, unittest.equals('foo')); | |
303 } | |
304 buildCounterBadgeList--; | |
305 } | |
306 | |
307 core.int buildCounterCommentInReplyTo = 0; | |
308 buildCommentInReplyTo() { | |
309 var o = new api.CommentInReplyTo(); | |
310 buildCounterCommentInReplyTo++; | |
311 if (buildCounterCommentInReplyTo < 3) { | |
312 o.href = "foo"; | |
313 o.ref = "foo"; | |
314 o.rel = "foo"; | |
315 o.type = "foo"; | |
316 } | |
317 buildCounterCommentInReplyTo--; | |
318 return o; | |
319 } | |
320 | |
321 checkCommentInReplyTo(api.CommentInReplyTo o) { | |
322 buildCounterCommentInReplyTo++; | |
323 if (buildCounterCommentInReplyTo < 3) { | |
324 unittest.expect(o.href, unittest.equals('foo')); | |
325 unittest.expect(o.ref, unittest.equals('foo')); | |
326 unittest.expect(o.rel, unittest.equals('foo')); | |
327 unittest.expect(o.type, unittest.equals('foo')); | |
328 } | |
329 buildCounterCommentInReplyTo--; | |
330 } | |
331 | |
332 buildUnnamed187() { | |
333 var o = new core.List<api.OrkutLinkResource>(); | |
334 o.add(buildOrkutLinkResource()); | |
335 o.add(buildOrkutLinkResource()); | |
336 return o; | |
337 } | |
338 | |
339 checkUnnamed187(core.List<api.OrkutLinkResource> o) { | |
340 unittest.expect(o, unittest.hasLength(2)); | |
341 checkOrkutLinkResource(o[0]); | |
342 checkOrkutLinkResource(o[1]); | |
343 } | |
344 | |
345 core.int buildCounterComment = 0; | |
346 buildComment() { | |
347 var o = new api.Comment(); | |
348 buildCounterComment++; | |
349 if (buildCounterComment < 3) { | |
350 o.actor = buildOrkutAuthorResource(); | |
351 o.content = "foo"; | |
352 o.id = "foo"; | |
353 o.inReplyTo = buildCommentInReplyTo(); | |
354 o.kind = "foo"; | |
355 o.links = buildUnnamed187(); | |
356 o.published = core.DateTime.parse("2002-02-27T14:01:02"); | |
357 } | |
358 buildCounterComment--; | |
359 return o; | |
360 } | |
361 | |
362 checkComment(api.Comment o) { | |
363 buildCounterComment++; | |
364 if (buildCounterComment < 3) { | |
365 checkOrkutAuthorResource(o.actor); | |
366 unittest.expect(o.content, unittest.equals('foo')); | |
367 unittest.expect(o.id, unittest.equals('foo')); | |
368 checkCommentInReplyTo(o.inReplyTo); | |
369 unittest.expect(o.kind, unittest.equals('foo')); | |
370 checkUnnamed187(o.links); | |
371 unittest.expect(o.published, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); | |
372 } | |
373 buildCounterComment--; | |
374 } | |
375 | |
376 buildUnnamed188() { | |
377 var o = new core.List<api.Comment>(); | |
378 o.add(buildComment()); | |
379 o.add(buildComment()); | |
380 return o; | |
381 } | |
382 | |
383 checkUnnamed188(core.List<api.Comment> o) { | |
384 unittest.expect(o, unittest.hasLength(2)); | |
385 checkComment(o[0]); | |
386 checkComment(o[1]); | |
387 } | |
388 | |
389 core.int buildCounterCommentList = 0; | |
390 buildCommentList() { | |
391 var o = new api.CommentList(); | |
392 buildCounterCommentList++; | |
393 if (buildCounterCommentList < 3) { | |
394 o.items = buildUnnamed188(); | |
395 o.kind = "foo"; | |
396 o.nextPageToken = "foo"; | |
397 o.previousPageToken = "foo"; | |
398 } | |
399 buildCounterCommentList--; | |
400 return o; | |
401 } | |
402 | |
403 checkCommentList(api.CommentList o) { | |
404 buildCounterCommentList++; | |
405 if (buildCounterCommentList < 3) { | |
406 checkUnnamed188(o.items); | |
407 unittest.expect(o.kind, unittest.equals('foo')); | |
408 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
409 unittest.expect(o.previousPageToken, unittest.equals('foo')); | |
410 } | |
411 buildCounterCommentList--; | |
412 } | |
413 | |
414 buildUnnamed189() { | |
415 var o = new core.List<api.OrkutAuthorResource>(); | |
416 o.add(buildOrkutAuthorResource()); | |
417 o.add(buildOrkutAuthorResource()); | |
418 return o; | |
419 } | |
420 | |
421 checkUnnamed189(core.List<api.OrkutAuthorResource> o) { | |
422 unittest.expect(o, unittest.hasLength(2)); | |
423 checkOrkutAuthorResource(o[0]); | |
424 checkOrkutAuthorResource(o[1]); | |
425 } | |
426 | |
427 buildUnnamed190() { | |
428 var o = new core.List<api.OrkutLinkResource>(); | |
429 o.add(buildOrkutLinkResource()); | |
430 o.add(buildOrkutLinkResource()); | |
431 return o; | |
432 } | |
433 | |
434 checkUnnamed190(core.List<api.OrkutLinkResource> o) { | |
435 unittest.expect(o, unittest.hasLength(2)); | |
436 checkOrkutLinkResource(o[0]); | |
437 checkOrkutLinkResource(o[1]); | |
438 } | |
439 | |
440 buildUnnamed191() { | |
441 var o = new core.List<api.OrkutAuthorResource>(); | |
442 o.add(buildOrkutAuthorResource()); | |
443 o.add(buildOrkutAuthorResource()); | |
444 return o; | |
445 } | |
446 | |
447 checkUnnamed191(core.List<api.OrkutAuthorResource> o) { | |
448 unittest.expect(o, unittest.hasLength(2)); | |
449 checkOrkutAuthorResource(o[0]); | |
450 checkOrkutAuthorResource(o[1]); | |
451 } | |
452 | |
453 core.int buildCounterCommunity = 0; | |
454 buildCommunity() { | |
455 var o = new api.Community(); | |
456 buildCounterCommunity++; | |
457 if (buildCounterCommunity < 3) { | |
458 o.category = "foo"; | |
459 o.coOwners = buildUnnamed189(); | |
460 o.creationDate = core.DateTime.parse("2002-02-27T14:01:02"); | |
461 o.description = "foo"; | |
462 o.id = 42; | |
463 o.kind = "foo"; | |
464 o.language = "foo"; | |
465 o.links = buildUnnamed190(); | |
466 o.location = "foo"; | |
467 o.memberCount = 42; | |
468 o.moderators = buildUnnamed191(); | |
469 o.name = "foo"; | |
470 o.owner = buildOrkutAuthorResource(); | |
471 o.photoUrl = "foo"; | |
472 } | |
473 buildCounterCommunity--; | |
474 return o; | |
475 } | |
476 | |
477 checkCommunity(api.Community o) { | |
478 buildCounterCommunity++; | |
479 if (buildCounterCommunity < 3) { | |
480 unittest.expect(o.category, unittest.equals('foo')); | |
481 checkUnnamed189(o.coOwners); | |
482 unittest.expect(o.creationDate, unittest.equals(core.DateTime.parse("2002-02
-27T14:01:02"))); | |
483 unittest.expect(o.description, unittest.equals('foo')); | |
484 unittest.expect(o.id, unittest.equals(42)); | |
485 unittest.expect(o.kind, unittest.equals('foo')); | |
486 unittest.expect(o.language, unittest.equals('foo')); | |
487 checkUnnamed190(o.links); | |
488 unittest.expect(o.location, unittest.equals('foo')); | |
489 unittest.expect(o.memberCount, unittest.equals(42)); | |
490 checkUnnamed191(o.moderators); | |
491 unittest.expect(o.name, unittest.equals('foo')); | |
492 checkOrkutAuthorResource(o.owner); | |
493 unittest.expect(o.photoUrl, unittest.equals('foo')); | |
494 } | |
495 buildCounterCommunity--; | |
496 } | |
497 | |
498 buildUnnamed192() { | |
499 var o = new core.List<api.Community>(); | |
500 o.add(buildCommunity()); | |
501 o.add(buildCommunity()); | |
502 return o; | |
503 } | |
504 | |
505 checkUnnamed192(core.List<api.Community> o) { | |
506 unittest.expect(o, unittest.hasLength(2)); | |
507 checkCommunity(o[0]); | |
508 checkCommunity(o[1]); | |
509 } | |
510 | |
511 core.int buildCounterCommunityList = 0; | |
512 buildCommunityList() { | |
513 var o = new api.CommunityList(); | |
514 buildCounterCommunityList++; | |
515 if (buildCounterCommunityList < 3) { | |
516 o.items = buildUnnamed192(); | |
517 o.kind = "foo"; | |
518 } | |
519 buildCounterCommunityList--; | |
520 return o; | |
521 } | |
522 | |
523 checkCommunityList(api.CommunityList o) { | |
524 buildCounterCommunityList++; | |
525 if (buildCounterCommunityList < 3) { | |
526 checkUnnamed192(o.items); | |
527 unittest.expect(o.kind, unittest.equals('foo')); | |
528 } | |
529 buildCounterCommunityList--; | |
530 } | |
531 | |
532 core.int buildCounterCommunityMembers = 0; | |
533 buildCommunityMembers() { | |
534 var o = new api.CommunityMembers(); | |
535 buildCounterCommunityMembers++; | |
536 if (buildCounterCommunityMembers < 3) { | |
537 o.communityMembershipStatus = buildCommunityMembershipStatus(); | |
538 o.kind = "foo"; | |
539 o.person = buildOrkutActivitypersonResource(); | |
540 } | |
541 buildCounterCommunityMembers--; | |
542 return o; | |
543 } | |
544 | |
545 checkCommunityMembers(api.CommunityMembers o) { | |
546 buildCounterCommunityMembers++; | |
547 if (buildCounterCommunityMembers < 3) { | |
548 checkCommunityMembershipStatus(o.communityMembershipStatus); | |
549 unittest.expect(o.kind, unittest.equals('foo')); | |
550 checkOrkutActivitypersonResource(o.person); | |
551 } | |
552 buildCounterCommunityMembers--; | |
553 } | |
554 | |
555 buildUnnamed193() { | |
556 var o = new core.List<api.CommunityMembers>(); | |
557 o.add(buildCommunityMembers()); | |
558 o.add(buildCommunityMembers()); | |
559 return o; | |
560 } | |
561 | |
562 checkUnnamed193(core.List<api.CommunityMembers> o) { | |
563 unittest.expect(o, unittest.hasLength(2)); | |
564 checkCommunityMembers(o[0]); | |
565 checkCommunityMembers(o[1]); | |
566 } | |
567 | |
568 core.int buildCounterCommunityMembersList = 0; | |
569 buildCommunityMembersList() { | |
570 var o = new api.CommunityMembersList(); | |
571 buildCounterCommunityMembersList++; | |
572 if (buildCounterCommunityMembersList < 3) { | |
573 o.firstPageToken = "foo"; | |
574 o.items = buildUnnamed193(); | |
575 o.kind = "foo"; | |
576 o.lastPageToken = "foo"; | |
577 o.nextPageToken = "foo"; | |
578 o.prevPageToken = "foo"; | |
579 } | |
580 buildCounterCommunityMembersList--; | |
581 return o; | |
582 } | |
583 | |
584 checkCommunityMembersList(api.CommunityMembersList o) { | |
585 buildCounterCommunityMembersList++; | |
586 if (buildCounterCommunityMembersList < 3) { | |
587 unittest.expect(o.firstPageToken, unittest.equals('foo')); | |
588 checkUnnamed193(o.items); | |
589 unittest.expect(o.kind, unittest.equals('foo')); | |
590 unittest.expect(o.lastPageToken, unittest.equals('foo')); | |
591 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
592 unittest.expect(o.prevPageToken, unittest.equals('foo')); | |
593 } | |
594 buildCounterCommunityMembersList--; | |
595 } | |
596 | |
597 core.int buildCounterCommunityMembershipStatus = 0; | |
598 buildCommunityMembershipStatus() { | |
599 var o = new api.CommunityMembershipStatus(); | |
600 buildCounterCommunityMembershipStatus++; | |
601 if (buildCounterCommunityMembershipStatus < 3) { | |
602 o.canCreatePoll = true; | |
603 o.canCreateTopic = true; | |
604 o.canShout = true; | |
605 o.isCoOwner = true; | |
606 o.isFollowing = true; | |
607 o.isModerator = true; | |
608 o.isOwner = true; | |
609 o.isRestoreAvailable = true; | |
610 o.isTakebackAvailable = true; | |
611 o.kind = "foo"; | |
612 o.status = "foo"; | |
613 } | |
614 buildCounterCommunityMembershipStatus--; | |
615 return o; | |
616 } | |
617 | |
618 checkCommunityMembershipStatus(api.CommunityMembershipStatus o) { | |
619 buildCounterCommunityMembershipStatus++; | |
620 if (buildCounterCommunityMembershipStatus < 3) { | |
621 unittest.expect(o.canCreatePoll, unittest.isTrue); | |
622 unittest.expect(o.canCreateTopic, unittest.isTrue); | |
623 unittest.expect(o.canShout, unittest.isTrue); | |
624 unittest.expect(o.isCoOwner, unittest.isTrue); | |
625 unittest.expect(o.isFollowing, unittest.isTrue); | |
626 unittest.expect(o.isModerator, unittest.isTrue); | |
627 unittest.expect(o.isOwner, unittest.isTrue); | |
628 unittest.expect(o.isRestoreAvailable, unittest.isTrue); | |
629 unittest.expect(o.isTakebackAvailable, unittest.isTrue); | |
630 unittest.expect(o.kind, unittest.equals('foo')); | |
631 unittest.expect(o.status, unittest.equals('foo')); | |
632 } | |
633 buildCounterCommunityMembershipStatus--; | |
634 } | |
635 | |
636 buildUnnamed194() { | |
637 var o = new core.List<api.OrkutLinkResource>(); | |
638 o.add(buildOrkutLinkResource()); | |
639 o.add(buildOrkutLinkResource()); | |
640 return o; | |
641 } | |
642 | |
643 checkUnnamed194(core.List<api.OrkutLinkResource> o) { | |
644 unittest.expect(o, unittest.hasLength(2)); | |
645 checkOrkutLinkResource(o[0]); | |
646 checkOrkutLinkResource(o[1]); | |
647 } | |
648 | |
649 core.int buildCounterCommunityMessage = 0; | |
650 buildCommunityMessage() { | |
651 var o = new api.CommunityMessage(); | |
652 buildCounterCommunityMessage++; | |
653 if (buildCounterCommunityMessage < 3) { | |
654 o.addedDate = core.DateTime.parse("2002-02-27T14:01:02"); | |
655 o.author = buildOrkutAuthorResource(); | |
656 o.body = "foo"; | |
657 o.id = "foo"; | |
658 o.isSpam = true; | |
659 o.kind = "foo"; | |
660 o.links = buildUnnamed194(); | |
661 o.subject = "foo"; | |
662 } | |
663 buildCounterCommunityMessage--; | |
664 return o; | |
665 } | |
666 | |
667 checkCommunityMessage(api.CommunityMessage o) { | |
668 buildCounterCommunityMessage++; | |
669 if (buildCounterCommunityMessage < 3) { | |
670 unittest.expect(o.addedDate, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); | |
671 checkOrkutAuthorResource(o.author); | |
672 unittest.expect(o.body, unittest.equals('foo')); | |
673 unittest.expect(o.id, unittest.equals('foo')); | |
674 unittest.expect(o.isSpam, unittest.isTrue); | |
675 unittest.expect(o.kind, unittest.equals('foo')); | |
676 checkUnnamed194(o.links); | |
677 unittest.expect(o.subject, unittest.equals('foo')); | |
678 } | |
679 buildCounterCommunityMessage--; | |
680 } | |
681 | |
682 buildUnnamed195() { | |
683 var o = new core.List<api.CommunityMessage>(); | |
684 o.add(buildCommunityMessage()); | |
685 o.add(buildCommunityMessage()); | |
686 return o; | |
687 } | |
688 | |
689 checkUnnamed195(core.List<api.CommunityMessage> o) { | |
690 unittest.expect(o, unittest.hasLength(2)); | |
691 checkCommunityMessage(o[0]); | |
692 checkCommunityMessage(o[1]); | |
693 } | |
694 | |
695 core.int buildCounterCommunityMessageList = 0; | |
696 buildCommunityMessageList() { | |
697 var o = new api.CommunityMessageList(); | |
698 buildCounterCommunityMessageList++; | |
699 if (buildCounterCommunityMessageList < 3) { | |
700 o.firstPageToken = "foo"; | |
701 o.items = buildUnnamed195(); | |
702 o.kind = "foo"; | |
703 o.lastPageToken = "foo"; | |
704 o.nextPageToken = "foo"; | |
705 o.prevPageToken = "foo"; | |
706 } | |
707 buildCounterCommunityMessageList--; | |
708 return o; | |
709 } | |
710 | |
711 checkCommunityMessageList(api.CommunityMessageList o) { | |
712 buildCounterCommunityMessageList++; | |
713 if (buildCounterCommunityMessageList < 3) { | |
714 unittest.expect(o.firstPageToken, unittest.equals('foo')); | |
715 checkUnnamed195(o.items); | |
716 unittest.expect(o.kind, unittest.equals('foo')); | |
717 unittest.expect(o.lastPageToken, unittest.equals('foo')); | |
718 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
719 unittest.expect(o.prevPageToken, unittest.equals('foo')); | |
720 } | |
721 buildCounterCommunityMessageList--; | |
722 } | |
723 | |
724 core.int buildCounterCommunityPollImage = 0; | |
725 buildCommunityPollImage() { | |
726 var o = new api.CommunityPollImage(); | |
727 buildCounterCommunityPollImage++; | |
728 if (buildCounterCommunityPollImage < 3) { | |
729 o.url = "foo"; | |
730 } | |
731 buildCounterCommunityPollImage--; | |
732 return o; | |
733 } | |
734 | |
735 checkCommunityPollImage(api.CommunityPollImage o) { | |
736 buildCounterCommunityPollImage++; | |
737 if (buildCounterCommunityPollImage < 3) { | |
738 unittest.expect(o.url, unittest.equals('foo')); | |
739 } | |
740 buildCounterCommunityPollImage--; | |
741 } | |
742 | |
743 buildUnnamed196() { | |
744 var o = new core.List<api.OrkutLinkResource>(); | |
745 o.add(buildOrkutLinkResource()); | |
746 o.add(buildOrkutLinkResource()); | |
747 return o; | |
748 } | |
749 | |
750 checkUnnamed196(core.List<api.OrkutLinkResource> o) { | |
751 unittest.expect(o, unittest.hasLength(2)); | |
752 checkOrkutLinkResource(o[0]); | |
753 checkOrkutLinkResource(o[1]); | |
754 } | |
755 | |
756 buildUnnamed197() { | |
757 var o = new core.List<api.OrkutCommunitypolloptionResource>(); | |
758 o.add(buildOrkutCommunitypolloptionResource()); | |
759 o.add(buildOrkutCommunitypolloptionResource()); | |
760 return o; | |
761 } | |
762 | |
763 checkUnnamed197(core.List<api.OrkutCommunitypolloptionResource> o) { | |
764 unittest.expect(o, unittest.hasLength(2)); | |
765 checkOrkutCommunitypolloptionResource(o[0]); | |
766 checkOrkutCommunitypolloptionResource(o[1]); | |
767 } | |
768 | |
769 buildUnnamed198() { | |
770 var o = new core.List<core.int>(); | |
771 o.add(42); | |
772 o.add(42); | |
773 return o; | |
774 } | |
775 | |
776 checkUnnamed198(core.List<core.int> o) { | |
777 unittest.expect(o, unittest.hasLength(2)); | |
778 unittest.expect(o[0], unittest.equals(42)); | |
779 unittest.expect(o[1], unittest.equals(42)); | |
780 } | |
781 | |
782 core.int buildCounterCommunityPoll = 0; | |
783 buildCommunityPoll() { | |
784 var o = new api.CommunityPoll(); | |
785 buildCounterCommunityPoll++; | |
786 if (buildCounterCommunityPoll < 3) { | |
787 o.author = buildOrkutAuthorResource(); | |
788 o.communityId = 42; | |
789 o.creationTime = core.DateTime.parse("2002-02-27T14:01:02"); | |
790 o.description = "foo"; | |
791 o.endingTime = core.DateTime.parse("2002-02-27T14:01:02"); | |
792 o.hasVoted = true; | |
793 o.id = "foo"; | |
794 o.image = buildCommunityPollImage(); | |
795 o.isClosed = true; | |
796 o.isMultipleAnswers = true; | |
797 o.isOpenForVoting = true; | |
798 o.isRestricted = true; | |
799 o.isSpam = true; | |
800 o.isUsersVotePublic = true; | |
801 o.isVotingAllowedForNonMembers = true; | |
802 o.kind = "foo"; | |
803 o.lastUpdate = core.DateTime.parse("2002-02-27T14:01:02"); | |
804 o.links = buildUnnamed196(); | |
805 o.options = buildUnnamed197(); | |
806 o.question = "foo"; | |
807 o.totalNumberOfVotes = 42; | |
808 o.votedOptions = buildUnnamed198(); | |
809 } | |
810 buildCounterCommunityPoll--; | |
811 return o; | |
812 } | |
813 | |
814 checkCommunityPoll(api.CommunityPoll o) { | |
815 buildCounterCommunityPoll++; | |
816 if (buildCounterCommunityPoll < 3) { | |
817 checkOrkutAuthorResource(o.author); | |
818 unittest.expect(o.communityId, unittest.equals(42)); | |
819 unittest.expect(o.creationTime, unittest.equals(core.DateTime.parse("2002-02
-27T14:01:02"))); | |
820 unittest.expect(o.description, unittest.equals('foo')); | |
821 unittest.expect(o.endingTime, unittest.equals(core.DateTime.parse("2002-02-2
7T14:01:02"))); | |
822 unittest.expect(o.hasVoted, unittest.isTrue); | |
823 unittest.expect(o.id, unittest.equals('foo')); | |
824 checkCommunityPollImage(o.image); | |
825 unittest.expect(o.isClosed, unittest.isTrue); | |
826 unittest.expect(o.isMultipleAnswers, unittest.isTrue); | |
827 unittest.expect(o.isOpenForVoting, unittest.isTrue); | |
828 unittest.expect(o.isRestricted, unittest.isTrue); | |
829 unittest.expect(o.isSpam, unittest.isTrue); | |
830 unittest.expect(o.isUsersVotePublic, unittest.isTrue); | |
831 unittest.expect(o.isVotingAllowedForNonMembers, unittest.isTrue); | |
832 unittest.expect(o.kind, unittest.equals('foo')); | |
833 unittest.expect(o.lastUpdate, unittest.equals(core.DateTime.parse("2002-02-2
7T14:01:02"))); | |
834 checkUnnamed196(o.links); | |
835 checkUnnamed197(o.options); | |
836 unittest.expect(o.question, unittest.equals('foo')); | |
837 unittest.expect(o.totalNumberOfVotes, unittest.equals(42)); | |
838 checkUnnamed198(o.votedOptions); | |
839 } | |
840 buildCounterCommunityPoll--; | |
841 } | |
842 | |
843 core.int buildCounterCommunityPollComment = 0; | |
844 buildCommunityPollComment() { | |
845 var o = new api.CommunityPollComment(); | |
846 buildCounterCommunityPollComment++; | |
847 if (buildCounterCommunityPollComment < 3) { | |
848 o.addedDate = core.DateTime.parse("2002-02-27T14:01:02"); | |
849 o.author = buildOrkutAuthorResource(); | |
850 o.body = "foo"; | |
851 o.id = 42; | |
852 o.kind = "foo"; | |
853 } | |
854 buildCounterCommunityPollComment--; | |
855 return o; | |
856 } | |
857 | |
858 checkCommunityPollComment(api.CommunityPollComment o) { | |
859 buildCounterCommunityPollComment++; | |
860 if (buildCounterCommunityPollComment < 3) { | |
861 unittest.expect(o.addedDate, unittest.equals(core.DateTime.parse("2002-02-27
T14:01:02"))); | |
862 checkOrkutAuthorResource(o.author); | |
863 unittest.expect(o.body, unittest.equals('foo')); | |
864 unittest.expect(o.id, unittest.equals(42)); | |
865 unittest.expect(o.kind, unittest.equals('foo')); | |
866 } | |
867 buildCounterCommunityPollComment--; | |
868 } | |
869 | |
870 buildUnnamed199() { | |
871 var o = new core.List<api.CommunityPollComment>(); | |
872 o.add(buildCommunityPollComment()); | |
873 o.add(buildCommunityPollComment()); | |
874 return o; | |
875 } | |
876 | |
877 checkUnnamed199(core.List<api.CommunityPollComment> o) { | |
878 unittest.expect(o, unittest.hasLength(2)); | |
879 checkCommunityPollComment(o[0]); | |
880 checkCommunityPollComment(o[1]); | |
881 } | |
882 | |
883 core.int buildCounterCommunityPollCommentList = 0; | |
884 buildCommunityPollCommentList() { | |
885 var o = new api.CommunityPollCommentList(); | |
886 buildCounterCommunityPollCommentList++; | |
887 if (buildCounterCommunityPollCommentList < 3) { | |
888 o.firstPageToken = "foo"; | |
889 o.items = buildUnnamed199(); | |
890 o.kind = "foo"; | |
891 o.lastPageToken = "foo"; | |
892 o.nextPageToken = "foo"; | |
893 o.prevPageToken = "foo"; | |
894 } | |
895 buildCounterCommunityPollCommentList--; | |
896 return o; | |
897 } | |
898 | |
899 checkCommunityPollCommentList(api.CommunityPollCommentList o) { | |
900 buildCounterCommunityPollCommentList++; | |
901 if (buildCounterCommunityPollCommentList < 3) { | |
902 unittest.expect(o.firstPageToken, unittest.equals('foo')); | |
903 checkUnnamed199(o.items); | |
904 unittest.expect(o.kind, unittest.equals('foo')); | |
905 unittest.expect(o.lastPageToken, unittest.equals('foo')); | |
906 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
907 unittest.expect(o.prevPageToken, unittest.equals('foo')); | |
908 } | |
909 buildCounterCommunityPollCommentList--; | |
910 } | |
911 | |
912 buildUnnamed200() { | |
913 var o = new core.List<api.CommunityPoll>(); | |
914 o.add(buildCommunityPoll()); | |
915 o.add(buildCommunityPoll()); | |
916 return o; | |
917 } | |
918 | |
919 checkUnnamed200(core.List<api.CommunityPoll> o) { | |
920 unittest.expect(o, unittest.hasLength(2)); | |
921 checkCommunityPoll(o[0]); | |
922 checkCommunityPoll(o[1]); | |
923 } | |
924 | |
925 core.int buildCounterCommunityPollList = 0; | |
926 buildCommunityPollList() { | |
927 var o = new api.CommunityPollList(); | |
928 buildCounterCommunityPollList++; | |
929 if (buildCounterCommunityPollList < 3) { | |
930 o.firstPageToken = "foo"; | |
931 o.items = buildUnnamed200(); | |
932 o.kind = "foo"; | |
933 o.lastPageToken = "foo"; | |
934 o.nextPageToken = "foo"; | |
935 o.prevPageToken = "foo"; | |
936 } | |
937 buildCounterCommunityPollList--; | |
938 return o; | |
939 } | |
940 | |
941 checkCommunityPollList(api.CommunityPollList o) { | |
942 buildCounterCommunityPollList++; | |
943 if (buildCounterCommunityPollList < 3) { | |
944 unittest.expect(o.firstPageToken, unittest.equals('foo')); | |
945 checkUnnamed200(o.items); | |
946 unittest.expect(o.kind, unittest.equals('foo')); | |
947 unittest.expect(o.lastPageToken, unittest.equals('foo')); | |
948 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
949 unittest.expect(o.prevPageToken, unittest.equals('foo')); | |
950 } | |
951 buildCounterCommunityPollList--; | |
952 } | |
953 | |
954 buildUnnamed201() { | |
955 var o = new core.List<core.int>(); | |
956 o.add(42); | |
957 o.add(42); | |
958 return o; | |
959 } | |
960 | |
961 checkUnnamed201(core.List<core.int> o) { | |
962 unittest.expect(o, unittest.hasLength(2)); | |
963 unittest.expect(o[0], unittest.equals(42)); | |
964 unittest.expect(o[1], unittest.equals(42)); | |
965 } | |
966 | |
967 core.int buildCounterCommunityPollVote = 0; | |
968 buildCommunityPollVote() { | |
969 var o = new api.CommunityPollVote(); | |
970 buildCounterCommunityPollVote++; | |
971 if (buildCounterCommunityPollVote < 3) { | |
972 o.isVotevisible = true; | |
973 o.kind = "foo"; | |
974 o.optionIds = buildUnnamed201(); | |
975 } | |
976 buildCounterCommunityPollVote--; | |
977 return o; | |
978 } | |
979 | |
980 checkCommunityPollVote(api.CommunityPollVote o) { | |
981 buildCounterCommunityPollVote++; | |
982 if (buildCounterCommunityPollVote < 3) { | |
983 unittest.expect(o.isVotevisible, unittest.isTrue); | |
984 unittest.expect(o.kind, unittest.equals('foo')); | |
985 checkUnnamed201(o.optionIds); | |
986 } | |
987 buildCounterCommunityPollVote--; | |
988 } | |
989 | |
990 buildUnnamed202() { | |
991 var o = new core.List<api.OrkutLinkResource>(); | |
992 o.add(buildOrkutLinkResource()); | |
993 o.add(buildOrkutLinkResource()); | |
994 return o; | |
995 } | |
996 | |
997 checkUnnamed202(core.List<api.OrkutLinkResource> o) { | |
998 unittest.expect(o, unittest.hasLength(2)); | |
999 checkOrkutLinkResource(o[0]); | |
1000 checkOrkutLinkResource(o[1]); | |
1001 } | |
1002 | |
1003 buildUnnamed203() { | |
1004 var o = new core.List<api.CommunityMessage>(); | |
1005 o.add(buildCommunityMessage()); | |
1006 o.add(buildCommunityMessage()); | |
1007 return o; | |
1008 } | |
1009 | |
1010 checkUnnamed203(core.List<api.CommunityMessage> o) { | |
1011 unittest.expect(o, unittest.hasLength(2)); | |
1012 checkCommunityMessage(o[0]); | |
1013 checkCommunityMessage(o[1]); | |
1014 } | |
1015 | |
1016 core.int buildCounterCommunityTopic = 0; | |
1017 buildCommunityTopic() { | |
1018 var o = new api.CommunityTopic(); | |
1019 buildCounterCommunityTopic++; | |
1020 if (buildCounterCommunityTopic < 3) { | |
1021 o.author = buildOrkutAuthorResource(); | |
1022 o.body = "foo"; | |
1023 o.id = "foo"; | |
1024 o.isClosed = true; | |
1025 o.kind = "foo"; | |
1026 o.lastUpdate = core.DateTime.parse("2002-02-27T14:01:02"); | |
1027 o.latestMessageSnippet = "foo"; | |
1028 o.links = buildUnnamed202(); | |
1029 o.messages = buildUnnamed203(); | |
1030 o.numberOfReplies = 42; | |
1031 o.title = "foo"; | |
1032 } | |
1033 buildCounterCommunityTopic--; | |
1034 return o; | |
1035 } | |
1036 | |
1037 checkCommunityTopic(api.CommunityTopic o) { | |
1038 buildCounterCommunityTopic++; | |
1039 if (buildCounterCommunityTopic < 3) { | |
1040 checkOrkutAuthorResource(o.author); | |
1041 unittest.expect(o.body, unittest.equals('foo')); | |
1042 unittest.expect(o.id, unittest.equals('foo')); | |
1043 unittest.expect(o.isClosed, unittest.isTrue); | |
1044 unittest.expect(o.kind, unittest.equals('foo')); | |
1045 unittest.expect(o.lastUpdate, unittest.equals(core.DateTime.parse("2002-02-2
7T14:01:02"))); | |
1046 unittest.expect(o.latestMessageSnippet, unittest.equals('foo')); | |
1047 checkUnnamed202(o.links); | |
1048 checkUnnamed203(o.messages); | |
1049 unittest.expect(o.numberOfReplies, unittest.equals(42)); | |
1050 unittest.expect(o.title, unittest.equals('foo')); | |
1051 } | |
1052 buildCounterCommunityTopic--; | |
1053 } | |
1054 | |
1055 buildUnnamed204() { | |
1056 var o = new core.List<api.CommunityTopic>(); | |
1057 o.add(buildCommunityTopic()); | |
1058 o.add(buildCommunityTopic()); | |
1059 return o; | |
1060 } | |
1061 | |
1062 checkUnnamed204(core.List<api.CommunityTopic> o) { | |
1063 unittest.expect(o, unittest.hasLength(2)); | |
1064 checkCommunityTopic(o[0]); | |
1065 checkCommunityTopic(o[1]); | |
1066 } | |
1067 | |
1068 core.int buildCounterCommunityTopicList = 0; | |
1069 buildCommunityTopicList() { | |
1070 var o = new api.CommunityTopicList(); | |
1071 buildCounterCommunityTopicList++; | |
1072 if (buildCounterCommunityTopicList < 3) { | |
1073 o.firstPageToken = "foo"; | |
1074 o.items = buildUnnamed204(); | |
1075 o.kind = "foo"; | |
1076 o.lastPageToken = "foo"; | |
1077 o.nextPageToken = "foo"; | |
1078 o.prevPageToken = "foo"; | |
1079 } | |
1080 buildCounterCommunityTopicList--; | |
1081 return o; | |
1082 } | |
1083 | |
1084 checkCommunityTopicList(api.CommunityTopicList o) { | |
1085 buildCounterCommunityTopicList++; | |
1086 if (buildCounterCommunityTopicList < 3) { | |
1087 unittest.expect(o.firstPageToken, unittest.equals('foo')); | |
1088 checkUnnamed204(o.items); | |
1089 unittest.expect(o.kind, unittest.equals('foo')); | |
1090 unittest.expect(o.lastPageToken, unittest.equals('foo')); | |
1091 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
1092 unittest.expect(o.prevPageToken, unittest.equals('foo')); | |
1093 } | |
1094 buildCounterCommunityTopicList--; | |
1095 } | |
1096 | |
1097 buildUnnamed205() { | |
1098 var o = new core.List<api.OrkutCounterResource>(); | |
1099 o.add(buildOrkutCounterResource()); | |
1100 o.add(buildOrkutCounterResource()); | |
1101 return o; | |
1102 } | |
1103 | |
1104 checkUnnamed205(core.List<api.OrkutCounterResource> o) { | |
1105 unittest.expect(o, unittest.hasLength(2)); | |
1106 checkOrkutCounterResource(o[0]); | |
1107 checkOrkutCounterResource(o[1]); | |
1108 } | |
1109 | |
1110 core.int buildCounterCounters = 0; | |
1111 buildCounters() { | |
1112 var o = new api.Counters(); | |
1113 buildCounterCounters++; | |
1114 if (buildCounterCounters < 3) { | |
1115 o.items = buildUnnamed205(); | |
1116 o.kind = "foo"; | |
1117 } | |
1118 buildCounterCounters--; | |
1119 return o; | |
1120 } | |
1121 | |
1122 checkCounters(api.Counters o) { | |
1123 buildCounterCounters++; | |
1124 if (buildCounterCounters < 3) { | |
1125 checkUnnamed205(o.items); | |
1126 unittest.expect(o.kind, unittest.equals('foo')); | |
1127 } | |
1128 buildCounterCounters--; | |
1129 } | |
1130 | |
1131 buildUnnamed206() { | |
1132 var o = new core.List<api.OrkutLinkResource>(); | |
1133 o.add(buildOrkutLinkResource()); | |
1134 o.add(buildOrkutLinkResource()); | |
1135 return o; | |
1136 } | |
1137 | |
1138 checkUnnamed206(core.List<api.OrkutLinkResource> o) { | |
1139 unittest.expect(o, unittest.hasLength(2)); | |
1140 checkOrkutLinkResource(o[0]); | |
1141 checkOrkutLinkResource(o[1]); | |
1142 } | |
1143 | |
1144 core.int buildCounterOrkutActivityobjectsResource = 0; | |
1145 buildOrkutActivityobjectsResource() { | |
1146 var o = new api.OrkutActivityobjectsResource(); | |
1147 buildCounterOrkutActivityobjectsResource++; | |
1148 if (buildCounterOrkutActivityobjectsResource < 3) { | |
1149 o.community = buildCommunity(); | |
1150 o.content = "foo"; | |
1151 o.displayName = "foo"; | |
1152 o.id = "foo"; | |
1153 o.links = buildUnnamed206(); | |
1154 o.objectType = "foo"; | |
1155 o.person = buildOrkutActivitypersonResource(); | |
1156 } | |
1157 buildCounterOrkutActivityobjectsResource--; | |
1158 return o; | |
1159 } | |
1160 | |
1161 checkOrkutActivityobjectsResource(api.OrkutActivityobjectsResource o) { | |
1162 buildCounterOrkutActivityobjectsResource++; | |
1163 if (buildCounterOrkutActivityobjectsResource < 3) { | |
1164 checkCommunity(o.community); | |
1165 unittest.expect(o.content, unittest.equals('foo')); | |
1166 unittest.expect(o.displayName, unittest.equals('foo')); | |
1167 unittest.expect(o.id, unittest.equals('foo')); | |
1168 checkUnnamed206(o.links); | |
1169 unittest.expect(o.objectType, unittest.equals('foo')); | |
1170 checkOrkutActivitypersonResource(o.person); | |
1171 } | |
1172 buildCounterOrkutActivityobjectsResource--; | |
1173 } | |
1174 | |
1175 core.int buildCounterOrkutActivitypersonResourceImage = 0; | |
1176 buildOrkutActivitypersonResourceImage() { | |
1177 var o = new api.OrkutActivitypersonResourceImage(); | |
1178 buildCounterOrkutActivitypersonResourceImage++; | |
1179 if (buildCounterOrkutActivitypersonResourceImage < 3) { | |
1180 o.url = "foo"; | |
1181 } | |
1182 buildCounterOrkutActivitypersonResourceImage--; | |
1183 return o; | |
1184 } | |
1185 | |
1186 checkOrkutActivitypersonResourceImage(api.OrkutActivitypersonResourceImage o) { | |
1187 buildCounterOrkutActivitypersonResourceImage++; | |
1188 if (buildCounterOrkutActivitypersonResourceImage < 3) { | |
1189 unittest.expect(o.url, unittest.equals('foo')); | |
1190 } | |
1191 buildCounterOrkutActivitypersonResourceImage--; | |
1192 } | |
1193 | |
1194 core.int buildCounterOrkutActivitypersonResourceName = 0; | |
1195 buildOrkutActivitypersonResourceName() { | |
1196 var o = new api.OrkutActivitypersonResourceName(); | |
1197 buildCounterOrkutActivitypersonResourceName++; | |
1198 if (buildCounterOrkutActivitypersonResourceName < 3) { | |
1199 o.familyName = "foo"; | |
1200 o.givenName = "foo"; | |
1201 } | |
1202 buildCounterOrkutActivitypersonResourceName--; | |
1203 return o; | |
1204 } | |
1205 | |
1206 checkOrkutActivitypersonResourceName(api.OrkutActivitypersonResourceName o) { | |
1207 buildCounterOrkutActivitypersonResourceName++; | |
1208 if (buildCounterOrkutActivitypersonResourceName < 3) { | |
1209 unittest.expect(o.familyName, unittest.equals('foo')); | |
1210 unittest.expect(o.givenName, unittest.equals('foo')); | |
1211 } | |
1212 buildCounterOrkutActivitypersonResourceName--; | |
1213 } | |
1214 | |
1215 core.int buildCounterOrkutActivitypersonResource = 0; | |
1216 buildOrkutActivitypersonResource() { | |
1217 var o = new api.OrkutActivitypersonResource(); | |
1218 buildCounterOrkutActivitypersonResource++; | |
1219 if (buildCounterOrkutActivitypersonResource < 3) { | |
1220 o.birthday = "foo"; | |
1221 o.gender = "foo"; | |
1222 o.id = "foo"; | |
1223 o.image = buildOrkutActivitypersonResourceImage(); | |
1224 o.name = buildOrkutActivitypersonResourceName(); | |
1225 o.url = "foo"; | |
1226 } | |
1227 buildCounterOrkutActivitypersonResource--; | |
1228 return o; | |
1229 } | |
1230 | |
1231 checkOrkutActivitypersonResource(api.OrkutActivitypersonResource o) { | |
1232 buildCounterOrkutActivitypersonResource++; | |
1233 if (buildCounterOrkutActivitypersonResource < 3) { | |
1234 unittest.expect(o.birthday, unittest.equals('foo')); | |
1235 unittest.expect(o.gender, unittest.equals('foo')); | |
1236 unittest.expect(o.id, unittest.equals('foo')); | |
1237 checkOrkutActivitypersonResourceImage(o.image); | |
1238 checkOrkutActivitypersonResourceName(o.name); | |
1239 unittest.expect(o.url, unittest.equals('foo')); | |
1240 } | |
1241 buildCounterOrkutActivitypersonResource--; | |
1242 } | |
1243 | |
1244 core.int buildCounterOrkutAuthorResourceImage = 0; | |
1245 buildOrkutAuthorResourceImage() { | |
1246 var o = new api.OrkutAuthorResourceImage(); | |
1247 buildCounterOrkutAuthorResourceImage++; | |
1248 if (buildCounterOrkutAuthorResourceImage < 3) { | |
1249 o.url = "foo"; | |
1250 } | |
1251 buildCounterOrkutAuthorResourceImage--; | |
1252 return o; | |
1253 } | |
1254 | |
1255 checkOrkutAuthorResourceImage(api.OrkutAuthorResourceImage o) { | |
1256 buildCounterOrkutAuthorResourceImage++; | |
1257 if (buildCounterOrkutAuthorResourceImage < 3) { | |
1258 unittest.expect(o.url, unittest.equals('foo')); | |
1259 } | |
1260 buildCounterOrkutAuthorResourceImage--; | |
1261 } | |
1262 | |
1263 core.int buildCounterOrkutAuthorResource = 0; | |
1264 buildOrkutAuthorResource() { | |
1265 var o = new api.OrkutAuthorResource(); | |
1266 buildCounterOrkutAuthorResource++; | |
1267 if (buildCounterOrkutAuthorResource < 3) { | |
1268 o.displayName = "foo"; | |
1269 o.id = "foo"; | |
1270 o.image = buildOrkutAuthorResourceImage(); | |
1271 o.url = "foo"; | |
1272 } | |
1273 buildCounterOrkutAuthorResource--; | |
1274 return o; | |
1275 } | |
1276 | |
1277 checkOrkutAuthorResource(api.OrkutAuthorResource o) { | |
1278 buildCounterOrkutAuthorResource++; | |
1279 if (buildCounterOrkutAuthorResource < 3) { | |
1280 unittest.expect(o.displayName, unittest.equals('foo')); | |
1281 unittest.expect(o.id, unittest.equals('foo')); | |
1282 checkOrkutAuthorResourceImage(o.image); | |
1283 unittest.expect(o.url, unittest.equals('foo')); | |
1284 } | |
1285 buildCounterOrkutAuthorResource--; | |
1286 } | |
1287 | |
1288 core.int buildCounterOrkutCommunitypolloptionResourceImage = 0; | |
1289 buildOrkutCommunitypolloptionResourceImage() { | |
1290 var o = new api.OrkutCommunitypolloptionResourceImage(); | |
1291 buildCounterOrkutCommunitypolloptionResourceImage++; | |
1292 if (buildCounterOrkutCommunitypolloptionResourceImage < 3) { | |
1293 o.url = "foo"; | |
1294 } | |
1295 buildCounterOrkutCommunitypolloptionResourceImage--; | |
1296 return o; | |
1297 } | |
1298 | |
1299 checkOrkutCommunitypolloptionResourceImage(api.OrkutCommunitypolloptionResourceI
mage o) { | |
1300 buildCounterOrkutCommunitypolloptionResourceImage++; | |
1301 if (buildCounterOrkutCommunitypolloptionResourceImage < 3) { | |
1302 unittest.expect(o.url, unittest.equals('foo')); | |
1303 } | |
1304 buildCounterOrkutCommunitypolloptionResourceImage--; | |
1305 } | |
1306 | |
1307 core.int buildCounterOrkutCommunitypolloptionResource = 0; | |
1308 buildOrkutCommunitypolloptionResource() { | |
1309 var o = new api.OrkutCommunitypolloptionResource(); | |
1310 buildCounterOrkutCommunitypolloptionResource++; | |
1311 if (buildCounterOrkutCommunitypolloptionResource < 3) { | |
1312 o.description = "foo"; | |
1313 o.image = buildOrkutCommunitypolloptionResourceImage(); | |
1314 o.numberOfVotes = 42; | |
1315 o.optionId = 42; | |
1316 } | |
1317 buildCounterOrkutCommunitypolloptionResource--; | |
1318 return o; | |
1319 } | |
1320 | |
1321 checkOrkutCommunitypolloptionResource(api.OrkutCommunitypolloptionResource o) { | |
1322 buildCounterOrkutCommunitypolloptionResource++; | |
1323 if (buildCounterOrkutCommunitypolloptionResource < 3) { | |
1324 unittest.expect(o.description, unittest.equals('foo')); | |
1325 checkOrkutCommunitypolloptionResourceImage(o.image); | |
1326 unittest.expect(o.numberOfVotes, unittest.equals(42)); | |
1327 unittest.expect(o.optionId, unittest.equals(42)); | |
1328 } | |
1329 buildCounterOrkutCommunitypolloptionResource--; | |
1330 } | |
1331 | |
1332 core.int buildCounterOrkutCounterResource = 0; | |
1333 buildOrkutCounterResource() { | |
1334 var o = new api.OrkutCounterResource(); | |
1335 buildCounterOrkutCounterResource++; | |
1336 if (buildCounterOrkutCounterResource < 3) { | |
1337 o.link = buildOrkutLinkResource(); | |
1338 o.name = "foo"; | |
1339 o.total = 42; | |
1340 } | |
1341 buildCounterOrkutCounterResource--; | |
1342 return o; | |
1343 } | |
1344 | |
1345 checkOrkutCounterResource(api.OrkutCounterResource o) { | |
1346 buildCounterOrkutCounterResource++; | |
1347 if (buildCounterOrkutCounterResource < 3) { | |
1348 checkOrkutLinkResource(o.link); | |
1349 unittest.expect(o.name, unittest.equals('foo')); | |
1350 unittest.expect(o.total, unittest.equals(42)); | |
1351 } | |
1352 buildCounterOrkutCounterResource--; | |
1353 } | |
1354 | |
1355 core.int buildCounterOrkutLinkResource = 0; | |
1356 buildOrkutLinkResource() { | |
1357 var o = new api.OrkutLinkResource(); | |
1358 buildCounterOrkutLinkResource++; | |
1359 if (buildCounterOrkutLinkResource < 3) { | |
1360 o.href = "foo"; | |
1361 o.rel = "foo"; | |
1362 o.title = "foo"; | |
1363 o.type = "foo"; | |
1364 } | |
1365 buildCounterOrkutLinkResource--; | |
1366 return o; | |
1367 } | |
1368 | |
1369 checkOrkutLinkResource(api.OrkutLinkResource o) { | |
1370 buildCounterOrkutLinkResource++; | |
1371 if (buildCounterOrkutLinkResource < 3) { | |
1372 unittest.expect(o.href, unittest.equals('foo')); | |
1373 unittest.expect(o.rel, unittest.equals('foo')); | |
1374 unittest.expect(o.title, unittest.equals('foo')); | |
1375 unittest.expect(o.type, unittest.equals('foo')); | |
1376 } | |
1377 buildCounterOrkutLinkResource--; | |
1378 } | |
1379 | |
1380 buildUnnamed207() { | |
1381 var o = new core.List<api.OrkutLinkResource>(); | |
1382 o.add(buildOrkutLinkResource()); | |
1383 o.add(buildOrkutLinkResource()); | |
1384 return o; | |
1385 } | |
1386 | |
1387 checkUnnamed207(core.List<api.OrkutLinkResource> o) { | |
1388 unittest.expect(o, unittest.hasLength(2)); | |
1389 checkOrkutLinkResource(o[0]); | |
1390 checkOrkutLinkResource(o[1]); | |
1391 } | |
1392 | |
1393 core.int buildCounterVisibility = 0; | |
1394 buildVisibility() { | |
1395 var o = new api.Visibility(); | |
1396 buildCounterVisibility++; | |
1397 if (buildCounterVisibility < 3) { | |
1398 o.kind = "foo"; | |
1399 o.links = buildUnnamed207(); | |
1400 o.visibility = "foo"; | |
1401 } | |
1402 buildCounterVisibility--; | |
1403 return o; | |
1404 } | |
1405 | |
1406 checkVisibility(api.Visibility o) { | |
1407 buildCounterVisibility++; | |
1408 if (buildCounterVisibility < 3) { | |
1409 unittest.expect(o.kind, unittest.equals('foo')); | |
1410 checkUnnamed207(o.links); | |
1411 unittest.expect(o.visibility, unittest.equals('foo')); | |
1412 } | |
1413 buildCounterVisibility--; | |
1414 } | |
1415 | |
1416 | |
1417 main() { | |
1418 unittest.group("obj-schema-AclItems", () { | |
1419 unittest.test("to-json--from-json", () { | |
1420 var o = buildAclItems(); | |
1421 var od = new api.AclItems.fromJson(o.toJson()); | |
1422 checkAclItems(od); | |
1423 }); | |
1424 }); | |
1425 | |
1426 | |
1427 unittest.group("obj-schema-Acl", () { | |
1428 unittest.test("to-json--from-json", () { | |
1429 var o = buildAcl(); | |
1430 var od = new api.Acl.fromJson(o.toJson()); | |
1431 checkAcl(od); | |
1432 }); | |
1433 }); | |
1434 | |
1435 | |
1436 unittest.group("obj-schema-ActivityObjectReplies", () { | |
1437 unittest.test("to-json--from-json", () { | |
1438 var o = buildActivityObjectReplies(); | |
1439 var od = new api.ActivityObjectReplies.fromJson(o.toJson()); | |
1440 checkActivityObjectReplies(od); | |
1441 }); | |
1442 }); | |
1443 | |
1444 | |
1445 unittest.group("obj-schema-ActivityObject", () { | |
1446 unittest.test("to-json--from-json", () { | |
1447 var o = buildActivityObject(); | |
1448 var od = new api.ActivityObject.fromJson(o.toJson()); | |
1449 checkActivityObject(od); | |
1450 }); | |
1451 }); | |
1452 | |
1453 | |
1454 unittest.group("obj-schema-Activity", () { | |
1455 unittest.test("to-json--from-json", () { | |
1456 var o = buildActivity(); | |
1457 var od = new api.Activity.fromJson(o.toJson()); | |
1458 checkActivity(od); | |
1459 }); | |
1460 }); | |
1461 | |
1462 | |
1463 unittest.group("obj-schema-ActivityList", () { | |
1464 unittest.test("to-json--from-json", () { | |
1465 var o = buildActivityList(); | |
1466 var od = new api.ActivityList.fromJson(o.toJson()); | |
1467 checkActivityList(od); | |
1468 }); | |
1469 }); | |
1470 | |
1471 | |
1472 unittest.group("obj-schema-Badge", () { | |
1473 unittest.test("to-json--from-json", () { | |
1474 var o = buildBadge(); | |
1475 var od = new api.Badge.fromJson(o.toJson()); | |
1476 checkBadge(od); | |
1477 }); | |
1478 }); | |
1479 | |
1480 | |
1481 unittest.group("obj-schema-BadgeList", () { | |
1482 unittest.test("to-json--from-json", () { | |
1483 var o = buildBadgeList(); | |
1484 var od = new api.BadgeList.fromJson(o.toJson()); | |
1485 checkBadgeList(od); | |
1486 }); | |
1487 }); | |
1488 | |
1489 | |
1490 unittest.group("obj-schema-CommentInReplyTo", () { | |
1491 unittest.test("to-json--from-json", () { | |
1492 var o = buildCommentInReplyTo(); | |
1493 var od = new api.CommentInReplyTo.fromJson(o.toJson()); | |
1494 checkCommentInReplyTo(od); | |
1495 }); | |
1496 }); | |
1497 | |
1498 | |
1499 unittest.group("obj-schema-Comment", () { | |
1500 unittest.test("to-json--from-json", () { | |
1501 var o = buildComment(); | |
1502 var od = new api.Comment.fromJson(o.toJson()); | |
1503 checkComment(od); | |
1504 }); | |
1505 }); | |
1506 | |
1507 | |
1508 unittest.group("obj-schema-CommentList", () { | |
1509 unittest.test("to-json--from-json", () { | |
1510 var o = buildCommentList(); | |
1511 var od = new api.CommentList.fromJson(o.toJson()); | |
1512 checkCommentList(od); | |
1513 }); | |
1514 }); | |
1515 | |
1516 | |
1517 unittest.group("obj-schema-Community", () { | |
1518 unittest.test("to-json--from-json", () { | |
1519 var o = buildCommunity(); | |
1520 var od = new api.Community.fromJson(o.toJson()); | |
1521 checkCommunity(od); | |
1522 }); | |
1523 }); | |
1524 | |
1525 | |
1526 unittest.group("obj-schema-CommunityList", () { | |
1527 unittest.test("to-json--from-json", () { | |
1528 var o = buildCommunityList(); | |
1529 var od = new api.CommunityList.fromJson(o.toJson()); | |
1530 checkCommunityList(od); | |
1531 }); | |
1532 }); | |
1533 | |
1534 | |
1535 unittest.group("obj-schema-CommunityMembers", () { | |
1536 unittest.test("to-json--from-json", () { | |
1537 var o = buildCommunityMembers(); | |
1538 var od = new api.CommunityMembers.fromJson(o.toJson()); | |
1539 checkCommunityMembers(od); | |
1540 }); | |
1541 }); | |
1542 | |
1543 | |
1544 unittest.group("obj-schema-CommunityMembersList", () { | |
1545 unittest.test("to-json--from-json", () { | |
1546 var o = buildCommunityMembersList(); | |
1547 var od = new api.CommunityMembersList.fromJson(o.toJson()); | |
1548 checkCommunityMembersList(od); | |
1549 }); | |
1550 }); | |
1551 | |
1552 | |
1553 unittest.group("obj-schema-CommunityMembershipStatus", () { | |
1554 unittest.test("to-json--from-json", () { | |
1555 var o = buildCommunityMembershipStatus(); | |
1556 var od = new api.CommunityMembershipStatus.fromJson(o.toJson()); | |
1557 checkCommunityMembershipStatus(od); | |
1558 }); | |
1559 }); | |
1560 | |
1561 | |
1562 unittest.group("obj-schema-CommunityMessage", () { | |
1563 unittest.test("to-json--from-json", () { | |
1564 var o = buildCommunityMessage(); | |
1565 var od = new api.CommunityMessage.fromJson(o.toJson()); | |
1566 checkCommunityMessage(od); | |
1567 }); | |
1568 }); | |
1569 | |
1570 | |
1571 unittest.group("obj-schema-CommunityMessageList", () { | |
1572 unittest.test("to-json--from-json", () { | |
1573 var o = buildCommunityMessageList(); | |
1574 var od = new api.CommunityMessageList.fromJson(o.toJson()); | |
1575 checkCommunityMessageList(od); | |
1576 }); | |
1577 }); | |
1578 | |
1579 | |
1580 unittest.group("obj-schema-CommunityPollImage", () { | |
1581 unittest.test("to-json--from-json", () { | |
1582 var o = buildCommunityPollImage(); | |
1583 var od = new api.CommunityPollImage.fromJson(o.toJson()); | |
1584 checkCommunityPollImage(od); | |
1585 }); | |
1586 }); | |
1587 | |
1588 | |
1589 unittest.group("obj-schema-CommunityPoll", () { | |
1590 unittest.test("to-json--from-json", () { | |
1591 var o = buildCommunityPoll(); | |
1592 var od = new api.CommunityPoll.fromJson(o.toJson()); | |
1593 checkCommunityPoll(od); | |
1594 }); | |
1595 }); | |
1596 | |
1597 | |
1598 unittest.group("obj-schema-CommunityPollComment", () { | |
1599 unittest.test("to-json--from-json", () { | |
1600 var o = buildCommunityPollComment(); | |
1601 var od = new api.CommunityPollComment.fromJson(o.toJson()); | |
1602 checkCommunityPollComment(od); | |
1603 }); | |
1604 }); | |
1605 | |
1606 | |
1607 unittest.group("obj-schema-CommunityPollCommentList", () { | |
1608 unittest.test("to-json--from-json", () { | |
1609 var o = buildCommunityPollCommentList(); | |
1610 var od = new api.CommunityPollCommentList.fromJson(o.toJson()); | |
1611 checkCommunityPollCommentList(od); | |
1612 }); | |
1613 }); | |
1614 | |
1615 | |
1616 unittest.group("obj-schema-CommunityPollList", () { | |
1617 unittest.test("to-json--from-json", () { | |
1618 var o = buildCommunityPollList(); | |
1619 var od = new api.CommunityPollList.fromJson(o.toJson()); | |
1620 checkCommunityPollList(od); | |
1621 }); | |
1622 }); | |
1623 | |
1624 | |
1625 unittest.group("obj-schema-CommunityPollVote", () { | |
1626 unittest.test("to-json--from-json", () { | |
1627 var o = buildCommunityPollVote(); | |
1628 var od = new api.CommunityPollVote.fromJson(o.toJson()); | |
1629 checkCommunityPollVote(od); | |
1630 }); | |
1631 }); | |
1632 | |
1633 | |
1634 unittest.group("obj-schema-CommunityTopic", () { | |
1635 unittest.test("to-json--from-json", () { | |
1636 var o = buildCommunityTopic(); | |
1637 var od = new api.CommunityTopic.fromJson(o.toJson()); | |
1638 checkCommunityTopic(od); | |
1639 }); | |
1640 }); | |
1641 | |
1642 | |
1643 unittest.group("obj-schema-CommunityTopicList", () { | |
1644 unittest.test("to-json--from-json", () { | |
1645 var o = buildCommunityTopicList(); | |
1646 var od = new api.CommunityTopicList.fromJson(o.toJson()); | |
1647 checkCommunityTopicList(od); | |
1648 }); | |
1649 }); | |
1650 | |
1651 | |
1652 unittest.group("obj-schema-Counters", () { | |
1653 unittest.test("to-json--from-json", () { | |
1654 var o = buildCounters(); | |
1655 var od = new api.Counters.fromJson(o.toJson()); | |
1656 checkCounters(od); | |
1657 }); | |
1658 }); | |
1659 | |
1660 | |
1661 unittest.group("obj-schema-OrkutActivityobjectsResource", () { | |
1662 unittest.test("to-json--from-json", () { | |
1663 var o = buildOrkutActivityobjectsResource(); | |
1664 var od = new api.OrkutActivityobjectsResource.fromJson(o.toJson()); | |
1665 checkOrkutActivityobjectsResource(od); | |
1666 }); | |
1667 }); | |
1668 | |
1669 | |
1670 unittest.group("obj-schema-OrkutActivitypersonResourceImage", () { | |
1671 unittest.test("to-json--from-json", () { | |
1672 var o = buildOrkutActivitypersonResourceImage(); | |
1673 var od = new api.OrkutActivitypersonResourceImage.fromJson(o.toJson()); | |
1674 checkOrkutActivitypersonResourceImage(od); | |
1675 }); | |
1676 }); | |
1677 | |
1678 | |
1679 unittest.group("obj-schema-OrkutActivitypersonResourceName", () { | |
1680 unittest.test("to-json--from-json", () { | |
1681 var o = buildOrkutActivitypersonResourceName(); | |
1682 var od = new api.OrkutActivitypersonResourceName.fromJson(o.toJson()); | |
1683 checkOrkutActivitypersonResourceName(od); | |
1684 }); | |
1685 }); | |
1686 | |
1687 | |
1688 unittest.group("obj-schema-OrkutActivitypersonResource", () { | |
1689 unittest.test("to-json--from-json", () { | |
1690 var o = buildOrkutActivitypersonResource(); | |
1691 var od = new api.OrkutActivitypersonResource.fromJson(o.toJson()); | |
1692 checkOrkutActivitypersonResource(od); | |
1693 }); | |
1694 }); | |
1695 | |
1696 | |
1697 unittest.group("obj-schema-OrkutAuthorResourceImage", () { | |
1698 unittest.test("to-json--from-json", () { | |
1699 var o = buildOrkutAuthorResourceImage(); | |
1700 var od = new api.OrkutAuthorResourceImage.fromJson(o.toJson()); | |
1701 checkOrkutAuthorResourceImage(od); | |
1702 }); | |
1703 }); | |
1704 | |
1705 | |
1706 unittest.group("obj-schema-OrkutAuthorResource", () { | |
1707 unittest.test("to-json--from-json", () { | |
1708 var o = buildOrkutAuthorResource(); | |
1709 var od = new api.OrkutAuthorResource.fromJson(o.toJson()); | |
1710 checkOrkutAuthorResource(od); | |
1711 }); | |
1712 }); | |
1713 | |
1714 | |
1715 unittest.group("obj-schema-OrkutCommunitypolloptionResourceImage", () { | |
1716 unittest.test("to-json--from-json", () { | |
1717 var o = buildOrkutCommunitypolloptionResourceImage(); | |
1718 var od = new api.OrkutCommunitypolloptionResourceImage.fromJson(o.toJson()
); | |
1719 checkOrkutCommunitypolloptionResourceImage(od); | |
1720 }); | |
1721 }); | |
1722 | |
1723 | |
1724 unittest.group("obj-schema-OrkutCommunitypolloptionResource", () { | |
1725 unittest.test("to-json--from-json", () { | |
1726 var o = buildOrkutCommunitypolloptionResource(); | |
1727 var od = new api.OrkutCommunitypolloptionResource.fromJson(o.toJson()); | |
1728 checkOrkutCommunitypolloptionResource(od); | |
1729 }); | |
1730 }); | |
1731 | |
1732 | |
1733 unittest.group("obj-schema-OrkutCounterResource", () { | |
1734 unittest.test("to-json--from-json", () { | |
1735 var o = buildOrkutCounterResource(); | |
1736 var od = new api.OrkutCounterResource.fromJson(o.toJson()); | |
1737 checkOrkutCounterResource(od); | |
1738 }); | |
1739 }); | |
1740 | |
1741 | |
1742 unittest.group("obj-schema-OrkutLinkResource", () { | |
1743 unittest.test("to-json--from-json", () { | |
1744 var o = buildOrkutLinkResource(); | |
1745 var od = new api.OrkutLinkResource.fromJson(o.toJson()); | |
1746 checkOrkutLinkResource(od); | |
1747 }); | |
1748 }); | |
1749 | |
1750 | |
1751 unittest.group("obj-schema-Visibility", () { | |
1752 unittest.test("to-json--from-json", () { | |
1753 var o = buildVisibility(); | |
1754 var od = new api.Visibility.fromJson(o.toJson()); | |
1755 checkVisibility(od); | |
1756 }); | |
1757 }); | |
1758 | |
1759 | |
1760 unittest.group("resource-AclResourceApi", () { | |
1761 unittest.test("method--delete", () { | |
1762 | |
1763 var mock = new common_test.HttpServerMock(); | |
1764 api.AclResourceApi res = new api.OrkutApi(mock).acl; | |
1765 var arg_activityId = "foo"; | |
1766 var arg_userId = "foo"; | |
1767 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1768 var path = (req.url).path; | |
1769 var pathOffset = 0; | |
1770 var index; | |
1771 var subPart; | |
1772 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1773 pathOffset += 1; | |
1774 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
1775 pathOffset += 9; | |
1776 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
1777 pathOffset += 11; | |
1778 index = path.indexOf("/acl/", pathOffset); | |
1779 unittest.expect(index >= 0, unittest.isTrue); | |
1780 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1781 pathOffset = index; | |
1782 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
1783 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("/acl/")); | |
1784 pathOffset += 5; | |
1785 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1786 pathOffset = path.length; | |
1787 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
1788 | |
1789 var query = (req.url).query; | |
1790 var queryOffset = 0; | |
1791 var queryMap = {}; | |
1792 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1793 parseBool(n) { | |
1794 if (n == "true") return true; | |
1795 if (n == "false") return false; | |
1796 if (n == null) return null; | |
1797 throw new core.ArgumentError("Invalid boolean: $n"); | |
1798 } | |
1799 if (query.length > 0) { | |
1800 for (var part in query.split("&")) { | |
1801 var keyvalue = part.split("="); | |
1802 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1803 } | |
1804 } | |
1805 | |
1806 | |
1807 var h = { | |
1808 "content-type" : "application/json; charset=utf-8", | |
1809 }; | |
1810 var resp = ""; | |
1811 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1812 }), true); | |
1813 res.delete(arg_activityId, arg_userId).then(unittest.expectAsync((_) {})); | |
1814 }); | |
1815 | |
1816 }); | |
1817 | |
1818 | |
1819 unittest.group("resource-ActivitiesResourceApi", () { | |
1820 unittest.test("method--delete", () { | |
1821 | |
1822 var mock = new common_test.HttpServerMock(); | |
1823 api.ActivitiesResourceApi res = new api.OrkutApi(mock).activities; | |
1824 var arg_activityId = "foo"; | |
1825 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1826 var path = (req.url).path; | |
1827 var pathOffset = 0; | |
1828 var index; | |
1829 var subPart; | |
1830 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1831 pathOffset += 1; | |
1832 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
1833 pathOffset += 9; | |
1834 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
1835 pathOffset += 11; | |
1836 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1837 pathOffset = path.length; | |
1838 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
1839 | |
1840 var query = (req.url).query; | |
1841 var queryOffset = 0; | |
1842 var queryMap = {}; | |
1843 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1844 parseBool(n) { | |
1845 if (n == "true") return true; | |
1846 if (n == "false") return false; | |
1847 if (n == null) return null; | |
1848 throw new core.ArgumentError("Invalid boolean: $n"); | |
1849 } | |
1850 if (query.length > 0) { | |
1851 for (var part in query.split("&")) { | |
1852 var keyvalue = part.split("="); | |
1853 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1854 } | |
1855 } | |
1856 | |
1857 | |
1858 var h = { | |
1859 "content-type" : "application/json; charset=utf-8", | |
1860 }; | |
1861 var resp = ""; | |
1862 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1863 }), true); | |
1864 res.delete(arg_activityId).then(unittest.expectAsync((_) {})); | |
1865 }); | |
1866 | |
1867 unittest.test("method--list", () { | |
1868 | |
1869 var mock = new common_test.HttpServerMock(); | |
1870 api.ActivitiesResourceApi res = new api.OrkutApi(mock).activities; | |
1871 var arg_userId = "foo"; | |
1872 var arg_collection = "foo"; | |
1873 var arg_hl = "foo"; | |
1874 var arg_maxResults = 42; | |
1875 var arg_pageToken = "foo"; | |
1876 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1877 var path = (req.url).path; | |
1878 var pathOffset = 0; | |
1879 var index; | |
1880 var subPart; | |
1881 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1882 pathOffset += 1; | |
1883 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
1884 pathOffset += 9; | |
1885 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("people/")); | |
1886 pathOffset += 7; | |
1887 index = path.indexOf("/activities/", pathOffset); | |
1888 unittest.expect(index >= 0, unittest.isTrue); | |
1889 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1890 pathOffset = index; | |
1891 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
1892 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/activities/")); | |
1893 pathOffset += 12; | |
1894 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1895 pathOffset = path.length; | |
1896 unittest.expect(subPart, unittest.equals("$arg_collection")); | |
1897 | |
1898 var query = (req.url).query; | |
1899 var queryOffset = 0; | |
1900 var queryMap = {}; | |
1901 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1902 parseBool(n) { | |
1903 if (n == "true") return true; | |
1904 if (n == "false") return false; | |
1905 if (n == null) return null; | |
1906 throw new core.ArgumentError("Invalid boolean: $n"); | |
1907 } | |
1908 if (query.length > 0) { | |
1909 for (var part in query.split("&")) { | |
1910 var keyvalue = part.split("="); | |
1911 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1912 } | |
1913 } | |
1914 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
1915 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1916 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1917 | |
1918 | |
1919 var h = { | |
1920 "content-type" : "application/json; charset=utf-8", | |
1921 }; | |
1922 var resp = convert.JSON.encode(buildActivityList()); | |
1923 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1924 }), true); | |
1925 res.list(arg_userId, arg_collection, hl: arg_hl, maxResults: arg_maxResult
s, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ActivityList respon
se) { | |
1926 checkActivityList(response); | |
1927 }))); | |
1928 }); | |
1929 | |
1930 }); | |
1931 | |
1932 | |
1933 unittest.group("resource-ActivityVisibilityResourceApi", () { | |
1934 unittest.test("method--get", () { | |
1935 | |
1936 var mock = new common_test.HttpServerMock(); | |
1937 api.ActivityVisibilityResourceApi res = new api.OrkutApi(mock).activityVis
ibility; | |
1938 var arg_activityId = "foo"; | |
1939 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1940 var path = (req.url).path; | |
1941 var pathOffset = 0; | |
1942 var index; | |
1943 var subPart; | |
1944 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1945 pathOffset += 1; | |
1946 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
1947 pathOffset += 9; | |
1948 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
1949 pathOffset += 11; | |
1950 index = path.indexOf("/visibility", pathOffset); | |
1951 unittest.expect(index >= 0, unittest.isTrue); | |
1952 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1953 pathOffset = index; | |
1954 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
1955 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/visibility")); | |
1956 pathOffset += 11; | |
1957 | |
1958 var query = (req.url).query; | |
1959 var queryOffset = 0; | |
1960 var queryMap = {}; | |
1961 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1962 parseBool(n) { | |
1963 if (n == "true") return true; | |
1964 if (n == "false") return false; | |
1965 if (n == null) return null; | |
1966 throw new core.ArgumentError("Invalid boolean: $n"); | |
1967 } | |
1968 if (query.length > 0) { | |
1969 for (var part in query.split("&")) { | |
1970 var keyvalue = part.split("="); | |
1971 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1972 } | |
1973 } | |
1974 | |
1975 | |
1976 var h = { | |
1977 "content-type" : "application/json; charset=utf-8", | |
1978 }; | |
1979 var resp = convert.JSON.encode(buildVisibility()); | |
1980 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1981 }), true); | |
1982 res.get(arg_activityId).then(unittest.expectAsync(((api.Visibility respons
e) { | |
1983 checkVisibility(response); | |
1984 }))); | |
1985 }); | |
1986 | |
1987 unittest.test("method--patch", () { | |
1988 | |
1989 var mock = new common_test.HttpServerMock(); | |
1990 api.ActivityVisibilityResourceApi res = new api.OrkutApi(mock).activityVis
ibility; | |
1991 var arg_request = buildVisibility(); | |
1992 var arg_activityId = "foo"; | |
1993 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1994 var obj = new api.Visibility.fromJson(json); | |
1995 checkVisibility(obj); | |
1996 | |
1997 var path = (req.url).path; | |
1998 var pathOffset = 0; | |
1999 var index; | |
2000 var subPart; | |
2001 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2002 pathOffset += 1; | |
2003 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2004 pathOffset += 9; | |
2005 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
2006 pathOffset += 11; | |
2007 index = path.indexOf("/visibility", pathOffset); | |
2008 unittest.expect(index >= 0, unittest.isTrue); | |
2009 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2010 pathOffset = index; | |
2011 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
2012 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/visibility")); | |
2013 pathOffset += 11; | |
2014 | |
2015 var query = (req.url).query; | |
2016 var queryOffset = 0; | |
2017 var queryMap = {}; | |
2018 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2019 parseBool(n) { | |
2020 if (n == "true") return true; | |
2021 if (n == "false") return false; | |
2022 if (n == null) return null; | |
2023 throw new core.ArgumentError("Invalid boolean: $n"); | |
2024 } | |
2025 if (query.length > 0) { | |
2026 for (var part in query.split("&")) { | |
2027 var keyvalue = part.split("="); | |
2028 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2029 } | |
2030 } | |
2031 | |
2032 | |
2033 var h = { | |
2034 "content-type" : "application/json; charset=utf-8", | |
2035 }; | |
2036 var resp = convert.JSON.encode(buildVisibility()); | |
2037 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2038 }), true); | |
2039 res.patch(arg_request, arg_activityId).then(unittest.expectAsync(((api.Vis
ibility response) { | |
2040 checkVisibility(response); | |
2041 }))); | |
2042 }); | |
2043 | |
2044 unittest.test("method--update", () { | |
2045 | |
2046 var mock = new common_test.HttpServerMock(); | |
2047 api.ActivityVisibilityResourceApi res = new api.OrkutApi(mock).activityVis
ibility; | |
2048 var arg_request = buildVisibility(); | |
2049 var arg_activityId = "foo"; | |
2050 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2051 var obj = new api.Visibility.fromJson(json); | |
2052 checkVisibility(obj); | |
2053 | |
2054 var path = (req.url).path; | |
2055 var pathOffset = 0; | |
2056 var index; | |
2057 var subPart; | |
2058 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2059 pathOffset += 1; | |
2060 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2061 pathOffset += 9; | |
2062 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
2063 pathOffset += 11; | |
2064 index = path.indexOf("/visibility", pathOffset); | |
2065 unittest.expect(index >= 0, unittest.isTrue); | |
2066 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2067 pathOffset = index; | |
2068 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
2069 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/visibility")); | |
2070 pathOffset += 11; | |
2071 | |
2072 var query = (req.url).query; | |
2073 var queryOffset = 0; | |
2074 var queryMap = {}; | |
2075 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2076 parseBool(n) { | |
2077 if (n == "true") return true; | |
2078 if (n == "false") return false; | |
2079 if (n == null) return null; | |
2080 throw new core.ArgumentError("Invalid boolean: $n"); | |
2081 } | |
2082 if (query.length > 0) { | |
2083 for (var part in query.split("&")) { | |
2084 var keyvalue = part.split("="); | |
2085 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2086 } | |
2087 } | |
2088 | |
2089 | |
2090 var h = { | |
2091 "content-type" : "application/json; charset=utf-8", | |
2092 }; | |
2093 var resp = convert.JSON.encode(buildVisibility()); | |
2094 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2095 }), true); | |
2096 res.update(arg_request, arg_activityId).then(unittest.expectAsync(((api.Vi
sibility response) { | |
2097 checkVisibility(response); | |
2098 }))); | |
2099 }); | |
2100 | |
2101 }); | |
2102 | |
2103 | |
2104 unittest.group("resource-BadgesResourceApi", () { | |
2105 unittest.test("method--get", () { | |
2106 | |
2107 var mock = new common_test.HttpServerMock(); | |
2108 api.BadgesResourceApi res = new api.OrkutApi(mock).badges; | |
2109 var arg_userId = "foo"; | |
2110 var arg_badgeId = "foo"; | |
2111 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2112 var path = (req.url).path; | |
2113 var pathOffset = 0; | |
2114 var index; | |
2115 var subPart; | |
2116 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2117 pathOffset += 1; | |
2118 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2119 pathOffset += 9; | |
2120 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("people/")); | |
2121 pathOffset += 7; | |
2122 index = path.indexOf("/badges/", pathOffset); | |
2123 unittest.expect(index >= 0, unittest.isTrue); | |
2124 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2125 pathOffset = index; | |
2126 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2127 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/badges/")); | |
2128 pathOffset += 8; | |
2129 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2130 pathOffset = path.length; | |
2131 unittest.expect(subPart, unittest.equals("$arg_badgeId")); | |
2132 | |
2133 var query = (req.url).query; | |
2134 var queryOffset = 0; | |
2135 var queryMap = {}; | |
2136 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2137 parseBool(n) { | |
2138 if (n == "true") return true; | |
2139 if (n == "false") return false; | |
2140 if (n == null) return null; | |
2141 throw new core.ArgumentError("Invalid boolean: $n"); | |
2142 } | |
2143 if (query.length > 0) { | |
2144 for (var part in query.split("&")) { | |
2145 var keyvalue = part.split("="); | |
2146 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2147 } | |
2148 } | |
2149 | |
2150 | |
2151 var h = { | |
2152 "content-type" : "application/json; charset=utf-8", | |
2153 }; | |
2154 var resp = convert.JSON.encode(buildBadge()); | |
2155 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2156 }), true); | |
2157 res.get(arg_userId, arg_badgeId).then(unittest.expectAsync(((api.Badge res
ponse) { | |
2158 checkBadge(response); | |
2159 }))); | |
2160 }); | |
2161 | |
2162 unittest.test("method--list", () { | |
2163 | |
2164 var mock = new common_test.HttpServerMock(); | |
2165 api.BadgesResourceApi res = new api.OrkutApi(mock).badges; | |
2166 var arg_userId = "foo"; | |
2167 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2168 var path = (req.url).path; | |
2169 var pathOffset = 0; | |
2170 var index; | |
2171 var subPart; | |
2172 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2173 pathOffset += 1; | |
2174 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2175 pathOffset += 9; | |
2176 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("people/")); | |
2177 pathOffset += 7; | |
2178 index = path.indexOf("/badges", pathOffset); | |
2179 unittest.expect(index >= 0, unittest.isTrue); | |
2180 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2181 pathOffset = index; | |
2182 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2183 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/badges")); | |
2184 pathOffset += 7; | |
2185 | |
2186 var query = (req.url).query; | |
2187 var queryOffset = 0; | |
2188 var queryMap = {}; | |
2189 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2190 parseBool(n) { | |
2191 if (n == "true") return true; | |
2192 if (n == "false") return false; | |
2193 if (n == null) return null; | |
2194 throw new core.ArgumentError("Invalid boolean: $n"); | |
2195 } | |
2196 if (query.length > 0) { | |
2197 for (var part in query.split("&")) { | |
2198 var keyvalue = part.split("="); | |
2199 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2200 } | |
2201 } | |
2202 | |
2203 | |
2204 var h = { | |
2205 "content-type" : "application/json; charset=utf-8", | |
2206 }; | |
2207 var resp = convert.JSON.encode(buildBadgeList()); | |
2208 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2209 }), true); | |
2210 res.list(arg_userId).then(unittest.expectAsync(((api.BadgeList response) { | |
2211 checkBadgeList(response); | |
2212 }))); | |
2213 }); | |
2214 | |
2215 }); | |
2216 | |
2217 | |
2218 unittest.group("resource-CommentsResourceApi", () { | |
2219 unittest.test("method--delete", () { | |
2220 | |
2221 var mock = new common_test.HttpServerMock(); | |
2222 api.CommentsResourceApi res = new api.OrkutApi(mock).comments; | |
2223 var arg_commentId = "foo"; | |
2224 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2225 var path = (req.url).path; | |
2226 var pathOffset = 0; | |
2227 var index; | |
2228 var subPart; | |
2229 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2230 pathOffset += 1; | |
2231 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2232 pathOffset += 9; | |
2233 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("comments/")); | |
2234 pathOffset += 9; | |
2235 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2236 pathOffset = path.length; | |
2237 unittest.expect(subPart, unittest.equals("$arg_commentId")); | |
2238 | |
2239 var query = (req.url).query; | |
2240 var queryOffset = 0; | |
2241 var queryMap = {}; | |
2242 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2243 parseBool(n) { | |
2244 if (n == "true") return true; | |
2245 if (n == "false") return false; | |
2246 if (n == null) return null; | |
2247 throw new core.ArgumentError("Invalid boolean: $n"); | |
2248 } | |
2249 if (query.length > 0) { | |
2250 for (var part in query.split("&")) { | |
2251 var keyvalue = part.split("="); | |
2252 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2253 } | |
2254 } | |
2255 | |
2256 | |
2257 var h = { | |
2258 "content-type" : "application/json; charset=utf-8", | |
2259 }; | |
2260 var resp = ""; | |
2261 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2262 }), true); | |
2263 res.delete(arg_commentId).then(unittest.expectAsync((_) {})); | |
2264 }); | |
2265 | |
2266 unittest.test("method--get", () { | |
2267 | |
2268 var mock = new common_test.HttpServerMock(); | |
2269 api.CommentsResourceApi res = new api.OrkutApi(mock).comments; | |
2270 var arg_commentId = "foo"; | |
2271 var arg_hl = "foo"; | |
2272 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2273 var path = (req.url).path; | |
2274 var pathOffset = 0; | |
2275 var index; | |
2276 var subPart; | |
2277 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2278 pathOffset += 1; | |
2279 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2280 pathOffset += 9; | |
2281 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("comments/")); | |
2282 pathOffset += 9; | |
2283 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2284 pathOffset = path.length; | |
2285 unittest.expect(subPart, unittest.equals("$arg_commentId")); | |
2286 | |
2287 var query = (req.url).query; | |
2288 var queryOffset = 0; | |
2289 var queryMap = {}; | |
2290 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2291 parseBool(n) { | |
2292 if (n == "true") return true; | |
2293 if (n == "false") return false; | |
2294 if (n == null) return null; | |
2295 throw new core.ArgumentError("Invalid boolean: $n"); | |
2296 } | |
2297 if (query.length > 0) { | |
2298 for (var part in query.split("&")) { | |
2299 var keyvalue = part.split("="); | |
2300 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2301 } | |
2302 } | |
2303 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2304 | |
2305 | |
2306 var h = { | |
2307 "content-type" : "application/json; charset=utf-8", | |
2308 }; | |
2309 var resp = convert.JSON.encode(buildComment()); | |
2310 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2311 }), true); | |
2312 res.get(arg_commentId, hl: arg_hl).then(unittest.expectAsync(((api.Comment
response) { | |
2313 checkComment(response); | |
2314 }))); | |
2315 }); | |
2316 | |
2317 unittest.test("method--insert", () { | |
2318 | |
2319 var mock = new common_test.HttpServerMock(); | |
2320 api.CommentsResourceApi res = new api.OrkutApi(mock).comments; | |
2321 var arg_request = buildComment(); | |
2322 var arg_activityId = "foo"; | |
2323 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2324 var obj = new api.Comment.fromJson(json); | |
2325 checkComment(obj); | |
2326 | |
2327 var path = (req.url).path; | |
2328 var pathOffset = 0; | |
2329 var index; | |
2330 var subPart; | |
2331 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2332 pathOffset += 1; | |
2333 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2334 pathOffset += 9; | |
2335 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
2336 pathOffset += 11; | |
2337 index = path.indexOf("/comments", pathOffset); | |
2338 unittest.expect(index >= 0, unittest.isTrue); | |
2339 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2340 pathOffset = index; | |
2341 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
2342 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/comments")); | |
2343 pathOffset += 9; | |
2344 | |
2345 var query = (req.url).query; | |
2346 var queryOffset = 0; | |
2347 var queryMap = {}; | |
2348 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2349 parseBool(n) { | |
2350 if (n == "true") return true; | |
2351 if (n == "false") return false; | |
2352 if (n == null) return null; | |
2353 throw new core.ArgumentError("Invalid boolean: $n"); | |
2354 } | |
2355 if (query.length > 0) { | |
2356 for (var part in query.split("&")) { | |
2357 var keyvalue = part.split("="); | |
2358 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2359 } | |
2360 } | |
2361 | |
2362 | |
2363 var h = { | |
2364 "content-type" : "application/json; charset=utf-8", | |
2365 }; | |
2366 var resp = convert.JSON.encode(buildComment()); | |
2367 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2368 }), true); | |
2369 res.insert(arg_request, arg_activityId).then(unittest.expectAsync(((api.Co
mment response) { | |
2370 checkComment(response); | |
2371 }))); | |
2372 }); | |
2373 | |
2374 unittest.test("method--list", () { | |
2375 | |
2376 var mock = new common_test.HttpServerMock(); | |
2377 api.CommentsResourceApi res = new api.OrkutApi(mock).comments; | |
2378 var arg_activityId = "foo"; | |
2379 var arg_hl = "foo"; | |
2380 var arg_maxResults = 42; | |
2381 var arg_orderBy = "foo"; | |
2382 var arg_pageToken = "foo"; | |
2383 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2384 var path = (req.url).path; | |
2385 var pathOffset = 0; | |
2386 var index; | |
2387 var subPart; | |
2388 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2389 pathOffset += 1; | |
2390 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2391 pathOffset += 9; | |
2392 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("activities/")); | |
2393 pathOffset += 11; | |
2394 index = path.indexOf("/comments", pathOffset); | |
2395 unittest.expect(index >= 0, unittest.isTrue); | |
2396 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2397 pathOffset = index; | |
2398 unittest.expect(subPart, unittest.equals("$arg_activityId")); | |
2399 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/comments")); | |
2400 pathOffset += 9; | |
2401 | |
2402 var query = (req.url).query; | |
2403 var queryOffset = 0; | |
2404 var queryMap = {}; | |
2405 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2406 parseBool(n) { | |
2407 if (n == "true") return true; | |
2408 if (n == "false") return false; | |
2409 if (n == null) return null; | |
2410 throw new core.ArgumentError("Invalid boolean: $n"); | |
2411 } | |
2412 if (query.length > 0) { | |
2413 for (var part in query.split("&")) { | |
2414 var keyvalue = part.split("="); | |
2415 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2416 } | |
2417 } | |
2418 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2419 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
2420 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; | |
2421 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
2422 | |
2423 | |
2424 var h = { | |
2425 "content-type" : "application/json; charset=utf-8", | |
2426 }; | |
2427 var resp = convert.JSON.encode(buildCommentList()); | |
2428 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2429 }), true); | |
2430 res.list(arg_activityId, hl: arg_hl, maxResults: arg_maxResults, orderBy:
arg_orderBy, pageToken: arg_pageToken).then(unittest.expectAsync(((api.CommentLi
st response) { | |
2431 checkCommentList(response); | |
2432 }))); | |
2433 }); | |
2434 | |
2435 }); | |
2436 | |
2437 | |
2438 unittest.group("resource-CommunitiesResourceApi", () { | |
2439 unittest.test("method--get", () { | |
2440 | |
2441 var mock = new common_test.HttpServerMock(); | |
2442 api.CommunitiesResourceApi res = new api.OrkutApi(mock).communities; | |
2443 var arg_communityId = 42; | |
2444 var arg_hl = "foo"; | |
2445 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2446 var path = (req.url).path; | |
2447 var pathOffset = 0; | |
2448 var index; | |
2449 var subPart; | |
2450 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2451 pathOffset += 1; | |
2452 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2453 pathOffset += 9; | |
2454 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2455 pathOffset += 12; | |
2456 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2457 pathOffset = path.length; | |
2458 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2459 | |
2460 var query = (req.url).query; | |
2461 var queryOffset = 0; | |
2462 var queryMap = {}; | |
2463 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2464 parseBool(n) { | |
2465 if (n == "true") return true; | |
2466 if (n == "false") return false; | |
2467 if (n == null) return null; | |
2468 throw new core.ArgumentError("Invalid boolean: $n"); | |
2469 } | |
2470 if (query.length > 0) { | |
2471 for (var part in query.split("&")) { | |
2472 var keyvalue = part.split("="); | |
2473 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2474 } | |
2475 } | |
2476 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2477 | |
2478 | |
2479 var h = { | |
2480 "content-type" : "application/json; charset=utf-8", | |
2481 }; | |
2482 var resp = convert.JSON.encode(buildCommunity()); | |
2483 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2484 }), true); | |
2485 res.get(arg_communityId, hl: arg_hl).then(unittest.expectAsync(((api.Commu
nity response) { | |
2486 checkCommunity(response); | |
2487 }))); | |
2488 }); | |
2489 | |
2490 unittest.test("method--list", () { | |
2491 | |
2492 var mock = new common_test.HttpServerMock(); | |
2493 api.CommunitiesResourceApi res = new api.OrkutApi(mock).communities; | |
2494 var arg_userId = "foo"; | |
2495 var arg_hl = "foo"; | |
2496 var arg_maxResults = 42; | |
2497 var arg_orderBy = "foo"; | |
2498 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2499 var path = (req.url).path; | |
2500 var pathOffset = 0; | |
2501 var index; | |
2502 var subPart; | |
2503 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2504 pathOffset += 1; | |
2505 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2506 pathOffset += 9; | |
2507 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("people/")); | |
2508 pathOffset += 7; | |
2509 index = path.indexOf("/communities", pathOffset); | |
2510 unittest.expect(index >= 0, unittest.isTrue); | |
2511 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2512 pathOffset = index; | |
2513 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2514 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/communities")); | |
2515 pathOffset += 12; | |
2516 | |
2517 var query = (req.url).query; | |
2518 var queryOffset = 0; | |
2519 var queryMap = {}; | |
2520 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2521 parseBool(n) { | |
2522 if (n == "true") return true; | |
2523 if (n == "false") return false; | |
2524 if (n == null) return null; | |
2525 throw new core.ArgumentError("Invalid boolean: $n"); | |
2526 } | |
2527 if (query.length > 0) { | |
2528 for (var part in query.split("&")) { | |
2529 var keyvalue = part.split("="); | |
2530 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2531 } | |
2532 } | |
2533 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2534 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
2535 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; | |
2536 | |
2537 | |
2538 var h = { | |
2539 "content-type" : "application/json; charset=utf-8", | |
2540 }; | |
2541 var resp = convert.JSON.encode(buildCommunityList()); | |
2542 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2543 }), true); | |
2544 res.list(arg_userId, hl: arg_hl, maxResults: arg_maxResults, orderBy: arg_
orderBy).then(unittest.expectAsync(((api.CommunityList response) { | |
2545 checkCommunityList(response); | |
2546 }))); | |
2547 }); | |
2548 | |
2549 }); | |
2550 | |
2551 | |
2552 unittest.group("resource-CommunityFollowResourceApi", () { | |
2553 unittest.test("method--delete", () { | |
2554 | |
2555 var mock = new common_test.HttpServerMock(); | |
2556 api.CommunityFollowResourceApi res = new api.OrkutApi(mock).communityFollo
w; | |
2557 var arg_communityId = 42; | |
2558 var arg_userId = "foo"; | |
2559 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2560 var path = (req.url).path; | |
2561 var pathOffset = 0; | |
2562 var index; | |
2563 var subPart; | |
2564 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2565 pathOffset += 1; | |
2566 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2567 pathOffset += 9; | |
2568 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2569 pathOffset += 12; | |
2570 index = path.indexOf("/followers/", pathOffset); | |
2571 unittest.expect(index >= 0, unittest.isTrue); | |
2572 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2573 pathOffset = index; | |
2574 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2575 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/followers/")); | |
2576 pathOffset += 11; | |
2577 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2578 pathOffset = path.length; | |
2579 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2580 | |
2581 var query = (req.url).query; | |
2582 var queryOffset = 0; | |
2583 var queryMap = {}; | |
2584 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2585 parseBool(n) { | |
2586 if (n == "true") return true; | |
2587 if (n == "false") return false; | |
2588 if (n == null) return null; | |
2589 throw new core.ArgumentError("Invalid boolean: $n"); | |
2590 } | |
2591 if (query.length > 0) { | |
2592 for (var part in query.split("&")) { | |
2593 var keyvalue = part.split("="); | |
2594 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2595 } | |
2596 } | |
2597 | |
2598 | |
2599 var h = { | |
2600 "content-type" : "application/json; charset=utf-8", | |
2601 }; | |
2602 var resp = ""; | |
2603 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2604 }), true); | |
2605 res.delete(arg_communityId, arg_userId).then(unittest.expectAsync((_) {}))
; | |
2606 }); | |
2607 | |
2608 unittest.test("method--insert", () { | |
2609 | |
2610 var mock = new common_test.HttpServerMock(); | |
2611 api.CommunityFollowResourceApi res = new api.OrkutApi(mock).communityFollo
w; | |
2612 var arg_communityId = 42; | |
2613 var arg_userId = "foo"; | |
2614 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2615 var path = (req.url).path; | |
2616 var pathOffset = 0; | |
2617 var index; | |
2618 var subPart; | |
2619 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2620 pathOffset += 1; | |
2621 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2622 pathOffset += 9; | |
2623 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2624 pathOffset += 12; | |
2625 index = path.indexOf("/followers/", pathOffset); | |
2626 unittest.expect(index >= 0, unittest.isTrue); | |
2627 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2628 pathOffset = index; | |
2629 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2630 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/followers/")); | |
2631 pathOffset += 11; | |
2632 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2633 pathOffset = path.length; | |
2634 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2635 | |
2636 var query = (req.url).query; | |
2637 var queryOffset = 0; | |
2638 var queryMap = {}; | |
2639 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2640 parseBool(n) { | |
2641 if (n == "true") return true; | |
2642 if (n == "false") return false; | |
2643 if (n == null) return null; | |
2644 throw new core.ArgumentError("Invalid boolean: $n"); | |
2645 } | |
2646 if (query.length > 0) { | |
2647 for (var part in query.split("&")) { | |
2648 var keyvalue = part.split("="); | |
2649 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2650 } | |
2651 } | |
2652 | |
2653 | |
2654 var h = { | |
2655 "content-type" : "application/json; charset=utf-8", | |
2656 }; | |
2657 var resp = convert.JSON.encode(buildCommunityMembers()); | |
2658 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2659 }), true); | |
2660 res.insert(arg_communityId, arg_userId).then(unittest.expectAsync(((api.Co
mmunityMembers response) { | |
2661 checkCommunityMembers(response); | |
2662 }))); | |
2663 }); | |
2664 | |
2665 }); | |
2666 | |
2667 | |
2668 unittest.group("resource-CommunityMembersResourceApi", () { | |
2669 unittest.test("method--delete", () { | |
2670 | |
2671 var mock = new common_test.HttpServerMock(); | |
2672 api.CommunityMembersResourceApi res = new api.OrkutApi(mock).communityMemb
ers; | |
2673 var arg_communityId = 42; | |
2674 var arg_userId = "foo"; | |
2675 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2676 var path = (req.url).path; | |
2677 var pathOffset = 0; | |
2678 var index; | |
2679 var subPart; | |
2680 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2681 pathOffset += 1; | |
2682 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2683 pathOffset += 9; | |
2684 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2685 pathOffset += 12; | |
2686 index = path.indexOf("/members/", pathOffset); | |
2687 unittest.expect(index >= 0, unittest.isTrue); | |
2688 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2689 pathOffset = index; | |
2690 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2691 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/members/")); | |
2692 pathOffset += 9; | |
2693 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2694 pathOffset = path.length; | |
2695 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2696 | |
2697 var query = (req.url).query; | |
2698 var queryOffset = 0; | |
2699 var queryMap = {}; | |
2700 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2701 parseBool(n) { | |
2702 if (n == "true") return true; | |
2703 if (n == "false") return false; | |
2704 if (n == null) return null; | |
2705 throw new core.ArgumentError("Invalid boolean: $n"); | |
2706 } | |
2707 if (query.length > 0) { | |
2708 for (var part in query.split("&")) { | |
2709 var keyvalue = part.split("="); | |
2710 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2711 } | |
2712 } | |
2713 | |
2714 | |
2715 var h = { | |
2716 "content-type" : "application/json; charset=utf-8", | |
2717 }; | |
2718 var resp = ""; | |
2719 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2720 }), true); | |
2721 res.delete(arg_communityId, arg_userId).then(unittest.expectAsync((_) {}))
; | |
2722 }); | |
2723 | |
2724 unittest.test("method--get", () { | |
2725 | |
2726 var mock = new common_test.HttpServerMock(); | |
2727 api.CommunityMembersResourceApi res = new api.OrkutApi(mock).communityMemb
ers; | |
2728 var arg_communityId = 42; | |
2729 var arg_userId = "foo"; | |
2730 var arg_hl = "foo"; | |
2731 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2732 var path = (req.url).path; | |
2733 var pathOffset = 0; | |
2734 var index; | |
2735 var subPart; | |
2736 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2737 pathOffset += 1; | |
2738 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2739 pathOffset += 9; | |
2740 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2741 pathOffset += 12; | |
2742 index = path.indexOf("/members/", pathOffset); | |
2743 unittest.expect(index >= 0, unittest.isTrue); | |
2744 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2745 pathOffset = index; | |
2746 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2747 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/members/")); | |
2748 pathOffset += 9; | |
2749 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2750 pathOffset = path.length; | |
2751 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2752 | |
2753 var query = (req.url).query; | |
2754 var queryOffset = 0; | |
2755 var queryMap = {}; | |
2756 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2757 parseBool(n) { | |
2758 if (n == "true") return true; | |
2759 if (n == "false") return false; | |
2760 if (n == null) return null; | |
2761 throw new core.ArgumentError("Invalid boolean: $n"); | |
2762 } | |
2763 if (query.length > 0) { | |
2764 for (var part in query.split("&")) { | |
2765 var keyvalue = part.split("="); | |
2766 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2767 } | |
2768 } | |
2769 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2770 | |
2771 | |
2772 var h = { | |
2773 "content-type" : "application/json; charset=utf-8", | |
2774 }; | |
2775 var resp = convert.JSON.encode(buildCommunityMembers()); | |
2776 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2777 }), true); | |
2778 res.get(arg_communityId, arg_userId, hl: arg_hl).then(unittest.expectAsync
(((api.CommunityMembers response) { | |
2779 checkCommunityMembers(response); | |
2780 }))); | |
2781 }); | |
2782 | |
2783 unittest.test("method--insert", () { | |
2784 | |
2785 var mock = new common_test.HttpServerMock(); | |
2786 api.CommunityMembersResourceApi res = new api.OrkutApi(mock).communityMemb
ers; | |
2787 var arg_communityId = 42; | |
2788 var arg_userId = "foo"; | |
2789 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2790 var path = (req.url).path; | |
2791 var pathOffset = 0; | |
2792 var index; | |
2793 var subPart; | |
2794 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2795 pathOffset += 1; | |
2796 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2797 pathOffset += 9; | |
2798 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2799 pathOffset += 12; | |
2800 index = path.indexOf("/members/", pathOffset); | |
2801 unittest.expect(index >= 0, unittest.isTrue); | |
2802 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2803 pathOffset = index; | |
2804 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2805 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/members/")); | |
2806 pathOffset += 9; | |
2807 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2808 pathOffset = path.length; | |
2809 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
2810 | |
2811 var query = (req.url).query; | |
2812 var queryOffset = 0; | |
2813 var queryMap = {}; | |
2814 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2815 parseBool(n) { | |
2816 if (n == "true") return true; | |
2817 if (n == "false") return false; | |
2818 if (n == null) return null; | |
2819 throw new core.ArgumentError("Invalid boolean: $n"); | |
2820 } | |
2821 if (query.length > 0) { | |
2822 for (var part in query.split("&")) { | |
2823 var keyvalue = part.split("="); | |
2824 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2825 } | |
2826 } | |
2827 | |
2828 | |
2829 var h = { | |
2830 "content-type" : "application/json; charset=utf-8", | |
2831 }; | |
2832 var resp = convert.JSON.encode(buildCommunityMembers()); | |
2833 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2834 }), true); | |
2835 res.insert(arg_communityId, arg_userId).then(unittest.expectAsync(((api.Co
mmunityMembers response) { | |
2836 checkCommunityMembers(response); | |
2837 }))); | |
2838 }); | |
2839 | |
2840 unittest.test("method--list", () { | |
2841 | |
2842 var mock = new common_test.HttpServerMock(); | |
2843 api.CommunityMembersResourceApi res = new api.OrkutApi(mock).communityMemb
ers; | |
2844 var arg_communityId = 42; | |
2845 var arg_friendsOnly = true; | |
2846 var arg_hl = "foo"; | |
2847 var arg_maxResults = 42; | |
2848 var arg_pageToken = "foo"; | |
2849 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2850 var path = (req.url).path; | |
2851 var pathOffset = 0; | |
2852 var index; | |
2853 var subPart; | |
2854 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2855 pathOffset += 1; | |
2856 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2857 pathOffset += 9; | |
2858 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2859 pathOffset += 12; | |
2860 index = path.indexOf("/members", pathOffset); | |
2861 unittest.expect(index >= 0, unittest.isTrue); | |
2862 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2863 pathOffset = index; | |
2864 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2865 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/members")); | |
2866 pathOffset += 8; | |
2867 | |
2868 var query = (req.url).query; | |
2869 var queryOffset = 0; | |
2870 var queryMap = {}; | |
2871 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2872 parseBool(n) { | |
2873 if (n == "true") return true; | |
2874 if (n == "false") return false; | |
2875 if (n == null) return null; | |
2876 throw new core.ArgumentError("Invalid boolean: $n"); | |
2877 } | |
2878 if (query.length > 0) { | |
2879 for (var part in query.split("&")) { | |
2880 var keyvalue = part.split("="); | |
2881 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2882 } | |
2883 } | |
2884 unittest.expect(queryMap["friendsOnly"].first, unittest.equals("$arg_fri
endsOnly")); | |
2885 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
2886 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
2887 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
2888 | |
2889 | |
2890 var h = { | |
2891 "content-type" : "application/json; charset=utf-8", | |
2892 }; | |
2893 var resp = convert.JSON.encode(buildCommunityMembersList()); | |
2894 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2895 }), true); | |
2896 res.list(arg_communityId, friendsOnly: arg_friendsOnly, hl: arg_hl, maxRes
ults: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.
CommunityMembersList response) { | |
2897 checkCommunityMembersList(response); | |
2898 }))); | |
2899 }); | |
2900 | |
2901 }); | |
2902 | |
2903 | |
2904 unittest.group("resource-CommunityMessagesResourceApi", () { | |
2905 unittest.test("method--delete", () { | |
2906 | |
2907 var mock = new common_test.HttpServerMock(); | |
2908 api.CommunityMessagesResourceApi res = new api.OrkutApi(mock).communityMes
sages; | |
2909 var arg_communityId = 42; | |
2910 var arg_topicId = "foo"; | |
2911 var arg_messageId = "foo"; | |
2912 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2913 var path = (req.url).path; | |
2914 var pathOffset = 0; | |
2915 var index; | |
2916 var subPart; | |
2917 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2918 pathOffset += 1; | |
2919 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2920 pathOffset += 9; | |
2921 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2922 pathOffset += 12; | |
2923 index = path.indexOf("/topics/", pathOffset); | |
2924 unittest.expect(index >= 0, unittest.isTrue); | |
2925 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2926 pathOffset = index; | |
2927 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2928 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/topics/")); | |
2929 pathOffset += 8; | |
2930 index = path.indexOf("/messages/", pathOffset); | |
2931 unittest.expect(index >= 0, unittest.isTrue); | |
2932 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2933 pathOffset = index; | |
2934 unittest.expect(subPart, unittest.equals("$arg_topicId")); | |
2935 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/messages/")); | |
2936 pathOffset += 10; | |
2937 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
2938 pathOffset = path.length; | |
2939 unittest.expect(subPart, unittest.equals("$arg_messageId")); | |
2940 | |
2941 var query = (req.url).query; | |
2942 var queryOffset = 0; | |
2943 var queryMap = {}; | |
2944 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2945 parseBool(n) { | |
2946 if (n == "true") return true; | |
2947 if (n == "false") return false; | |
2948 if (n == null) return null; | |
2949 throw new core.ArgumentError("Invalid boolean: $n"); | |
2950 } | |
2951 if (query.length > 0) { | |
2952 for (var part in query.split("&")) { | |
2953 var keyvalue = part.split("="); | |
2954 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2955 } | |
2956 } | |
2957 | |
2958 | |
2959 var h = { | |
2960 "content-type" : "application/json; charset=utf-8", | |
2961 }; | |
2962 var resp = ""; | |
2963 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
2964 }), true); | |
2965 res.delete(arg_communityId, arg_topicId, arg_messageId).then(unittest.expe
ctAsync((_) {})); | |
2966 }); | |
2967 | |
2968 unittest.test("method--insert", () { | |
2969 | |
2970 var mock = new common_test.HttpServerMock(); | |
2971 api.CommunityMessagesResourceApi res = new api.OrkutApi(mock).communityMes
sages; | |
2972 var arg_request = buildCommunityMessage(); | |
2973 var arg_communityId = 42; | |
2974 var arg_topicId = "foo"; | |
2975 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2976 var obj = new api.CommunityMessage.fromJson(json); | |
2977 checkCommunityMessage(obj); | |
2978 | |
2979 var path = (req.url).path; | |
2980 var pathOffset = 0; | |
2981 var index; | |
2982 var subPart; | |
2983 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2984 pathOffset += 1; | |
2985 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
2986 pathOffset += 9; | |
2987 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
2988 pathOffset += 12; | |
2989 index = path.indexOf("/topics/", pathOffset); | |
2990 unittest.expect(index >= 0, unittest.isTrue); | |
2991 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2992 pathOffset = index; | |
2993 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
2994 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/topics/")); | |
2995 pathOffset += 8; | |
2996 index = path.indexOf("/messages", pathOffset); | |
2997 unittest.expect(index >= 0, unittest.isTrue); | |
2998 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
2999 pathOffset = index; | |
3000 unittest.expect(subPart, unittest.equals("$arg_topicId")); | |
3001 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/messages")); | |
3002 pathOffset += 9; | |
3003 | |
3004 var query = (req.url).query; | |
3005 var queryOffset = 0; | |
3006 var queryMap = {}; | |
3007 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3008 parseBool(n) { | |
3009 if (n == "true") return true; | |
3010 if (n == "false") return false; | |
3011 if (n == null) return null; | |
3012 throw new core.ArgumentError("Invalid boolean: $n"); | |
3013 } | |
3014 if (query.length > 0) { | |
3015 for (var part in query.split("&")) { | |
3016 var keyvalue = part.split("="); | |
3017 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3018 } | |
3019 } | |
3020 | |
3021 | |
3022 var h = { | |
3023 "content-type" : "application/json; charset=utf-8", | |
3024 }; | |
3025 var resp = convert.JSON.encode(buildCommunityMessage()); | |
3026 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3027 }), true); | |
3028 res.insert(arg_request, arg_communityId, arg_topicId).then(unittest.expect
Async(((api.CommunityMessage response) { | |
3029 checkCommunityMessage(response); | |
3030 }))); | |
3031 }); | |
3032 | |
3033 unittest.test("method--list", () { | |
3034 | |
3035 var mock = new common_test.HttpServerMock(); | |
3036 api.CommunityMessagesResourceApi res = new api.OrkutApi(mock).communityMes
sages; | |
3037 var arg_communityId = 42; | |
3038 var arg_topicId = "foo"; | |
3039 var arg_hl = "foo"; | |
3040 var arg_maxResults = 42; | |
3041 var arg_pageToken = "foo"; | |
3042 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3043 var path = (req.url).path; | |
3044 var pathOffset = 0; | |
3045 var index; | |
3046 var subPart; | |
3047 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3048 pathOffset += 1; | |
3049 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3050 pathOffset += 9; | |
3051 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3052 pathOffset += 12; | |
3053 index = path.indexOf("/topics/", pathOffset); | |
3054 unittest.expect(index >= 0, unittest.isTrue); | |
3055 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3056 pathOffset = index; | |
3057 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3058 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/topics/")); | |
3059 pathOffset += 8; | |
3060 index = path.indexOf("/messages", pathOffset); | |
3061 unittest.expect(index >= 0, unittest.isTrue); | |
3062 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3063 pathOffset = index; | |
3064 unittest.expect(subPart, unittest.equals("$arg_topicId")); | |
3065 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/messages")); | |
3066 pathOffset += 9; | |
3067 | |
3068 var query = (req.url).query; | |
3069 var queryOffset = 0; | |
3070 var queryMap = {}; | |
3071 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3072 parseBool(n) { | |
3073 if (n == "true") return true; | |
3074 if (n == "false") return false; | |
3075 if (n == null) return null; | |
3076 throw new core.ArgumentError("Invalid boolean: $n"); | |
3077 } | |
3078 if (query.length > 0) { | |
3079 for (var part in query.split("&")) { | |
3080 var keyvalue = part.split("="); | |
3081 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3082 } | |
3083 } | |
3084 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3085 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
3086 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
3087 | |
3088 | |
3089 var h = { | |
3090 "content-type" : "application/json; charset=utf-8", | |
3091 }; | |
3092 var resp = convert.JSON.encode(buildCommunityMessageList()); | |
3093 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3094 }), true); | |
3095 res.list(arg_communityId, arg_topicId, hl: arg_hl, maxResults: arg_maxResu
lts, pageToken: arg_pageToken).then(unittest.expectAsync(((api.CommunityMessageL
ist response) { | |
3096 checkCommunityMessageList(response); | |
3097 }))); | |
3098 }); | |
3099 | |
3100 }); | |
3101 | |
3102 | |
3103 unittest.group("resource-CommunityPollCommentsResourceApi", () { | |
3104 unittest.test("method--insert", () { | |
3105 | |
3106 var mock = new common_test.HttpServerMock(); | |
3107 api.CommunityPollCommentsResourceApi res = new api.OrkutApi(mock).communit
yPollComments; | |
3108 var arg_request = buildCommunityPollComment(); | |
3109 var arg_communityId = 42; | |
3110 var arg_pollId = "foo"; | |
3111 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3112 var obj = new api.CommunityPollComment.fromJson(json); | |
3113 checkCommunityPollComment(obj); | |
3114 | |
3115 var path = (req.url).path; | |
3116 var pathOffset = 0; | |
3117 var index; | |
3118 var subPart; | |
3119 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3120 pathOffset += 1; | |
3121 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3122 pathOffset += 9; | |
3123 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3124 pathOffset += 12; | |
3125 index = path.indexOf("/polls/", pathOffset); | |
3126 unittest.expect(index >= 0, unittest.isTrue); | |
3127 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3128 pathOffset = index; | |
3129 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3130 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/polls/")); | |
3131 pathOffset += 7; | |
3132 index = path.indexOf("/comments", pathOffset); | |
3133 unittest.expect(index >= 0, unittest.isTrue); | |
3134 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3135 pathOffset = index; | |
3136 unittest.expect(subPart, unittest.equals("$arg_pollId")); | |
3137 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/comments")); | |
3138 pathOffset += 9; | |
3139 | |
3140 var query = (req.url).query; | |
3141 var queryOffset = 0; | |
3142 var queryMap = {}; | |
3143 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3144 parseBool(n) { | |
3145 if (n == "true") return true; | |
3146 if (n == "false") return false; | |
3147 if (n == null) return null; | |
3148 throw new core.ArgumentError("Invalid boolean: $n"); | |
3149 } | |
3150 if (query.length > 0) { | |
3151 for (var part in query.split("&")) { | |
3152 var keyvalue = part.split("="); | |
3153 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3154 } | |
3155 } | |
3156 | |
3157 | |
3158 var h = { | |
3159 "content-type" : "application/json; charset=utf-8", | |
3160 }; | |
3161 var resp = convert.JSON.encode(buildCommunityPollComment()); | |
3162 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3163 }), true); | |
3164 res.insert(arg_request, arg_communityId, arg_pollId).then(unittest.expectA
sync(((api.CommunityPollComment response) { | |
3165 checkCommunityPollComment(response); | |
3166 }))); | |
3167 }); | |
3168 | |
3169 unittest.test("method--list", () { | |
3170 | |
3171 var mock = new common_test.HttpServerMock(); | |
3172 api.CommunityPollCommentsResourceApi res = new api.OrkutApi(mock).communit
yPollComments; | |
3173 var arg_communityId = 42; | |
3174 var arg_pollId = "foo"; | |
3175 var arg_hl = "foo"; | |
3176 var arg_maxResults = 42; | |
3177 var arg_pageToken = "foo"; | |
3178 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3179 var path = (req.url).path; | |
3180 var pathOffset = 0; | |
3181 var index; | |
3182 var subPart; | |
3183 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3184 pathOffset += 1; | |
3185 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3186 pathOffset += 9; | |
3187 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3188 pathOffset += 12; | |
3189 index = path.indexOf("/polls/", pathOffset); | |
3190 unittest.expect(index >= 0, unittest.isTrue); | |
3191 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3192 pathOffset = index; | |
3193 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3194 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/polls/")); | |
3195 pathOffset += 7; | |
3196 index = path.indexOf("/comments", pathOffset); | |
3197 unittest.expect(index >= 0, unittest.isTrue); | |
3198 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3199 pathOffset = index; | |
3200 unittest.expect(subPart, unittest.equals("$arg_pollId")); | |
3201 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/comments")); | |
3202 pathOffset += 9; | |
3203 | |
3204 var query = (req.url).query; | |
3205 var queryOffset = 0; | |
3206 var queryMap = {}; | |
3207 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3208 parseBool(n) { | |
3209 if (n == "true") return true; | |
3210 if (n == "false") return false; | |
3211 if (n == null) return null; | |
3212 throw new core.ArgumentError("Invalid boolean: $n"); | |
3213 } | |
3214 if (query.length > 0) { | |
3215 for (var part in query.split("&")) { | |
3216 var keyvalue = part.split("="); | |
3217 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3218 } | |
3219 } | |
3220 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3221 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
3222 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
3223 | |
3224 | |
3225 var h = { | |
3226 "content-type" : "application/json; charset=utf-8", | |
3227 }; | |
3228 var resp = convert.JSON.encode(buildCommunityPollCommentList()); | |
3229 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3230 }), true); | |
3231 res.list(arg_communityId, arg_pollId, hl: arg_hl, maxResults: arg_maxResul
ts, pageToken: arg_pageToken).then(unittest.expectAsync(((api.CommunityPollComme
ntList response) { | |
3232 checkCommunityPollCommentList(response); | |
3233 }))); | |
3234 }); | |
3235 | |
3236 }); | |
3237 | |
3238 | |
3239 unittest.group("resource-CommunityPollVotesResourceApi", () { | |
3240 unittest.test("method--insert", () { | |
3241 | |
3242 var mock = new common_test.HttpServerMock(); | |
3243 api.CommunityPollVotesResourceApi res = new api.OrkutApi(mock).communityPo
llVotes; | |
3244 var arg_request = buildCommunityPollVote(); | |
3245 var arg_communityId = 42; | |
3246 var arg_pollId = "foo"; | |
3247 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3248 var obj = new api.CommunityPollVote.fromJson(json); | |
3249 checkCommunityPollVote(obj); | |
3250 | |
3251 var path = (req.url).path; | |
3252 var pathOffset = 0; | |
3253 var index; | |
3254 var subPart; | |
3255 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3256 pathOffset += 1; | |
3257 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3258 pathOffset += 9; | |
3259 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3260 pathOffset += 12; | |
3261 index = path.indexOf("/polls/", pathOffset); | |
3262 unittest.expect(index >= 0, unittest.isTrue); | |
3263 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3264 pathOffset = index; | |
3265 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3266 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/polls/")); | |
3267 pathOffset += 7; | |
3268 index = path.indexOf("/votes", pathOffset); | |
3269 unittest.expect(index >= 0, unittest.isTrue); | |
3270 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3271 pathOffset = index; | |
3272 unittest.expect(subPart, unittest.equals("$arg_pollId")); | |
3273 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/votes")); | |
3274 pathOffset += 6; | |
3275 | |
3276 var query = (req.url).query; | |
3277 var queryOffset = 0; | |
3278 var queryMap = {}; | |
3279 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3280 parseBool(n) { | |
3281 if (n == "true") return true; | |
3282 if (n == "false") return false; | |
3283 if (n == null) return null; | |
3284 throw new core.ArgumentError("Invalid boolean: $n"); | |
3285 } | |
3286 if (query.length > 0) { | |
3287 for (var part in query.split("&")) { | |
3288 var keyvalue = part.split("="); | |
3289 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3290 } | |
3291 } | |
3292 | |
3293 | |
3294 var h = { | |
3295 "content-type" : "application/json; charset=utf-8", | |
3296 }; | |
3297 var resp = convert.JSON.encode(buildCommunityPollVote()); | |
3298 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3299 }), true); | |
3300 res.insert(arg_request, arg_communityId, arg_pollId).then(unittest.expectA
sync(((api.CommunityPollVote response) { | |
3301 checkCommunityPollVote(response); | |
3302 }))); | |
3303 }); | |
3304 | |
3305 }); | |
3306 | |
3307 | |
3308 unittest.group("resource-CommunityPollsResourceApi", () { | |
3309 unittest.test("method--get", () { | |
3310 | |
3311 var mock = new common_test.HttpServerMock(); | |
3312 api.CommunityPollsResourceApi res = new api.OrkutApi(mock).communityPolls; | |
3313 var arg_communityId = 42; | |
3314 var arg_pollId = "foo"; | |
3315 var arg_hl = "foo"; | |
3316 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3317 var path = (req.url).path; | |
3318 var pathOffset = 0; | |
3319 var index; | |
3320 var subPart; | |
3321 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3322 pathOffset += 1; | |
3323 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3324 pathOffset += 9; | |
3325 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3326 pathOffset += 12; | |
3327 index = path.indexOf("/polls/", pathOffset); | |
3328 unittest.expect(index >= 0, unittest.isTrue); | |
3329 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3330 pathOffset = index; | |
3331 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3332 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/polls/")); | |
3333 pathOffset += 7; | |
3334 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
3335 pathOffset = path.length; | |
3336 unittest.expect(subPart, unittest.equals("$arg_pollId")); | |
3337 | |
3338 var query = (req.url).query; | |
3339 var queryOffset = 0; | |
3340 var queryMap = {}; | |
3341 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3342 parseBool(n) { | |
3343 if (n == "true") return true; | |
3344 if (n == "false") return false; | |
3345 if (n == null) return null; | |
3346 throw new core.ArgumentError("Invalid boolean: $n"); | |
3347 } | |
3348 if (query.length > 0) { | |
3349 for (var part in query.split("&")) { | |
3350 var keyvalue = part.split("="); | |
3351 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3352 } | |
3353 } | |
3354 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3355 | |
3356 | |
3357 var h = { | |
3358 "content-type" : "application/json; charset=utf-8", | |
3359 }; | |
3360 var resp = convert.JSON.encode(buildCommunityPoll()); | |
3361 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3362 }), true); | |
3363 res.get(arg_communityId, arg_pollId, hl: arg_hl).then(unittest.expectAsync
(((api.CommunityPoll response) { | |
3364 checkCommunityPoll(response); | |
3365 }))); | |
3366 }); | |
3367 | |
3368 unittest.test("method--list", () { | |
3369 | |
3370 var mock = new common_test.HttpServerMock(); | |
3371 api.CommunityPollsResourceApi res = new api.OrkutApi(mock).communityPolls; | |
3372 var arg_communityId = 42; | |
3373 var arg_hl = "foo"; | |
3374 var arg_maxResults = 42; | |
3375 var arg_pageToken = "foo"; | |
3376 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3377 var path = (req.url).path; | |
3378 var pathOffset = 0; | |
3379 var index; | |
3380 var subPart; | |
3381 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3382 pathOffset += 1; | |
3383 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3384 pathOffset += 9; | |
3385 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3386 pathOffset += 12; | |
3387 index = path.indexOf("/polls", pathOffset); | |
3388 unittest.expect(index >= 0, unittest.isTrue); | |
3389 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3390 pathOffset = index; | |
3391 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3392 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/polls")); | |
3393 pathOffset += 6; | |
3394 | |
3395 var query = (req.url).query; | |
3396 var queryOffset = 0; | |
3397 var queryMap = {}; | |
3398 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3399 parseBool(n) { | |
3400 if (n == "true") return true; | |
3401 if (n == "false") return false; | |
3402 if (n == null) return null; | |
3403 throw new core.ArgumentError("Invalid boolean: $n"); | |
3404 } | |
3405 if (query.length > 0) { | |
3406 for (var part in query.split("&")) { | |
3407 var keyvalue = part.split("="); | |
3408 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3409 } | |
3410 } | |
3411 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3412 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
3413 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
3414 | |
3415 | |
3416 var h = { | |
3417 "content-type" : "application/json; charset=utf-8", | |
3418 }; | |
3419 var resp = convert.JSON.encode(buildCommunityPollList()); | |
3420 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3421 }), true); | |
3422 res.list(arg_communityId, hl: arg_hl, maxResults: arg_maxResults, pageToke
n: arg_pageToken).then(unittest.expectAsync(((api.CommunityPollList response) { | |
3423 checkCommunityPollList(response); | |
3424 }))); | |
3425 }); | |
3426 | |
3427 }); | |
3428 | |
3429 | |
3430 unittest.group("resource-CommunityRelatedResourceApi", () { | |
3431 unittest.test("method--list", () { | |
3432 | |
3433 var mock = new common_test.HttpServerMock(); | |
3434 api.CommunityRelatedResourceApi res = new api.OrkutApi(mock).communityRela
ted; | |
3435 var arg_communityId = 42; | |
3436 var arg_hl = "foo"; | |
3437 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3438 var path = (req.url).path; | |
3439 var pathOffset = 0; | |
3440 var index; | |
3441 var subPart; | |
3442 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3443 pathOffset += 1; | |
3444 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3445 pathOffset += 9; | |
3446 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3447 pathOffset += 12; | |
3448 index = path.indexOf("/related", pathOffset); | |
3449 unittest.expect(index >= 0, unittest.isTrue); | |
3450 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3451 pathOffset = index; | |
3452 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3453 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/related")); | |
3454 pathOffset += 8; | |
3455 | |
3456 var query = (req.url).query; | |
3457 var queryOffset = 0; | |
3458 var queryMap = {}; | |
3459 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3460 parseBool(n) { | |
3461 if (n == "true") return true; | |
3462 if (n == "false") return false; | |
3463 if (n == null) return null; | |
3464 throw new core.ArgumentError("Invalid boolean: $n"); | |
3465 } | |
3466 if (query.length > 0) { | |
3467 for (var part in query.split("&")) { | |
3468 var keyvalue = part.split("="); | |
3469 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3470 } | |
3471 } | |
3472 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3473 | |
3474 | |
3475 var h = { | |
3476 "content-type" : "application/json; charset=utf-8", | |
3477 }; | |
3478 var resp = convert.JSON.encode(buildCommunityList()); | |
3479 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3480 }), true); | |
3481 res.list(arg_communityId, hl: arg_hl).then(unittest.expectAsync(((api.Comm
unityList response) { | |
3482 checkCommunityList(response); | |
3483 }))); | |
3484 }); | |
3485 | |
3486 }); | |
3487 | |
3488 | |
3489 unittest.group("resource-CommunityTopicsResourceApi", () { | |
3490 unittest.test("method--delete", () { | |
3491 | |
3492 var mock = new common_test.HttpServerMock(); | |
3493 api.CommunityTopicsResourceApi res = new api.OrkutApi(mock).communityTopic
s; | |
3494 var arg_communityId = 42; | |
3495 var arg_topicId = "foo"; | |
3496 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3497 var path = (req.url).path; | |
3498 var pathOffset = 0; | |
3499 var index; | |
3500 var subPart; | |
3501 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3502 pathOffset += 1; | |
3503 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3504 pathOffset += 9; | |
3505 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3506 pathOffset += 12; | |
3507 index = path.indexOf("/topics/", pathOffset); | |
3508 unittest.expect(index >= 0, unittest.isTrue); | |
3509 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3510 pathOffset = index; | |
3511 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3512 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/topics/")); | |
3513 pathOffset += 8; | |
3514 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
3515 pathOffset = path.length; | |
3516 unittest.expect(subPart, unittest.equals("$arg_topicId")); | |
3517 | |
3518 var query = (req.url).query; | |
3519 var queryOffset = 0; | |
3520 var queryMap = {}; | |
3521 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3522 parseBool(n) { | |
3523 if (n == "true") return true; | |
3524 if (n == "false") return false; | |
3525 if (n == null) return null; | |
3526 throw new core.ArgumentError("Invalid boolean: $n"); | |
3527 } | |
3528 if (query.length > 0) { | |
3529 for (var part in query.split("&")) { | |
3530 var keyvalue = part.split("="); | |
3531 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3532 } | |
3533 } | |
3534 | |
3535 | |
3536 var h = { | |
3537 "content-type" : "application/json; charset=utf-8", | |
3538 }; | |
3539 var resp = ""; | |
3540 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3541 }), true); | |
3542 res.delete(arg_communityId, arg_topicId).then(unittest.expectAsync((_) {})
); | |
3543 }); | |
3544 | |
3545 unittest.test("method--get", () { | |
3546 | |
3547 var mock = new common_test.HttpServerMock(); | |
3548 api.CommunityTopicsResourceApi res = new api.OrkutApi(mock).communityTopic
s; | |
3549 var arg_communityId = 42; | |
3550 var arg_topicId = "foo"; | |
3551 var arg_hl = "foo"; | |
3552 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3553 var path = (req.url).path; | |
3554 var pathOffset = 0; | |
3555 var index; | |
3556 var subPart; | |
3557 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3558 pathOffset += 1; | |
3559 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3560 pathOffset += 9; | |
3561 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3562 pathOffset += 12; | |
3563 index = path.indexOf("/topics/", pathOffset); | |
3564 unittest.expect(index >= 0, unittest.isTrue); | |
3565 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3566 pathOffset = index; | |
3567 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3568 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/topics/")); | |
3569 pathOffset += 8; | |
3570 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
3571 pathOffset = path.length; | |
3572 unittest.expect(subPart, unittest.equals("$arg_topicId")); | |
3573 | |
3574 var query = (req.url).query; | |
3575 var queryOffset = 0; | |
3576 var queryMap = {}; | |
3577 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3578 parseBool(n) { | |
3579 if (n == "true") return true; | |
3580 if (n == "false") return false; | |
3581 if (n == null) return null; | |
3582 throw new core.ArgumentError("Invalid boolean: $n"); | |
3583 } | |
3584 if (query.length > 0) { | |
3585 for (var part in query.split("&")) { | |
3586 var keyvalue = part.split("="); | |
3587 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3588 } | |
3589 } | |
3590 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3591 | |
3592 | |
3593 var h = { | |
3594 "content-type" : "application/json; charset=utf-8", | |
3595 }; | |
3596 var resp = convert.JSON.encode(buildCommunityTopic()); | |
3597 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3598 }), true); | |
3599 res.get(arg_communityId, arg_topicId, hl: arg_hl).then(unittest.expectAsyn
c(((api.CommunityTopic response) { | |
3600 checkCommunityTopic(response); | |
3601 }))); | |
3602 }); | |
3603 | |
3604 unittest.test("method--insert", () { | |
3605 | |
3606 var mock = new common_test.HttpServerMock(); | |
3607 api.CommunityTopicsResourceApi res = new api.OrkutApi(mock).communityTopic
s; | |
3608 var arg_request = buildCommunityTopic(); | |
3609 var arg_communityId = 42; | |
3610 var arg_isShout = true; | |
3611 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3612 var obj = new api.CommunityTopic.fromJson(json); | |
3613 checkCommunityTopic(obj); | |
3614 | |
3615 var path = (req.url).path; | |
3616 var pathOffset = 0; | |
3617 var index; | |
3618 var subPart; | |
3619 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3620 pathOffset += 1; | |
3621 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3622 pathOffset += 9; | |
3623 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3624 pathOffset += 12; | |
3625 index = path.indexOf("/topics", pathOffset); | |
3626 unittest.expect(index >= 0, unittest.isTrue); | |
3627 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3628 pathOffset = index; | |
3629 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3630 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/topics")); | |
3631 pathOffset += 7; | |
3632 | |
3633 var query = (req.url).query; | |
3634 var queryOffset = 0; | |
3635 var queryMap = {}; | |
3636 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3637 parseBool(n) { | |
3638 if (n == "true") return true; | |
3639 if (n == "false") return false; | |
3640 if (n == null) return null; | |
3641 throw new core.ArgumentError("Invalid boolean: $n"); | |
3642 } | |
3643 if (query.length > 0) { | |
3644 for (var part in query.split("&")) { | |
3645 var keyvalue = part.split("="); | |
3646 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3647 } | |
3648 } | |
3649 unittest.expect(queryMap["isShout"].first, unittest.equals("$arg_isShout
")); | |
3650 | |
3651 | |
3652 var h = { | |
3653 "content-type" : "application/json; charset=utf-8", | |
3654 }; | |
3655 var resp = convert.JSON.encode(buildCommunityTopic()); | |
3656 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3657 }), true); | |
3658 res.insert(arg_request, arg_communityId, isShout: arg_isShout).then(unitte
st.expectAsync(((api.CommunityTopic response) { | |
3659 checkCommunityTopic(response); | |
3660 }))); | |
3661 }); | |
3662 | |
3663 unittest.test("method--list", () { | |
3664 | |
3665 var mock = new common_test.HttpServerMock(); | |
3666 api.CommunityTopicsResourceApi res = new api.OrkutApi(mock).communityTopic
s; | |
3667 var arg_communityId = 42; | |
3668 var arg_hl = "foo"; | |
3669 var arg_maxResults = 42; | |
3670 var arg_pageToken = "foo"; | |
3671 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3672 var path = (req.url).path; | |
3673 var pathOffset = 0; | |
3674 var index; | |
3675 var subPart; | |
3676 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3677 pathOffset += 1; | |
3678 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3679 pathOffset += 9; | |
3680 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("communities/")); | |
3681 pathOffset += 12; | |
3682 index = path.indexOf("/topics", pathOffset); | |
3683 unittest.expect(index >= 0, unittest.isTrue); | |
3684 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3685 pathOffset = index; | |
3686 unittest.expect(subPart, unittest.equals("$arg_communityId")); | |
3687 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/topics")); | |
3688 pathOffset += 7; | |
3689 | |
3690 var query = (req.url).query; | |
3691 var queryOffset = 0; | |
3692 var queryMap = {}; | |
3693 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3694 parseBool(n) { | |
3695 if (n == "true") return true; | |
3696 if (n == "false") return false; | |
3697 if (n == null) return null; | |
3698 throw new core.ArgumentError("Invalid boolean: $n"); | |
3699 } | |
3700 if (query.length > 0) { | |
3701 for (var part in query.split("&")) { | |
3702 var keyvalue = part.split("="); | |
3703 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3704 } | |
3705 } | |
3706 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | |
3707 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
3708 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
3709 | |
3710 | |
3711 var h = { | |
3712 "content-type" : "application/json; charset=utf-8", | |
3713 }; | |
3714 var resp = convert.JSON.encode(buildCommunityTopicList()); | |
3715 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3716 }), true); | |
3717 res.list(arg_communityId, hl: arg_hl, maxResults: arg_maxResults, pageToke
n: arg_pageToken).then(unittest.expectAsync(((api.CommunityTopicList response) { | |
3718 checkCommunityTopicList(response); | |
3719 }))); | |
3720 }); | |
3721 | |
3722 }); | |
3723 | |
3724 | |
3725 unittest.group("resource-CountersResourceApi", () { | |
3726 unittest.test("method--list", () { | |
3727 | |
3728 var mock = new common_test.HttpServerMock(); | |
3729 api.CountersResourceApi res = new api.OrkutApi(mock).counters; | |
3730 var arg_userId = "foo"; | |
3731 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3732 var path = (req.url).path; | |
3733 var pathOffset = 0; | |
3734 var index; | |
3735 var subPart; | |
3736 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3737 pathOffset += 1; | |
3738 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3739 pathOffset += 9; | |
3740 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("people/")); | |
3741 pathOffset += 7; | |
3742 index = path.indexOf("/counters", pathOffset); | |
3743 unittest.expect(index >= 0, unittest.isTrue); | |
3744 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
3745 pathOffset = index; | |
3746 unittest.expect(subPart, unittest.equals("$arg_userId")); | |
3747 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/counters")); | |
3748 pathOffset += 9; | |
3749 | |
3750 var query = (req.url).query; | |
3751 var queryOffset = 0; | |
3752 var queryMap = {}; | |
3753 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3754 parseBool(n) { | |
3755 if (n == "true") return true; | |
3756 if (n == "false") return false; | |
3757 if (n == null) return null; | |
3758 throw new core.ArgumentError("Invalid boolean: $n"); | |
3759 } | |
3760 if (query.length > 0) { | |
3761 for (var part in query.split("&")) { | |
3762 var keyvalue = part.split("="); | |
3763 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3764 } | |
3765 } | |
3766 | |
3767 | |
3768 var h = { | |
3769 "content-type" : "application/json; charset=utf-8", | |
3770 }; | |
3771 var resp = convert.JSON.encode(buildCounters()); | |
3772 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3773 }), true); | |
3774 res.list(arg_userId).then(unittest.expectAsync(((api.Counters response) { | |
3775 checkCounters(response); | |
3776 }))); | |
3777 }); | |
3778 | |
3779 }); | |
3780 | |
3781 | |
3782 unittest.group("resource-ScrapsResourceApi", () { | |
3783 unittest.test("method--insert", () { | |
3784 | |
3785 var mock = new common_test.HttpServerMock(); | |
3786 api.ScrapsResourceApi res = new api.OrkutApi(mock).scraps; | |
3787 var arg_request = buildActivity(); | |
3788 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
3789 var obj = new api.Activity.fromJson(json); | |
3790 checkActivity(obj); | |
3791 | |
3792 var path = (req.url).path; | |
3793 var pathOffset = 0; | |
3794 var index; | |
3795 var subPart; | |
3796 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
3797 pathOffset += 1; | |
3798 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("orkut/v2/")); | |
3799 pathOffset += 9; | |
3800 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("activities/scraps")); | |
3801 pathOffset += 17; | |
3802 | |
3803 var query = (req.url).query; | |
3804 var queryOffset = 0; | |
3805 var queryMap = {}; | |
3806 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
3807 parseBool(n) { | |
3808 if (n == "true") return true; | |
3809 if (n == "false") return false; | |
3810 if (n == null) return null; | |
3811 throw new core.ArgumentError("Invalid boolean: $n"); | |
3812 } | |
3813 if (query.length > 0) { | |
3814 for (var part in query.split("&")) { | |
3815 var keyvalue = part.split("="); | |
3816 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
3817 } | |
3818 } | |
3819 | |
3820 | |
3821 var h = { | |
3822 "content-type" : "application/json; charset=utf-8", | |
3823 }; | |
3824 var resp = convert.JSON.encode(buildActivity()); | |
3825 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
3826 }), true); | |
3827 res.insert(arg_request).then(unittest.expectAsync(((api.Activity response)
{ | |
3828 checkActivity(response); | |
3829 }))); | |
3830 }); | |
3831 | |
3832 }); | |
3833 | |
3834 | |
3835 } | |
3836 | |
OLD | NEW |