teamlab 0.1.4 → 0.2.1

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.
@@ -14,7 +14,7 @@ describe Teamlab do
14
14
  before do
15
15
  @module = Teamlab.send(teamlab_module)
16
16
  @response = args.empty? ? @module.send(command) : @module.send(command, *args)
17
- DATA_COLLECTOR[data_param] << @response.body['response'][param_name] if add_data_to_collector
17
+ DATA_COLLECTOR[data_param] << param_names.inject(@response.body['response']) { |resp, param| resp[param] } if add_data_to_collector
18
18
  end
19
19
 
20
20
  context 'Successful api request' do
@@ -55,34 +55,34 @@ describe Teamlab do
55
55
  describe '#search_people' do
56
56
  it_should_behave_like 'an api request' do
57
57
  let(:command) { :search_people }
58
- let(:args) { random_word(4, true) }
58
+ let(:args) { random_word(4) }
59
59
  end
60
60
  end
61
61
 
62
62
  describe '#filter' do
63
63
  it_should_behave_like 'an api request' do
64
64
  let(:command) { :filter_people }
65
- let(:args) { USER_FILTER }
65
+ let(:args) { { activationStatus: 1 } }
66
66
  end
67
67
  end
68
68
 
69
69
  describe '#add_user' do
70
70
  it_should_behave_like 'an api request' do
71
71
  let(:command) { :add_user }
72
- let(:args) { [random_bool, random_email, random_word(rand(10), true), random_word(rand(10), true)] }
72
+ let(:args) { [random_bool, random_email, random_word.capitalize, random_word.capitalize] }
73
73
  let(:add_data_to_collector) { true }
74
- let(:data_param) {:user_ids}
75
- let(:param_name) {'id'}
74
+ let(:data_param) {:new_user_ids}
75
+ let(:param_names) {%w(id)}
76
76
  end
77
77
  end
78
78
 
79
79
  describe '#get_user_by_username' do
80
80
  it_should_behave_like 'an api request' do
81
81
  let(:command) { :get_user_by_username }
82
- let(:args) { DATA_COLLECTOR[:user_ids].first }
82
+ let(:args) { DATA_COLLECTOR[:new_user_ids].first }
83
83
  let(:add_data_to_collector) { true }
84
84
  let(:data_param) {:emails}
85
- let(:param_name) {'email'}
85
+ let(:param_names) {%w(email)}
86
86
  end
87
87
  end
88
88
 
@@ -103,7 +103,7 @@ describe Teamlab do
103
103
  describe '#remind_password' do
104
104
  it_should_behave_like 'an api request' do
105
105
  let(:command) { :remind_password }
106
- let(:args) { [DATA_COLLECTOR[:user_ids].first, DATA_COLLECTOR[:emails].pop] }
106
+ let(:args) { [DATA_COLLECTOR[:new_user_ids].first, DATA_COLLECTOR[:emails].pop] }
107
107
  end
108
108
  end
109
109
 
@@ -117,14 +117,14 @@ describe Teamlab do
117
117
  describe '#update_contacts' do
118
118
  it_should_behave_like 'an api request' do
119
119
  let(:command) { :update_contacts }
120
- let(:args) { [DATA_COLLECTOR[:user_ids].sample, USER_CONTACTS] }
120
+ let(:args) { [random_id(:new_user), USER_CONTACTS] }
121
121
  end
122
122
  end
123
123
 
124
124
  describe '#send_invite' do
125
125
  it_should_behave_like 'an api request' do
126
126
  let(:command) { :send_invite }
127
- let(:args) { [DATA_COLLECTOR[:user_ids]] }
127
+ let(:args) { [DATA_COLLECTOR[:new_user_ids]] }
128
128
  end
129
129
  end
130
130
 
@@ -138,61 +138,62 @@ describe Teamlab do
138
138
  describe '#update_user' do
139
139
  it_should_behave_like 'an api request' do
140
140
  let(:command) { :update_user }
141
- let(:args) { [DATA_COLLECTOR[:user_ids].sample, random_bool, random_email, random_word, random_word, { comment: random_word}] }
141
+ let(:args) { [random_id(:new_user), random_bool, random_email, random_word, random_word, { comment: random_word}] }
142
142
  end
143
143
  end
144
144
 
145
145
  describe '#change_people_type' do
146
146
  it_should_behave_like 'an api request' do
147
147
  let(:command) { :change_people_type }
148
- let(:args) { [USER_TYPES.sample, DATA_COLLECTOR[:user_ids]] }
148
+ let(:args) { [USER_TYPES.sample, DATA_COLLECTOR[:new_user_ids]] }
149
149
  end
150
150
  end
151
151
 
152
152
  describe '#update_photo' do
153
153
  it_should_behave_like 'an api request' do
154
154
  let(:command) { :update_photo }
155
- let(:args) { [DATA_COLLECTOR[:user_ids].sample, PATH_TO_IMAGE] }
155
+ let(:args) { [random_id(:new_user), PATH_TO_IMAGE] }
156
156
  end
157
157
  end
158
158
 
159
159
  describe '#change_people_status' do
160
160
  it_should_behave_like 'an api request' do
161
161
  let(:command) { :change_people_status }
162
- let(:args) { [ USER_STATUSES.sample, DATA_COLLECTOR[:user_ids]] }
162
+ let(:args) { [ USER_STATUSES.sample, DATA_COLLECTOR[:new_user_ids]] }
163
163
  end
164
164
  end
165
165
 
166
166
  describe '#add_contacts' do
167
167
  it_should_behave_like 'an api request' do
168
168
  let(:command) { :add_contacts }
169
- let(:args) { [ USER_CONTACTS, DATA_COLLECTOR[:user_ids].sample] }
169
+ let(:args) { [ USER_CONTACTS, random_id(:new_user)] }
170
170
  end
171
171
  end
172
172
 
173
173
  describe '#delete_photo' do
174
174
  it_should_behave_like 'an api request' do
175
175
  let(:command) { :delete_photo }
176
- let(:args) { DATA_COLLECTOR[:user_ids].sample }
176
+ let(:args) { random_id(:new_user) }
177
177
  end
178
178
  end
179
179
 
180
180
  describe '#delete_contacts' do
181
181
  it_should_behave_like 'an api request' do
182
182
  let(:command) { :delete_contacts }
183
- let(:args) { [DATA_COLLECTOR[:user_ids].sample, USER_CONTACTS] }
183
+ let(:args) { [random_id(:new_user), USER_CONTACTS] }
184
184
  end
185
185
  end
186
186
 
187
187
  describe '#delete_user' do
188
188
  it_should_behave_like 'an api request' do
189
189
  let(:command) { :delete_user }
190
- let(:args) { DATA_COLLECTOR[:user_ids].pop }
190
+ let(:args) { DATA_COLLECTOR[:new_user_ids].pop }
191
191
  end
192
192
  end
193
193
  end
194
194
 
195
195
  describe '[Group]' do
196
+
196
197
  let(:teamlab_module) { :group }
197
198
 
198
199
  describe '#get_groups' do
@@ -201,71 +202,75 @@ describe Teamlab do
201
202
  end
202
203
  end
203
204
 
204
- describe '#get_group' do
205
+ describe '#add_group' do
205
206
  it_should_behave_like 'an api request' do
206
- let(:command) { :get_group }
207
- let(:args) { GROUP_ID }
207
+ let(:command) { :add_group }
208
+ let(:args) { [random_id(:user), random_word, DATA_COLLECTOR[:user_ids]] }
209
+ let(:add_data_to_collector) { true }
210
+ let(:data_param) {:group_ids}
211
+ let(:param_names) {%w(id)}
208
212
  end
209
213
  end
210
214
 
211
- describe '#add_group' do
215
+ describe '#get_group' do
212
216
  it_should_behave_like 'an api request' do
213
- let(:command) { :add_group }
214
- let(:args) { [USER_ID, GROUP_NAME, FEW_USER_IDS] }
217
+ let(:command) { :get_group }
218
+ let(:args) { random_id(:group) }
215
219
  end
216
220
  end
217
221
 
218
222
  describe '#replace_members' do
219
223
  it_should_behave_like 'an api request' do
220
224
  let(:command) { :replace_members }
221
- let(:args) { [GROUP_ID_FOR_OPERATIONS, FEW_USER_IDS] }
225
+ let(:args) { [random_id(:group), DATA_COLLECTOR[:user_ids]] }
222
226
  end
223
227
  end
224
228
 
225
229
  describe '#update_group' do
226
230
  it_should_behave_like 'an api request' do
227
231
  let(:command) { :update_group }
228
- let(:args) { [GROUP_ID_FOR_OPERATIONS, GROUP_UPDATE_OPTIONS] }
232
+ let(:args) { [random_id(:group), { groupManager: random_id(:user), groupName: random_word, members: DATA_COLLECTOR[:user_ids] }] }
229
233
  end
230
234
  end
231
235
 
232
236
  describe '#add_group_users' do
233
237
  it_should_behave_like 'an api request' do
234
238
  let(:command) { :add_group_users }
235
- let(:args) { [GROUP_ID_FOR_OPERATIONS, FEW_USER_IDS] }
239
+ let(:args) { [random_id(:group), DATA_COLLECTOR[:user_ids]] }
236
240
  end
237
241
  end
238
242
 
239
243
  describe '#set_group_manager' do
240
244
  it_should_behave_like 'an api request' do
241
245
  let(:command) { :set_group_manager }
242
- let(:args) { [GROUP_ID_FOR_OPERATIONS, USER_ID] }
246
+ let(:args) { [random_id(:group), random_id(:user)] }
243
247
  end
244
248
  end
245
249
 
246
250
  describe '#move_group_members' do
247
251
  it_should_behave_like 'an api request' do
248
252
  let(:command) { :move_group_members }
249
- let(:args) { [GROUP_ID_FOR_OPERATIONS, GROUP_ID] }
253
+ let(:args) { [random_id(:group), random_id(:group)] }
250
254
  end
251
255
  end
252
256
 
253
- describe '#delete_group' do
257
+ describe '#remove_group_members' do
254
258
  it_should_behave_like 'an api request' do
255
- let(:command) { :delete_group }
256
- let(:args) { GROUP_ID_TO_DELETE }
259
+ let(:command) { :remove_group_members }
260
+ let(:args) { random_id(:group) }
257
261
  end
258
262
  end
259
263
 
260
- describe '#remove_group_members' do
264
+ describe '#delete_group' do
261
265
  it_should_behave_like 'an api request' do
262
- let(:command) { :remove_group_members }
263
- let(:args) { GROUP_ID_FOR_OPERATIONS }
266
+ let(:command) { :delete_group }
267
+ let(:args) { DATA_COLLECTOR[:group_ids].pop }
264
268
  end
265
269
  end
266
270
  end
267
271
 
268
272
  describe '[Settings]' do
273
+
269
274
  let(:teamlab_module) { :settings }
270
275
 
271
276
  describe '#get_settings' do
@@ -295,210 +300,247 @@ describe Teamlab do
295
300
  describe '#get_security' do
296
301
  it_should_behave_like 'an api request' do
297
302
  let(:command) { :get_security }
298
- let(:args) { [SETTINGS_ENTITY_IDS] }
303
+ let(:args) { [random_settings_entity_id] }
299
304
  end
300
305
  end
301
306
 
302
307
  describe '#get_admin_security' do
303
308
  it_should_behave_like 'an api request' do
304
309
  let(:command) { :get_admin_security }
305
- let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_TEST_USER] }
310
+ let(:args) { [random_settings_entity_id, random_id(:user)] }
306
311
  end
307
312
  end
308
313
 
309
314
  describe '#get_product_admin' do
310
315
  it_should_behave_like 'an api request' do
311
316
  let(:command) { :get_product_admin }
312
- let(:args) { [SETTINGS_TALK_MODULE_ID] }
317
+ let(:args) { [random_settings_entity_id] }
313
318
  end
314
319
  end
315
320
 
316
321
  describe '#set_version' do
317
322
  it_should_behave_like 'an api request' do
318
323
  let(:command) { :set_version }
319
- let(:args) { [SETTINGS_VERSION] }
324
+ let(:args) { [rand(2..50)] }
320
325
  end
321
326
  end
322
327
 
323
328
  describe '#set_security' do
324
329
  it_should_behave_like 'an api request' do
325
330
  let(:command) { :set_security }
326
- let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_FOR_TALK] }
331
+ let(:args) { [random_settings_entity_id, {enabled: random_bool}] }
327
332
  end
328
333
  end
329
334
 
330
335
  describe '#set_access' do
331
336
  it_should_behave_like 'an api request' do
332
337
  let(:command) { :set_access }
333
- let(:args) { [SETTINGS_TALK_MODULE_ID] }
338
+ let(:args) { [random_settings_entity_id, random_bool] }
334
339
  end
335
340
  end
336
341
 
337
342
  describe '#set_product_admin' do
338
343
  it_should_behave_like 'an api request' do
339
344
  let(:command) { :set_product_admin }
340
- let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_TEST_USER] }
345
+ let(:args) { [random_settings_entity_id, random_id(:user)] }
341
346
  end
342
347
  end
343
348
  end
344
349
 
345
- describe '[Settings]' do
350
+ describe '[Files]' do
351
+
346
352
  let(:teamlab_module) { :files }
347
353
 
348
354
  describe '#get_my_files' do
349
355
  it_should_behave_like 'an api request' do
350
356
  let(:command) { :get_my_files }
357
+ #let(:add_data_to_collector) { true }
358
+ #let(:data_param) {:my_documents_ids}
359
+ #let(:param_names) {%w(current id)}
351
360
  end
352
361
  end
353
362
 
354
363
  describe '#get_trash' do
355
364
  it_should_behave_like 'an api request' do
356
365
  let(:command) { :get_trash }
366
+ let(:add_data_to_collector) { true }
367
+ let(:data_param) {:trash_documents_ids}
368
+ let(:param_names) {%w(current id)}
357
369
  end
358
370
  end
359
371
 
360
- describe '#get_folder' do
372
+ describe '#get_shared_docs' do
361
373
  it_should_behave_like 'an api request' do
362
- let(:command) { :get_folder }
363
- let(:args) { FOLDER_COMMON_DOCS_ID }
374
+ let(:command) { :get_shared_docs }
375
+ let(:add_data_to_collector) { true }
376
+ let(:data_param) {:shared_documents_ids}
377
+ let(:param_names) {%w(current id)}
364
378
  end
365
379
  end
366
380
 
367
- describe '#new_folder' do
381
+ describe '#get_common_docs' do
368
382
  it_should_behave_like 'an api request' do
369
- let(:command) { :new_folder }
370
- let(:args) { ['1553123', FOLDER_TITLE] }
383
+ let(:command) { :get_common_docs }
384
+ let(:add_data_to_collector) { true }
385
+ let(:data_param) {:common_documents_ids}
386
+ let(:param_names) {%w(current id)}
371
387
  end
372
388
  end
373
389
 
374
- describe '#rename_folder' do
390
+ describe '#new_folder' do
375
391
  it_should_behave_like 'an api request' do
376
- let(:command) { :rename_folder }
377
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, FOLDER_TITLE] }
392
+ let(:command) { :new_folder }
393
+ let(:args) { [random_id(:my_documents), random_word] }
394
+ let(:add_data_to_collector) { true }
395
+ let(:data_param) {:new_folder_ids}
396
+ let(:param_names) {%w(current id)}
378
397
  end
379
398
  end
380
399
 
381
- describe '#get_shared_docs' do
400
+ describe '#get_folder' do
382
401
  it_should_behave_like 'an api request' do
383
- let(:command) { :get_shared_docs }
402
+ let(:command) { :get_folder }
403
+ let(:args) { random_id(:new_folder) }
384
404
  end
385
405
  end
386
406
 
387
- describe '#get_common_docs' do
407
+ describe '#rename_folder' do
388
408
  it_should_behave_like 'an api request' do
389
- let(:command) { :get_common_docs }
409
+ let(:command) { :rename_folder }
410
+ let(:args) { [random_id(:new_folder), random_word] }
390
411
  end
391
412
  end
392
413
 
393
414
  describe '#search' do
394
415
  it_should_behave_like 'an api request' do
395
416
  let(:command) { :search }
396
- let(:args) { FOLDER_TITLE }
417
+ let(:args) { random_word }
397
418
  end
398
419
  end
399
420
 
400
421
  describe '#get_recent_upload_files' do
401
422
  it_should_behave_like 'an api request' do
402
423
  let(:command) { :get_recent_upload_files }
403
- let(:args) { FOLDER_COMMON_DOCS_ID }
424
+ let(:args) { [random_id(:my_documents)] }
404
425
  end
405
426
  end
406
427
 
407
- describe '#get_share_link' do
408
- it_should_behave_like 'an api request' do
409
- let(:command) { :get_share_link }
410
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILES_SHARE_TYPE] }
411
- end
412
- end
413
-
414
- describe '#upload_to_my_docs' do
415
- it_should_behave_like 'an api request' do
416
- let(:command) { :upload_to_my_docs }
417
- let(:args) { FILE_TO_UPLOAD }
418
- end
419
- end
420
-
421
- describe '#upload_to_common_docs' do
428
+ describe '#create_file' do
422
429
  it_should_behave_like 'an api request' do
423
- let(:command) { :upload_to_common_docs }
424
- let(:args) { FILE_TO_UPLOAD }
430
+ let(:command) { :create_file }
431
+ let(:args) { [random_id(:new_folder), random_word] }
432
+ let(:add_data_to_collector) { true }
433
+ let(:data_param) {:new_file_ids}
434
+ let(:param_names) {%w(id)}
425
435
  end
426
436
  end
427
437
 
428
- describe '#upload_to_folder' do
438
+ describe '#generate_shared_link' do
429
439
  it_should_behave_like 'an api request' do
430
- let(:command) { :upload_to_folder }
431
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILE_TO_UPLOAD] }
440
+ let(:command) { :generate_shared_link }
441
+ let(:args) { [random_id(:new_file), FILES_SHARE_TYPES.sample] }
432
442
  end
433
443
  end
434
444
 
435
- describe '#chunked_upload' do
436
- it_should_behave_like 'an api request' do
437
- let(:command) { :chunked_upload }
438
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILE_TO_UPLOAD] }
439
- end
440
- end
445
+ #describe '#upload_to_my_docs' do
446
+ # it_should_behave_like 'an api request' do
447
+ # let(:command) { :upload_to_my_docs }
448
+ # let(:args) { FILE_TO_UPLOAD }
449
+ # end
450
+ #end
451
+ #
452
+ #describe '#upload_to_common_docs' do
453
+ # it_should_behave_like 'an api request' do
454
+ # let(:command) { :upload_to_common_docs }
455
+ # let(:args) { FILE_TO_UPLOAD }
456
+ # end
457
+ #end
458
+ #
459
+ #describe '#upload_to_folder' do
460
+ # it_should_behave_like 'an api request' do
461
+ # let(:command) { :upload_to_folder }
462
+ # let(:args) { [random_id(:new_folder), FILE_TO_UPLOAD] }
463
+ # end
464
+ #end
465
+ #
466
+ #describe '#chunked_upload' do
467
+ # it_should_behave_like 'an api request' do
468
+ # let(:command) { :chunked_upload }
469
+ # let(:args) { [random_id(:new_folder), FILE_TO_UPLOAD] }
470
+ # end
471
+ #end
441
472
 
442
473
  describe '#create_txt_in_my_docs' do
443
474
  it_should_behave_like 'an api request' do
444
475
  let(:command) { :create_txt_in_my_docs }
445
- let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
476
+ let(:args) { [random_word, random_word(rand(100))] }
477
+ #let(:add_data_to_collector) { true }
478
+ #let(:data_param) {:some_file_ids}
479
+ #let(:param_names) {%w(current id)}
446
480
  end
447
481
  end
448
482
 
449
483
  describe '#create_html_in_my_docs' do
450
484
  it_should_behave_like 'an api request' do
451
485
  let(:command) { :create_html_in_my_docs }
452
- let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
486
+ let(:args) { [random_word, random_word(rand(100))] }
487
+ #let(:add_data_to_collector) { true }
488
+ #let(:data_param) {:some_file_ids}
489
+ #let(:param_names) {%w(current id)}
453
490
  end
454
491
  end
455
492
 
456
493
  describe '#create_txt_in_common_docs' do
457
494
  it_should_behave_like 'an api request' do
458
495
  let(:command) { :create_txt_in_common_docs }
459
- let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
496
+ let(:args) { [random_word, random_word(rand(100))] }
497
+ #let(:add_data_to_collector) { true }
498
+ #let(:data_param) {:some_file_ids}
499
+ #let(:param_names) {%w(current id)}
460
500
  end
461
501
  end
462
502
 
463
503
  describe '#create_html_in_common_docs' do
464
504
  it_should_behave_like 'an api request' do
465
505
  let(:command) { :create_html_in_common_docs }
466
- let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
506
+ let(:args) { [random_word, random_word(rand(100))] }
507
+ #let(:add_data_to_collector) { true }
508
+ #let(:data_param) {:some_file_ids}
509
+ #let(:param_names) {%w(current id)}
467
510
  end
468
511
  end
469
512
 
470
513
  describe '#create_txt' do
471
514
  it_should_behave_like 'an api request' do
472
515
  let(:command) { :create_txt }
473
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME, NEW_FILE_CONTENT] }
516
+ let(:args) { [random_id(:new_folder), random_word, random_word(rand(100))] }
517
+ #let(:add_data_to_collector) { true }
518
+ #let(:data_param) {:some_file_ids}
519
+ #let(:param_names) {%w(current id)}
474
520
  end
475
521
  end
476
522
 
477
523
  describe '#create_html' do
478
524
  it_should_behave_like 'an api request' do
479
525
  let(:command) { :create_html }
480
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME, NEW_FILE_CONTENT] }
481
- end
482
- end
483
-
484
- describe '#create_file' do
485
- it_should_behave_like 'an api request' do
486
- let(:command) { :create_file }
487
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME] }
526
+ let(:args) { [random_id(:new_folder), random_word, random_word(rand(100))] }
527
+ #let(:add_data_to_collector) { true }
528
+ #let(:data_param) {:some_file_ids}
529
+ #let(:param_names) {%w(current id)}
488
530
  end
489
531
  end
490
532
 
491
533
  describe '#get_file_info' do
492
534
  it_should_behave_like 'an api request' do
493
535
  let(:command) { :get_file_info }
494
- let(:args) { FILE_FOR_OPERATIONS_ID }
536
+ let(:args) { [random_id(:new_file)] }
495
537
  end
496
538
  end
497
539
 
498
540
  describe '#get_file_history' do
499
541
  it_should_behave_like 'an api request' do
500
542
  let(:command) { :get_file_history }
501
- let(:args) { FILE_FOR_OPERATIONS_ID }
543
+ let(:args) { [random_id(:new_file)] }
502
544
  end
503
545
  end
504
546
 
@@ -512,7 +554,7 @@ describe Teamlab do
512
554
  describe '#update_file_info' do
513
555
  it_should_behave_like 'an api request' do
514
556
  let(:command) { :update_file_info }
515
- let(:args) { [FILE_FOR_OPERATIONS_ID, NEW_FILE_NAME, FILE_FOR_OPERATIONS_VERSION] }
557
+ let(:args) { [random_id(:new_file), random_word, 1] }
516
558
  end
517
559
  end
518
560
 
@@ -525,21 +567,7 @@ describe Teamlab do
525
567
  describe '#import_from_third_party' do
526
568
  it_should_behave_like 'an api request' do
527
569
  let(:command) { :import_from_third_party }
528
- let(:args) { [THIRD_PARTY_SERVICE, THIRD_PARTY_FOLDER_ID, IGNORE_COINCIDENCE_FILES, DATA_TO_IMPORT, THIRD_PARTY_LOGIN_DATA] }
529
- end
530
- end
531
-
532
- describe '#delete_file' do
533
- it_should_behave_like 'an api request' do
534
- let(:command) { :delete_file }
535
- let(:args) { FILE_TO_DELETE_ID }
536
- end
537
- end
538
-
539
- describe '#delete_folder' do
540
- it_should_behave_like 'an api request' do
541
- let(:command) { :delete_folder }
542
- let(:args) { FOLDER_TO_DELETE_ID }
570
+ let(:args) { [THIRD_PARTY_SERVICE, THIRD_PARTY_FOLDER_ID, random_bool, [], THIRD_PARTY_LOGIN_DATA] }
543
571
  end
544
572
  end
545
573
 
@@ -552,21 +580,21 @@ describe Teamlab do
552
580
  describe '#move_files' do
553
581
  it_should_behave_like 'an api request' do
554
582
  let(:command) { :move_files }
555
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, { folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID], overwrite: true}] }
583
+ let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool}] }
556
584
  end
557
585
  end
558
586
 
559
587
  describe '#copy_to_folder' do
560
588
  it_should_behave_like 'an api request' do
561
589
  let(:command) { :copy_to_folder }
562
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, { folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID], overwrite: true}] }
590
+ let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool}] }
563
591
  end
564
592
  end
565
593
 
566
594
  describe '#delete' do
567
595
  it_should_behave_like 'an api request' do
568
596
  let(:command) { :delete }
569
- let(:args) { [ folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID] ] }
597
+ let(:args) { [ folderIds: [], fileids: [] ] }
570
598
  end
571
599
  end
572
600
 
@@ -576,64 +604,58 @@ describe Teamlab do
576
604
  end
577
605
  end
578
606
 
579
- describe '#clear_recycle_bin' do
580
- it_should_behave_like 'an api request' do
581
- let(:command) { :clear_recycle_bin }
582
- end
583
- end
584
-
585
607
  describe '#mark_as_read' do
586
608
  it_should_behave_like 'an api request' do
587
- let(:command) { :clear_recycle_bin }
609
+ let(:command) { :mark_as_read }
588
610
  end
589
611
  end
590
612
 
591
613
  describe '#finish_operations' do
592
614
  it_should_behave_like 'an api request' do
593
615
  let(:command) { :finish_operations }
594
- let(:args) { [ folderIds: [FOLDER_FOR_OPERATIONS_ID], fileids: [FILE_FOR_OPERATIONS_ID] ] }
616
+ let(:args) { [ folderIds: [random_id(:new_folder)], fileids: [random_id(:new_file)] ] }
595
617
  end
596
618
  end
597
619
 
598
620
  describe '#get_file_sharing' do
599
621
  it_should_behave_like 'an api request' do
600
622
  let(:command) { :get_file_sharing }
601
- let(:args) { FILE_FOR_OPERATIONS_ID }
623
+ let(:args) { [random_id(:new_file)] }
602
624
  end
603
625
  end
604
626
 
605
627
  describe '#get_folder_sharing' do
606
628
  it_should_behave_like 'an api request' do
607
629
  let(:command) { :get_folder_sharing }
608
- let(:args) { FOLDER_FOR_OPERATIONS_ID }
630
+ let(:args) { [random_id(:new_folder)] }
609
631
  end
610
632
  end
611
633
 
612
634
  describe '#share_file' do
613
635
  it_should_behave_like 'an api request' do
614
636
  let(:command) { :share_file }
615
- let(:args) { [FILE_FOR_OPERATIONS_ID, USER_ID, ACCESS_TYPE, { notify: NOTIFY_USER, sharingMessage: NOTIFICATION_MESSAGE }] }
637
+ let(:args) { [random_id(:new_file), random_id(:user), 1, { notify: random_bool, sharingMessage: random_word }] }
616
638
  end
617
639
  end
618
640
 
619
641
  describe '#share_folder' do
620
642
  it_should_behave_like 'an api request' do
621
643
  let(:command) { :share_folder }
622
- let(:args) { [FOLDER_FOR_OPERATIONS_ID, USER_ID, ACCESS_TYPE, { notify: NOTIFY_USER, sharingMessage: NOTIFICATION_MESSAGE }] }
644
+ let(:args) { [random_id(:new_folder), random_id(:user), 1, { notify: random_bool, sharingMessage: random_word }] }
623
645
  end
624
646
  end
625
647
 
626
648
  describe '#remove_file_sharing_rights' do
627
649
  it_should_behave_like 'an api request' do
628
650
  let(:command) { :remove_file_sharing_rights }
629
- let(:args) { [ FILE_FOR_OPERATIONS_ID, [USER_ID] ] }
651
+ let(:args) { [ random_id(:new_file), [random_id(:user)] ] }
630
652
  end
631
653
  end
632
654
 
633
655
  describe '#remove_folder_sharing_rights' do
634
656
  it_should_behave_like 'an api request' do
635
657
  let(:command) { :remove_folder_sharing_rights }
636
- let(:args) { [ FOLDER_FOR_OPERATIONS_ID, [USER_ID] ] }
658
+ let(:args) { [ random_id(:new_folder), [random_id(:user)] ] }
637
659
  end
638
660
  end
639
661
 
@@ -649,17 +671,66 @@ describe Teamlab do
649
671
  let(:args) { PROVIDER_ID }
650
672
  end
651
673
  end
674
+
675
+ describe '#delete_file' do
676
+ it_should_behave_like 'an api request' do
677
+ let(:command) { :delete_file }
678
+ let(:args) { [DATA_COLLECTOR[:new_file_ids].pop] }
679
+ end
680
+ end
681
+
682
+ describe '#delete_folder' do
683
+ it_should_behave_like 'an api request' do
684
+ let(:command) { :delete_folder }
685
+ let(:args) { [DATA_COLLECTOR[:new_folder_ids].pop] }
686
+ end
687
+ end
688
+
689
+ describe '#clear_recycle_bin' do
690
+ it_should_behave_like 'an api request' do
691
+ let(:command) { :clear_recycle_bin }
692
+ end
693
+ end
652
694
  end
653
695
 
654
696
  describe '[Project]' do
655
- let(:teamlab_module) { :project }
656
697
 
657
- describe '#get_import_status' do
658
- it_should_behave_like 'an api request' do
659
- let(:command) { :get_import_status }
698
+ describe 'Preparing enviroment' do
699
+ describe '#add_user' do
700
+ it_should_behave_like 'an api request' do
701
+ let(:teamlab_module) { :people }
702
+ let(:command) { :add_user }
703
+ let(:args) { [false, random_email, random_word.capitalize, random_word.capitalize] }
704
+ let(:add_data_to_collector) { true }
705
+ let(:data_param) { :user_ids }
706
+ let(:param_names) { %w(id) }
707
+ end
708
+ end
709
+
710
+ describe '#get_my_files' do
711
+ it_should_behave_like 'an api request' do
712
+ let(:teamlab_module) { :files }
713
+ let(:command) { :get_my_files }
714
+ let(:add_data_to_collector) { true }
715
+ let(:data_param) { :my_documents_ids }
716
+ let(:param_names) { %w(current id) }
717
+ end
718
+ end
719
+
720
+ describe '#create_file' do
721
+ it_should_behave_like 'an api request' do
722
+ let(:teamlab_module) { :files }
723
+ let(:command) { :create_file }
724
+ let(:args) { [random_id(:my_documents), random_word] }
725
+ let(:add_data_to_collector) { true }
726
+ let(:data_param) { :file_ids }
727
+ let(:param_names) { %w(id) }
728
+ end
660
729
  end
661
730
  end
662
731
 
732
+ let(:teamlab_module) { :project }
733
+
663
734
  describe '#add_importing_url_to_queue' do
664
735
  it_should_behave_like 'an api request' do
665
736
  let(:command) { :add_importing_url_to_queue }
@@ -670,18 +741,114 @@ describe Teamlab do
670
741
  describe '#get_projects_for_import' do
671
742
  it_should_behave_like 'an api request' do
672
743
  let(:command) { :get_projects_for_import }
744
+ let(:args) { [BASECAMP_URL, BASECAMP_LOGIN, BASECAMP_PSW] }
673
745
  end
674
746
  end
675
747
 
676
- describe '#get_projects' do
748
+ describe '#get_import_status' do
677
749
  it_should_behave_like 'an api request' do
678
- let(:command) { :get_projects }
750
+ let(:command) { :get_import_status }
679
751
  end
680
752
  end
681
753
 
682
- describe '#get_import_status' do
754
+ describe '#create_project' do
683
755
  it_should_behave_like 'an api request' do
684
- let(:command) { :get_import_status }
756
+ let(:command) { :create_project }
757
+ let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool] }
758
+ let(:add_data_to_collector) { true }
759
+ let(:data_param) { :project_ids }
760
+ let(:param_names) { %w(id) }
761
+ end
762
+ end
763
+
764
+ describe '#add_message' do
765
+ it_should_behave_like 'an api request' do
766
+ let(:command) { :add_message }
767
+ let(:args) { [random_id(:project), random_word, random_word, DATA_COLLECTOR[:user_ids].join(',')] }
768
+ let(:add_data_to_collector) { true }
769
+ let(:data_param) { :discussion_ids }
770
+ let(:param_names) { %w(id) }
771
+ end
772
+ end
773
+
774
+ describe '#create_template' do
775
+ it_should_behave_like 'an api request' do
776
+ let(:command) { :create_template }
777
+ let(:args) { [random_word] }
778
+ let(:add_data_to_collector) { true }
779
+ let(:data_param) { :project_template_ids }
780
+ let(:param_names) { %w(id) }
781
+ end
782
+ end
783
+
784
+ describe '#add_task' do
785
+ it_should_behave_like 'an api request' do
786
+ let(:command) { :add_task }
787
+ let(:args) { [random_id(:project), random_word] }
788
+ let(:add_data_to_collector) { true }
789
+ let(:data_param) { :project_task_ids }
790
+ let(:param_names) { %w(id) }
791
+ end
792
+ end
793
+
794
+ describe '#add_task_from_discussion' do
795
+ it_should_behave_like 'an api request' do
796
+ let(:command) { :add_task_from_discussion }
797
+ let(:args) { [random_id(:project), random_id(:discussion)] }
798
+ end
799
+ end
800
+
801
+ describe '#create_subtask' do
802
+ it_should_behave_like 'an api request' do
803
+ let(:command) { :get_my_tasks_with_status }
804
+ let(:args) { [random_id(:project_task), random_id(:user), random_word] }
805
+ let(:add_data_to_collector) { true }
806
+ let(:data_param) { :project_subtask_ids }
807
+ let(:param_names) { %w(id) }
808
+ end
809
+ end
810
+
811
+ describe '#upload_file_to_task' do
812
+ it_should_behave_like 'an api request' do
813
+ let(:command) { :upload_file_to_task }
814
+ let(:args) { [random_id(:project_task), [random_id(:file)]] }
815
+ end
816
+ end
817
+
818
+ describe '#upload_file_to_message' do
819
+ it_should_behave_like 'an api request' do
820
+ let(:command) { :upload_file_to_message }
821
+ let(:args) { [random_id(:discussion), [random_id(:file)]] }
822
+ end
823
+ end
824
+
825
+ describe '#add_milestone' do
826
+ it_should_behave_like 'an api request' do
827
+ let(:command) { :add_milestone }
828
+ let(:args) { [random_id(:project), random_word, DateTime.commercial(2015).to_s, random_id(:user)] }
829
+ let(:add_data_to_collector) { true }
830
+ let(:data_param) { :project_milestone_ids }
831
+ let(:param_names) { %w(id) }
832
+ end
833
+ end
834
+
835
+ describe '#add_task_comment' do
836
+ it_should_behave_like 'an api request' do
837
+ let(:command) { :add_task_comment }
838
+ let(:args) { [random_id(:project_task), random_word] }
839
+ let(:add_data_to_collector) { true }
840
+ let(:data_param) { :comment_ids }
841
+ let(:param_names) { %w(id) }
842
+ end
843
+ end
844
+
845
+ describe '#add_message_comment' do
846
+ it_should_behave_like 'an api request' do
847
+ let(:command) { :add_message_comment }
848
+ let(:args) { [random_id(:project_task), random_word] }
849
+ let(:add_data_to_collector) { true }
850
+ let(:data_param) { :comment_ids }
851
+ let(:param_names) { %w(id) }
685
852
  end
686
853
  end
687
854
 
@@ -694,113 +861,475 @@ describe Teamlab do
694
861
  describe '#get_message_by_filter' do
695
862
  it_should_behave_like 'an api request' do
696
863
  let(:command) { :get_message_by_filter }
864
+ let(:args) { [{projectId: random_id(:project)}] }
697
865
  end
698
866
  end
699
867
 
700
868
  describe '#get_messages' do
701
869
  it_should_behave_like 'an api request' do
702
870
  let(:command) { :get_messages }
703
- let(:args) { PROJECT_ID_FOR_OPERATIONS }
871
+ let(:args) { [random_id(:project)] }
704
872
  end
705
873
  end
706
874
 
707
- describe '#get_message' do
875
+ describe '#check_subscription_to_discussion' do
708
876
  it_should_behave_like 'an api request' do
709
- let(:command) { :get_message }
710
- let(:args) { MESSAGE_ID }
877
+ let(:command) { :check_subscription_to_discussion }
878
+ let(:args) { [random_id(:discussion)] }
711
879
  end
712
880
  end
713
881
 
714
- describe '#check_subscription_to_discussion' do
882
+ describe '#update_message' do
715
883
  it_should_behave_like 'an api request' do
716
- let(:command) { :check_subscription_to_discussion }
717
- let(:args) { MESSAGE_ID }
884
+ let(:command) { :update_message }
885
+ let(:args) { [random_id(:discussion), random_id(:project), random_word, random_word] }
718
886
  end
719
887
  end
720
888
 
721
- describe '#add_message' do
889
+ describe '#subscribe_to_message_action' do
722
890
  it_should_behave_like 'an api request' do
723
- let(:command) { :add_message }
724
- let(:args) { [PROJECT_ID_FOR_OPERATIONS, MESSAGE_TITLE, MESSAGE_CONTENT, USERS_TO_DELETE] }
891
+ let(:command) { :subscribe_to_message_action }
892
+ let(:args) { [random_id(:discussion)] }
725
893
  end
726
894
  end
727
895
 
728
- describe '#upload_file_to_task' do
896
+ describe '#get_task_files' do
729
897
  it_should_behave_like 'an api request' do
730
- let(:command) { :upload_file_to_task }
731
- let(:args) { [TASK_ID, FEW_FILES_IDS] }
898
+ let(:command) { :get_task_files }
899
+ let(:args) { [random_id(:project_task)] }
900
+ end
901
+ end
902
+
903
+ describe '#get_entity_files' do
904
+ it_should_behave_like 'an api request' do
905
+ let(:command) { :get_entity_files }
906
+ let(:args) { [random_id(:project_task), 'Task'] }
907
+ end
908
+ end
909
+
910
+ describe '#get_message_files' do
911
+ it_should_behave_like 'an api request' do
912
+ let(:command) { :get_message_files }
913
+ let(:args) { [random_id(:discussion)] }
914
+ end
915
+ end
916
+
917
+ describe '#get_comment' do
918
+ it_should_behave_like 'an api request' do
919
+ let(:command) { :get_comment }
920
+ let(:args) { [random_id(:comment)] }
921
+ end
922
+ end
923
+
924
+ describe '#get_task_comments' do
925
+ it_should_behave_like 'an api request' do
926
+ let(:command) { :get_task_comments }
927
+ let(:args) { [random_id(:project_task)] }
928
+ end
929
+ end
930
+
931
+ describe '#get_message_comments' do
932
+ it_should_behave_like 'an api request' do
933
+ let(:command) { :get_message_comments }
934
+ let(:args) { [random_id(:discussion)] }
935
+ end
936
+ end
937
+
938
+ describe '#update_comment' do
939
+ it_should_behave_like 'an api request' do
940
+ let(:command) { :update_comment }
941
+ let(:args) { [random_id(:comment), random_word] }
942
+ end
943
+ end
944
+
945
+ describe '#create_report_template' do
946
+ it_should_behave_like 'an api request' do
947
+ let(:command) { :create_report_template }
948
+ let(:args) { [random_word] }
949
+ let(:add_data_to_collector) { true }
950
+ let(:data_param) { :report_template_ids }
951
+ let(:param_names) { %w(id) }
952
+ end
953
+ end
954
+
955
+ describe '#update_report_template' do
956
+ it_should_behave_like 'an api request' do
957
+ let(:command) { :update_report_template }
958
+ let(:args) { [random_id(:report_template), random_word] }
959
+ end
960
+ end
961
+
962
+ describe '#delete_report_template' do
963
+ it_should_behave_like 'an api request' do
964
+ let(:command) { :delete_report_template }
965
+ let(:args) { [DATA_COLLECTOR[:report_template_ids].pop] }
966
+ end
967
+ end
968
+
969
+ describe '#get_projects' do
970
+ it_should_behave_like 'an api request' do
971
+ let(:command) { :get_projects }
972
+ end
973
+ end
974
+
975
+ describe '#get_project' do
976
+ it_should_behave_like 'an api request' do
977
+ let(:command) { :get_project }
978
+ let(:args) { random_id(:project) }
979
+ end
980
+ end
981
+
982
+ describe '#get_participated_projects' do
983
+ it_should_behave_like 'an api request' do
984
+ let(:command) { :get_participated_projects }
985
+ end
986
+ end
987
+
988
+ describe '#filter_projects' do
989
+ it_should_behave_like 'an api request' do
990
+ let(:command) { :filter_projects }
991
+ end
992
+ end
993
+
994
+ describe '#get_followed_projects' do
995
+ it_should_behave_like 'an api request' do
996
+ let(:command) { :get_followed_projects }
997
+ end
998
+ end
999
+
1000
+ describe '#get_project_by_status' do
1001
+ it_should_behave_like 'an api request' do
1002
+ let(:command) { :get_project_by_status }
1003
+ let(:args) { [PROJECT_STATUSES.sample] }
1004
+ end
1005
+ end
1006
+
1007
+ describe '#get_templates' do
1008
+ it_should_behave_like 'an api request' do
1009
+ let(:command) { :get_templates }
1010
+ end
1011
+ end
1012
+
1013
+ describe '#get_spent_time' do
1014
+ it_should_behave_like 'an api request' do
1015
+ let(:command) { :get_spent_time }
1016
+ let(:args) { [random_id(:project)] }
1017
+ end
1018
+ end
1019
+
1020
+ describe '#get_project_files' do
1021
+ it_should_behave_like 'an api request' do
1022
+ let(:command) { :get_project_files }
1023
+ let(:args) { [random_id(:project)] }
1024
+ end
1025
+ end
1026
+
1027
+ describe '#get_template' do
1028
+ it_should_behave_like 'an api request' do
1029
+ let(:command) { :get_template }
1030
+ let(:args) { [random_id(:project_template)] }
1031
+ end
1032
+ end
1033
+
1034
+ describe '#get_milestones' do
1035
+ it_should_behave_like 'an api request' do
1036
+ let(:command) { :get_milestones }
1037
+ let(:args) { [random_id(:project)] }
1038
+ end
1039
+ end
1040
+
1041
+ describe '#search_all_projects' do
1042
+ it_should_behave_like 'an api request' do
1043
+ let(:command) { :search_all_projects }
1044
+ let(:args) { [random_word] }
1045
+ end
1046
+ end
1047
+
1048
+ describe '#search_project' do
1049
+ it_should_behave_like 'an api request' do
1050
+ let(:command) { :search_project }
1051
+ let(:args) { [random_id(:project), random_word] }
1052
+ end
1053
+ end
1054
+
1055
+ describe '#get_milestones_with_status' do
1056
+ it_should_behave_like 'an api request' do
1057
+ let(:command) { :get_milestones_with_status }
1058
+ let(:args) { [random_id(:project), PROJECT_MILESTONE_STATUSES.sample] }
1059
+ end
1060
+ end
1061
+
1062
+ describe '#update_project_tags' do
1063
+ it_should_behave_like 'an api request' do
1064
+ let(:command) { :update_project_tags }
1065
+ let(:args) { [random_id(:project), random_word(3)] }
1066
+ end
1067
+ end
1068
+
1069
+ describe '#update_project_status' do
1070
+ it_should_behave_like 'an api request' do
1071
+ let(:command) { :update_project_status }
1072
+ let(:args) { [random_id(:project), PROJECT_STATUSES.sample] }
1073
+ end
1074
+ end
1075
+
1076
+ describe '#update_template' do
1077
+ it_should_behave_like 'an api request' do
1078
+ let(:command) { :update_template }
1079
+ let(:args) { [random_id(:project_template), random_word] }
1080
+ end
1081
+ end
1082
+
1083
+ describe '#follow_unfollow_project' do
1084
+ it_should_behave_like 'an api request' do
1085
+ let(:command) { :follow_unfollow_project }
1086
+ let(:args) { [random_id(:project)] }
1087
+ end
1088
+ end
1089
+
1090
+ describe '#get_tasks_by_ids' do
1091
+ it_should_behave_like 'an api request' do
1092
+ let(:command) { :get_tasks_by_ids }
1093
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].sample(rand(2..4))] }
1094
+ end
1095
+ end
1096
+
1097
+ describe '#get_task_order' do
1098
+ it_should_behave_like 'an api request' do
1099
+ let(:command) { :get_task_order }
1100
+ let(:args) { [random_id(:project)] }
1101
+ end
1102
+ end
1103
+
1104
+ describe '#get_simple_task_by_filter' do
1105
+ it_should_behave_like 'an api request' do
1106
+ let(:command) { :get_simple_task_by_filter }
1107
+ let(:args) { [random_id(:project)] }
1108
+ end
1109
+ end
1110
+
1111
+ describe '#add_link' do
1112
+ it_should_behave_like 'an api request' do
1113
+ let(:command) { :add_link }
1114
+ let(:args) { [random_id(:project_task), random_id(:project_task), PROJECT_TASK_LINK_TYPES.sample] }
732
1115
  end
733
1116
  end
734
1117
 
735
1118
  describe '#update_project' do
736
1119
  it_should_behave_like 'an api request' do
737
1120
  let(:command) { :update_project }
738
- let(:args) { [PROJECT_ID_FOR_OPERATIONS, RANDOM_TITLE, RESPONSIBLE_ID, { description: PROJECT_DESCRIPTION}] }
1121
+ let(:args) { [random_id(:project), random_word, random_id(:user), {private: random_bool, notify: random_bool}] }
1122
+ end
1123
+ end
1124
+
1125
+ describe '#set_task_order' do
1126
+ it_should_behave_like 'an api request' do
1127
+ let(:command) { :set_task_order }
1128
+ let(:args) { [random_id(:project_task), '123456'] }
739
1129
  end
740
1130
  end
741
1131
 
742
1132
  describe '#update_project_task' do
743
1133
  it_should_behave_like 'an api request' do
744
1134
  let(:command) { :update_project_task }
745
- let(:args) { [TASK_ID, RANDOM_TITLE] }
1135
+ let(:args) { [random_id(:project_task), random_word] }
1136
+ end
1137
+ end
1138
+
1139
+ describe '#get_project_team' do
1140
+ it_should_behave_like 'an api request' do
1141
+ let(:command) { :get_project_team }
1142
+ let(:args) { [random_id(:project)] }
746
1143
  end
747
1144
  end
748
1145
 
749
1146
  describe '#get_projects_teams' do
750
1147
  it_should_behave_like 'an api request' do
751
1148
  let(:command) { :get_projects_teams }
752
- let(:args) { [[PROJECT_ID_FOR_OPERATIONS, ANOTHER_PROJECT_ID]] }
1149
+ let(:args) { [DATA_COLLECTOR[:project_ids].sample(rand(2..4))] }
1150
+ end
1151
+ end
1152
+
1153
+ describe '#add_to_team' do
1154
+ it_should_behave_like 'an api request' do
1155
+ let(:command) { :add_to_team }
1156
+ let(:args) { [random_id(:project), random_id(:user)] }
1157
+ end
1158
+ end
1159
+
1160
+ describe '#update_project_team' do
1161
+ it_should_behave_like 'an api request' do
1162
+ let(:command) { :update_project_team }
1163
+ let(:args) { [random_id(:project), DATA_COLLECTOR[:user_ids].sample(rand(2..4)), {notify: random_bool}] }
1164
+ end
1165
+ end
1166
+
1167
+ describe '#set_team_security' do
1168
+ it_should_behave_like 'an api request' do
1169
+ let(:command) { :set_team_security }
1170
+ let(:args) { [random_id(:project), random_id(:user), PROJECT_SECURITY_RIGHTS.sample] }
1171
+ end
1172
+ end
1173
+
1174
+ describe '#remove_from_team' do
1175
+ it_should_behave_like 'an api request' do
1176
+ let(:command) { :remove_from_team }
1177
+ let(:args) { [random_id(:project), random_id(:user)] }
1178
+ end
1179
+ end
1180
+
1181
+ describe '#get_my_tasks' do
1182
+ it_should_behave_like 'an api request' do
1183
+ let(:command) { :get_my_tasks }
753
1184
  end
754
1185
  end
755
1186
 
756
1187
  describe '#get_task_by_filter' do
757
1188
  it_should_behave_like 'an api request' do
758
1189
  let(:command) { :get_task_by_filter }
1190
+ let(:args) { [{participant: random_id(:user)}] }
759
1191
  end
760
1192
  end
761
1193
 
762
- describe '#add_task' do
1194
+ describe '#get_task' do
763
1195
  it_should_behave_like 'an api request' do
764
- let(:command) { :add_task }
765
- let(:args) { [PROJECT_ID_FOR_OPERATIONS, RANDOM_TITLE] }
1196
+ let(:command) { :get_task }
1197
+ let(:args) { [random_id(:project_task)] }
766
1198
  end
767
1199
  end
768
1200
 
769
- describe '#add_task_from_discussion' do
1201
+ describe '#get_tasks' do
770
1202
  it_should_behave_like 'an api request' do
771
- let(:command) { :add_task_from_discussion }
772
- let(:args) { [PROJECT_ID_FOR_OPERATIONS, MESSAGE_ID] }
1203
+ let(:command) { :get_tasks }
1204
+ let(:args) { [random_id(:project)] }
773
1205
  end
774
1206
  end
775
1207
 
776
- describe '#update_task_milestone' do
1208
+ describe '#get_my_tasks_by_status' do
777
1209
  it_should_behave_like 'an api request' do
778
- let(:command) { :update_task_milestone }
779
- let(:args) { [TASK_ID, MILESTONE_ID] }
1210
+ let(:command) { :get_my_tasks_by_status }
1211
+ let(:args) { [PROJECT_TASKS_STATUSES.sample] }
780
1212
  end
781
1213
  end
782
1214
 
783
- describe '#update_milestone' do
1215
+ describe '#notify_task_responsible' do
784
1216
  it_should_behave_like 'an api request' do
785
- let(:command) { :update_milestone }
786
- let(:args) { [MILESTONE_ID, RANDOM_TITLE, SOME_DATE] }
1217
+ let(:command) { :notify_task_responsible }
1218
+ let(:args) { [random_id(:project_task)] }
787
1219
  end
788
1220
  end
789
1221
 
790
- describe '#add_task_time' do
1222
+ describe '#get_all_tasks' do
791
1223
  it_should_behave_like 'an api request' do
792
- let(:command) { :add_task_time }
793
- let(:args) { [TASK_ID, RANDOM_NOTE, SIMPLE_DATE, USER_ID, 2, PROJECT_ID_FOR_OPERATIONS] }
1224
+ let(:command) { :get_all_tasks }
1225
+ let(:args) { [random_id(:project)] }
794
1226
  end
795
1227
  end
796
1228
 
797
- describe '#update_task_time' do
1229
+ describe '#get_tasks_with_status' do
798
1230
  it_should_behave_like 'an api request' do
799
- let(:command) { :update_task_time }
800
- let(:args) { [TIME_ID, RANDOM_NOTE, SIMPLE_DATE, USER_ID, 2] }
1231
+ let(:command) { :get_tasks_with_status }
1232
+ let(:args) { [random_id(:project), PROJECT_TASKS_STATUSES.sample] }
801
1233
  end
802
1234
  end
803
- end
1235
+
1236
+ describe '#update_task_status' do
1237
+ it_should_behave_like 'an api request' do
1238
+ let(:command) { :update_task_status }
1239
+ let(:args) { [random_id(:project_task), PROJECT_TASKS_STATUSES.sample] }
1240
+ end
1241
+ end
1242
+
1243
+ describe '#update_subtask' do
1244
+ it_should_behave_like 'an api request' do
1245
+ let(:command) { :update_subtask }
1246
+ let(:args) { [random_id(:project_task), random_id(:project_subtask), random_id(:user), random_word] }
1247
+ end
1248
+ end
1249
+
1250
+ describe '#update_subtask_status' do
1251
+ it_should_behave_like 'an api request' do
1252
+ let(:command) { :update_subtask_status }
1253
+ let(:args) { [random_id(:project_task), random_id(:project_subtask), PROJECT_TASKS_STATUSES.sample] }
1254
+ end
1255
+ end
1256
+
1257
+
1258
+
1259
+ describe '#delete_subtask' do
1260
+ it_should_behave_like 'an api request' do
1261
+ let(:command) { :delete_subtask }
1262
+ let(:args) { [random_id(:project_task), random_id(:project_subtask)] }
1263
+ end
1264
+ end
1265
+
1266
+ describe '#detach_file_from_task' do
1267
+ it_should_behave_like 'an api request' do
1268
+ let(:command) { :detach_file_from_task }
1269
+ let(:args) { [random_id(:project_task), random_id(:file)] }
1270
+ end
1271
+ end
1272
+
1273
+ describe '#detach_file_from_message' do
1274
+ it_should_behave_like 'an api request' do
1275
+ let(:command) { :detach_file_from_task }
1276
+ let(:args) { [random_id(:discussion), random_id(:file)] }
1277
+ end
1278
+ end
1279
+
1280
+ describe '#delete_message_comments' do
1281
+ it_should_behave_like 'an api request' do
1282
+ let(:command) { :delete_comment }
1283
+ let(:args) { [DATA_COLLECTOR[:comment_ids].pop] }
1284
+ end
1285
+ end
1286
+
1287
+ describe '#delete_task_comments' do
1288
+ it_should_behave_like 'an api request' do
1289
+ let(:command) { :delete_comment }
1290
+ puts DATA_COLLECTOR[:project_task_ids].last
1291
+ let(:args) { [DATA_COLLECTOR[:comment_ids].pop] }
1292
+ end
1293
+ end
1294
+
1295
+ describe '#delete_task' do
1296
+ it_should_behave_like 'an api request' do
1297
+ let(:command) { :delete_task }
1298
+ puts DATA_COLLECTOR[:project_task_ids].last
1299
+ let(:args) { DATA_COLLECTOR[:project_task_ids].pop }
1300
+ end
1301
+ end
1302
+
1303
+ describe '#delete_project' do
1304
+ it_should_behave_like 'an api request' do
1305
+ let(:command) { :delete_project }
1306
+ let(:args) { [DATA_COLLECTOR[:project_ids].pop] }
1307
+ end
1308
+ end
1309
+
1310
+ describe '#delete_template' do
1311
+ it_should_behave_like 'an api request' do
1312
+ let(:command) { :delete_template }
1313
+ let(:args) { [DATA_COLLECTOR[:project_template_ids].pop] }
1314
+ end
1315
+ end
1316
+
1317
+ describe '#delete_file' do
1318
+ it_should_behave_like 'an api request' do
1319
+ let(:teamlab_module) { :files }
1320
+ let(:command) { :delete_file }
1321
+ let(:args) { [DATA_COLLECTOR[:file_ids].pop] }
1322
+ end
1323
+ end
1324
+
1325
+ describe '#delete_user' do
1326
+ it_should_behave_like 'an api request' do
1327
+ let(:teamlab_module) { :people }
1328
+ let(:command) { :delete_user }
1329
+ let(:args) { DATA_COLLECTOR[:user_ids].pop }
1330
+ end
1331
+ end
1332
+ end
804
1333
 
805
1334
  describe '[CRM]' do
806
1335
  let(:teamlab_module) { :crm }
@@ -1072,7 +1601,7 @@ describe Teamlab do
1072
1601
  describe '#save_number_settings' do
1073
1602
  it_should_behave_like 'an api request' do
1074
1603
  let(:command) { :save_number_settings }
1075
- let(:args) {[AUTOGENERATED, random_word(3, true), rand(10)]}
1604
+ let(:args) {[AUTOGENERATED, random_word(3).capitalize, rand(10)]}
1076
1605
  end
1077
1606
  end
1078
1607