teamlab 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,175 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe '[Calendar]' do
4
+
5
+ let(:teamlab_module) { :calendar }
6
+
7
+ before :all do
8
+ Teamlab.configure do |config|
9
+ config.server = SERVER
10
+ config.username = USERNAME
11
+ config.password = PASSWORD
12
+ end
13
+ end
14
+
15
+ describe '#create_calendar' do
16
+ it_should_behave_like 'an api request' do
17
+ let(:command) { :create_calendar }
18
+ let(:args) { [random_word, TIME_ZONES.sample] }
19
+ let(:add_data_to_collector) { true }
20
+ let(:data_param) { :calendar_ids }
21
+ let(:param_names) { %w(objectId) }
22
+ end
23
+ end
24
+
25
+ describe '#get_icalc_link' do
26
+ it_should_behave_like 'an api request' do
27
+ let(:command) { :get_icalc_link }
28
+ i = -1
29
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1]] }
30
+ let(:add_data_to_collector) { true }
31
+ let(:data_param) { :ical_link_ids }
32
+ let(:param_names) { %w() }
33
+ end
34
+ end
35
+
36
+ describe '#create_calendar_by_ical_link' do
37
+ it_should_behave_like 'an api request' do
38
+ let(:command) { :create_calendar_by_ical_link }
39
+ let(:args) { [CALENDAR_WEB_URL, random_word] }
40
+ let(:add_data_to_collector) { true }
41
+ let(:data_param) { :calendar_ids }
42
+ let(:param_names) { %w(objectId) }
43
+ end
44
+ end
45
+
46
+ describe '#add_event' do
47
+ it_should_behave_like 'an api request' do
48
+ let(:command) { :add_event }
49
+ i = -1
50
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], random_word, {description: random_word, startDate: DateTime.now, endDate: DateTime.now, repeatType: '', alertType: '-1', isAllDayLong: false}] }
51
+ let(:add_data_to_collector) { true }
52
+ let(:data_param) { :event_ids }
53
+ let(:param_names) { %w(objectId) }
54
+ end
55
+ end
56
+
57
+ describe '#get_default_access' do
58
+ it_should_behave_like 'an api request' do
59
+ let(:command) { :get_default_access }
60
+ end
61
+ end
62
+
63
+ describe '#get_calendar' do
64
+ it_should_behave_like 'an api request' do
65
+ let(:command) { :get_calendar }
66
+ let(:args) { [random_id(:calendar)] }
67
+ end
68
+ end
69
+
70
+ describe '#get_subscription_list' do
71
+ it_should_behave_like 'an api request' do
72
+ let(:command) { :get_subscription_list }
73
+ end
74
+ end
75
+
76
+ describe '#get_access_parameters' do
77
+ it_should_behave_like 'an api request' do
78
+ let(:command) { :get_access_parameters }
79
+ let(:args) { [random_id(:calendar)] }
80
+ end
81
+ end
82
+
83
+ describe '#get_icalc_feed' do
84
+ it_should_behave_like 'an api request' do
85
+ let(:command) { :get_icalc_feed }
86
+ i = -1
87
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], DATA_COLLECTOR[:ical_link_ids][i].split('/').last] }
88
+ end
89
+ end
90
+
91
+ describe '#get_calendar_events' do
92
+ it_should_behave_like 'an api request' do
93
+ let(:command) { :get_calendar_events }
94
+ let(:args) { [DateTime.new(2014).strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s, DateTime.now.strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s] }
95
+ end
96
+ end
97
+
98
+ describe '#get_calendars_and_subscriptions' do
99
+ it_should_behave_like 'an api request' do
100
+ let(:command) { :get_calendars_and_subscriptions }
101
+ let(:args) { [DateTime.new(2014).strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s, DateTime.now.strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s] }
102
+ end
103
+ end
104
+
105
+ describe '#import_ical' do
106
+ it_should_behave_like 'an api request' do
107
+ let(:command) { :import_ical }
108
+ let(:args) { [random_id(:calendar), CALENDAR_TO_UPLOAD] }
109
+ end
110
+ end
111
+
112
+ describe '#update_calendar' do
113
+ it_should_behave_like 'an api request' do
114
+ let(:command) { :update_calendar }
115
+ let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample] }
116
+ end
117
+ end
118
+
119
+ describe '#update_calendar_user_view' do
120
+ it_should_behave_like 'an api request' do
121
+ let(:command) { :update_calendar_user_view }
122
+ let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample, {textColor: 'red', backgroundColor: 'blue'}] }
123
+ end
124
+ end
125
+
126
+ describe '#manage_subscriptions' do
127
+ it_should_behave_like 'an api request' do
128
+ let(:command) { :manage_subscriptions }
129
+ let(:args) { [[random_word]] }
130
+ end
131
+ end
132
+
133
+ describe '#update_event' do
134
+ it_should_behave_like 'an api request' do
135
+ let(:command) { :update_event }
136
+ i = -1
137
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], DATA_COLLECTOR[:event_ids][i], random_word] }
138
+ end
139
+ end
140
+
141
+ describe '#unsubscribe_from_event' do
142
+ it_should_behave_like 'an api request' do
143
+ let(:command) { :unsubscribe_from_event }
144
+ let(:args) { [DATA_COLLECTOR[:event_ids][-1]] }
145
+ end
146
+ end
147
+
148
+ describe '#remove_event' do
149
+ it_should_behave_like 'an api request' do
150
+ let(:command) { :remove_event }
151
+ let(:args) { [random_id(:event)] }
152
+ end
153
+ end
154
+
155
+ describe '#delete_event_series' do
156
+ it_should_behave_like 'an api request' do
157
+ let(:command) { :delete_event_series }
158
+ let(:args) { [DATA_COLLECTOR[:event_ids].pop] }
159
+ end
160
+ end
161
+
162
+ describe '#delete_calendar' do
163
+ it_should_behave_like 'an api request' do
164
+ let(:command) { :delete_calendar }
165
+ let(:args) { [DATA_COLLECTOR[:calendar_ids].pop] }
166
+ end
167
+ end
168
+
169
+ after :all do
170
+ all_calendars = Teamlab.calendar.get_calendars_and_subscriptions(DateTime.new(2010).strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s, DateTime.now.strftime('%Y-%m-%dT%H-%M-%S.%LZ').to_s).body['response']
171
+ all_calendars.each do |current_calendar|
172
+ Teamlab.calendar.delete_calendar(current_calendar['objectId'])
173
+ end
174
+ end
175
+ end
@@ -0,0 +1,475 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe '[Community]' do
4
+
5
+ let(:teamlab_module) { :community }
6
+
7
+ before :all do
8
+ Teamlab.configure do |config|
9
+ config.server = SERVER
10
+ config.username = USERNAME
11
+ config.password = PASSWORD
12
+ end
13
+ end
14
+
15
+ describe '#create_project' do
16
+ it_should_behave_like 'an api request' do
17
+ let(:command) { :create_post }
18
+ let(:args) { [random_word, random_word] }
19
+ let(:add_data_to_collector) { true }
20
+ let(:data_param) { :community_post_ids }
21
+ let(:param_names) { %w(id) }
22
+ end
23
+ end
24
+
25
+ describe '#add_comment' do
26
+ it_should_behave_like 'an api request' do
27
+ let(:command) { :create_post }
28
+ let(:args) { [random_id(:community_post), random_word] }
29
+ let(:add_data_to_collector) { true }
30
+ let(:data_param) { :community_post_comment_ids }
31
+ let(:param_names) { %w(id) }
32
+ end
33
+ end
34
+
35
+ describe '#add_bookmark' do
36
+ it_should_behave_like 'an api request' do
37
+ let(:command) { :add_bookmark }
38
+ let(:args) { [SOME_URL, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(', ')}] }
39
+ let(:add_data_to_collector) { true }
40
+ let(:data_param) { :bookmark_ids }
41
+ let(:param_names) { %w(id) }
42
+ end
43
+ end
44
+
45
+ describe '#add_comment_to_bookmark' do
46
+ it_should_behave_like 'an api request' do
47
+ let(:command) { :add_comment_to_bookmark }
48
+ let(:args) { [random_id(:bookmark), random_word] }
49
+ let(:add_data_to_collector) { true }
50
+ let(:data_param) { :bookmark_comment_ids }
51
+ let(:param_names) { %w(id) }
52
+ end
53
+ end
54
+
55
+ describe '#create_event' do
56
+ it_should_behave_like 'an api request' do
57
+ let(:command) { :create_event }
58
+ let(:args) { [random_word, random_word] }
59
+ let(:add_data_to_collector) { true }
60
+ let(:data_param) { :event_ids }
61
+ let(:param_names) { %w(id) }
62
+ end
63
+ end
64
+
65
+ describe '#create_poll' do
66
+ it_should_behave_like 'an api request' do
67
+ let(:command) { :create_event }
68
+ let(:args) { [random_word, random_word, {type: 'Poll'}] }
69
+ let(:add_data_to_collector) { true }
70
+ let(:data_param) { :poll_ids }
71
+ let(:param_names) { %w(id) }
72
+ end
73
+ end
74
+
75
+ describe '#add_thread_to_category' do
76
+ it_should_behave_like 'an api request' do
77
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
78
+ let(:command) { :add_thread_to_category }
79
+ let(:args) { [-1, random_word, random_word, random_word] }
80
+ let(:add_data_to_collector) { true }
81
+ let(:data_param) { :thread_ids }
82
+ let(:param_names) { %w(id) }
83
+ end
84
+ end
85
+
86
+ describe '#add_topic_to_thread' do
87
+ it_should_behave_like 'an api request' do
88
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
89
+ let(:command) { :add_topic_to_thread }
90
+ let(:args) { [random_id(:thread), random_word, random_word] }
91
+ let(:add_data_to_collector) { true }
92
+ let(:data_param) { :thread_topic_ids }
93
+ let(:param_names) { %w(id) }
94
+ end
95
+ end
96
+
97
+ describe '#add_post_to_topic' do
98
+ it_should_behave_like 'an api request' do
99
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
100
+ let(:command) { :add_post_to_topic }
101
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, random_word, random_word] }
102
+ let(:add_data_to_collector) { true }
103
+ let(:data_param) { :topic_post_ids }
104
+ let(:param_names) { %w(id) }
105
+ end
106
+ end
107
+
108
+ describe '#create_page' do
109
+ it_should_behave_like 'an api request' do
110
+ let(:command) { :create_page }
111
+ let(:args) { [random_word, random_word] }
112
+ let(:add_data_to_collector) { true }
113
+ let(:data_param) { :wiki_page_name_ids }
114
+ let(:param_names) { %w(name) }
115
+ end
116
+ end
117
+
118
+ describe '#create_wiki_page_comment' do
119
+ it_should_behave_like 'an api request' do
120
+ let(:command) { :create_wiki_page_comment }
121
+ let(:args) { [random_id(:wiki_page_name), random_word] }
122
+ let(:add_data_to_collector) { true }
123
+ let(:data_param) { :wiki_page_comment_ids }
124
+ let(:param_names) { %w(id) }
125
+ end
126
+ end
127
+
128
+ describe '#upload_files' do
129
+ it_should_behave_like 'an api request' do
130
+ let(:command) { :upload_files }
131
+ let(:args) { [random_id(:wiki_pages_name), FILES_TO_UPLOAD] }
132
+ let(:add_data_to_collector) { true }
133
+ let(:data_param) { :wiki_page_file_name_ids }
134
+ let(:param_names) { %w(name) }
135
+ end
136
+ end
137
+
138
+ describe '#update_post' do
139
+ it_should_behave_like 'an api request' do
140
+ let(:command) { :update_post }
141
+ let(:args) { [random_id(:community_post), random_word, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(',')}] }
142
+ end
143
+ end
144
+
145
+ describe '#get_all_posts' do
146
+ it_should_behave_like 'an api request' do
147
+ let(:command) { :get_all_posts }
148
+ end
149
+ end
150
+
151
+ describe '#get_blog_tags' do
152
+ it_should_behave_like 'an api request' do
153
+ let(:command) { :get_blog_tags }
154
+ end
155
+ end
156
+
157
+ describe '#get_my_posts' do
158
+ it_should_behave_like 'an api request' do
159
+ let(:command) { :get_my_posts }
160
+ end
161
+ end
162
+
163
+ describe '#get_post_by_id' do
164
+ it_should_behave_like 'an api request' do
165
+ let(:command) { :get_post }
166
+ let(:args) { [random_id(:community_post)] }
167
+ end
168
+ end
169
+
170
+ describe '#get_posts_by_tag' do
171
+ it_should_behave_like 'an api request' do
172
+ let(:command) { :get_posts_by_tag }
173
+ let(:args) { [random_word(4)] }
174
+ end
175
+ end
176
+
177
+ describe '#search_posts' do
178
+ it_should_behave_like 'an api request' do
179
+ let(:command) { :search_posts }
180
+ let(:args) { [random_word] }
181
+ end
182
+ end
183
+
184
+ describe '#get_user_posts' do
185
+ it_should_behave_like 'an api request' do
186
+ let(:command) { :get_user_posts }
187
+ let(:args) { [DATA_COLLECTOR[:self_username].sample] }
188
+ end
189
+ end
190
+
191
+ describe '#get_comments' do
192
+ it_should_behave_like 'an api request' do
193
+ let(:command) { :get_comments }
194
+ let(:args) { [random_id(:community_post)] }
195
+ end
196
+ end
197
+
198
+ describe '#get_all_bookmarks' do
199
+ it_should_behave_like 'an api request' do
200
+ let(:command) { :get_all_bookmarks }
201
+ end
202
+ end
203
+
204
+ describe '#get_all_bookmark_tags' do
205
+ it_should_behave_like 'an api request' do
206
+ let(:command) { :get_all_bookmark_tags }
207
+ end
208
+ end
209
+
210
+ describe '#get_bookmark' do
211
+ it_should_behave_like 'an api request' do
212
+ let(:command) { :get_bookmark }
213
+ let(:args) { [random_id(:bookmark)] }
214
+ end
215
+ end
216
+
217
+ describe '#get_bookmarks_added_by_me' do
218
+ it_should_behave_like 'an api request' do
219
+ let(:command) { :get_bookmarks_added_by_me }
220
+ end
221
+ end
222
+
223
+ describe '#get_my_favourite_bookmarks' do
224
+ it_should_behave_like 'an api request' do
225
+ let(:command) { :get_my_favourite_bookmarks }
226
+ end
227
+ end
228
+
229
+ describe '#get_top_of_day_bookmarks' do
230
+ it_should_behave_like 'an api request' do
231
+ let(:command) { :get_top_of_day_bookmarks }
232
+ end
233
+ end
234
+
235
+ describe '#get_top_of_week_bookmarks' do
236
+ it_should_behave_like 'an api request' do
237
+ let(:command) { :get_top_of_week_bookmarks }
238
+ end
239
+ end
240
+
241
+ describe '#get_top_of_month_bookmarks' do
242
+ it_should_behave_like 'an api request' do
243
+ let(:command) { :get_top_of_month_bookmarks }
244
+ end
245
+ end
246
+
247
+ describe '#get_top_of_year_bookmarks' do
248
+ it_should_behave_like 'an api request' do
249
+ let(:command) { :get_top_of_year_bookmarks }
250
+ end
251
+ end
252
+
253
+ describe '#get_bookmarks_by_tag' do
254
+ it_should_behave_like 'an api request' do
255
+ let(:command) { :get_bookmarks_by_tag }
256
+ let(:args) { [random_word(4)] }
257
+ end
258
+ end
259
+
260
+ describe '#get_recently_added_bookmarks' do
261
+ it_should_behave_like 'an api request' do
262
+ let(:command) { :get_recently_added_bookmarks }
263
+ end
264
+ end
265
+
266
+ describe '#get_bookmark_comments' do
267
+ it_should_behave_like 'an api request' do
268
+ let(:command) { :get_bookmark_comments }
269
+ let(:args) { [random_id(:bookmark)] }
270
+ end
271
+ end
272
+
273
+ describe '#search_bookmarks' do
274
+ it_should_behave_like 'an api request' do
275
+ let(:command) { :search_bookmarks }
276
+ let(:args) { [random_word] }
277
+ end
278
+ end
279
+
280
+ describe '#update_event' do
281
+ it_should_behave_like 'an api request' do
282
+ let(:command) { :update_event }
283
+ let(:args) { [random_id(:event), random_word, random_word] }
284
+ end
285
+ end
286
+
287
+ describe '#get_all_events' do
288
+ it_should_behave_like 'an api request' do
289
+ let(:command) { :get_all_events }
290
+ end
291
+ end
292
+
293
+ describe '#get_my_events' do
294
+ it_should_behave_like 'an api request' do
295
+ let(:command) { :get_my_events }
296
+ end
297
+ end
298
+
299
+ describe '#get_event' do
300
+ it_should_behave_like 'an api request' do
301
+ let(:command) { :get_event }
302
+ let(:args) { [random_id(:event)] }
303
+ end
304
+ end
305
+
306
+ describe '#search_events' do
307
+ it_should_behave_like 'an api request' do
308
+ let(:command) { :search_events }
309
+ let(:args) { [random_word] }
310
+ end
311
+ end
312
+
313
+ describe '#vote_for_event' do
314
+ it_should_behave_like 'an api request' do
315
+ let(:command) { :vote_for_event }
316
+ let(:args) { [random_id(:poll), rand(2)] }
317
+ end
318
+ end
319
+
320
+ describe '#add_comment_to_event' do
321
+ it_should_behave_like 'an api request' do
322
+ let(:command) { :add_comment_to_event }
323
+ let(:args) { [random_id(:event), random_word] }
324
+ end
325
+ end
326
+
327
+ describe '#get_forums' do
328
+ it_should_behave_like 'an api request' do
329
+ let(:command) { :get_forums }
330
+ end
331
+ end
332
+
333
+ describe '#get_thread_topics' do
334
+ it_should_behave_like 'an api request' do
335
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
336
+ let(:command) { :get_thread_topics }
337
+ let(:args) { [random_id(:thread)] }
338
+ end
339
+ end
340
+
341
+ describe '#get_last_updated_topics' do
342
+ it_should_behave_like 'an api request' do
343
+ let(:command) { :get_last_updated_topics }
344
+ end
345
+ end
346
+
347
+ describe '#get_posts' do
348
+ it_should_behave_like 'an api request' do
349
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
350
+ let(:command) { :get_posts }
351
+ let(:args) { [random_id(:thread_topic)] }
352
+ end
353
+ end
354
+
355
+ describe '#search_topics' do
356
+ it_should_behave_like 'an api request' do
357
+ let(:command) { :search_topics }
358
+ let(:args) { [random_word(5)] }
359
+ end
360
+ end
361
+
362
+ describe '#update_topic_in_thread' do
363
+ it_should_behave_like 'an api request' do
364
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
365
+ let(:command) { :update_topic_in_thread }
366
+ let(:args) { [random_id(:thread_topic), random_word, random_word] }
367
+ end
368
+ end
369
+
370
+ describe '#update_post_in_topic' do
371
+ it_should_behave_like 'an api request' do
372
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
373
+ let(:command) { :update_post_in_topic }
374
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, random_id(:topic_post)] }
375
+ end
376
+ end
377
+
378
+ describe '#get_wiki_pages' do
379
+ it_should_behave_like 'an api request' do
380
+ let(:command) { :get_wiki_pages }
381
+ end
382
+ end
383
+
384
+ describe '#get_wiki_page' do
385
+ it_should_behave_like 'an api request' do
386
+ let(:command) { :get_wiki_page }
387
+ let(:args) { [random_id(:wiki_page_name)] }
388
+ end
389
+ end
390
+
391
+ describe '#get_wiki_file_info' do
392
+ it_should_behave_like 'an api request' do
393
+ let(:command) { :get_wiki_file_info }
394
+ let(:args) { [random_id(:wiki_page_file_name)] }
395
+ end
396
+ end
397
+
398
+ describe '#get_page_history' do
399
+ it_should_behave_like 'an api request' do
400
+ let(:command) { :get_page_history }
401
+ let(:args) { [random_id(:wiki_page_name)] }
402
+ end
403
+ end
404
+
405
+ describe '#get_all_page_comments' do
406
+ it_should_behave_like 'an api request' do
407
+ let(:command) { :get_all_page_comments }
408
+ let(:args) { [random_id(:wiki_page_name)] }
409
+ end
410
+ end
411
+
412
+ describe '#search_wiki_pages_by_name' do
413
+ it_should_behave_like 'an api request' do
414
+ let(:command) { :search_wiki_pages_by_name }
415
+ let(:args) { [random_word] }
416
+ end
417
+ end
418
+
419
+ describe '#search_wiki_pages_by_content' do
420
+ it_should_behave_like 'an api request' do
421
+ let(:command) { :search_wiki_pages_by_content }
422
+ let(:args) { [random_word] }
423
+ end
424
+ end
425
+
426
+ describe '#update_wiki_page' do
427
+ it_should_behave_like 'an api request' do
428
+ let(:command) { :update_wiki_page }
429
+ let(:args) { [random_id(:wiki_page_name), random_word] }
430
+ end
431
+ end
432
+
433
+ describe '#update_wiki_page_comment' do
434
+ it_should_behave_like 'an api request' do
435
+ let(:command) { :update_wiki_page_comment }
436
+ let(:args) { [random_id(:wiki_page_comment), random_word] }
437
+ end
438
+ end
439
+
440
+ describe '#delete_post' do
441
+ it_should_behave_like 'an api request' do
442
+ let(:command) { :delete_post }
443
+ let(:args) { [DATA_COLLECTOR[:community_post_ids].pop] }
444
+ end
445
+ end
446
+
447
+ describe '#delete_post_in_topic' do
448
+ it_should_behave_like 'an api request' do
449
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
450
+ let(:command) { :delete_post_in_topic }
451
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, DATA_COLLECTOR[:topic_post_ids].pop] }
452
+ end
453
+ end
454
+
455
+ describe '#delete_wiki_page_comment' do
456
+ it_should_behave_like 'an api request' do
457
+ let(:command) { :delete_wiki_page_comment }
458
+ let(:args) { [DATA_COLLECTOR[:wiki_page_comment_ids].pop] }
459
+ end
460
+ end
461
+
462
+ describe '#delete_wiki_file' do
463
+ it_should_behave_like 'an api request' do
464
+ let(:command) { :delete_wiki_file }
465
+ let(:args) { [DATA_COLLECTOR[:wiki_page_file_name_ids].pop] }
466
+ end
467
+ end
468
+
469
+ describe '#delete_wiki_page' do
470
+ it_should_behave_like 'an api request' do
471
+ let(:command) { :delete_wiki_page }
472
+ let(:args) { [DATA_COLLECTOR[:wiki_page_name_ids].pop] }
473
+ end
474
+ end
475
+ end