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,1439 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe '[CRM]' do
4
+ before :all do
5
+ Teamlab.configure do |config|
6
+ config.server = SERVER
7
+ config.username = USERNAME
8
+ config.password = PASSWORD
9
+ end
10
+ end
11
+
12
+ let(:teamlab_module) { :crm }
13
+
14
+ describe '#add_user' do
15
+ it_should_behave_like 'an api request' do
16
+ let(:teamlab_module) { :people }
17
+ let(:command) { :add_user }
18
+ let(:args) { [false, random_email, random_word.capitalize, random_word.capitalize] }
19
+ let(:add_data_to_collector) { true }
20
+ let(:data_param) { :user_ids }
21
+ let(:param_names) { %w(id) }
22
+ end
23
+ end
24
+
25
+ describe '#create_opportunity_stage' do
26
+ it_should_behave_like 'an api request' do
27
+ let(:teamlab_module) { :crm }
28
+ let(:command) { :create_opportunity_stage }
29
+ let(:args) { [random_word.capitalize, COLORS_NAMES.sample] }
30
+ let(:add_data_to_collector) { true }
31
+ let(:data_param) { :opportunity_stage_ids }
32
+ let(:param_names) { %w(id) }
33
+ end
34
+ end
35
+
36
+ describe '#create_person' do
37
+ it_should_behave_like 'an api request' do
38
+ let(:teamlab_module) { :crm }
39
+ let(:command) { :create_person }
40
+ let(:args) { [random_word.capitalize, random_word.capitalize] }
41
+ let(:add_data_to_collector) { true }
42
+ let(:data_param) { :new_contact_ids }
43
+ let(:param_names) { %w(id) }
44
+ end
45
+ end
46
+
47
+ describe '#create_person__for_group' do
48
+ it_should_behave_like 'an api request' do
49
+ let(:teamlab_module) { :crm }
50
+ let(:command) { :create_person }
51
+ let(:args) { [random_word.capitalize, random_word.capitalize] }
52
+ let(:add_data_to_collector) { true }
53
+ let(:data_param) { :new_contact_ids }
54
+ let(:param_names) { %w(id) }
55
+ end
56
+ end
57
+
58
+ describe '#create_opportunity' do
59
+ it_should_behave_like 'an api request' do
60
+ let(:command) { :create_opportunity }
61
+ let(:args) { [random_id(:opportunity_stage), random_word, random_id(:user)] }
62
+ let(:add_data_to_collector) { true }
63
+ let(:data_param) { :opportunity_ids }
64
+ let(:param_names) { %w(id) }
65
+ end
66
+ end
67
+
68
+ describe '#create_opportunity_for_group' do
69
+ it_should_behave_like 'an api request' do
70
+ let(:command) { :create_opportunity }
71
+ let(:args) { [random_id(:opportunity_stage), random_word, random_id(:user)] }
72
+ let(:add_data_to_collector) { true }
73
+ let(:data_param) { :opportunity_ids }
74
+ let(:param_names) { %w(id) }
75
+ end
76
+ end
77
+
78
+ describe '#create_invoice' do
79
+ it_should_behave_like 'an api request' do
80
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
81
+ let(:command) { :create_invoice }
82
+ let(:args) { [] }
83
+ let(:add_data_to_collector) { true }
84
+ let(:data_param) { :invoice_ids }
85
+ let(:param_names) { %w(id) }
86
+ end
87
+ end
88
+
89
+ describe '#create_invoice_for_batch' do
90
+ it_should_behave_like 'an api request' do
91
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
92
+ let(:command) { :create_invoice }
93
+ let(:args) { [] }
94
+ let(:add_data_to_collector) { true }
95
+ let(:data_param) { :invoice_ids }
96
+ let(:param_names) { %w(id) }
97
+ end
98
+ end
99
+
100
+ describe '#create_history_category' do
101
+ it_should_behave_like 'an api request' do
102
+ let(:command) { :create_history_category }
103
+ let(:args) { [random_word, random_word] }
104
+ let(:add_data_to_collector) { true }
105
+ let(:data_param) { :crm_history_category_ids }
106
+ let(:param_names) { %w(id) }
107
+ end
108
+ end
109
+
110
+ describe '#create_invoice_line' do
111
+ it_should_behave_like 'an api request' do
112
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
113
+ let(:command) { :create_invoice_line }
114
+ let(:args) { [random_id(:invoice)] }
115
+ let(:add_data_to_collector) { true }
116
+ let(:data_param) { :invoice_line_ids }
117
+ let(:param_names) { %w(id) }
118
+ end
119
+ end
120
+
121
+ describe '#create_invoice_item' do
122
+ it_should_behave_like 'an api request' do
123
+ let(:command) { :create_invoice_item }
124
+ let(:args) { [random_word, random_word, rand, random_word] }
125
+ let(:add_data_to_collector) { true }
126
+ let(:data_param) { :invoice_item_ids }
127
+ let(:param_names) { %w(id) }
128
+ end
129
+ end
130
+
131
+ describe '#create_invoice_item_for_batch' do
132
+ it_should_behave_like 'an api request' do
133
+ let(:command) { :create_invoice_item }
134
+ let(:args) { [random_word, random_word, rand, random_word] }
135
+ let(:add_data_to_collector) { true }
136
+ let(:data_param) { :invoice_item_ids }
137
+ let(:param_names) { %w(id) }
138
+ end
139
+ end
140
+
141
+ describe '#create_invoice_tax' do
142
+ it_should_behave_like 'an api request' do
143
+ let(:command) { :create_invoice_tax }
144
+ let(:args) { [random_word, random_word] }
145
+ let(:add_data_to_collector) { true }
146
+ let(:data_param) { :invoice_tax_ids }
147
+ let(:param_names) { %w(id) }
148
+ end
149
+ end
150
+
151
+ describe '#create_contact_type' do
152
+ it_should_behave_like 'an api request' do
153
+ let(:command) { :create_contact_type }
154
+ let(:args) { [random_word] }
155
+ let(:add_data_to_collector) { true }
156
+ let(:data_param) { :contact_type_ids }
157
+ let(:param_names) { %w(id) }
158
+ end
159
+ end
160
+
161
+ describe '#create_contact_status' do
162
+ it_should_behave_like 'an api request' do
163
+ let(:command) { :create_contact_status }
164
+ let(:args) { [random_word, COLORS_NAMES.sample] }
165
+ let(:add_data_to_collector) { true }
166
+ let(:data_param) { :contact_status_ids }
167
+ let(:param_names) { %w(id) }
168
+ end
169
+ end
170
+
171
+ describe '#create_company' do
172
+ it_should_behave_like 'an api request' do
173
+ let(:command) { :create_company }
174
+ let(:args) { [random_word, [random_id(:user)]] }
175
+ let(:add_data_to_collector) { true }
176
+ let(:data_param) { :company_ids }
177
+ let(:param_names) { %w(id) }
178
+ end
179
+ end
180
+
181
+ #describe '#create_task_group' do
182
+ # it_should_behave_like 'an api request' do
183
+ # let(:command) { :create_task_group }
184
+ # let(:args) { [random_word] }
185
+ # let(:add_data_to_collector) { true }
186
+ # let(:data_param) { :task_group_ids }
187
+ # let(:param_names) { %w(id) }
188
+ # end
189
+ #end
190
+
191
+ describe '#update_history_category' do
192
+ it_should_behave_like 'an api request' do
193
+ let(:command) { :update_history_category }
194
+ i = -1
195
+ let(:args) { [DATA_COLLECTOR[:crm_history_category_ids][i += 1], random_word] }
196
+ let(:add_data_to_collector) { true }
197
+ let(:data_param) { :history_category_titles }
198
+ let(:param_names) { %w(title) }
199
+ end
200
+ end
201
+
202
+ describe '#create_event' do
203
+ it_should_behave_like 'an api request' do
204
+ let(:command) { :create_event }
205
+ let(:args) { [random_id(:new_contact), random_word, random_id(:crm_history_category)] }
206
+ let(:add_data_to_collector) { true }
207
+ let(:data_param) { :crm_event_ids }
208
+ let(:param_names) { %w(id) }
209
+ end
210
+ end
211
+
212
+ describe '#create_task_category' do
213
+ it_should_behave_like 'an api request' do
214
+ let(:command) { :create_task_category }
215
+ let(:args) { [random_word, random_word] }
216
+ let(:add_data_to_collector) { true }
217
+ let(:data_param) { :crm_task_category_ids }
218
+ let(:param_names) { %w(id) }
219
+ end
220
+ end
221
+
222
+ describe '#update_task_category' do
223
+ it_should_behave_like 'an api request' do
224
+ let(:command) { :update_task_category }
225
+ i = -1
226
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_ids][i += 1], random_word] }
227
+ let(:add_data_to_collector) { true }
228
+ let(:data_param) { :crm_task_category_titles }
229
+ let(:param_names) { %w(title) }
230
+ end
231
+ end
232
+
233
+ describe '#create_task' do
234
+ it_should_behave_like 'an api request' do
235
+ let(:command) { :create_task }
236
+ let(:args) { [random_word, DateTime.commercial(2015).to_s, random_id(:user), random_id(:crm_task_category)] }
237
+ let(:add_data_to_collector) { true }
238
+ let(:data_param) { :crm_task_ids }
239
+ let(:param_names) { %w(id) }
240
+ end
241
+ end
242
+
243
+ describe '#add_contact_info' do
244
+ it_should_behave_like 'an api request' do
245
+ let(:command) { :add_contact_info }
246
+ i = -1
247
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], info_type = CONTACT_INFO_TYPES.sample, random_word, random_info_category(info_type)] }
248
+ let(:add_data_to_collector) { true }
249
+ let(:data_param) { :contact_info_ids }
250
+ let(:param_names) { %w(id) }
251
+ end
252
+ end
253
+
254
+ describe '#quick_person_list_creation' do
255
+ it_should_behave_like 'an api request' do
256
+ pending ('http://bugzserver/show_bug.cgi?id=23997')
257
+ let(:command) { :quick_person_list_creation }
258
+ let(:args) { [[[random_word, random_word], [random_word, random_word]]] }
259
+ end
260
+ end
261
+
262
+ describe '#add_opportunity_contact' do
263
+ it_should_behave_like 'an api request' do
264
+ let(:command) { :add_opportunity_contact }
265
+ i = -1
266
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
267
+ end
268
+ end
269
+
270
+ describe '#create_task_template_container' do
271
+ it_should_behave_like 'an api request' do
272
+ let(:command) { :create_task_template_container }
273
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact'), random_word] }
274
+ let(:add_data_to_collector) { true }
275
+ let(:data_param) { :task_template_container_ids }
276
+ let(:param_names) { %w(id) }
277
+ end
278
+ end
279
+
280
+ describe '#create_task_template' do
281
+ it_should_behave_like 'an api request' do
282
+ let(:command) { :create_task_template }
283
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].last, random_word] }
284
+ let(:add_data_to_collector) { true }
285
+ let(:data_param) { :task_template_ids }
286
+ let(:param_names) { %w(id) }
287
+ end
288
+ end
289
+
290
+ describe '#create_case' do
291
+ it_should_behave_like 'an api request' do
292
+ let(:command) { :create_case }
293
+ let(:args) { [random_word, { members: DATA_COLLECTOR[:new_contact_ids] }] }
294
+ let(:add_data_to_collector) { true }
295
+ let(:data_param) { :crm_case_ids }
296
+ let(:param_names) { %w(id) }
297
+ end
298
+ end
299
+
300
+ describe '#create_case_for_group_deleting' do
301
+ it_should_behave_like 'an api request' do
302
+ let(:command) { :create_case }
303
+ let(:args) { [random_word] }
304
+ let(:add_data_to_collector) { true }
305
+ let(:data_param) { :crm_case_ids }
306
+ let(:param_names) { %w(id) }
307
+ end
308
+ end
309
+
310
+ describe '#create_case_for_group_deleting_by_filter' do
311
+ it_should_behave_like 'an api request' do
312
+ let(:command) { :create_case }
313
+ let(:args) { [random_word] }
314
+ let(:add_data_to_collector) { true }
315
+ let(:data_param) { :crm_case_ids }
316
+ let(:param_names) { %w(id) }
317
+ end
318
+ end
319
+
320
+ describe '#create_user_field' do
321
+ it_should_behave_like 'an api request' do
322
+ let(:command) { :create_user_field }
323
+ let(:args) { [ENTITY_TYPES.last, random_word, rand(6)] }
324
+ let(:add_data_to_collector) { true }
325
+ let(:data_param) { :user_field_ids }
326
+ let(:param_names) { %w(id) }
327
+ end
328
+ end
329
+
330
+ describe '#get_all_opportunity_stages' do
331
+ it_should_behave_like 'an api request' do
332
+ let(:command) { :get_all_opportunity_stages }
333
+ end
334
+ end
335
+
336
+ describe '#get_curreny_list' do
337
+ it_should_behave_like 'an api request' do
338
+ let(:command) { :get_currency_list }
339
+ end
340
+ end
341
+
342
+ describe '#get_opportunity_list' do
343
+ it_should_behave_like 'an api request' do
344
+ let(:command) { :get_opportunity_list }
345
+ end
346
+ end
347
+
348
+ describe '#get_result_of_convertation' do
349
+ it_should_behave_like 'an api request' do
350
+ let(:command) { :get_result_of_convertation }
351
+ end
352
+ end
353
+
354
+ describe '#get_opportunity_stage' do
355
+ it_should_behave_like 'an api request' do
356
+ let(:command) { :get_opportunity_stage }
357
+ let(:args) { [random_id(:opportunity_stage)] }
358
+ end
359
+ end
360
+
361
+ describe '#get_opportunity_by_id' do
362
+ it_should_behave_like 'an api request' do
363
+ let(:command) { :get_opportunity_by_id }
364
+ let(:args) { [random_id(:opportunity)] }
365
+ end
366
+ end
367
+
368
+ describe '#get_all_opportunity_contacts' do
369
+ it_should_behave_like 'an api request' do
370
+ let(:command) { :get_all_opportunity_contacts }
371
+ let(:args) { [random_id(:opportunity)] }
372
+ end
373
+ end
374
+
375
+ describe '#get_summary_table' do
376
+ it_should_behave_like 'an api request' do
377
+ pending 'http://bugzserver/show_bug.cgi?id=23883'
378
+ let(:command) { :get_summary_table }
379
+ let(:args) { [random_word] }
380
+ end
381
+ end
382
+
383
+ describe '#set_opportunity_access_rights' do
384
+ it_should_behave_like 'an api request' do
385
+ let(:command) { :set_opportunity_access_rights }
386
+ let(:args) { [[random_id(:opportunity)], random_bool, random_id(:user)] }
387
+ end
388
+ end
389
+
390
+ describe '#update_opportunity_stage' do
391
+ it_should_behave_like 'an api request' do
392
+ pending 'http://bugzserver/show_bug.cgi?id=23884'
393
+ let(:command) { :update_opportunity_stage }
394
+ let(:args) { [random_id(:opportunity_stage), random_word, COLORS_NAMES.sample] }
395
+ end
396
+ end
397
+
398
+ describe '#update_opportunity_stages_order' do
399
+ it_should_behave_like 'an api request' do
400
+ let(:command) { :update_opportunity_stages_order }
401
+ let(:args) { [DATA_COLLECTOR[:opportunity_stage_ids].sample(rand(1..3))] }
402
+ end
403
+ end
404
+
405
+ describe '#set_opportunity_access_rights_for_users' do
406
+ it_should_behave_like 'an api request' do
407
+ let(:command) { :set_opportunity_access_rights_for_users }
408
+ end
409
+ end
410
+
411
+ describe '#update_opportunity_to_stage' do
412
+ it_should_behave_like 'an api request' do
413
+ let(:command) { :update_opportunity_to_stage }
414
+ let(:args) { [random_id(:opportunity), random_id(:opportunity_stage)] }
415
+ end
416
+ end
417
+
418
+ describe '#get_invoice_taxes' do
419
+ it_should_behave_like 'an api request' do
420
+ let(:command) { :get_invoice_taxes }
421
+ end
422
+ end
423
+
424
+ describe '#get_contacts_for_mail' do
425
+ it_should_behave_like 'an api request' do
426
+ let(:command) { :get_contacts_for_mail }
427
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].sample(rand(1..3))] }
428
+ end
429
+ end
430
+
431
+ describe '#get_cases_by_prefix' do
432
+ it_should_behave_like 'an api request' do
433
+ let(:command) { :get_cases_by_prefix }
434
+ let(:args) { [random_id(:new_contact), random_word] }
435
+ end
436
+ end
437
+
438
+ describe '#get_contact_statuses' do
439
+ it_should_behave_like 'an api request' do
440
+ let(:command) { :get_contact_statuses }
441
+ end
442
+ end
443
+
444
+ describe '#get_invoice_sample' do
445
+ it_should_behave_like 'an api request' do
446
+ let(:command) { :get_invoice_sample }
447
+ end
448
+ end
449
+
450
+ describe '#get_invoices_by_filter' do
451
+ it_should_behave_like 'an api request' do
452
+ let(:command) { :get_invoices_by_filter }
453
+ end
454
+ end
455
+
456
+ describe '#get_contacts_by_filter' do
457
+ it_should_behave_like 'an api request' do
458
+ let(:command) { :get_contacts_by_filter }
459
+ end
460
+ end
461
+
462
+ describe '#get_settings' do
463
+ it_should_behave_like 'an api request' do
464
+ let(:command) { :get_settings }
465
+ end
466
+ end
467
+
468
+ describe '#get_invoice_items_by_filter' do
469
+ it_should_behave_like 'an api request' do
470
+ let(:command) { :get_invoice_items_by_filter }
471
+ end
472
+ end
473
+
474
+ describe '#get_entity_invoices' do
475
+ it_should_behave_like 'an api request' do
476
+ let(:command) { :get_entity_invoices }
477
+ let(:args) { [:contact, random_id(:new_contact)] }
478
+ end
479
+ end
480
+
481
+ describe '#create_task_group' do
482
+ it_should_behave_like 'an api request' do
483
+ let(:command) { :create_task_group }
484
+ let(:args) { [random_word] }
485
+ end
486
+ end
487
+
488
+ describe '#add_tag_to_batch_contacts' do
489
+ it_should_behave_like 'an api request' do
490
+ let(:command) { :add_tag_to_batch_contacts }
491
+ let(:args) { [(1..rand(1..4)).map {random_word(rand(3..6))}] }
492
+ end
493
+ end
494
+
495
+ describe '#add_contact_tag_to_group' do
496
+ it_should_behave_like 'an api request' do
497
+ let(:command) { :add_contact_tag_to_group }
498
+ let(:args) { [:company, random_id(:company), random_word(4)] }
499
+ end
500
+ end
501
+
502
+ describe '#add_deal_to_contact' do
503
+ it_should_behave_like 'an api request' do
504
+ let(:command) { :add_deal_to_contact }
505
+ let(:args) { [random_id(:new_contact), random_id(:opportunity)] }
506
+ end
507
+ end
508
+
509
+ describe '#set_is_portal_configured' do
510
+ it_should_behave_like 'an api request' do
511
+ let(:command) { :set_is_portal_configured }
512
+ let(:args) { [{configured: random_bool}] }
513
+ end
514
+ end
515
+
516
+ describe '#update_task' do
517
+ it_should_behave_like 'an api request' do
518
+ let(:command) { :update_task }
519
+ let(:args) { [random_id(:crm_task), random_word, DateTime.commercial(2015).to_s, random_id(:crm_task_category)] }
520
+ end
521
+ end
522
+
523
+ describe '#update_invoice_item' do
524
+ it_should_behave_like 'an api request' do
525
+ let(:command) { :update_invoice_item }
526
+ let(:args) { [random_id(:invoice_item), random_word, random_word, rand, random_word] }
527
+ end
528
+ end
529
+
530
+ describe '#update_invoice_tax' do
531
+ it_should_behave_like 'an api request' do
532
+ let(:command) { :update_invoice_tax }
533
+ let(:args) { [random_id(:invoice_tax), random_word] }
534
+ end
535
+ end
536
+
537
+ describe '#update_contact_type' do
538
+ it_should_behave_like 'an api request' do
539
+ let(:command) { :update_contact_type }
540
+ let(:args) { [random_id(:contact_type), random_word] }
541
+ let(:add_data_to_collector) { true }
542
+ let(:data_param) { :contact_types_titles }
543
+ let(:param_names) { %w(title) }
544
+ end
545
+ end
546
+
547
+ describe '#update_contact_status' do
548
+ it_should_behave_like 'an api request' do
549
+ let(:command) { :update_contact_status }
550
+ let(:args) { [random_id(:contact_status), random_word, {color: COLORS_NAMES.sample}] }
551
+ end
552
+ end
553
+
554
+ describe '#update_invoice' do
555
+ it_should_behave_like 'an api request' do
556
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
557
+ let(:command) { :update_invoice }
558
+ let(:args) { [random_id(:invoice)] }
559
+ end
560
+ end
561
+
562
+ describe '#update_crm_contact_tag_setting' do
563
+ it_should_behave_like 'an api request' do
564
+ let(:command) { :update_crm_contact_tag_setting }
565
+ end
566
+ end
567
+
568
+ describe '#save_number_settings' do
569
+ it_should_behave_like 'an api request' do
570
+ let(:command) { :save_number_settings }
571
+ end
572
+ end
573
+
574
+ describe '#set_access_to_batch_contact' do
575
+ it_should_behave_like 'an api request' do
576
+ let(:command) { :set_access_to_batch_contact }
577
+ end
578
+ end
579
+
580
+ describe '#update_statuses_contact_order' do
581
+ it_should_behave_like 'an api request' do
582
+ let(:command) { :update_statuses_contact_order }
583
+ end
584
+ end
585
+
586
+ describe '#save_terms_settings' do
587
+ it_should_behave_like 'an api request' do
588
+ let(:command) { :save_terms_settings }
589
+ end
590
+ end
591
+
592
+ describe '#update_crm_contact_status_settings' do
593
+ it_should_behave_like 'an api request' do
594
+ let(:command) { :update_crm_contact_status_settings }
595
+ end
596
+ end
597
+
598
+ describe '#update_invoice_patch_status' do
599
+ it_should_behave_like 'an api request' do
600
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
601
+ let(:command) { :update_invoice_patch_status }
602
+ let(:args) { [INVOICE_STATUSES.sample, DATA_COLLECTOR[:invoice_ids].sample(rand(1..3))] }
603
+ end
604
+ end
605
+
606
+ describe '#update_contact_status_color' do
607
+ it_should_behave_like 'an api request' do
608
+ let(:command) { :update_contact_status_color }
609
+ let(:args) { [random_id(:contact_status), COLORS_NAMES.sample] }
610
+ end
611
+ end
612
+
613
+ describe '#update_person' do
614
+ it_should_behave_like 'an api request' do
615
+ let(:command) { :update_person }
616
+ let(:args) { [random_id(:new_contact), random_word.capitalize, random_word.capitalize] }
617
+ end
618
+ end
619
+
620
+ describe '#update_contact_status_by_id' do
621
+ it_should_behave_like 'an api request' do
622
+ let(:command) { :update_contact_status_by_id }
623
+ let(:args) { [random_id(:new_contact), random_id(:contact_status)] }
624
+ end
625
+ end
626
+
627
+ describe '#update_invoice_line' do
628
+ it_should_behave_like 'an api request' do
629
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
630
+ let(:command) { :update_invoice_line }
631
+ let(:args) { [random_id(:invoice_line), random_id(:invoice)] }
632
+ end
633
+ end
634
+
635
+ #describe '#change_contact_photo' do
636
+ # it_should_behave_like 'an api request' do
637
+ # let(:command) { :change_contact_photo }
638
+ # let(:args) { [random_id(:new_contact), 'path_to_image'] }
639
+ # end
640
+ #end
641
+
642
+ describe '#update_person_and_its_company_status' do
643
+ it_should_behave_like 'an api request' do
644
+ let(:command) { :update_person_and_its_company_status }
645
+ let(:args) { [random_id(:new_contact), random_id(:contact_status)] }
646
+ end
647
+ end
648
+
649
+ describe '#update_company_and_participants_status' do
650
+ it_should_behave_like 'an api request' do
651
+ let(:command) { :update_company_and_participants_status }
652
+ let(:args) { [random_id(:company), random_id(:contact_status)] }
653
+ end
654
+ end
655
+
656
+ describe '#get_event_list_by_filter' do
657
+ it_should_behave_like 'an api request' do
658
+ let(:command) { :get_event_list_by_filter }
659
+ end
660
+ end
661
+
662
+ describe '#get_all_history_categories' do
663
+ it_should_behave_like 'an api request' do
664
+ let(:command) { :get_all_history_categories }
665
+ end
666
+ end
667
+
668
+ describe '#get_all_history_categories' do
669
+ it_should_behave_like 'an api request' do
670
+ let(:command) { :get_all_history_categories }
671
+ end
672
+ end
673
+
674
+ describe '#update_history_categories_order' do
675
+ it_should_behave_like 'an api request' do
676
+ let(:command) { :update_history_categories_order }
677
+ let(:args) { [DATA_COLLECTOR[:history_category_titles].shuffle] }
678
+ end
679
+ end
680
+
681
+ describe '#update_history_category_icon' do
682
+ it_should_behave_like 'an api request' do
683
+ let(:command) { :update_history_category_icon }
684
+ let(:args) { [random_id(:crm_history_category), random_word] }
685
+ end
686
+ end
687
+
688
+ describe '#get_task_list_by_filter' do
689
+ it_should_behave_like 'an api request' do
690
+ let(:command) { :get_task_list_by_filter }
691
+ end
692
+ end
693
+
694
+ describe '#get_all_task_categories' do
695
+ it_should_behave_like 'an api request' do
696
+ let(:command) { :get_all_task_categories }
697
+ end
698
+ end
699
+
700
+ describe '#get_task_by_id' do
701
+ it_should_behave_like 'an api request' do
702
+ let(:command) { :get_task_by_id }
703
+ let(:args) { [random_id(:crm_task)] }
704
+ end
705
+ end
706
+
707
+ describe '#get_task_category' do
708
+ it_should_behave_like 'an api request' do
709
+ let(:command) { :get_task_category }
710
+ let(:args) { [random_id(:crm_task_category)] }
711
+ end
712
+ end
713
+
714
+ describe '#get_contact_upcoming_tasks' do
715
+ it_should_behave_like 'an api request' do
716
+ #pending 'http://bugzserver/show_bug.cgi?id=23925'
717
+ let(:command) { :get_contact_upcoming_tasks }
718
+ let(:args) { [random_id(:new_contact)] }
719
+ end
720
+ end
721
+
722
+ describe '#close_task' do
723
+ it_should_behave_like 'an api request' do
724
+ let(:command) { :close_task }
725
+ let(:args) { [random_id(:crm_task)] }
726
+ end
727
+ end
728
+
729
+ describe '#resume_task' do
730
+ it_should_behave_like 'an api request' do
731
+ let(:command) { :resume_task }
732
+ let(:args) { [random_id(:crm_task)] }
733
+ end
734
+ end
735
+
736
+ describe '#update_task_categories_order' do
737
+ it_should_behave_like 'an api request' do
738
+ let(:command) { :update_task_categories_order }
739
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_titles].shuffle] }
740
+ end
741
+ end
742
+
743
+ describe '#update_task_category_icon' do
744
+ it_should_behave_like 'an api request' do
745
+ let(:command) { :update_task_category_icon }
746
+ let(:args) { [random_id(:crm_task_category), random_word] }
747
+ end
748
+ end
749
+
750
+ describe '#get_all_contact_types' do
751
+ it_should_behave_like 'an api request' do
752
+ let(:command) { :get_all_contact_types }
753
+ end
754
+ end
755
+
756
+ describe '#get_contact_by_id' do
757
+ it_should_behave_like 'an api request' do
758
+ let(:command) { :get_contact_by_id }
759
+ let(:args) { [random_id(:new_contact)] }
760
+ end
761
+ end
762
+
763
+ describe '#get_all_contact_info_types' do
764
+ it_should_behave_like 'an api request' do
765
+ let(:command) { :get_all_contact_info_types }
766
+ end
767
+ end
768
+
769
+ describe '#link_contact_list_with_project' do
770
+ it_should_behave_like 'an api request' do
771
+ let(:command) { :link_contact_list_with_project }
772
+ let(:args) { [random_id(:project), DATA_COLLECTOR[:new_contact_ids].sample(rand(1..4))] }
773
+ end
774
+ end
775
+
776
+ describe '#link_contact_with_project' do
777
+ it_should_behave_like 'an api request' do
778
+ let(:command) { :link_contact_with_project }
779
+ let(:args) { [random_id(:project), random_id(:new_contact)] }
780
+ end
781
+ end
782
+
783
+ describe '#add_persons_to_company' do
784
+ it_should_behave_like 'an api request' do
785
+ let(:command) { :add_persons_to_company }
786
+ i = -1
787
+ let(:args) { [DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
788
+ end
789
+ end
790
+
791
+ describe '#get_contacts_by_project_id' do
792
+ it_should_behave_like 'an api request' do
793
+ let(:command) { :get_contacts_by_project_id }
794
+ let(:args) { [random_id(:project)] }
795
+ end
796
+ end
797
+
798
+ describe '#get_contact_type' do
799
+ it_should_behave_like 'an api request' do
800
+ let(:command) { :get_contact_type }
801
+ let(:args) { [random_id(:contact_type)] }
802
+ end
803
+ end
804
+
805
+ describe '#get_contact_info' do
806
+ it_should_behave_like 'an api request' do
807
+ let(:command) { :get_contact_info }
808
+ let(:args) { [random_id(:new_contact), CONTACT_INFO_TYPES.sample] }
809
+ end
810
+ end
811
+
812
+ describe '#get_all_categories' do
813
+ it_should_behave_like 'an api request' do
814
+ let(:command) { :get_all_categories }
815
+ let(:args) { [CONTACT_INFO_TYPES.sample] }
816
+ end
817
+ end
818
+
819
+ describe '#get_company_linked_persons_list' do
820
+ it_should_behave_like 'an api request' do
821
+ let(:command) { :get_company_linked_persons_list }
822
+ let(:args) { [random_id(:company)] }
823
+ end
824
+ end
825
+
826
+ describe '#get_contact_information_by_type' do
827
+ it_should_behave_like 'an api request' do
828
+ let(:command) { :get_contact_information_by_type }
829
+ let(:args) { [random_id(:new_contact), CONTACT_INFO_TYPES.sample] }
830
+ end
831
+ end
832
+
833
+ describe '#group_contact_info' do
834
+ it_should_behave_like 'an api request' do
835
+ pending 'http://bugzserver/show_bug.cgi?id=23988'
836
+ let(:command) { :group_contact_info }
837
+ let(:args) { [[random_id(:new_contact), CONTACT_INFO_TYPES.sample]] }
838
+ end
839
+ end
840
+
841
+ describe '#quick_company_list_creation' do
842
+ it_should_behave_like 'an api request' do
843
+ let(:command) { :quick_company_list_creation }
844
+ let(:args) { [random_word] }
845
+ end
846
+ end
847
+
848
+ describe '#add_contact_address' do
849
+ it_should_behave_like 'an api request' do
850
+ let(:command) { :add_contact_address }
851
+ i = -1
852
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], random_info_category('Address'), random_word] }
853
+ let(:add_data_to_collector) { true }
854
+ let(:data_param) { :contact_address_ids }
855
+ let(:param_names) { %w() }
856
+ end
857
+ end
858
+
859
+ describe '#group_contact_info_update' do
860
+ it_should_behave_like 'an api request' do
861
+ pending 'http://bugzserver/show_bug.cgi?id=23988'
862
+ let(:command) { :group_contact_info_update }
863
+ let(:args) { [[random_id(:new_contact), CONTACT_INFO_TYPES.sample]] }
864
+ end
865
+ end
866
+
867
+ describe '#merge_contacts' do
868
+ it_should_behave_like 'an api request' do
869
+ let(:command) { :merge_contacts }
870
+ let(:args) { [random_id(:new_contact), random_id(:new_contact)] }
871
+ end
872
+ end
873
+
874
+ describe '#set_contacts_access_rights' do
875
+ it_should_behave_like 'an api request' do
876
+ let(:command) { :set_contacts_access_rights }
877
+ let(:args) { [[DATA_COLLECTOR[:new_contact_ids].sample(rand(1..4))]] }
878
+ end
879
+ end
880
+
881
+ describe '#update_contact_types_order' do
882
+ it_should_behave_like 'an api request' do
883
+ let(:command) { :update_contact_types_order }
884
+ let(:args) { [DATA_COLLECTOR[:contact_types_titles].sample(rand(1..4))] }
885
+ end
886
+ end
887
+
888
+ describe '#set_contact_access_rights' do
889
+ it_should_behave_like 'an api request' do
890
+ let(:command) { :set_contact_access_rights }
891
+ let(:args) { [ random_id(:new_contact) ] }
892
+ end
893
+ end
894
+
895
+ describe '#update_company' do
896
+ it_should_behave_like 'an api request' do
897
+ let(:command) { :update_company }
898
+ let(:args) { [ random_id(:company), random_word ] }
899
+ end
900
+ end
901
+
902
+ describe '#update_contact_info' do
903
+ it_should_behave_like 'an api request' do
904
+ let(:command) { :update_contact_info }
905
+ let(:args) { [ random_id(:contact_info), random_id(:new_contact), random_word ] }
906
+ end
907
+ end
908
+
909
+ describe '#change_contact_photo_by_url' do
910
+ it_should_behave_like 'an api request' do
911
+ let(:command) { :change_contact_photo_by_url }
912
+ let(:args) { [ random_id(:new_contact), IMAGE_URL ] }
913
+ end
914
+ end
915
+
916
+ describe '#update_contact_address' do
917
+ it_should_behave_like 'an api request' do
918
+ pending('http://bugzserver/show_bug.cgi?id=24002')
919
+ let(:command) { :update_contact_address }
920
+ let(:args) { [ random_id(:new_contact), random_id(:contact_address), random_word ] }
921
+ end
922
+ end
923
+
924
+ describe '#get_root_folder_id' do
925
+ it_should_behave_like 'an api request' do
926
+ let(:command) { :get_root_folder_id }
927
+ end
928
+ end
929
+
930
+ describe '#associate_file_with_entity' do
931
+ it_should_behave_like 'an api request' do
932
+ let(:command) { :associate_file_with_entity }
933
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), DATA_COLLECTOR[:file_ids].sample(rand(1..4))] }
934
+ end
935
+ end
936
+
937
+ describe '#create_txt' do
938
+ it_should_behave_like 'an api request' do
939
+ let(:command) { :create_txt }
940
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_word] }
941
+ let(:add_data_to_collector) { true }
942
+ let(:data_param) { :crm_file_ids }
943
+ let(:param_names) { %w(id) }
944
+ end
945
+ end
946
+
947
+ describe '#get_file_list' do
948
+ it_should_behave_like 'an api request' do
949
+ let(:command) { :get_file_list }
950
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
951
+ end
952
+ end
953
+
954
+ describe '#upload_file' do
955
+ it_should_behave_like 'an api request' do
956
+ let(:command) { :upload_file }
957
+ let(:args) { [entity = ENTITY_TYPES.sample, random_id(entity.to_sym), FILE_FOR_UPLOAD] }
958
+ end
959
+ end
960
+
961
+ describe '#create_tag' do
962
+ it_should_behave_like 'an api request' do
963
+ let(:command) { :create_tag }
964
+ let(:args) { [ENTITY_TYPES.last, random_word(4)] }
965
+ let(:add_data_to_collector) { true }
966
+ let(:data_param) { :crm_tag_ids }
967
+ let(:param_names) { %w() }
968
+ end
969
+ end
970
+
971
+ describe '#get_tags_for_entity_type' do
972
+ it_should_behave_like 'an api request' do
973
+ let(:command) { :get_tags_for_entity_type }
974
+ let(:args) { [ENTITY_TYPES.sample] }
975
+ end
976
+ end
977
+
978
+ describe '#get_all_contact_tags' do
979
+ it_should_behave_like 'an api request' do
980
+ let(:command) { :get_all_contact_tags }
981
+ let(:args) { [random_id(:new_contact)] }
982
+ end
983
+ end
984
+
985
+ describe '#get_entity_tags' do
986
+ it_should_behave_like 'an api request' do
987
+ let(:command) { :get_all_contact_tags }
988
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
989
+ end
990
+ end
991
+
992
+ describe '#add_tag_to_case_group_by_filter' do
993
+ it_should_behave_like 'an api request' do
994
+ let(:command) { :add_tag_to_case_group_by_filter }
995
+ let(:args) { [random_id(:crm_tag)] }
996
+ end
997
+ end
998
+
999
+ describe '#add_tag_group_to_entity' do
1000
+ it_should_behave_like 'an api request' do
1001
+ let(:command) { :add_tag_group_to_entity }
1002
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
1003
+ end
1004
+ end
1005
+
1006
+ describe '#add_tag_to_opportunity_group' do
1007
+ it_should_behave_like 'an api request' do
1008
+ let(:command) { :add_tag_to_opportunity_group }
1009
+ let(:args) { [random_id(:crm_tag)] }
1010
+ end
1011
+ end
1012
+
1013
+ describe '#add_tag' do
1014
+ it_should_behave_like 'an api request' do
1015
+ let(:command) { :add_tag }
1016
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
1017
+ end
1018
+ end
1019
+
1020
+ describe '#get_task_template_container_list' do
1021
+ it_should_behave_like 'an api request' do
1022
+ let(:command) { :get_task_template_container_list }
1023
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
1024
+ end
1025
+ end
1026
+
1027
+ describe '#update_task_template_container' do
1028
+ it_should_behave_like 'an api request' do
1029
+ let(:command) { :update_task_template_container }
1030
+ let(:args) { [random_id(:task_template_container), random_word] }
1031
+ let(:add_data_to_collector) { true }
1032
+ let(:data_param) { :task_template_container_title_ids }
1033
+ let(:param_names) { %w(title) }
1034
+ end
1035
+ end
1036
+
1037
+ describe '#get_task_template_container' do
1038
+ it_should_behave_like 'an api request' do
1039
+ let(:command) { :get_task_template_container }
1040
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact'), random_id(:task_template_container_title)] }
1041
+ end
1042
+ end
1043
+
1044
+ describe '#get_task_template' do
1045
+ it_should_behave_like 'an api request' do
1046
+ let(:command) { :get_task_template }
1047
+ let(:args) { [random_id(:task_template)] }
1048
+ end
1049
+ end
1050
+
1051
+ describe '#get_task_template_list_by_container_id' do
1052
+ it_should_behave_like 'an api request' do
1053
+ let(:command) { :get_task_template_list_by_container_id }
1054
+ let(:args) { [random_id(:task_template_container)] }
1055
+ end
1056
+ end
1057
+
1058
+ describe '#update_task_template' do
1059
+ it_should_behave_like 'an api request' do
1060
+ let(:command) { :update_task_template }
1061
+ i = -1
1062
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].last, DATA_COLLECTOR[:task_template_ids][i += 1], random_word] }
1063
+ end
1064
+ end
1065
+
1066
+ describe '#get_case_list' do
1067
+ it_should_behave_like 'an api request' do
1068
+ let(:command) { :get_case_list }
1069
+ end
1070
+ end
1071
+
1072
+ describe '#add_case_contact' do
1073
+ it_should_behave_like 'an api request' do
1074
+ let(:command) { :add_case_contact }
1075
+ i = 3
1076
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1], DATA_COLLECTOR[:new_contact_ids][i - 4]] }
1077
+ end
1078
+ end
1079
+
1080
+ describe '#get_case_by_id' do
1081
+ it_should_behave_like 'an api request' do
1082
+ let(:command) { :get_case_by_id }
1083
+ let(:args) { [random_id(:crm_case)] }
1084
+ end
1085
+ end
1086
+
1087
+ describe '#get_all_case_contacts' do
1088
+ it_should_behave_like 'an api request' do
1089
+ let(:command) { :get_all_case_contacts }
1090
+ let(:args) { [random_id(:crm_case)] }
1091
+ end
1092
+ end
1093
+
1094
+ describe '#set_case_access_rights' do
1095
+ it_should_behave_like 'an api request' do
1096
+ let(:command) { :set_case_access_rights }
1097
+ let(:args) { [random_id(:crm_case), {isPrivate: random_bool}] }
1098
+ end
1099
+ end
1100
+
1101
+ describe '#update_case' do
1102
+ it_should_behave_like 'an api request' do
1103
+ let(:command) { :update_case }
1104
+ let(:args) { [random_id(:crm_case), random_word] }
1105
+ end
1106
+ end
1107
+
1108
+ describe '#set_case_access_rights_by_filter' do
1109
+ it_should_behave_like 'an api request' do
1110
+ let(:command) { :set_case_access_rights_by_filter }
1111
+ let(:args) { [{contactId: random_id(:new_contact), isPrivate: random_bool}] }
1112
+ end
1113
+ end
1114
+
1115
+ describe '#close_case' do
1116
+ it_should_behave_like 'an api request' do
1117
+ let(:command) { :close_case }
1118
+ i = -1
1119
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1]] }
1120
+ end
1121
+ end
1122
+
1123
+ describe '#resume_case' do
1124
+ it_should_behave_like 'an api request' do
1125
+ let(:command) { :resume_case }
1126
+ i = -1
1127
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1]] }
1128
+ end
1129
+ end
1130
+
1131
+ describe '#set_rights_to_case' do
1132
+ it_should_behave_like 'an api request' do
1133
+ let(:command) { :set_rights_to_case }
1134
+ let(:args) { [random_id(:crm_case), isPrivate: random_bool] }
1135
+ end
1136
+ end
1137
+
1138
+ describe '#get_user_field_values' do
1139
+ it_should_behave_like 'an api request' do
1140
+ let(:command) { :get_user_field_values }
1141
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
1142
+ end
1143
+ end
1144
+
1145
+ describe '#get_user_field_list' do
1146
+ it_should_behave_like 'an api request' do
1147
+ let(:command) { :get_user_field_list }
1148
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
1149
+ end
1150
+ end
1151
+
1152
+ describe '#set_user_field_value' do
1153
+ it_should_behave_like 'an api request' do
1154
+ let(:command) { :set_user_field_value }
1155
+ let(:args) { [ENTITY_TYPES.last, random_id(ENTITY_TYPES.last.to_sym), random_id(:user_field), random_word] }
1156
+ end
1157
+ end
1158
+
1159
+ describe '#update_selected_user_field' do
1160
+ it_should_behave_like 'an api request' do
1161
+ let(:command) { :update_selected_user_field }
1162
+ i = -1
1163
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:user_field_ids][i += 1], random_word, rand(6)] }
1164
+ let(:add_data_to_collector) { true }
1165
+ let(:data_param) { :user_field_title_ids }
1166
+ let(:param_names) { %w(label) }
1167
+ end
1168
+ end
1169
+
1170
+ describe '#update_user_fields_order' do
1171
+ it_should_behave_like 'an api request' do
1172
+ let(:command) { :update_user_fields_order }
1173
+ let(:args) { [DATA_COLLECTOR[:user_field_title_ids].sample(rand(1..4))] }
1174
+ end
1175
+ end
1176
+
1177
+ describe '#delete_user_field' do
1178
+ it_should_behave_like 'an api request' do
1179
+ let(:command) { :delete_user_field }
1180
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:user_field_ids].pop] }
1181
+ end
1182
+ end
1183
+
1184
+ describe '#delete_case_contact' do
1185
+ it_should_behave_like 'an api request' do
1186
+ let(:command) { :delete_case_contact }
1187
+ i = -1
1188
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1], random_id(:new_contact)] }
1189
+ end
1190
+ end
1191
+
1192
+ describe '#delete_case' do
1193
+ it_should_behave_like 'an api request' do
1194
+ let(:command) { :delete_case }
1195
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids].shift] }
1196
+ end
1197
+ end
1198
+
1199
+ describe '#delete_case_group' do
1200
+ it_should_behave_like 'an api request' do
1201
+ let(:command) { :delete_case_group }
1202
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids].pop] }
1203
+ end
1204
+ end
1205
+
1206
+ describe '#delete_case_group_by_filter' do
1207
+ it_should_behave_like 'an api request' do
1208
+ let(:command) { :delete_case_group }
1209
+ i = -1
1210
+ let(:args) { [{ contactId: DATA_COLLECTOR[:new_contact_ids][i += 1] }] }
1211
+ end
1212
+ end
1213
+
1214
+ describe '#delete_invoice_item' do
1215
+ it_should_behave_like 'an api request' do
1216
+ let(:command) { :delete_invoice_item }
1217
+ let(:args) { [DATA_COLLECTOR[:invoice_item_ids].pop] }
1218
+ end
1219
+ end
1220
+
1221
+ describe '#delete_invoice_tax' do
1222
+ it_should_behave_like 'an api request' do
1223
+ let(:command) { :delete_invoice_tax }
1224
+ let(:args) { [DATA_COLLECTOR[:invoice_tax_ids].pop] }
1225
+ end
1226
+ end
1227
+
1228
+ describe '#delete_invoice_line' do
1229
+ it_should_behave_like 'an api request' do
1230
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
1231
+ let(:command) { :delete_invoice_line }
1232
+ let(:args) { [DATA_COLLECTOR[:invoice_line_ids].pop] }
1233
+ end
1234
+ end
1235
+
1236
+ describe '#delete_invoice' do
1237
+ it_should_behave_like 'an api request' do
1238
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
1239
+ let(:command) { :delete_invoice }
1240
+ let(:args) { [DATA_COLLECTOR[:invoice_ids].pop] }
1241
+ end
1242
+ end
1243
+
1244
+ describe '#delete_opportunity_contact' do
1245
+ it_should_behave_like 'an api request' do
1246
+ let(:command) { :delete_opportunity_contact }
1247
+ i = -1
1248
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
1249
+ end
1250
+ end
1251
+
1252
+ describe '#delete_batch_invoices' do
1253
+ it_should_behave_like 'an api request' do
1254
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
1255
+ let(:command) { :delete_batch_invoices }
1256
+ let(:args) { [[DATA_COLLECTOR[:invoice_ids].pop]] }
1257
+ end
1258
+ end
1259
+
1260
+ describe '#delete_batch_items' do
1261
+ it_should_behave_like 'an api request' do
1262
+ let(:command) { :delete_batch_items }
1263
+ let(:args) { [[DATA_COLLECTOR[:invoice_item_ids].pop]] }
1264
+ end
1265
+ end
1266
+
1267
+ describe '#delete_batch_contacts_by_filter' do
1268
+ it_should_behave_like 'an api request' do
1269
+ pending 'http://bugzserver/show_bug.cgi?id=23902'
1270
+ let(:command) { :delete_batch_contacts_by_filter }
1271
+ let(:args) { [{tags: [random_word(4)]}] }
1272
+ end
1273
+ end
1274
+
1275
+ describe '#delete_contact_status' do
1276
+ it_should_behave_like 'an api request' do
1277
+ pending 'http://bugzserver/show_bug.cgi?id=23915'
1278
+ let(:command) { :delete_contact_status }
1279
+ let(:args) { [DATA_COLLECTOR[:contact_status_ids].pop] }
1280
+ end
1281
+ end
1282
+
1283
+ describe '#delete_deal_from_contact' do
1284
+ it_should_behave_like 'an api request' do
1285
+ let(:command) { :delete_deal_from_contact }
1286
+ let(:args) { [random_id(:new_contact), random_id(:opportunity)] }
1287
+ end
1288
+ end
1289
+
1290
+ describe '#delete_event_and_related_files' do
1291
+ it_should_behave_like 'an api request' do
1292
+ let(:command) { :delete_event_and_related_files }
1293
+ let(:args) { [DATA_COLLECTOR[:crm_event_ids].pop] }
1294
+ end
1295
+ end
1296
+
1297
+ describe '#delete_history_category' do
1298
+ it_should_behave_like 'an api request' do
1299
+ let(:command) { :delete_history_category }
1300
+ let(:args) { [DATA_COLLECTOR[:crm_history_category_ids].pop] }
1301
+ end
1302
+ end
1303
+
1304
+ describe '#delete_task' do
1305
+ it_should_behave_like 'an api request' do
1306
+ let(:command) { :delete_task }
1307
+ let(:args) { [DATA_COLLECTOR[:crm_task_ids].pop] }
1308
+ end
1309
+ end
1310
+
1311
+ describe '#delete_task_category' do
1312
+ it_should_behave_like 'an api request' do
1313
+ let(:command) { :delete_task_category }
1314
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_ids].pop] }
1315
+ end
1316
+ end
1317
+
1318
+ describe '#delete_person_from_company' do
1319
+ it_should_behave_like 'an api request' do
1320
+ let(:command) { :delete_person_from_company }
1321
+ i = -1
1322
+ let(:args) { [ DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
1323
+ end
1324
+ end
1325
+
1326
+ describe '#delete_contact_address' do
1327
+ it_should_behave_like 'an api request' do
1328
+ pending 'http://bugzserver/show_bug.cgi?id=24028'
1329
+ let(:command) { :delete_contact_address }
1330
+ i = -1
1331
+ let(:args) { [ DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_address_ids].shift ] }
1332
+ end
1333
+ end
1334
+
1335
+ describe '#remove_contact_from_project' do
1336
+ it_should_behave_like 'an api request' do
1337
+ let(:command) { :remove_contact_from_project }
1338
+ let(:args) { [ random_id(:new_contact), random_id(:project)] }
1339
+ end
1340
+ end
1341
+
1342
+ describe '#delete_contact_type' do
1343
+ it_should_behave_like 'an api request' do
1344
+ let(:command) { :delete_contact_type }
1345
+ let(:args) { [DATA_COLLECTOR[:contact_type_ids].pop] }
1346
+ end
1347
+ end
1348
+
1349
+ describe '#delete_contact_info' do
1350
+ it_should_behave_like 'an api request' do
1351
+ let(:command) { :delete_contact_info }
1352
+ i = -1
1353
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_info_ids][i]] }
1354
+ end
1355
+ end
1356
+
1357
+ describe '#delete_contact_group' do
1358
+ it_should_behave_like 'an api request' do
1359
+ let(:command) { :delete_contact_group }
1360
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].pop] }
1361
+ end
1362
+ end
1363
+
1364
+ describe '#delete_contact' do
1365
+ it_should_behave_like 'an api request' do
1366
+ let(:command) { :delete_contact }
1367
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].pop] }
1368
+ end
1369
+ end
1370
+
1371
+ describe '#delete_file' do
1372
+ it_should_behave_like 'an api request' do
1373
+ let(:command) { :delete_file }
1374
+ let(:args) { [DATA_COLLECTOR[:crm_file_ids].pop] }
1375
+ end
1376
+ end
1377
+
1378
+ describe '#delete_tag' do
1379
+ it_should_behave_like 'an api request' do
1380
+ let(:command) { :delete_tag }
1381
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:crm_tag_ids].pop] }
1382
+ end
1383
+ end
1384
+
1385
+ describe '#remove_tag' do
1386
+ it_should_behave_like 'an api request' do
1387
+ let(:command) { :remove_tag }
1388
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
1389
+ end
1390
+ end
1391
+
1392
+ describe '#delete_unused_tags' do
1393
+ it_should_behave_like 'an api request' do
1394
+ let(:command) { :delete_unused_tags }
1395
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
1396
+ end
1397
+ end
1398
+
1399
+ describe '#delete_task_template' do
1400
+ it_should_behave_like 'an api request' do
1401
+ let(:command) { :delete_task_template }
1402
+ let(:args) { [DATA_COLLECTOR[:task_template_ids].pop] }
1403
+ end
1404
+ end
1405
+
1406
+ describe '#delete_task_template_container' do
1407
+ it_should_behave_like 'an api request' do
1408
+ let(:command) { :delete_task_template_container }
1409
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].pop] }
1410
+ end
1411
+ end
1412
+
1413
+ describe '#delete_opportunity_group' do
1414
+ it_should_behave_like 'an api request' do
1415
+ let(:command) { :delete_opportunity_group }
1416
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].pop] }
1417
+ end
1418
+ end
1419
+
1420
+ describe '#delete_opportunity' do
1421
+ it_should_behave_like 'an api request' do
1422
+ let(:command) { :delete_opportunity }
1423
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].pop] }
1424
+ end
1425
+ end
1426
+
1427
+ describe '#delete_opportunity_group_by_filter' do
1428
+ it_should_behave_like 'an api request' do
1429
+ let(:command) { :delete_opportunity_group_by_filter }
1430
+ end
1431
+ end
1432
+
1433
+ describe '#delete_opportunity_stage' do
1434
+ it_should_behave_like 'an api request' do
1435
+ let(:command) { :delete_opportunity_stage }
1436
+ let(:args) { [DATA_COLLECTOR[:opportunity_stage_ids].pop] }
1437
+ end
1438
+ end
1439
+ end