teamlab 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,8 +13,12 @@ describe Teamlab do
13
13
  shared_examples_for 'an api request' do
14
14
  before do
15
15
  @module = Teamlab.send(teamlab_module)
16
+ puts "#{command}(#{args.join(', ')})"
16
17
  @response = args.empty? ? @module.send(command) : @module.send(command, *args)
17
- DATA_COLLECTOR[data_param] << param_names.inject(@response.body['response']) { |resp, param| resp[param] } if add_data_to_collector
18
+ if add_data_to_collector
19
+ DATA_COLLECTOR[data_param] ||= []
20
+ DATA_COLLECTOR[data_param] << param_names.inject(@response.body['response']) { |resp, param| resp[param] }
21
+ end
18
22
  end
19
23
 
20
24
  context 'Successful api request' do
@@ -55,14 +59,14 @@ describe Teamlab do
55
59
  describe '#search_people' do
56
60
  it_should_behave_like 'an api request' do
57
61
  let(:command) { :search_people }
58
- let(:args) { random_word(4) }
62
+ let(:args) { [random_word(4)] }
59
63
  end
60
64
  end
61
65
 
62
66
  describe '#filter' do
63
67
  it_should_behave_like 'an api request' do
64
68
  let(:command) { :filter_people }
65
- let(:args) { { activationStatus: 1 } }
69
+ let(:args) { [{ activationStatus: 1 }] }
66
70
  end
67
71
  end
68
72
 
@@ -79,7 +83,7 @@ describe Teamlab do
79
83
  describe '#get_user_by_username' do
80
84
  it_should_behave_like 'an api request' do
81
85
  let(:command) { :get_user_by_username }
82
- let(:args) { DATA_COLLECTOR[:new_user_ids].first }
86
+ let(:args) { [random_id(:new_user)] }
83
87
  let(:add_data_to_collector) { true }
84
88
  let(:data_param) {:emails}
85
89
  let(:param_names) {%w(email)}
@@ -89,14 +93,14 @@ describe Teamlab do
89
93
  describe '#get_people_by_status' do
90
94
  it_should_behave_like 'an api request' do
91
95
  let(:command) { :get_people_by_status }
92
- let(:args) { USER_STATUSES.sample }
96
+ let(:args) { [USER_STATUSES.sample] }
93
97
  end
94
98
  end
95
99
 
96
100
  describe '#get_people_by_search_query' do
97
101
  it_should_behave_like 'an api request' do
98
102
  let(:command) { :get_people_by_search_query }
99
- let(:args) { random_word }
103
+ let(:args) { [random_word] }
100
104
  end
101
105
  end
102
106
 
@@ -151,6 +155,7 @@ describe Teamlab do
151
155
 
152
156
  describe '#update_photo' do
153
157
  it_should_behave_like 'an api request' do
158
+ pending 'http://bugzserver/show_bug.cgi?id=23867'
154
159
  let(:command) { :update_photo }
155
160
  let(:args) { [random_id(:new_user), PATH_TO_IMAGE] }
156
161
  end
@@ -173,7 +178,7 @@ describe Teamlab do
173
178
  describe '#delete_photo' do
174
179
  it_should_behave_like 'an api request' do
175
180
  let(:command) { :delete_photo }
176
- let(:args) { random_id(:new_user) }
181
+ let(:args) { [random_id(:new_user)] }
177
182
  end
178
183
  end
179
184
 
@@ -187,7 +192,7 @@ describe Teamlab do
187
192
  describe '#delete_user' do
188
193
  it_should_behave_like 'an api request' do
189
194
  let(:command) { :delete_user }
190
- let(:args) { DATA_COLLECTOR[:new_user_ids].pop }
195
+ let(:args) { [DATA_COLLECTOR[:new_user_ids].pop] }
191
196
  end
192
197
  end
193
198
  end
@@ -215,7 +220,7 @@ describe Teamlab do
215
220
  describe '#get_group' do
216
221
  it_should_behave_like 'an api request' do
217
222
  let(:command) { :get_group }
218
- let(:args) { random_id(:group) }
223
+ let(:args) { [random_id(:group)] }
219
224
  end
220
225
  end
221
226
 
@@ -257,14 +262,14 @@ describe Teamlab do
257
262
  describe '#remove_group_members' do
258
263
  it_should_behave_like 'an api request' do
259
264
  let(:command) { :remove_group_members }
260
- let(:args) { random_id(:group) }
265
+ let(:args) { [random_id(:group)] }
261
266
  end
262
267
  end
263
268
 
264
269
  describe '#delete_group' do
265
270
  it_should_behave_like 'an api request' do
266
271
  let(:command) { :delete_group }
267
- let(:args) { DATA_COLLECTOR[:group_ids].pop }
272
+ let(:args) { [DATA_COLLECTOR[:group_ids].pop] }
268
273
  end
269
274
  end
270
275
  end
@@ -287,6 +292,7 @@ describe Teamlab do
287
292
 
288
293
  describe '#get_usage_quota' do
289
294
  it_should_behave_like 'an api request' do
295
+ pending 'http://bugzserver/show_bug.cgi?id=23868'
290
296
  let(:command) { :get_usage_quota }
291
297
  end
292
298
  end
@@ -334,8 +340,9 @@ describe Teamlab do
334
340
 
335
341
  describe '#set_access' do
336
342
  it_should_behave_like 'an api request' do
343
+ pending 'http://bugzserver/show_bug.cgi?id=23764'
337
344
  let(:command) { :set_access }
338
- let(:args) { [random_settings_entity_id, random_bool] }
345
+ let(:args) { [[random_settings_entity_id, random_bool]] }
339
346
  end
340
347
  end
341
348
 
@@ -400,7 +407,7 @@ describe Teamlab do
400
407
  describe '#get_folder' do
401
408
  it_should_behave_like 'an api request' do
402
409
  let(:command) { :get_folder }
403
- let(:args) { random_id(:new_folder) }
410
+ let(:args) { [random_id(:new_folder)] }
404
411
  end
405
412
  end
406
413
 
@@ -414,13 +421,14 @@ describe Teamlab do
414
421
  describe '#search' do
415
422
  it_should_behave_like 'an api request' do
416
423
  let(:command) { :search }
417
- let(:args) { random_word }
424
+ let(:args) { [random_word] }
418
425
  end
419
426
  end
420
427
 
421
- describe '#get_recent_upload_files' do
428
+ describe '#get_recent_uploaded_files' do
422
429
  it_should_behave_like 'an api request' do
423
- let(:command) { :get_recent_upload_files }
430
+ pending 'http://bugzserver/show_bug.cgi?id=23869'
431
+ let(:command) { :get_recent_uploaded_files }
424
432
  let(:args) { [random_id(:my_documents)] }
425
433
  end
426
434
  end
@@ -695,40 +703,6 @@ describe Teamlab do
695
703
 
696
704
  describe '[Project]' do
697
705
 
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
729
- end
730
- end
731
-
732
706
  let(:teamlab_module) { :project }
733
707
 
734
708
  describe '#add_importing_url_to_queue' do
@@ -754,9 +728,9 @@ describe Teamlab do
754
728
  describe '#create_project' do
755
729
  it_should_behave_like 'an api request' do
756
730
  let(:command) { :create_project }
757
- let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool] }
731
+ let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool, {participants: DATA_COLLECTOR[:user_ids]}] }
758
732
  let(:add_data_to_collector) { true }
759
- let(:data_param) { :project_ids }
733
+ let(:data_param) { :new_project_ids }
760
734
  let(:param_names) { %w(id) }
761
735
  end
762
736
  end
@@ -764,7 +738,7 @@ describe Teamlab do
764
738
  describe '#add_message' do
765
739
  it_should_behave_like 'an api request' do
766
740
  let(:command) { :add_message }
767
- let(:args) { [random_id(:project), random_word, random_word, DATA_COLLECTOR[:user_ids].join(',')] }
741
+ let(:args) { [random_id(:new_project), random_word, random_word, DATA_COLLECTOR[:user_ids].join(',')] }
768
742
  let(:add_data_to_collector) { true }
769
743
  let(:data_param) { :discussion_ids }
770
744
  let(:param_names) { %w(id) }
@@ -784,7 +758,7 @@ describe Teamlab do
784
758
  describe '#add_task' do
785
759
  it_should_behave_like 'an api request' do
786
760
  let(:command) { :add_task }
787
- let(:args) { [random_id(:project), random_word] }
761
+ let(:args) { [random_id(:new_project), random_word] }
788
762
  let(:add_data_to_collector) { true }
789
763
  let(:data_param) { :project_task_ids }
790
764
  let(:param_names) { %w(id) }
@@ -794,20 +768,30 @@ describe Teamlab do
794
768
  describe '#add_task_from_discussion' do
795
769
  it_should_behave_like 'an api request' do
796
770
  let(:command) { :add_task_from_discussion }
797
- let(:args) { [random_id(:project), random_id(:discussion)] }
771
+ let(:args) { [random_id(:new_project), random_id(:discussion)] }
798
772
  end
799
773
  end
800
774
 
801
775
  describe '#create_subtask' do
802
776
  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] }
777
+ let(:command) { :create_subtask }
778
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].last, random_id(:user), random_word] }
805
779
  let(:add_data_to_collector) { true }
806
780
  let(:data_param) { :project_subtask_ids }
807
781
  let(:param_names) { %w(id) }
808
782
  end
809
783
  end
810
784
 
785
+ describe '#add_task_time' do
786
+ it_should_behave_like 'an api request' do
787
+ let(:command) { :add_task_time }
788
+ let(:args) { [random_id(:project_task), Time.now.strftime('%Y-%m-%-d'), random_id(:user), DATA_COLLECTOR[:new_project_ids].last] }
789
+ let(:add_data_to_collector) { true }
790
+ let(:data_param) { :project_task_time_ids }
791
+ let(:param_names) { %w(id) }
792
+ end
793
+ end
794
+
811
795
  describe '#upload_file_to_task' do
812
796
  it_should_behave_like 'an api request' do
813
797
  let(:command) { :upload_file_to_task }
@@ -825,7 +809,7 @@ describe Teamlab do
825
809
  describe '#add_milestone' do
826
810
  it_should_behave_like 'an api request' do
827
811
  let(:command) { :add_milestone }
828
- let(:args) { [random_id(:project), random_word, DateTime.commercial(2015).to_s, random_id(:user)] }
812
+ let(:args) { [random_id(:new_project), random_word, DateTime.commercial(2015).to_s, random_id(:user)] }
829
813
  let(:add_data_to_collector) { true }
830
814
  let(:data_param) { :project_milestone_ids }
831
815
  let(:param_names) { %w(id) }
@@ -861,14 +845,14 @@ describe Teamlab do
861
845
  describe '#get_message_by_filter' do
862
846
  it_should_behave_like 'an api request' do
863
847
  let(:command) { :get_message_by_filter }
864
- let(:args) { [{projectId: random_id(:project)}] }
848
+ let(:args) { [{projectId: random_id(:new_project)}] }
865
849
  end
866
850
  end
867
851
 
868
852
  describe '#get_messages' do
869
853
  it_should_behave_like 'an api request' do
870
854
  let(:command) { :get_messages }
871
- let(:args) { [random_id(:project)] }
855
+ let(:args) { [random_id(:new_project)] }
872
856
  end
873
857
  end
874
858
 
@@ -882,7 +866,7 @@ describe Teamlab do
882
866
  describe '#update_message' do
883
867
  it_should_behave_like 'an api request' do
884
868
  let(:command) { :update_message }
885
- let(:args) { [random_id(:discussion), random_id(:project), random_word, random_word] }
869
+ let(:args) { [random_id(:discussion), random_id(:new_project), random_word, random_word] }
886
870
  end
887
871
  end
888
872
 
@@ -975,7 +959,7 @@ describe Teamlab do
975
959
  describe '#get_project' do
976
960
  it_should_behave_like 'an api request' do
977
961
  let(:command) { :get_project }
978
- let(:args) { random_id(:project) }
962
+ let(:args) { [random_id(:new_project)] }
979
963
  end
980
964
  end
981
965
 
@@ -1013,19 +997,20 @@ describe Teamlab do
1013
997
  describe '#get_spent_time' do
1014
998
  it_should_behave_like 'an api request' do
1015
999
  let(:command) { :get_spent_time }
1016
- let(:args) { [random_id(:project)] }
1000
+ let(:args) { [random_id(:new_project)] }
1017
1001
  end
1018
1002
  end
1019
1003
 
1020
1004
  describe '#get_project_files' do
1021
1005
  it_should_behave_like 'an api request' do
1022
1006
  let(:command) { :get_project_files }
1023
- let(:args) { [random_id(:project)] }
1007
+ let(:args) { [random_id(:new_project)] }
1024
1008
  end
1025
1009
  end
1026
1010
 
1027
1011
  describe '#get_template' do
1028
1012
  it_should_behave_like 'an api request' do
1013
+ pending 'http://bugzserver/show_bug.cgi?id=23875'
1029
1014
  let(:command) { :get_template }
1030
1015
  let(:args) { [random_id(:project_template)] }
1031
1016
  end
@@ -1034,7 +1019,7 @@ describe Teamlab do
1034
1019
  describe '#get_milestones' do
1035
1020
  it_should_behave_like 'an api request' do
1036
1021
  let(:command) { :get_milestones }
1037
- let(:args) { [random_id(:project)] }
1022
+ let(:args) { [random_id(:new_project)] }
1038
1023
  end
1039
1024
  end
1040
1025
 
@@ -1048,28 +1033,28 @@ describe Teamlab do
1048
1033
  describe '#search_project' do
1049
1034
  it_should_behave_like 'an api request' do
1050
1035
  let(:command) { :search_project }
1051
- let(:args) { [random_id(:project), random_word] }
1036
+ let(:args) { [random_id(:new_project), random_word] }
1052
1037
  end
1053
1038
  end
1054
1039
 
1055
1040
  describe '#get_milestones_with_status' do
1056
1041
  it_should_behave_like 'an api request' do
1057
1042
  let(:command) { :get_milestones_with_status }
1058
- let(:args) { [random_id(:project), PROJECT_MILESTONE_STATUSES.sample] }
1043
+ let(:args) { [random_id(:new_project), PROJECT_MILESTONE_STATUSES.sample] }
1059
1044
  end
1060
1045
  end
1061
1046
 
1062
1047
  describe '#update_project_tags' do
1063
1048
  it_should_behave_like 'an api request' do
1064
1049
  let(:command) { :update_project_tags }
1065
- let(:args) { [random_id(:project), random_word(3)] }
1050
+ let(:args) { [random_id(:new_project), random_word(3)] }
1066
1051
  end
1067
1052
  end
1068
1053
 
1069
1054
  describe '#update_project_status' do
1070
1055
  it_should_behave_like 'an api request' do
1071
1056
  let(:command) { :update_project_status }
1072
- let(:args) { [random_id(:project), PROJECT_STATUSES.sample] }
1057
+ let(:args) { [random_id(:new_project), PROJECT_STATUSES.sample] }
1073
1058
  end
1074
1059
  end
1075
1060
 
@@ -1083,7 +1068,7 @@ describe Teamlab do
1083
1068
  describe '#follow_unfollow_project' do
1084
1069
  it_should_behave_like 'an api request' do
1085
1070
  let(:command) { :follow_unfollow_project }
1086
- let(:args) { [random_id(:project)] }
1071
+ let(:args) { [random_id(:new_project)] }
1087
1072
  end
1088
1073
  end
1089
1074
 
@@ -1097,19 +1082,20 @@ describe Teamlab do
1097
1082
  describe '#get_task_order' do
1098
1083
  it_should_behave_like 'an api request' do
1099
1084
  let(:command) { :get_task_order }
1100
- let(:args) { [random_id(:project)] }
1085
+ let(:args) { [random_id(:new_project)] }
1101
1086
  end
1102
1087
  end
1103
1088
 
1104
1089
  describe '#get_simple_task_by_filter' do
1105
1090
  it_should_behave_like 'an api request' do
1106
1091
  let(:command) { :get_simple_task_by_filter }
1107
- let(:args) { [random_id(:project)] }
1092
+ let(:args) { [random_id(:new_project)] }
1108
1093
  end
1109
1094
  end
1110
1095
 
1111
1096
  describe '#add_link' do
1112
1097
  it_should_behave_like 'an api request' do
1098
+ pending 'http://bugzserver/show_bug.cgi?id=23861'
1113
1099
  let(:command) { :add_link }
1114
1100
  let(:args) { [random_id(:project_task), random_id(:project_task), PROJECT_TASK_LINK_TYPES.sample] }
1115
1101
  end
@@ -1118,14 +1104,14 @@ describe Teamlab do
1118
1104
  describe '#update_project' do
1119
1105
  it_should_behave_like 'an api request' do
1120
1106
  let(:command) { :update_project }
1121
- let(:args) { [random_id(:project), random_word, random_id(:user), {private: random_bool, notify: random_bool}] }
1107
+ let(:args) { [random_id(:new_project), random_word, random_id(:user), {private: random_bool, notify: random_bool}] }
1122
1108
  end
1123
1109
  end
1124
1110
 
1125
1111
  describe '#set_task_order' do
1126
1112
  it_should_behave_like 'an api request' do
1127
1113
  let(:command) { :set_task_order }
1128
- let(:args) { [random_id(:project_task), '123456'] }
1114
+ let(:args) { [random_id(:new_project), '123456'] }
1129
1115
  end
1130
1116
  end
1131
1117
 
@@ -1139,42 +1125,42 @@ describe Teamlab do
1139
1125
  describe '#get_project_team' do
1140
1126
  it_should_behave_like 'an api request' do
1141
1127
  let(:command) { :get_project_team }
1142
- let(:args) { [random_id(:project)] }
1128
+ let(:args) { [random_id(:new_project)] }
1143
1129
  end
1144
1130
  end
1145
1131
 
1146
1132
  describe '#get_projects_teams' do
1147
1133
  it_should_behave_like 'an api request' do
1148
1134
  let(:command) { :get_projects_teams }
1149
- let(:args) { [DATA_COLLECTOR[:project_ids].sample(rand(2..4))] }
1135
+ let(:args) { [DATA_COLLECTOR[:new_project_ids].sample(rand(2..4))] }
1150
1136
  end
1151
1137
  end
1152
1138
 
1153
1139
  describe '#add_to_team' do
1154
1140
  it_should_behave_like 'an api request' do
1155
1141
  let(:command) { :add_to_team }
1156
- let(:args) { [random_id(:project), random_id(:user)] }
1142
+ let(:args) { [random_id(:new_project), random_id(:user)] }
1157
1143
  end
1158
1144
  end
1159
1145
 
1160
1146
  describe '#update_project_team' do
1161
1147
  it_should_behave_like 'an api request' do
1162
1148
  let(:command) { :update_project_team }
1163
- let(:args) { [random_id(:project), DATA_COLLECTOR[:user_ids].sample(rand(2..4)), {notify: random_bool}] }
1149
+ let(:args) { [random_id(:new_project), DATA_COLLECTOR[:user_ids].sample(rand(2..4)), {notify: random_bool}] }
1164
1150
  end
1165
1151
  end
1166
1152
 
1167
1153
  describe '#set_team_security' do
1168
1154
  it_should_behave_like 'an api request' do
1169
1155
  let(:command) { :set_team_security }
1170
- let(:args) { [random_id(:project), random_id(:user), PROJECT_SECURITY_RIGHTS.sample] }
1156
+ let(:args) { [random_id(:new_project), random_id(:user), PROJECT_SECURITY_RIGHTS.sample] }
1171
1157
  end
1172
1158
  end
1173
1159
 
1174
1160
  describe '#remove_from_team' do
1175
1161
  it_should_behave_like 'an api request' do
1176
1162
  let(:command) { :remove_from_team }
1177
- let(:args) { [random_id(:project), random_id(:user)] }
1163
+ let(:args) { [random_id(:new_project), random_id(:user)] }
1178
1164
  end
1179
1165
  end
1180
1166
 
@@ -1201,7 +1187,7 @@ describe Teamlab do
1201
1187
  describe '#get_tasks' do
1202
1188
  it_should_behave_like 'an api request' do
1203
1189
  let(:command) { :get_tasks }
1204
- let(:args) { [random_id(:project)] }
1190
+ let(:args) { [random_id(:new_project)] }
1205
1191
  end
1206
1192
  end
1207
1193
 
@@ -1222,19 +1208,20 @@ describe Teamlab do
1222
1208
  describe '#get_all_tasks' do
1223
1209
  it_should_behave_like 'an api request' do
1224
1210
  let(:command) { :get_all_tasks }
1225
- let(:args) { [random_id(:project)] }
1211
+ let(:args) { [random_id(:new_project)] }
1226
1212
  end
1227
1213
  end
1228
1214
 
1229
1215
  describe '#get_tasks_with_status' do
1230
1216
  it_should_behave_like 'an api request' do
1231
1217
  let(:command) { :get_tasks_with_status }
1232
- let(:args) { [random_id(:project), PROJECT_TASKS_STATUSES.sample] }
1218
+ let(:args) { [random_id(:new_project), PROJECT_TASKS_STATUSES.sample] }
1233
1219
  end
1234
1220
  end
1235
1221
 
1236
1222
  describe '#update_task_status' do
1237
1223
  it_should_behave_like 'an api request' do
1224
+ pending 'http://bugzserver/show_bug.cgi?id=23860'
1238
1225
  let(:command) { :update_task_status }
1239
1226
  let(:args) { [random_id(:project_task), PROJECT_TASKS_STATUSES.sample] }
1240
1227
  end
@@ -1242,886 +1229,2010 @@ describe Teamlab do
1242
1229
 
1243
1230
  describe '#update_subtask' do
1244
1231
  it_should_behave_like 'an api request' do
1232
+ pending 'http://bugzserver/show_bug.cgi?id=23860'
1245
1233
  let(:command) { :update_subtask }
1246
- let(:args) { [random_id(:project_task), random_id(:project_subtask), random_id(:user), random_word] }
1234
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].last, random_id(:project_subtask), random_id(:user), random_word] }
1247
1235
  end
1248
1236
  end
1249
1237
 
1250
1238
  describe '#update_subtask_status' do
1251
1239
  it_should_behave_like 'an api request' do
1252
1240
  let(:command) { :update_subtask_status }
1253
- let(:args) { [random_id(:project_task), random_id(:project_subtask), PROJECT_TASKS_STATUSES.sample] }
1241
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].last, random_id(:project_subtask), PROJECT_TASKS_STATUSES.sample] }
1254
1242
  end
1255
1243
  end
1256
1244
 
1245
+ describe '#add_project_contact' do
1246
+ it_should_behave_like 'an api request' do
1247
+ let(:command) { :add_project_contact }
1248
+ let(:args) { [random_id(:new_project), random_id(:contact)] }
1249
+ end
1250
+ end
1257
1251
 
1252
+ describe '#get_projects_for_contact' do
1253
+ it_should_behave_like 'an api request' do
1254
+ let(:command) { :get_projects_for_contact }
1255
+ let(:args) { [random_id(:contact)] }
1256
+ end
1257
+ end
1258
1258
 
1259
- describe '#delete_subtask' do
1259
+ describe '#get_project_tags' do
1260
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)] }
1261
+ let(:command) { :get_project_tags }
1263
1262
  end
1264
1263
  end
1265
1264
 
1266
- describe '#detach_file_from_task' do
1265
+ describe '#get_project_by_tag' do
1267
1266
  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)] }
1267
+ let(:command) { :get_project_by_tag }
1268
+ let(:args) { [random_word(4)] }
1270
1269
  end
1271
1270
  end
1272
1271
 
1273
- describe '#detach_file_from_message' do
1272
+ describe '#get_tags_by_name' do
1274
1273
  it_should_behave_like 'an api request' do
1275
- let(:command) { :detach_file_from_task }
1276
- let(:args) { [random_id(:discussion), random_id(:file)] }
1274
+ let(:command) { :get_tags_by_name }
1275
+ let(:args) { [random_word(4)] }
1277
1276
  end
1278
1277
  end
1279
1278
 
1280
- describe '#delete_message_comments' do
1279
+ describe '#get_upcoming_milestones' do
1281
1280
  it_should_behave_like 'an api request' do
1282
- let(:command) { :delete_comment }
1283
- let(:args) { [DATA_COLLECTOR[:comment_ids].pop] }
1281
+ let(:command) { :get_upcoming_milestones }
1284
1282
  end
1285
1283
  end
1286
1284
 
1287
- describe '#delete_task_comments' do
1285
+ describe '#get_overdue_milestones' do
1288
1286
  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] }
1287
+ let(:command) { :get_overdue_milestones }
1292
1288
  end
1293
1289
  end
1294
1290
 
1295
- describe '#delete_task' do
1291
+ describe '#get_milestone' do
1296
1292
  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 }
1293
+ let(:command) { :get_milestone }
1294
+ let(:args) { [random_id(:project_milestone)] }
1300
1295
  end
1301
1296
  end
1302
1297
 
1303
- describe '#delete_project' do
1298
+ describe '#get_milestones_by_filter' do
1304
1299
  it_should_behave_like 'an api request' do
1305
- let(:command) { :delete_project }
1306
- let(:args) { [DATA_COLLECTOR[:project_ids].pop] }
1300
+ let(:command) { :get_milestones_by_filter }
1301
+ let(:args) { [{projectid: random_id(:new_project)}] }
1307
1302
  end
1308
1303
  end
1309
1304
 
1310
- describe '#delete_template' do
1305
+ describe '#get_milestone_tasks' do
1311
1306
  it_should_behave_like 'an api request' do
1312
- let(:command) { :delete_template }
1313
- let(:args) { [DATA_COLLECTOR[:project_template_ids].pop] }
1307
+ let(:command) { :get_milestone_tasks }
1308
+ let(:args) { [random_id(:project_milestone)] }
1314
1309
  end
1315
1310
  end
1316
1311
 
1317
- describe '#delete_file' do
1312
+ describe '#get_milestones_by_month' do
1318
1313
  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] }
1314
+ let(:command) { :get_milestones_by_month }
1315
+ let(:args) { [rand(2000..Time.now.year.to_i), rand(1..12)] }
1322
1316
  end
1323
1317
  end
1324
1318
 
1325
- describe '#delete_user' do
1319
+ describe '#get_milestones_by_full_date' do
1326
1320
  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 }
1321
+ let(:command) { :get_milestones_by_full_date }
1322
+ let(:args) { [rand(2000..Time.now.year.to_i), rand(1..12), rand(1..31)] }
1330
1323
  end
1331
1324
  end
1332
- end
1333
1325
 
1334
- describe '[CRM]' do
1335
- let(:teamlab_module) { :crm }
1326
+ describe '#update_milestone' do
1327
+ it_should_behave_like 'an api request' do
1328
+ let(:command) { :update_milestone }
1329
+ let(:args) { [random_id(:project_milestone), random_word, DateTime.commercial(2015).to_s] }
1330
+ end
1331
+ end
1336
1332
 
1337
- describe '#get_all_opportunity_stages' do
1333
+ describe '#update_milestone_status' do
1338
1334
  it_should_behave_like 'an api request' do
1339
- let(:command) { :get_all_opportunity_stages }
1335
+ let(:command) { :update_milestone_status }
1336
+ let(:args) { [random_id(:project_milestone), PROJECT_MILESTONE_STATUSES.sample] }
1340
1337
  end
1341
1338
  end
1342
1339
 
1343
- describe '#get_curreny_list' do
1340
+ describe '#get_time_spent_by_filter' do
1344
1341
  it_should_behave_like 'an api request' do
1345
- let(:command) { :get_currency_list }
1342
+ let(:command) { :get_time_spent_by_filter }
1346
1343
  end
1347
1344
  end
1348
1345
 
1349
- describe '#get_opportunity_list' do
1346
+ describe '#get_total_time_spent_by_filter' do
1350
1347
  it_should_behave_like 'an api request' do
1351
- let(:command) { :get_opportunity_list }
1348
+ let(:command) { :get_total_time_spent_by_filter }
1352
1349
  end
1353
1350
  end
1354
1351
 
1355
- describe '#get_result_of_convertation' do
1352
+ describe '#get_time_spent' do
1356
1353
  it_should_behave_like 'an api request' do
1357
- let(:command) { :get_result_of_convertation }
1354
+ let(:command) { :get_time_spent }
1355
+ let(:args) { [random_id(:project_task)] }
1358
1356
  end
1359
1357
  end
1360
1358
 
1361
- describe '#create_opportunity_stage' do
1359
+ describe '#update_task_time' do
1362
1360
  it_should_behave_like 'an api request' do
1363
- let(:command) { :create_opportunity_stage }
1364
- let(:args) { [RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
1361
+ let(:command) { :update_task_time }
1362
+ let(:args) { [random_id(:project_task_time), Time.now.strftime('%Y-%m-%-d'), random_id(:user)] }
1365
1363
  end
1366
1364
  end
1367
1365
 
1368
- describe '#update_opportunity_stage' do
1366
+ describe '#update_time_status_of_payment' do
1369
1367
  it_should_behave_like 'an api request' do
1370
- let(:command) { :update_opportunity_stage }
1371
- let(:args) { [OPPORTUNITY_ID, RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
1368
+ let(:command) { :update_time_status_of_payment }
1369
+ let(:args) { [DATA_COLLECTOR[:project_task_time_ids].sample(rand(2..4)), PROJECT_TASK_TIME_STATUSES.sample] }
1372
1370
  end
1373
1371
  end
1374
1372
 
1375
- describe '#update_opportunity_stage_order' do
1373
+ describe '#delete_time_spents' do
1376
1374
  it_should_behave_like 'an api request' do
1377
- let(:command) { :update_opportunity_stage_order }
1375
+ let(:command) { :delete_time_spents }
1376
+ let(:args) { [DATA_COLLECTOR[:project_task_time_ids].pop] }
1378
1377
  end
1379
1378
  end
1380
1379
 
1381
- describe '#set_opportunity_access_rights' do
1380
+ describe '#delete_project_contact' do
1382
1381
  it_should_behave_like 'an api request' do
1383
- let(:command) { :set_opportunity_access_rights }
1382
+ let(:command) { :delete_project_contact }
1383
+ let(:args) { [random_id(:new_project), random_id(:contact)] }
1384
1384
  end
1385
1385
  end
1386
1386
 
1387
- describe '#update_opportunity' do
1387
+ describe '#delete_subtask' do
1388
1388
  it_should_behave_like 'an api request' do
1389
- let(:command) { :update_opportunity }
1390
- let(:args) { [OPPORTUNITY_ID, CONTACT_ID, RANDOM_TITLE, RESPONSIBLE_ID, STAGE_ID] }
1389
+ let(:command) { :delete_subtask }
1390
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].last, DATA_COLLECTOR[:project_subtask_ids].pop] }
1391
1391
  end
1392
1392
  end
1393
1393
 
1394
- describe '#update_opportunity_stage_color' do
1394
+ describe '#detach_file_from_task' do
1395
1395
  it_should_behave_like 'an api request' do
1396
- let(:command) { :update_opportunity_stage_color }
1397
- let(:args) { [STAGE_ID, OPPORTUNITY_COLOR_NAME] }
1396
+ let(:command) { :detach_file_from_task }
1397
+ let(:args) { [random_id(:project_task), random_id(:file)] }
1398
1398
  end
1399
1399
  end
1400
1400
 
1401
- describe '#update_opportunity_stage_color' do
1401
+ describe '#detach_file_from_message' do
1402
1402
  it_should_behave_like 'an api request' do
1403
- let(:command) { :update_opportunity_stage_color }
1404
- let(:args) { [OPPORTUNITY_ID, OPPORTUNITY_COLOR_NAME] }
1403
+ let(:command) { :detach_file_from_task }
1404
+ let(:args) { [random_id(:discussion), random_id(:file)] }
1405
1405
  end
1406
1406
  end
1407
1407
 
1408
- describe '#set_rights_to_opportunity' do
1408
+ describe '#delete_message_comments' do
1409
1409
  it_should_behave_like 'an api request' do
1410
- let(:command) { :set_rights_to_opportunity }
1411
- let(:args) { [OPPORTUNITY_ID, IS_PRIVATE, FEW_USER_IDS] }
1410
+ let(:command) { :delete_comment }
1411
+ let(:args) { [DATA_COLLECTOR[:comment_ids].pop] }
1412
1412
  end
1413
1413
  end
1414
1414
 
1415
- describe '#update_opportunity_to_stage' do
1415
+ describe '#delete_milestone' do
1416
1416
  it_should_behave_like 'an api request' do
1417
- let(:command) { :update_opportunity_to_stage }
1418
- let(:args) { [OPPORTUNITY_ID, STAGE_ID] }
1417
+ let(:command) { :delete_milestone }
1418
+ let(:args) { [DATA_COLLECTOR[:project_milestone_ids].pop] }
1419
1419
  end
1420
1420
  end
1421
1421
 
1422
- describe '#get_invoice_taxes' do
1422
+ describe '#delete_task_comments' do
1423
1423
  it_should_behave_like 'an api request' do
1424
- let(:command) { :get_invoice_taxes }
1424
+ let(:command) { :delete_comment }
1425
+ let(:args) { [DATA_COLLECTOR[:comment_ids].pop] }
1425
1426
  end
1426
1427
  end
1427
1428
 
1428
- describe '#get_cases_by_prefix' do
1429
+ describe '#delete_task' do
1429
1430
  it_should_behave_like 'an api request' do
1430
- let(:command) { :get_cases_by_prefix }
1431
- let(:args) { [CONTACT_ID, RANDOM_TITLE] }
1431
+ let(:command) { :delete_task }
1432
+ let(:args) { [DATA_COLLECTOR[:project_task_ids].pop] }
1432
1433
  end
1433
1434
  end
1434
1435
 
1435
- describe '#get_contact_statuses' do
1436
+ describe '#delete_project' do
1436
1437
  it_should_behave_like 'an api request' do
1437
- let(:command) { :get_contact_statuses }
1438
+ let(:command) { :delete_project }
1439
+ let(:args) { [DATA_COLLECTOR[:new_project_ids].pop] }
1438
1440
  end
1439
1441
  end
1440
1442
 
1441
- describe '#get_invoice_sample' do
1443
+ describe '#delete_template' do
1442
1444
  it_should_behave_like 'an api request' do
1443
- let(:command) { :get_invoice_sample }
1445
+ let(:command) { :delete_template }
1446
+ let(:args) { [DATA_COLLECTOR[:project_template_ids].pop] }
1447
+ end
1448
+ end
1449
+
1450
+ end
1451
+
1452
+ describe '[CRM]' do
1453
+
1454
+ let(:teamlab_module) { :crm }
1455
+
1456
+ describe '#create_opportunity_stage' do
1457
+ it_should_behave_like 'an api request' do
1458
+ let(:teamlab_module) { :crm }
1459
+ let(:command) { :create_opportunity_stage }
1460
+ let(:args) { [random_word.capitalize, COLORS_NAMES.sample] }
1461
+ let(:add_data_to_collector) { true }
1462
+ let(:data_param) { :opportunity_stage_ids }
1463
+ let(:param_names) { %w(id) }
1444
1464
  end
1445
1465
  end
1446
1466
 
1447
- describe '#get_invoices' do
1467
+ describe '#create_person' do
1448
1468
  it_should_behave_like 'an api request' do
1449
- let(:command) { :get_invoices }
1469
+ let(:teamlab_module) { :crm }
1470
+ let(:command) { :create_person }
1471
+ let(:args) { [random_word.capitalize, random_word.capitalize] }
1472
+ let(:add_data_to_collector) { true }
1473
+ let(:data_param) { :new_contact_ids }
1474
+ let(:param_names) { %w(id) }
1450
1475
  end
1451
1476
  end
1452
1477
 
1453
- describe '#get_contacts' do
1478
+ describe '#create_person__for_group' do
1454
1479
  it_should_behave_like 'an api request' do
1455
- let(:command) { :get_contacts }
1480
+ let(:teamlab_module) { :crm }
1481
+ let(:command) { :create_person }
1482
+ let(:args) { [random_word.capitalize, random_word.capitalize] }
1483
+ let(:add_data_to_collector) { true }
1484
+ let(:data_param) { :new_contact_ids }
1485
+ let(:param_names) { %w(id) }
1456
1486
  end
1457
1487
  end
1458
1488
 
1459
- describe '#get_settings' do
1489
+ describe '#create_opportunity' do
1460
1490
  it_should_behave_like 'an api request' do
1461
- let(:command) { :get_settings }
1491
+ let(:command) { :create_opportunity }
1492
+ let(:args) { [random_id(:opportunity_stage), random_word, random_id(:user)] }
1493
+ let(:add_data_to_collector) { true }
1494
+ let(:data_param) { :opportunity_ids }
1495
+ let(:param_names) { %w(id) }
1462
1496
  end
1463
1497
  end
1464
1498
 
1465
- describe '#get_invoice_items' do
1499
+ describe '#create_opportunity_for_group' do
1466
1500
  it_should_behave_like 'an api request' do
1467
- let(:command) { :get_invoice_items }
1501
+ let(:command) { :create_opportunity }
1502
+ let(:args) { [random_id(:opportunity_stage), random_word, random_id(:user)] }
1503
+ let(:add_data_to_collector) { true }
1504
+ let(:data_param) { :opportunity_ids }
1505
+ let(:param_names) { %w(id) }
1468
1506
  end
1469
1507
  end
1470
1508
 
1471
- describe '#get_invoice_by_id' do
1509
+ describe '#create_invoice' do
1472
1510
  it_should_behave_like 'an api request' do
1473
- let(:command) { :get_invoice_by_id }
1474
- let(:args) { [INVOICE_ID] }
1511
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
1512
+ let(:command) { :create_invoice }
1513
+ let(:args) { [] }
1514
+ let(:add_data_to_collector) { true }
1515
+ let(:data_param) { :invoice_ids }
1516
+ let(:param_names) { %w(id) }
1475
1517
  end
1476
1518
  end
1477
1519
 
1478
- describe '#get_simple_contacts' do
1520
+ describe '#create_invoice_for_batch' do
1479
1521
  it_should_behave_like 'an api request' do
1480
- let(:command) { :get_simple_contacts }
1522
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
1523
+ let(:command) { :create_invoice }
1524
+ let(:args) { [] }
1525
+ let(:add_data_to_collector) { true }
1526
+ let(:data_param) { :invoice_ids }
1527
+ let(:param_names) { %w(id) }
1481
1528
  end
1482
1529
  end
1483
1530
 
1484
- describe '#create_task' do
1531
+ describe '#create_history_category' do
1485
1532
  it_should_behave_like 'an api request' do
1486
- let(:command) { :create_task }
1487
- let(:args) { [RANDOM_TITLE, SOME_DATE, RESPONSIBLE_ID, CATEGORY_ID] }
1533
+ let(:command) { :create_history_category }
1534
+ let(:args) { [random_word, random_word] }
1535
+ let(:add_data_to_collector) { true }
1536
+ let(:data_param) { :crm_history_category_ids }
1537
+ let(:param_names) { %w(id) }
1488
1538
  end
1489
1539
  end
1490
1540
 
1491
1541
  describe '#create_invoice_line' do
1492
1542
  it_should_behave_like 'an api request' do
1543
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
1493
1544
  let(:command) { :create_invoice_line }
1494
- let(:args) { [INVOICE_ID] }
1545
+ let(:args) { [random_id(:invoice)] }
1546
+ let(:add_data_to_collector) { true }
1547
+ let(:data_param) { :invoice_line_ids }
1548
+ let(:param_names) { %w(id) }
1495
1549
  end
1496
1550
  end
1497
1551
 
1498
- describe '#create_invoice_tax' do
1552
+ describe '#create_invoice_item' do
1499
1553
  it_should_behave_like 'an api request' do
1500
- let(:command) { :create_invoice_tax }
1501
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
1554
+ let(:command) { :create_invoice_item }
1555
+ let(:args) { [random_word, random_word, rand, random_word] }
1556
+ let(:add_data_to_collector) { true }
1557
+ let(:data_param) { :invoice_item_ids }
1558
+ let(:param_names) { %w(id) }
1559
+ end
1560
+ end
1561
+
1562
+ describe '#create_invoice_item_for_batch' do
1563
+ it_should_behave_like 'an api request' do
1564
+ let(:command) { :create_invoice_item }
1565
+ let(:args) { [random_word, random_word, rand, random_word] }
1566
+ let(:add_data_to_collector) { true }
1567
+ let(:data_param) { :invoice_item_ids }
1568
+ let(:param_names) { %w(id) }
1502
1569
  end
1503
1570
  end
1504
1571
 
1505
1572
  describe '#create_invoice_tax' do
1506
1573
  it_should_behave_like 'an api request' do
1507
1574
  let(:command) { :create_invoice_tax }
1508
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
1575
+ let(:args) { [random_word, random_word] }
1576
+ let(:add_data_to_collector) { true }
1577
+ let(:data_param) { :invoice_tax_ids }
1578
+ let(:param_names) { %w(id) }
1509
1579
  end
1510
1580
  end
1511
1581
 
1512
1582
  describe '#create_contact_type' do
1513
1583
  it_should_behave_like 'an api request' do
1514
1584
  let(:command) { :create_contact_type }
1515
- let(:args) { [RANDOM_TITLE] }
1585
+ let(:args) { [random_word] }
1586
+ let(:add_data_to_collector) { true }
1587
+ let(:data_param) { :contact_type_ids }
1588
+ let(:param_names) { %w(id) }
1516
1589
  end
1517
1590
  end
1518
1591
 
1519
1592
  describe '#create_contact_status' do
1520
1593
  it_should_behave_like 'an api request' do
1521
1594
  let(:command) { :create_contact_status }
1522
- let(:args) { [RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
1523
- end
1524
- end
1525
-
1526
- describe '#create_person' do
1527
- it_should_behave_like 'an api request' do
1528
- let(:command) { :create_person }
1529
- let(:args) { [NEW_USER_FIRSTNAME, NEW_USER_LASTNAME] }
1595
+ let(:args) { [random_word, COLORS_NAMES.sample] }
1596
+ let(:add_data_to_collector) { true }
1597
+ let(:data_param) { :contact_status_ids }
1598
+ let(:param_names) { %w(id) }
1530
1599
  end
1531
1600
  end
1532
1601
 
1533
1602
  describe '#create_company' do
1534
1603
  it_should_behave_like 'an api request' do
1535
1604
  let(:command) { :create_company }
1536
- let(:args) { [RANDOM_TITLE] }
1605
+ let(:args) { [random_word, [random_id(:user)]] }
1606
+ let(:add_data_to_collector) { true }
1607
+ let(:data_param) { :company_ids }
1608
+ let(:param_names) { %w(id) }
1537
1609
  end
1538
1610
  end
1539
1611
 
1540
- describe '#create_task_group' do
1612
+ #describe '#create_task_group' do
1613
+ # it_should_behave_like 'an api request' do
1614
+ # let(:command) { :create_task_group }
1615
+ # let(:args) { [random_word] }
1616
+ # let(:add_data_to_collector) { true }
1617
+ # let(:data_param) { :task_group_ids }
1618
+ # let(:param_names) { %w(id) }
1619
+ # end
1620
+ #end
1621
+
1622
+ describe '#update_history_category' do
1541
1623
  it_should_behave_like 'an api request' do
1542
- let(:command) { :create_task_group }
1543
- let(:args) { [RANDOM_TITLE] }
1624
+ let(:command) { :update_history_category }
1625
+ i = -1
1626
+ let(:args) { [DATA_COLLECTOR[:crm_history_category_ids][i += 1], random_word] }
1627
+ let(:add_data_to_collector) { true }
1628
+ let(:data_param) { :history_category_titles }
1629
+ let(:param_names) { %w(title) }
1544
1630
  end
1545
1631
  end
1546
1632
 
1547
- describe '#add_tag_to_batch_contacts' do
1633
+ describe '#create_event' do
1548
1634
  it_should_behave_like 'an api request' do
1549
- let(:command) { :add_tag_to_batch_contacts }
1550
- let(:args) { [RANDOM_TAGS] }
1635
+ let(:command) { :create_event }
1636
+ let(:args) { [random_id(:new_contact), random_word, random_id(:crm_history_category)] }
1637
+ let(:add_data_to_collector) { true }
1638
+ let(:data_param) { :crm_event_ids }
1639
+ let(:param_names) { %w(id) }
1551
1640
  end
1552
1641
  end
1553
1642
 
1554
- describe '#add_tag_to_batch_contacts' do
1643
+ describe '#create_task_category' do
1555
1644
  it_should_behave_like 'an api request' do
1556
- let(:command) { :add_tag_to_batch_contacts }
1557
- let(:args) { [RANDOM_TAGS] }
1645
+ let(:command) { :create_task_category }
1646
+ let(:args) { [random_word, random_word] }
1647
+ let(:add_data_to_collector) { true }
1648
+ let(:data_param) { :crm_task_category_ids }
1649
+ let(:param_names) { %w(id) }
1558
1650
  end
1559
1651
  end
1560
1652
 
1561
- describe '#set_is_portal_configured' do
1653
+ describe '#update_task_category' do
1562
1654
  it_should_behave_like 'an api request' do
1563
- let(:command) { :set_is_portal_configured }
1655
+ let(:command) { :update_task_category }
1656
+ i = -1
1657
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_ids][i += 1], random_word] }
1658
+ let(:add_data_to_collector) { true }
1659
+ let(:data_param) { :crm_task_category_titles }
1660
+ let(:param_names) { %w(title) }
1564
1661
  end
1565
1662
  end
1566
1663
 
1567
- describe '#update_task' do
1664
+ describe '#create_task' do
1568
1665
  it_should_behave_like 'an api request' do
1569
- let(:command) { :update_task }
1570
- let(:args) { TASK_ID }
1666
+ let(:command) { :create_task }
1667
+ let(:args) { [random_word, DateTime.commercial(2015).to_s, random_id(:user), random_id(:crm_task_category)] }
1668
+ let(:add_data_to_collector) { true }
1669
+ let(:data_param) { :crm_task_ids }
1670
+ let(:param_names) { %w(id) }
1571
1671
  end
1572
1672
  end
1573
1673
 
1574
- describe '#update_invoice_tax' do
1674
+ describe '#add_contact_info' do
1575
1675
  it_should_behave_like 'an api request' do
1576
- let(:command) { :update_invoice_tax }
1577
- let(:args) { TAX_ID }
1676
+ let(:command) { :add_contact_info }
1677
+ i = -1
1678
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], info_type = CONTACT_INFO_TYPES.sample, random_word, random_info_category(info_type)] }
1679
+ let(:add_data_to_collector) { true }
1680
+ let(:data_param) { :contact_info_ids }
1681
+ let(:param_names) { %w(id) }
1578
1682
  end
1579
1683
  end
1580
1684
 
1581
- describe '#update_contact_type' do
1685
+ describe '#quick_person_list_creation' do
1582
1686
  it_should_behave_like 'an api request' do
1583
- let(:command) { :update_contact_type }
1584
- let(:args) { [CONTACT_TYPE_ID, RANDOM_TITLE] }
1687
+ pending ('http://bugzserver/show_bug.cgi?id=23997')
1688
+ let(:command) { :quick_person_list_creation }
1689
+ let(:args) { [[[random_word, random_word], [random_word, random_word]]] }
1585
1690
  end
1586
1691
  end
1587
1692
 
1588
- describe '#update_contact_status' do
1693
+ describe '#add_opportunity_contact' do
1589
1694
  it_should_behave_like 'an api request' do
1590
- let(:command) { :update_contact_status }
1591
- let(:args) { [CONTACT_STATUS_ID, {title: RANDOM_TITLE}] }
1695
+ let(:command) { :add_opportunity_contact }
1696
+ i = -1
1697
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
1592
1698
  end
1593
1699
  end
1594
1700
 
1595
- describe '#update_crm_contact_tag_setting' do
1701
+ describe '#create_task_template_container' do
1596
1702
  it_should_behave_like 'an api request' do
1597
- let(:command) { :update_crm_contact_tag_setting }
1703
+ let(:command) { :create_task_template_container }
1704
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact'), random_word] }
1705
+ let(:add_data_to_collector) { true }
1706
+ let(:data_param) { :task_template_container_ids }
1707
+ let(:param_names) { %w(id) }
1598
1708
  end
1599
1709
  end
1600
1710
 
1601
- describe '#save_number_settings' do
1711
+ describe '#create_task_template' do
1602
1712
  it_should_behave_like 'an api request' do
1603
- let(:command) { :save_number_settings }
1604
- let(:args) {[AUTOGENERATED, random_word(3).capitalize, rand(10)]}
1713
+ let(:command) { :create_task_template }
1714
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].last, random_word] }
1715
+ let(:add_data_to_collector) { true }
1716
+ let(:data_param) { :task_template_ids }
1717
+ let(:param_names) { %w(id) }
1605
1718
  end
1606
1719
  end
1607
1720
 
1608
- describe '#set_access_to_batch_contact' do
1721
+ describe '#create_case' do
1609
1722
  it_should_behave_like 'an api request' do
1610
- let(:command) { :set_access_to_batch_contact }
1723
+ let(:command) { :create_case }
1724
+ let(:args) { [random_word, { members: DATA_COLLECTOR[:new_contact_ids] }] }
1725
+ let(:add_data_to_collector) { true }
1726
+ let(:data_param) { :crm_case_ids }
1727
+ let(:param_names) { %w(id) }
1611
1728
  end
1612
1729
  end
1613
1730
 
1614
- describe '#update_statuses_contact_order' do
1731
+ describe '#create_case_for_group_deleting' do
1615
1732
  it_should_behave_like 'an api request' do
1616
- let(:command) { :update_statuses_contact_order }
1733
+ let(:command) { :create_case }
1734
+ let(:args) { [random_word] }
1735
+ let(:add_data_to_collector) { true }
1736
+ let(:data_param) { :crm_case_ids }
1737
+ let(:param_names) { %w(id) }
1617
1738
  end
1618
1739
  end
1619
1740
 
1620
- describe '#save_terms_settings' do
1741
+ describe '#create_case_for_group_deleting_by_filter' do
1621
1742
  it_should_behave_like 'an api request' do
1622
- let(:command) { :save_terms_settings }
1743
+ let(:command) { :create_case }
1744
+ let(:args) { [random_word] }
1745
+ let(:add_data_to_collector) { true }
1746
+ let(:data_param) { :crm_case_ids }
1747
+ let(:param_names) { %w(id) }
1623
1748
  end
1624
1749
  end
1625
1750
 
1626
- describe '#update_crm_contact_status_settings' do
1751
+ describe '#create_user_field' do
1627
1752
  it_should_behave_like 'an api request' do
1628
- let(:command) { :update_crm_contact_status_settings }
1753
+ let(:command) { :create_user_field }
1754
+ let(:args) { [ENTITY_TYPES.last, random_word, rand(6)] }
1755
+ let(:add_data_to_collector) { true }
1756
+ let(:data_param) { :user_field_ids }
1757
+ let(:param_names) { %w(id) }
1629
1758
  end
1630
1759
  end
1631
1760
 
1632
- describe '#update_invoice_patch_status' do
1761
+ describe '#get_all_opportunity_stages' do
1633
1762
  it_should_behave_like 'an api request' do
1634
- let(:command) { :update_invoice_patch_status }
1635
- let(:args) { [INVOICE_STATUS, [INVOICE_ID]]}
1763
+ let(:command) { :get_all_opportunity_stages }
1636
1764
  end
1637
1765
  end
1638
1766
 
1639
- describe '#update_contact_status_color' do
1767
+ describe '#get_curreny_list' do
1640
1768
  it_should_behave_like 'an api request' do
1641
- let(:command) { :update_contact_status_color }
1642
- let(:args) { [CONTACT_STATUS_ID, OPPORTUNITY_COLOR_NAME]}
1769
+ let(:command) { :get_currency_list }
1643
1770
  end
1644
1771
  end
1645
1772
 
1646
- describe '#update_person' do
1773
+ describe '#get_opportunity_list' do
1647
1774
  it_should_behave_like 'an api request' do
1648
- let(:command) { :update_person }
1649
- let(:args) { [CONTACT_ID]}
1775
+ let(:command) { :get_opportunity_list }
1650
1776
  end
1651
1777
  end
1652
1778
 
1653
- describe '#update_contact_status_by_id' do
1779
+ describe '#get_result_of_convertation' do
1654
1780
  it_should_behave_like 'an api request' do
1655
- let(:command) { :update_contact_status_by_id }
1656
- let(:args) { [CONTACT_ID, CONTACT_STATUS_ID]}
1781
+ let(:command) { :get_result_of_convertation }
1657
1782
  end
1658
1783
  end
1659
1784
 
1660
- describe '#update_invoice_line' do
1785
+ describe '#get_opportunity_stage' do
1661
1786
  it_should_behave_like 'an api request' do
1662
- let(:command) { :update_invoice_line }
1663
- let(:args) { [INVOICE_ID]}
1787
+ let(:command) { :get_opportunity_stage }
1788
+ let(:args) { [random_id(:opportunity_stage)] }
1664
1789
  end
1665
1790
  end
1666
1791
 
1667
- describe '#create_history_category' do
1792
+ describe '#get_opportunity_by_id' do
1668
1793
  it_should_behave_like 'an api request' do
1669
- let(:command) { :create_history_category }
1670
- let(:args) { [RANDOM_TITLE, RANDOM_TITLE] }
1794
+ let(:command) { :get_opportunity_by_id }
1795
+ let(:args) { [random_id(:opportunity)] }
1671
1796
  end
1672
1797
  end
1673
1798
 
1674
- describe '#update_history_category' do
1799
+ describe '#get_all_opportunity_contacts' do
1675
1800
  it_should_behave_like 'an api request' do
1676
- let(:command) { :update_history_category }
1677
- let(:args) { [HISTORY_CATEGORY_ID, RANDOM_TITLE] }
1801
+ let(:command) { :get_all_opportunity_contacts }
1802
+ let(:args) { [random_id(:opportunity)] }
1678
1803
  end
1679
1804
  end
1680
1805
 
1681
- describe '#get_task_list_by_filter' do
1806
+ describe '#get_summary_table' do
1682
1807
  it_should_behave_like 'an api request' do
1683
- let(:command) { :get_task_list_by_filter }
1808
+ pending 'http://bugzserver/show_bug.cgi?id=23883'
1809
+ let(:command) { :get_summary_table }
1810
+ let(:args) { [random_word] }
1684
1811
  end
1685
1812
  end
1686
1813
 
1687
- describe '#get_all_task_categories' do
1814
+ describe '#set_opportunity_access_rights' do
1688
1815
  it_should_behave_like 'an api request' do
1689
- let(:command) { :get_all_task_categories }
1816
+ let(:command) { :set_opportunity_access_rights }
1817
+ let(:args) { [[random_id(:opportunity)], random_bool, random_id(:user)] }
1690
1818
  end
1691
1819
  end
1692
1820
 
1693
- describe '#create_task_category' do
1821
+ describe '#update_opportunity_stage' do
1694
1822
  it_should_behave_like 'an api request' do
1695
- let(:command) { :create_task_category }
1696
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE, {description: RANDOM_NOTE, sortOrder: 4 }] }
1823
+ pending 'http://bugzserver/show_bug.cgi?id=23884'
1824
+ let(:command) { :update_opportunity_stage }
1825
+ let(:args) { [random_id(:opportunity_stage), random_word, COLORS_NAMES.sample] }
1697
1826
  end
1698
1827
  end
1699
1828
 
1700
- describe '#get_contact_upcoming_tasks' do
1829
+ describe '#update_opportunity_stages_order' do
1701
1830
  it_should_behave_like 'an api request' do
1702
- let(:command) { :get_contact_upcoming_tasks }
1703
- let(:args) { [CONTACTS_IDS] }
1831
+ let(:command) { :update_opportunity_stages_order }
1832
+ let(:args) { [DATA_COLLECTOR[:opportunity_stage_ids].sample(rand(1..3))] }
1704
1833
  end
1705
1834
  end
1706
1835
 
1707
- describe '#update_task_category' do
1836
+ describe '#set_opportunity_access_rights_for_users' do
1708
1837
  it_should_behave_like 'an api request' do
1709
- let(:command) { :update_task_category }
1710
- let(:args) { [CATEGORY_ID, { title: RANDOM_TITLE, description: RANDOM_NOTE, imageName: RANDOM_NOTE, sortOrder: 4 }] }
1838
+ let(:command) { :set_opportunity_access_rights_for_users }
1711
1839
  end
1712
1840
  end
1713
1841
 
1714
- describe '#get_all_contact_types' do
1842
+ describe '#update_opportunity_to_stage' do
1715
1843
  it_should_behave_like 'an api request' do
1716
- let(:command) { :get_all_contact_types }
1844
+ let(:command) { :update_opportunity_to_stage }
1845
+ let(:args) { [random_id(:opportunity), random_id(:opportunity_stage)] }
1717
1846
  end
1718
1847
  end
1719
1848
 
1720
- describe '#get_contact_by_id' do
1849
+ describe '#get_invoice_taxes' do
1721
1850
  it_should_behave_like 'an api request' do
1722
- let(:command) { :get_contact_by_id }
1723
- let(:args) { [CONTACT_ID] }
1851
+ let(:command) { :get_invoice_taxes }
1724
1852
  end
1725
1853
  end
1726
1854
 
1727
- describe '#get_all_contact_info_types' do
1855
+ describe '#get_contacts_for_mail' do
1728
1856
  it_should_behave_like 'an api request' do
1729
- let(:command) { :get_all_contact_info_types }
1857
+ let(:command) { :get_contacts_for_mail }
1858
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].sample(rand(1..3))] }
1730
1859
  end
1731
1860
  end
1732
1861
 
1733
- describe '#get_contacts_by_project_id' do
1862
+ describe '#get_cases_by_prefix' do
1734
1863
  it_should_behave_like 'an api request' do
1735
- let(:command) { :get_contacts_by_project_id }
1736
- let(:args) { [PROJECT_ID_FOR_OPERATIONS] }
1864
+ let(:command) { :get_cases_by_prefix }
1865
+ let(:args) { [random_id(:new_contact), random_word] }
1737
1866
  end
1738
1867
  end
1739
1868
 
1740
- describe '#get_contact_type' do
1869
+ describe '#get_contact_statuses' do
1741
1870
  it_should_behave_like 'an api request' do
1742
- let(:command) { :get_contact_type }
1743
- let(:args) { [CONTACT_TYPE_ID] }
1871
+ let(:command) { :get_contact_statuses }
1744
1872
  end
1745
1873
  end
1746
1874
 
1747
- describe '#get_contact_info' do
1875
+ describe '#get_invoice_sample' do
1748
1876
  it_should_behave_like 'an api request' do
1749
- let(:command) { :get_contact_info }
1750
- let(:args) { [CONTACT_ID, CONTACT_INFORMATION_ID] }
1877
+ let(:command) { :get_invoice_sample }
1751
1878
  end
1752
1879
  end
1753
1880
 
1754
- describe '#get_company_linked_persons_list' do
1881
+ describe '#get_invoices_by_filter' do
1755
1882
  it_should_behave_like 'an api request' do
1756
- let(:command) { :get_company_linked_persons_list }
1757
- let(:args) { [COMPANY_ID] }
1883
+ let(:command) { :get_invoices_by_filter }
1758
1884
  end
1759
1885
  end
1760
1886
 
1761
- describe '#quick_person_list_creation' do
1887
+ describe '#get_contacts_by_filter' do
1762
1888
  it_should_behave_like 'an api request' do
1763
- let(:command) { :quick_person_list_creation }
1764
- let(:args) { [NEW_RANDOM_USERS_ARRAY] }
1889
+ let(:command) { :get_contacts_by_filter }
1765
1890
  end
1766
1891
  end
1767
1892
 
1768
- describe '#add_contact_info' do
1893
+ describe '#get_settings' do
1769
1894
  it_should_behave_like 'an api request' do
1770
- let(:command) { :add_contact_info }
1771
- let(:args) { [CONTACT_ID, INFO_TYPE, RANDOM_NOTE, INFO_CATEGORY] }
1895
+ let(:command) { :get_settings }
1772
1896
  end
1773
1897
  end
1774
1898
 
1775
- describe '#add_persons_to_company' do
1899
+ describe '#get_invoice_items_by_filter' do
1776
1900
  it_should_behave_like 'an api request' do
1777
- let(:command) { :add_persons_to_company }
1778
- let(:args) { [COMPANY_ID, CONTACT_ID] }
1901
+ let(:command) { :get_invoice_items_by_filter }
1779
1902
  end
1780
1903
  end
1781
1904
 
1782
- describe '#link_contact_with_project' do
1905
+ describe '#get_entity_invoices' do
1783
1906
  it_should_behave_like 'an api request' do
1784
- let(:command) { :link_contact_with_project }
1785
- let(:args) { [CONTACT_ID, PROJECT_ID_FOR_OPERATIONS] }
1907
+ let(:command) { :get_entity_invoices }
1908
+ let(:args) { [:contact, random_id(:new_contact)] }
1786
1909
  end
1787
1910
  end
1788
1911
 
1789
- describe '#add_contact_address' do
1912
+ describe '#create_task_group' do
1790
1913
  it_should_behave_like 'an api request' do
1791
- let(:command) { :add_contact_address }
1792
- let(:args) { [CONTACT_ID, CATEGORY_ID, RANDOM_TITLE] }
1914
+ let(:command) { :create_task_group }
1915
+ let(:args) { [random_word] }
1793
1916
  end
1794
1917
  end
1795
1918
 
1796
- describe '#set_contacts_access_rights' do
1919
+ describe '#add_tag_to_batch_contacts' do
1797
1920
  it_should_behave_like 'an api request' do
1798
- let(:command) { :set_contacts_access_rights }
1799
- let(:args) { [[CONTACT_ID]] }
1921
+ let(:command) { :add_tag_to_batch_contacts }
1922
+ let(:args) { [(1..rand(1..4)).map {random_word(rand(3..6))}] }
1800
1923
  end
1801
1924
  end
1802
1925
 
1803
- describe '#set_contact_access_rights' do
1926
+ describe '#add_contact_tag_to_group' do
1804
1927
  it_should_behave_like 'an api request' do
1805
- let(:command) { :set_contact_access_rights }
1806
- let(:args) { [CONTACT_ID] }
1928
+ let(:command) { :add_contact_tag_to_group }
1929
+ let(:args) { [:company, random_id(:company), random_word(4)] }
1807
1930
  end
1808
1931
  end
1809
1932
 
1810
- describe '#update_company' do
1933
+ describe '#add_deal_to_contact' do
1811
1934
  it_should_behave_like 'an api request' do
1812
- let(:command) { :update_company }
1813
- let(:args) { [COMPANY_ID, RANDOM_TITLE] }
1935
+ let(:command) { :add_deal_to_contact }
1936
+ let(:args) { [random_id(:new_contact), random_id(:opportunity)] }
1814
1937
  end
1815
1938
  end
1816
1939
 
1817
- describe '#update_contact_info' do
1940
+ describe '#set_is_portal_configured' do
1818
1941
  it_should_behave_like 'an api request' do
1819
- let(:command) { :update_contact_info }
1820
- let(:args) { [CONTACT_INFORMATION_ID, CONTACT_ID, INFO_TYPE, RANDOM_TITLE] }
1942
+ let(:command) { :set_is_portal_configured }
1943
+ let(:args) { [{configured: random_bool}] }
1821
1944
  end
1822
1945
  end
1823
1946
 
1824
- describe '#change_contact_photo_by_url' do
1947
+ describe '#update_task' do
1825
1948
  it_should_behave_like 'an api request' do
1826
- let(:command) { :change_contact_photo_by_url }
1827
- let(:args) { [CONTACT_ID, IMAGE_URL] }
1949
+ let(:command) { :update_task }
1950
+ let(:args) { [random_id(:crm_task), random_word, DateTime.commercial(2015).to_s, random_id(:crm_task_category)] }
1828
1951
  end
1829
1952
  end
1830
1953
 
1831
- describe '#add_tag_to_case_group_by_filter' do
1954
+ describe '#update_invoice_item' do
1832
1955
  it_should_behave_like 'an api request' do
1833
- let(:command) { :add_tag_to_case_group_by_filter }
1956
+ let(:command) { :update_invoice_item }
1957
+ let(:args) { [random_id(:invoice_item), random_word, random_word, rand, random_word] }
1834
1958
  end
1835
1959
  end
1836
1960
 
1837
-
1838
- end
1839
-
1840
- describe '[Community]' do
1841
- let(:teamlab_module) { :community }
1842
-
1843
- describe '#get_all_posts' do
1961
+ describe '#update_invoice_tax' do
1844
1962
  it_should_behave_like 'an api request' do
1845
- let(:command) { :get_all_posts }
1963
+ let(:command) { :update_invoice_tax }
1964
+ let(:args) { [random_id(:invoice_tax), random_word] }
1846
1965
  end
1847
1966
  end
1848
1967
 
1849
- describe '#get_blog_tags' do
1968
+ describe '#update_contact_type' do
1850
1969
  it_should_behave_like 'an api request' do
1851
- let(:command) { :get_blog_tags }
1970
+ let(:command) { :update_contact_type }
1971
+ let(:args) { [random_id(:contact_type), random_word] }
1972
+ let(:add_data_to_collector) { true }
1973
+ let(:data_param) { :contact_types_titles }
1974
+ let(:param_names) { %w(title) }
1852
1975
  end
1853
1976
  end
1854
1977
 
1855
- describe '#get_my_posts' do
1978
+ describe '#update_contact_status' do
1856
1979
  it_should_behave_like 'an api request' do
1857
- let(:command) { :get_my_posts }
1980
+ let(:command) { :update_contact_status }
1981
+ let(:args) { [random_id(:contact_status), random_word, {color: COLORS_NAMES.sample}] }
1858
1982
  end
1859
1983
  end
1860
1984
 
1861
- describe '#get_post_by_id' do
1985
+ describe '#update_invoice' do
1862
1986
  it_should_behave_like 'an api request' do
1863
- let(:command) { :get_post }
1864
- let(:args) { [POST_ID] }
1987
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
1988
+ let(:command) { :update_invoice }
1989
+ let(:args) { [random_id(:invoice)] }
1865
1990
  end
1866
1991
  end
1867
1992
 
1868
- describe '#get_posts_by_tag' do
1993
+ describe '#update_crm_contact_tag_setting' do
1869
1994
  it_should_behave_like 'an api request' do
1870
- let(:command) { :get_posts_by_tag }
1871
- let(:args) { [RANDOM_TAGS.sample] }
1995
+ let(:command) { :update_crm_contact_tag_setting }
1872
1996
  end
1873
1997
  end
1874
1998
 
1875
- describe '#search_posts' do
1999
+ describe '#save_number_settings' do
1876
2000
  it_should_behave_like 'an api request' do
1877
- let(:command) { :search_posts }
1878
- let(:args) { [random_word] }
2001
+ let(:command) { :save_number_settings }
1879
2002
  end
1880
2003
  end
1881
2004
 
1882
- describe '#get_user_posts' do
2005
+ describe '#set_access_to_batch_contact' do
1883
2006
  it_should_behave_like 'an api request' do
1884
- let(:command) { :get_user_posts }
1885
- let(:args) { [USERNAME_FOR_OPERATIONS] }
2007
+ let(:command) { :set_access_to_batch_contact }
1886
2008
  end
1887
2009
  end
1888
2010
 
1889
- describe '#get_comments' do
2011
+ describe '#update_statuses_contact_order' do
1890
2012
  it_should_behave_like 'an api request' do
1891
- let(:command) { :get_comments }
1892
- let(:args) { [POST_ID] }
2013
+ let(:command) { :update_statuses_contact_order }
1893
2014
  end
1894
2015
  end
1895
2016
 
1896
- describe '#create_post' do
2017
+ describe '#save_terms_settings' do
1897
2018
  it_should_behave_like 'an api request' do
1898
- let(:command) { :create_post }
1899
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
2019
+ let(:command) { :save_terms_settings }
1900
2020
  end
1901
2021
  end
1902
2022
 
1903
- describe '#add_comment' do
2023
+ describe '#update_crm_contact_status_settings' do
1904
2024
  it_should_behave_like 'an api request' do
1905
- let(:command) { :add_comment }
1906
- let(:args) { [POST_ID, RANDOM_NOTE] }
2025
+ let(:command) { :update_crm_contact_status_settings }
1907
2026
  end
1908
2027
  end
1909
2028
 
1910
- describe '#update_post' do
2029
+ describe '#update_invoice_patch_status' do
1911
2030
  it_should_behave_like 'an api request' do
1912
- let(:command) { :update_post }
1913
- let(:args) { [POST_ID, RANDOM_TITLE, RANDOM_NOTE, {tags: RANDOM_TAGS.join(',')}] }
2031
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
2032
+ let(:command) { :update_invoice_patch_status }
2033
+ let(:args) { [INVOICE_STATUSES.sample, DATA_COLLECTOR[:invoice_ids].sample(rand(1..3))] }
1914
2034
  end
1915
2035
  end
1916
2036
 
1917
- describe '#get_all_bookmarks' do
2037
+ describe '#update_contact_status_color' do
1918
2038
  it_should_behave_like 'an api request' do
1919
- let(:command) { :get_all_bookmarks }
2039
+ let(:command) { :update_contact_status_color }
2040
+ let(:args) { [random_id(:contact_status), COLORS_NAMES.sample] }
1920
2041
  end
1921
2042
  end
1922
2043
 
1923
- describe '#get_all_bookmark_tags' do
2044
+ describe '#update_person' do
1924
2045
  it_should_behave_like 'an api request' do
1925
- let(:command) { :get_all_bookmark_tags }
2046
+ let(:command) { :update_person }
2047
+ let(:args) { [random_id(:new_contact), random_word.capitalize, random_word.capitalize] }
1926
2048
  end
1927
2049
  end
1928
2050
 
1929
- describe '#get_bookmark' do
2051
+ describe '#update_contact_status_by_id' do
1930
2052
  it_should_behave_like 'an api request' do
1931
- let(:command) { :get_bookmark }
1932
- let(:args) { [BOOKMARK_ID] }
2053
+ let(:command) { :update_contact_status_by_id }
2054
+ let(:args) { [random_id(:new_contact), random_id(:contact_status)] }
1933
2055
  end
1934
2056
  end
1935
2057
 
1936
- describe '#get_bookmarks_added_by_me' do
2058
+ describe '#update_invoice_line' do
1937
2059
  it_should_behave_like 'an api request' do
1938
- let(:command) { :get_bookmarks_added_by_me }
2060
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
2061
+ let(:command) { :update_invoice_line }
2062
+ let(:args) { [random_id(:invoice_line), random_id(:invoice)] }
1939
2063
  end
1940
2064
  end
1941
2065
 
1942
- describe '#get_my_favourite_bookmarks' do
2066
+ #describe '#change_contact_photo' do
2067
+ # it_should_behave_like 'an api request' do
2068
+ # let(:command) { :change_contact_photo }
2069
+ # let(:args) { [random_id(:new_contact), 'path_to_image'] }
2070
+ # end
2071
+ #end
2072
+
2073
+ describe '#update_person_and_its_company_status' do
1943
2074
  it_should_behave_like 'an api request' do
1944
- let(:command) { :get_my_favourite_bookmarks }
2075
+ let(:command) { :update_person_and_its_company_status }
2076
+ let(:args) { [random_id(:new_contact), random_id(:contact_status)] }
1945
2077
  end
1946
2078
  end
1947
2079
 
1948
- describe '#get_top_of_day_bookmarks' do
2080
+ describe '#update_company_and_participants_status' do
1949
2081
  it_should_behave_like 'an api request' do
1950
- let(:command) { :get_top_of_day_bookmarks }
2082
+ let(:command) { :update_company_and_participants_status }
2083
+ let(:args) { [random_id(:company), random_id(:contact_status)] }
1951
2084
  end
1952
2085
  end
1953
2086
 
1954
- describe '#get_top_of_week_bookmarks' do
2087
+ describe '#get_event_list_by_filter' do
1955
2088
  it_should_behave_like 'an api request' do
1956
- let(:command) { :get_top_of_week_bookmarks }
2089
+ let(:command) { :get_event_list_by_filter }
1957
2090
  end
1958
2091
  end
1959
2092
 
1960
- describe '#get_top_of_month_bookmarks' do
2093
+ describe '#get_all_history_categories' do
1961
2094
  it_should_behave_like 'an api request' do
1962
- let(:command) { :get_top_of_month_bookmarks }
2095
+ let(:command) { :get_all_history_categories }
1963
2096
  end
1964
2097
  end
1965
2098
 
1966
- describe '#get_top_of_year_bookmarks' do
2099
+ describe '#get_all_history_categories' do
1967
2100
  it_should_behave_like 'an api request' do
1968
- let(:command) { :get_top_of_year_bookmarks }
2101
+ let(:command) { :get_all_history_categories }
1969
2102
  end
1970
2103
  end
1971
2104
 
1972
- describe '#get_bookmarks_by_tag' do
2105
+ describe '#update_history_categories_order' do
1973
2106
  it_should_behave_like 'an api request' do
1974
- let(:command) { :get_bookmarks_by_tag }
1975
- let(:args) { [RANDOM_TAGS.sample] }
2107
+ let(:command) { :update_history_categories_order }
2108
+ let(:args) { [DATA_COLLECTOR[:history_category_titles].shuffle] }
1976
2109
  end
1977
2110
  end
1978
2111
 
1979
- describe '#get_recently_added_bookmarks' do
2112
+ describe '#update_history_category_icon' do
1980
2113
  it_should_behave_like 'an api request' do
1981
- let(:command) { :get_recently_added_bookmarks }
2114
+ let(:command) { :update_history_category_icon }
2115
+ let(:args) { [random_id(:crm_history_category), random_word] }
1982
2116
  end
1983
2117
  end
1984
2118
 
1985
- describe '#get_bookmark_comments' do
2119
+ describe '#get_task_list_by_filter' do
1986
2120
  it_should_behave_like 'an api request' do
1987
- let(:command) { :get_bookmark_comments }
1988
- let(:args) { [BOOKMARK_ID] }
2121
+ let(:command) { :get_task_list_by_filter }
1989
2122
  end
1990
2123
  end
1991
2124
 
1992
- describe '#search_bookmarks' do
2125
+ describe '#get_all_task_categories' do
1993
2126
  it_should_behave_like 'an api request' do
1994
- let(:command) { :search_bookmarks }
1995
- let(:args) { [random_word] }
2127
+ let(:command) { :get_all_task_categories }
1996
2128
  end
1997
2129
  end
1998
2130
 
1999
- describe '#add_bookmark' do
2131
+ describe '#get_task_by_id' do
2000
2132
  it_should_behave_like 'an api request' do
2001
- let(:command) { :add_bookmark }
2002
- let(:args) { [IMAGE_URL, RANDOM_TITLE] }
2133
+ let(:command) { :get_task_by_id }
2134
+ let(:args) { [random_id(:crm_task)] }
2003
2135
  end
2004
2136
  end
2005
2137
 
2006
- describe '#add_comment_to_bookmark' do
2138
+ describe '#get_task_category' do
2007
2139
  it_should_behave_like 'an api request' do
2008
- let(:command) { :add_comment_to_bookmark }
2009
- let(:args) { [BOOKMARK_ID, RANDOM_NOTE] }
2140
+ let(:command) { :get_task_category }
2141
+ let(:args) { [random_id(:crm_task_category)] }
2010
2142
  end
2011
2143
  end
2012
2144
 
2013
- describe '#get_all_events' do
2145
+ describe '#get_contact_upcoming_tasks' do
2014
2146
  it_should_behave_like 'an api request' do
2015
- let(:command) { :get_all_events }
2147
+ #pending 'http://bugzserver/show_bug.cgi?id=23925'
2148
+ let(:command) { :get_contact_upcoming_tasks }
2149
+ let(:args) { [random_id(:new_contact)] }
2016
2150
  end
2017
2151
  end
2018
2152
 
2019
- describe '#get_my_events' do
2153
+ describe '#close_task' do
2020
2154
  it_should_behave_like 'an api request' do
2021
- let(:command) { :get_my_events }
2155
+ let(:command) { :close_task }
2156
+ let(:args) { [random_id(:crm_task)] }
2022
2157
  end
2023
2158
  end
2024
2159
 
2025
- describe '#get_event' do
2160
+ describe '#resume_task' do
2026
2161
  it_should_behave_like 'an api request' do
2027
- let(:command) { :get_event }
2028
- let(:args) { [EVENT_ID] }
2162
+ let(:command) { :resume_task }
2163
+ let(:args) { [random_id(:crm_task)] }
2029
2164
  end
2030
2165
  end
2031
2166
 
2032
- describe '#search_events' do
2167
+ describe '#update_task_categories_order' do
2033
2168
  it_should_behave_like 'an api request' do
2034
- let(:command) { :search_events }
2035
- let(:args) { [random_word] }
2169
+ let(:command) { :update_task_categories_order }
2170
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_titles].shuffle] }
2036
2171
  end
2037
2172
  end
2038
2173
 
2039
- describe '#create_event' do
2174
+ describe '#update_task_category_icon' do
2040
2175
  it_should_behave_like 'an api request' do
2041
- let(:command) { :create_event }
2042
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
2176
+ let(:command) { :update_task_category_icon }
2177
+ let(:args) { [random_id(:crm_task_category), random_word] }
2043
2178
  end
2044
2179
  end
2045
2180
 
2046
- describe '#vote_for_event' do
2181
+ describe '#get_all_contact_types' do
2047
2182
  it_should_behave_like 'an api request' do
2048
- let(:command) { :vote_for_event }
2049
- let(:args) { [EVENT_ID, 1] }
2183
+ let(:command) { :get_all_contact_types }
2050
2184
  end
2051
2185
  end
2052
2186
 
2053
- describe '#add_comment_to_event' do
2187
+ describe '#get_contact_by_id' do
2054
2188
  it_should_behave_like 'an api request' do
2055
- let(:command) { :add_comment_to_event }
2056
- let(:args) { [EVENT_ID, RANDOM_NOTE] }
2189
+ let(:command) { :get_contact_by_id }
2190
+ let(:args) { [random_id(:new_contact)] }
2057
2191
  end
2058
2192
  end
2059
2193
 
2060
- describe '#update_event' do
2194
+ describe '#get_all_contact_info_types' do
2061
2195
  it_should_behave_like 'an api request' do
2062
- let(:command) { :update_event }
2063
- let(:args) { [EVENT_ID, RANDOM_TITLE, RANDOM_NOTE] }
2196
+ let(:command) { :get_all_contact_info_types }
2064
2197
  end
2065
2198
  end
2066
2199
 
2067
- describe '#get_forums' do
2200
+ describe '#link_contact_list_with_project' do
2068
2201
  it_should_behave_like 'an api request' do
2069
- let(:command) { :get_forums }
2202
+ let(:command) { :link_contact_list_with_project }
2203
+ let(:args) { [random_id(:project), DATA_COLLECTOR[:new_contact_ids].sample(rand(1..4))] }
2070
2204
  end
2071
2205
  end
2072
2206
 
2073
- describe '#get_thread_topics' do
2207
+ describe '#link_contact_with_project' do
2074
2208
  it_should_behave_like 'an api request' do
2075
- let(:command) { :get_thread_topics }
2076
- let(:args) { [THREAD_ID] }
2209
+ let(:command) { :link_contact_with_project }
2210
+ let(:args) { [random_id(:project), random_id(:new_contact)] }
2077
2211
  end
2078
2212
  end
2079
2213
 
2080
- describe '#get_last_updated_topics' do
2214
+ describe '#add_persons_to_company' do
2081
2215
  it_should_behave_like 'an api request' do
2082
- let(:command) { :get_last_updated_topics }
2216
+ let(:command) { :add_persons_to_company }
2217
+ i = -1
2218
+ let(:args) { [DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
2083
2219
  end
2084
2220
  end
2085
2221
 
2086
- describe '#get_posts' do
2222
+ describe '#get_contacts_by_project_id' do
2087
2223
  it_should_behave_like 'an api request' do
2088
- let(:command) { :get_posts }
2089
- let(:args) { [TOPIC_ID] }
2224
+ let(:command) { :get_contacts_by_project_id }
2225
+ let(:args) { [random_id(:project)] }
2090
2226
  end
2091
2227
  end
2092
2228
 
2093
- describe '#search_topics' do
2229
+ describe '#get_contact_type' do
2094
2230
  it_should_behave_like 'an api request' do
2095
- let(:command) { :search_topics }
2096
- let(:args) { [random_word(5)] }
2231
+ let(:command) { :get_contact_type }
2232
+ let(:args) { [random_id(:contact_type)] }
2097
2233
  end
2098
2234
  end
2099
2235
 
2100
- describe '#add_thread_to_category' do
2236
+ describe '#get_contact_info' do
2101
2237
  it_should_behave_like 'an api request' do
2102
- let(:command) { :add_thread_to_category }
2103
- let(:args) { [COMMUNITY_CATEGORY_ID, RANDOM_NOTE, {categoryName: RANDOM_TITLE, threadDescription: random_word(4)}] }
2238
+ let(:command) { :get_contact_info }
2239
+ let(:args) { [random_id(:new_contact), CONTACT_INFO_TYPES.sample] }
2104
2240
  end
2105
2241
  end
2106
2242
 
2107
- describe '#add_topic_to_thread' do
2243
+ describe '#get_all_categories' do
2108
2244
  it_should_behave_like 'an api request' do
2109
- let(:command) { :add_topic_to_thread }
2110
- let(:args) { [THREAD_ID, RANDOM_TITLE, RANDOM_NOTE] }
2245
+ let(:command) { :get_all_categories }
2246
+ let(:args) { [CONTACT_INFO_TYPES.sample] }
2111
2247
  end
2112
2248
  end
2113
2249
 
2114
- describe '#update_topic_in_thread' do
2250
+ describe '#get_company_linked_persons_list' do
2115
2251
  it_should_behave_like 'an api request' do
2252
+ let(:command) { :get_company_linked_persons_list }
2253
+ let(:args) { [random_id(:company)] }
2254
+ end
2255
+ end
2256
+
2257
+ describe '#get_contact_information_by_type' do
2258
+ it_should_behave_like 'an api request' do
2259
+ let(:command) { :get_contact_information_by_type }
2260
+ let(:args) { [random_id(:new_contact), CONTACT_INFO_TYPES.sample] }
2261
+ end
2262
+ end
2263
+
2264
+ describe '#group_contact_info' do
2265
+ it_should_behave_like 'an api request' do
2266
+ pending 'http://bugzserver/show_bug.cgi?id=23988'
2267
+ let(:command) { :group_contact_info }
2268
+ let(:args) { [[random_id(:new_contact), CONTACT_INFO_TYPES.sample]] }
2269
+ end
2270
+ end
2271
+
2272
+ describe '#quick_company_list_creation' do
2273
+ it_should_behave_like 'an api request' do
2274
+ let(:command) { :quick_company_list_creation }
2275
+ let(:args) { [random_word] }
2276
+ end
2277
+ end
2278
+
2279
+ describe '#add_contact_address' do
2280
+ it_should_behave_like 'an api request' do
2281
+ let(:command) { :add_contact_address }
2282
+ i = -1
2283
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], random_info_category('Address'), random_word] }
2284
+ let(:add_data_to_collector) { true }
2285
+ let(:data_param) { :contact_address_ids }
2286
+ let(:param_names) { %w() }
2287
+ end
2288
+ end
2289
+
2290
+ describe '#group_contact_info_update' do
2291
+ it_should_behave_like 'an api request' do
2292
+ pending 'http://bugzserver/show_bug.cgi?id=23988'
2293
+ let(:command) { :group_contact_info_update }
2294
+ let(:args) { [[random_id(:new_contact), CONTACT_INFO_TYPES.sample]] }
2295
+ end
2296
+ end
2297
+
2298
+ describe '#merge_contacts' do
2299
+ it_should_behave_like 'an api request' do
2300
+ let(:command) { :merge_contacts }
2301
+ let(:args) { [random_id(:new_contact), random_id(:new_contact)] }
2302
+ end
2303
+ end
2304
+
2305
+ describe '#set_contacts_access_rights' do
2306
+ it_should_behave_like 'an api request' do
2307
+ let(:command) { :set_contacts_access_rights }
2308
+ let(:args) { [[DATA_COLLECTOR[:new_contact_ids].sample(rand(1..4))]] }
2309
+ end
2310
+ end
2311
+
2312
+ describe '#update_contact_types_order' do
2313
+ it_should_behave_like 'an api request' do
2314
+ let(:command) { :update_contact_types_order }
2315
+ let(:args) { [DATA_COLLECTOR[:contact_types_titles].sample(rand(1..4))] }
2316
+ end
2317
+ end
2318
+
2319
+ describe '#set_contact_access_rights' do
2320
+ it_should_behave_like 'an api request' do
2321
+ let(:command) { :set_contact_access_rights }
2322
+ let(:args) { [ random_id(:new_contact) ] }
2323
+ end
2324
+ end
2325
+
2326
+ describe '#update_company' do
2327
+ it_should_behave_like 'an api request' do
2328
+ let(:command) { :update_company }
2329
+ let(:args) { [ random_id(:company), random_word ] }
2330
+ end
2331
+ end
2332
+
2333
+ describe '#update_contact_info' do
2334
+ it_should_behave_like 'an api request' do
2335
+ let(:command) { :update_contact_info }
2336
+ let(:args) { [ random_id(:contact_info), random_id(:new_contact), random_word ] }
2337
+ end
2338
+ end
2339
+
2340
+ describe '#change_contact_photo_by_url' do
2341
+ it_should_behave_like 'an api request' do
2342
+ let(:command) { :change_contact_photo_by_url }
2343
+ let(:args) { [ random_id(:new_contact), IMAGE_URL ] }
2344
+ end
2345
+ end
2346
+
2347
+ describe '#update_contact_address' do
2348
+ it_should_behave_like 'an api request' do
2349
+ pending('http://bugzserver/show_bug.cgi?id=24002')
2350
+ let(:command) { :update_contact_address }
2351
+ let(:args) { [ random_id(:new_contact), random_id(:contact_address), random_word ] }
2352
+ end
2353
+ end
2354
+
2355
+ describe '#get_root_folder_id' do
2356
+ it_should_behave_like 'an api request' do
2357
+ let(:command) { :get_root_folder_id }
2358
+ end
2359
+ end
2360
+
2361
+ describe '#associate_file_with_entity' do
2362
+ it_should_behave_like 'an api request' do
2363
+ let(:command) { :associate_file_with_entity }
2364
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), DATA_COLLECTOR[:file_ids].sample(rand(1..4))] }
2365
+ end
2366
+ end
2367
+
2368
+ describe '#create_txt' do
2369
+ it_should_behave_like 'an api request' do
2370
+ let(:command) { :create_txt }
2371
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_word] }
2372
+ let(:add_data_to_collector) { true }
2373
+ let(:data_param) { :crm_file_ids }
2374
+ let(:param_names) { %w(id) }
2375
+ end
2376
+ end
2377
+
2378
+ describe '#get_file_list' do
2379
+ it_should_behave_like 'an api request' do
2380
+ let(:command) { :get_file_list }
2381
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
2382
+ end
2383
+ end
2384
+
2385
+ #describe '#upload_file' do
2386
+ # it_should_behave_like 'an api request' do
2387
+ # let(:command) { :upload_file }
2388
+ # let(:args) { [entity = ENTITY_TYPES.sample, random_id(entity.to_sym), 'files'] }
2389
+ # end
2390
+ #end
2391
+
2392
+ describe '#create_tag' do
2393
+ it_should_behave_like 'an api request' do
2394
+ let(:command) { :create_tag }
2395
+ let(:args) { [ENTITY_TYPES.last, random_word(4)] }
2396
+ let(:add_data_to_collector) { true }
2397
+ let(:data_param) { :crm_tag_ids }
2398
+ let(:param_names) { %w() }
2399
+ end
2400
+ end
2401
+
2402
+ describe '#get_tags_for_entity_type' do
2403
+ it_should_behave_like 'an api request' do
2404
+ let(:command) { :get_tags_for_entity_type }
2405
+ let(:args) { [ENTITY_TYPES.sample] }
2406
+ end
2407
+ end
2408
+
2409
+ describe '#get_all_contact_tags' do
2410
+ it_should_behave_like 'an api request' do
2411
+ let(:command) { :get_all_contact_tags }
2412
+ let(:args) { [random_id(:new_contact)] }
2413
+ end
2414
+ end
2415
+
2416
+ describe '#get_entity_tags' do
2417
+ it_should_behave_like 'an api request' do
2418
+ let(:command) { :get_all_contact_tags }
2419
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
2420
+ end
2421
+ end
2422
+
2423
+ describe '#add_tag_to_case_group_by_filter' do
2424
+ it_should_behave_like 'an api request' do
2425
+ let(:command) { :add_tag_to_case_group_by_filter }
2426
+ let(:args) { [random_id(:crm_tag)] }
2427
+ end
2428
+ end
2429
+
2430
+ describe '#add_tag_group_to_entity' do
2431
+ it_should_behave_like 'an api request' do
2432
+ let(:command) { :add_tag_group_to_entity }
2433
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
2434
+ end
2435
+ end
2436
+
2437
+ describe '#add_tag_to_opportunity_group' do
2438
+ it_should_behave_like 'an api request' do
2439
+ let(:command) { :add_tag_to_opportunity_group }
2440
+ let(:args) { [random_id(:crm_tag)] }
2441
+ end
2442
+ end
2443
+
2444
+ describe '#add_tag' do
2445
+ it_should_behave_like 'an api request' do
2446
+ let(:command) { :add_tag }
2447
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
2448
+ end
2449
+ end
2450
+
2451
+ describe '#get_task_template_container_list' do
2452
+ it_should_behave_like 'an api request' do
2453
+ let(:command) { :get_task_template_container_list }
2454
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
2455
+ end
2456
+ end
2457
+
2458
+ describe '#update_task_template_container' do
2459
+ it_should_behave_like 'an api request' do
2460
+ let(:command) { :update_task_template_container }
2461
+ let(:args) { [random_id(:task_template_container), random_word] }
2462
+ let(:add_data_to_collector) { true }
2463
+ let(:data_param) { :task_template_container_title_ids }
2464
+ let(:param_names) { %w(title) }
2465
+ end
2466
+ end
2467
+
2468
+ describe '#get_task_template_container' do
2469
+ it_should_behave_like 'an api request' do
2470
+ let(:command) { :get_task_template_container }
2471
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact'), random_id(:task_template_container_title)] }
2472
+ end
2473
+ end
2474
+
2475
+ describe '#get_task_template' do
2476
+ it_should_behave_like 'an api request' do
2477
+ let(:command) { :get_task_template }
2478
+ let(:args) { [random_id(:task_template)] }
2479
+ end
2480
+ end
2481
+
2482
+ describe '#get_task_template_list_by_container_id' do
2483
+ it_should_behave_like 'an api request' do
2484
+ let(:command) { :get_task_template_list_by_container_id }
2485
+ let(:args) { [random_id(:task_template_container)] }
2486
+ end
2487
+ end
2488
+
2489
+ describe '#update_task_template' do
2490
+ it_should_behave_like 'an api request' do
2491
+ let(:command) { :update_task_template }
2492
+ i = -1
2493
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].last, DATA_COLLECTOR[:task_template_ids][i += 1], random_word] }
2494
+ end
2495
+ end
2496
+
2497
+ describe '#get_case_list' do
2498
+ it_should_behave_like 'an api request' do
2499
+ let(:command) { :get_case_list }
2500
+ end
2501
+ end
2502
+
2503
+ describe '#add_case_contact' do
2504
+ it_should_behave_like 'an api request' do
2505
+ let(:command) { :add_case_contact }
2506
+ i = 3
2507
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1], DATA_COLLECTOR[:new_contact_ids][i - 4]] }
2508
+ end
2509
+ end
2510
+
2511
+ describe '#get_case_by_id' do
2512
+ it_should_behave_like 'an api request' do
2513
+ let(:command) { :get_case_by_id }
2514
+ let(:args) { [random_id(:crm_case)] }
2515
+ end
2516
+ end
2517
+
2518
+ describe '#get_all_case_contacts' do
2519
+ it_should_behave_like 'an api request' do
2520
+ let(:command) { :get_all_case_contacts }
2521
+ let(:args) { [random_id(:crm_case)] }
2522
+ end
2523
+ end
2524
+
2525
+ describe '#set_case_access_rights' do
2526
+ it_should_behave_like 'an api request' do
2527
+ let(:command) { :set_case_access_rights }
2528
+ let(:args) { [random_id(:crm_case), {isPrivate: random_bool}] }
2529
+ end
2530
+ end
2531
+
2532
+ describe '#update_case' do
2533
+ it_should_behave_like 'an api request' do
2534
+ let(:command) { :update_case }
2535
+ let(:args) { [random_id(:crm_case), random_word] }
2536
+ end
2537
+ end
2538
+
2539
+ describe '#set_case_access_rights_by_filter' do
2540
+ it_should_behave_like 'an api request' do
2541
+ let(:command) { :set_case_access_rights_by_filter }
2542
+ let(:args) { [{contactId: random_id(:new_contact), isPrivate: random_bool}] }
2543
+ end
2544
+ end
2545
+
2546
+ describe '#close_case' do
2547
+ it_should_behave_like 'an api request' do
2548
+ let(:command) { :close_case }
2549
+ i = -1
2550
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1]] }
2551
+ end
2552
+ end
2553
+
2554
+ describe '#resume_case' do
2555
+ it_should_behave_like 'an api request' do
2556
+ let(:command) { :resume_case }
2557
+ i = -1
2558
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1]] }
2559
+ end
2560
+ end
2561
+
2562
+ describe '#set_rights_to_case' do
2563
+ it_should_behave_like 'an api request' do
2564
+ let(:command) { :set_rights_to_case }
2565
+ let(:args) { [random_id(:crm_case), isPrivate: random_bool] }
2566
+ end
2567
+ end
2568
+
2569
+ describe '#get_user_field_values' do
2570
+ it_should_behave_like 'an api request' do
2571
+ let(:command) { :get_user_field_values }
2572
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym)] }
2573
+ end
2574
+ end
2575
+
2576
+ describe '#get_user_field_list' do
2577
+ it_should_behave_like 'an api request' do
2578
+ let(:command) { :get_user_field_list }
2579
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
2580
+ end
2581
+ end
2582
+
2583
+ describe '#set_user_field_value' do
2584
+ it_should_behave_like 'an api request' do
2585
+ let(:command) { :set_user_field_value }
2586
+ let(:args) { [ENTITY_TYPES.last, random_id(ENTITY_TYPES.last.to_sym), random_id(:user_field), random_word] }
2587
+ end
2588
+ end
2589
+
2590
+ describe '#update_selected_user_field' do
2591
+ it_should_behave_like 'an api request' do
2592
+ let(:command) { :update_selected_user_field }
2593
+ i = -1
2594
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:user_field_ids][i += 1], random_word, rand(6)] }
2595
+ let(:add_data_to_collector) { true }
2596
+ let(:data_param) { :user_field_title_ids }
2597
+ let(:param_names) { %w(label) }
2598
+ end
2599
+ end
2600
+
2601
+ describe '#update_user_fields_order' do
2602
+ it_should_behave_like 'an api request' do
2603
+ let(:command) { :update_user_fields_order }
2604
+ let(:args) { [DATA_COLLECTOR[:user_field_title_ids].sample(rand(1..4))] }
2605
+ end
2606
+ end
2607
+
2608
+ describe '#delete_user_field' do
2609
+ it_should_behave_like 'an api request' do
2610
+ let(:command) { :delete_user_field }
2611
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:user_field_ids].pop] }
2612
+ end
2613
+ end
2614
+
2615
+ describe '#delete_case_contact' do
2616
+ it_should_behave_like 'an api request' do
2617
+ let(:command) { :delete_case_contact }
2618
+ i = -1
2619
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids][i += 1], random_id(:new_contact)] }
2620
+ end
2621
+ end
2622
+
2623
+ describe '#delete_case' do
2624
+ it_should_behave_like 'an api request' do
2625
+ let(:command) { :delete_case }
2626
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids].shift] }
2627
+ end
2628
+ end
2629
+
2630
+ describe '#delete_case_group' do
2631
+ it_should_behave_like 'an api request' do
2632
+ let(:command) { :delete_case_group }
2633
+ let(:args) { [DATA_COLLECTOR[:crm_case_ids].pop] }
2634
+ end
2635
+ end
2636
+
2637
+ describe '#delete_case_group_by_filter' do
2638
+ it_should_behave_like 'an api request' do
2639
+ let(:command) { :delete_case_group }
2640
+ i = -1
2641
+ let(:args) { [{ contactId: DATA_COLLECTOR[:new_contact_ids][i += 1] }] }
2642
+ end
2643
+ end
2644
+
2645
+ describe '#delete_invoice_item' do
2646
+ it_should_behave_like 'an api request' do
2647
+ let(:command) { :delete_invoice_item }
2648
+ let(:args) { [DATA_COLLECTOR[:invoice_item_ids].pop] }
2649
+ end
2650
+ end
2651
+
2652
+ describe '#delete_invoice_tax' do
2653
+ it_should_behave_like 'an api request' do
2654
+ let(:command) { :delete_invoice_tax }
2655
+ let(:args) { [DATA_COLLECTOR[:invoice_tax_ids].pop] }
2656
+ end
2657
+ end
2658
+
2659
+ describe '#delete_invoice_line' do
2660
+ it_should_behave_like 'an api request' do
2661
+ pending 'http://bugzserver/show_bug.cgi?id=23886, http://bugzserver/show_bug.cgi?id=23888'
2662
+ let(:command) { :delete_invoice_line }
2663
+ let(:args) { [DATA_COLLECTOR[:invoice_line_ids].pop] }
2664
+ end
2665
+ end
2666
+
2667
+ describe '#delete_invoice' do
2668
+ it_should_behave_like 'an api request' do
2669
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
2670
+ let(:command) { :delete_invoice }
2671
+ let(:args) { [DATA_COLLECTOR[:invoice_ids].pop] }
2672
+ end
2673
+ end
2674
+
2675
+ describe '#delete_opportunity_contact' do
2676
+ it_should_behave_like 'an api request' do
2677
+ let(:command) { :delete_opportunity_contact }
2678
+ i = -1
2679
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
2680
+ end
2681
+ end
2682
+
2683
+ describe '#delete_batch_invoices' do
2684
+ it_should_behave_like 'an api request' do
2685
+ pending 'http://bugzserver/show_bug.cgi?id=23886'
2686
+ let(:command) { :delete_batch_invoices }
2687
+ let(:args) { [[DATA_COLLECTOR[:invoice_ids].pop]] }
2688
+ end
2689
+ end
2690
+
2691
+ describe '#delete_batch_items' do
2692
+ it_should_behave_like 'an api request' do
2693
+ let(:command) { :delete_batch_items }
2694
+ let(:args) { [[DATA_COLLECTOR[:invoice_item_ids].pop]] }
2695
+ end
2696
+ end
2697
+
2698
+ describe '#delete_batch_contacts_by_filter' do
2699
+ it_should_behave_like 'an api request' do
2700
+ pending 'http://bugzserver/show_bug.cgi?id=23902'
2701
+ let(:command) { :delete_batch_contacts_by_filter }
2702
+ let(:args) { [{tags: [random_word(4)]}] }
2703
+ end
2704
+ end
2705
+
2706
+ describe '#delete_contact_status' do
2707
+ it_should_behave_like 'an api request' do
2708
+ pending 'http://bugzserver/show_bug.cgi?id=23915'
2709
+ let(:command) { :delete_contact_status }
2710
+ let(:args) { [DATA_COLLECTOR[:contact_status_ids].pop] }
2711
+ end
2712
+ end
2713
+
2714
+ describe '#delete_deal_from_contact' do
2715
+ it_should_behave_like 'an api request' do
2716
+ let(:command) { :delete_deal_from_contact }
2717
+ let(:args) { [random_id(:new_contact), random_id(:opportunity)] }
2718
+ end
2719
+ end
2720
+
2721
+ describe '#delete_event_and_related_files' do
2722
+ it_should_behave_like 'an api request' do
2723
+ let(:command) { :delete_event_and_related_files }
2724
+ let(:args) { [DATA_COLLECTOR[:crm_event_ids].pop] }
2725
+ end
2726
+ end
2727
+
2728
+ describe '#delete_history_category' do
2729
+ it_should_behave_like 'an api request' do
2730
+ let(:command) { :delete_history_category }
2731
+ let(:args) { [DATA_COLLECTOR[:crm_history_category_ids].pop] }
2732
+ end
2733
+ end
2734
+
2735
+ describe '#delete_task' do
2736
+ it_should_behave_like 'an api request' do
2737
+ let(:command) { :delete_task }
2738
+ let(:args) { [DATA_COLLECTOR[:crm_task_ids].pop] }
2739
+ end
2740
+ end
2741
+
2742
+ describe '#delete_task_category' do
2743
+ it_should_behave_like 'an api request' do
2744
+ let(:command) { :delete_task_category }
2745
+ let(:args) { [DATA_COLLECTOR[:crm_task_category_ids].pop] }
2746
+ end
2747
+ end
2748
+
2749
+ describe '#delete_person_from_company' do
2750
+ it_should_behave_like 'an api request' do
2751
+ let(:command) { :delete_person_from_company }
2752
+ i = -1
2753
+ let(:args) { [ DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
2754
+ end
2755
+ end
2756
+
2757
+ describe '#delete_contact_address' do
2758
+ it_should_behave_like 'an api request' do
2759
+ pending 'http://bugzserver/show_bug.cgi?id=24028'
2760
+ let(:command) { :delete_contact_address }
2761
+ i = -1
2762
+ let(:args) { [ DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_address_ids].shift ] }
2763
+ end
2764
+ end
2765
+
2766
+ describe '#remove_contact_from_project' do
2767
+ it_should_behave_like 'an api request' do
2768
+ let(:command) { :remove_contact_from_project }
2769
+ let(:args) { [ random_id(:new_contact), random_id(:project)] }
2770
+ end
2771
+ end
2772
+
2773
+ describe '#delete_contact_type' do
2774
+ it_should_behave_like 'an api request' do
2775
+ let(:command) { :delete_contact_type }
2776
+ let(:args) { [DATA_COLLECTOR[:contact_type_ids].pop] }
2777
+ end
2778
+ end
2779
+
2780
+ describe '#delete_contact_info' do
2781
+ it_should_behave_like 'an api request' do
2782
+ let(:command) { :delete_contact_info }
2783
+ i = -1
2784
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_info_ids][i]] }
2785
+ end
2786
+ end
2787
+
2788
+ describe '#delete_contact_group' do
2789
+ it_should_behave_like 'an api request' do
2790
+ let(:command) { :delete_contact_group }
2791
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].pop] }
2792
+ end
2793
+ end
2794
+
2795
+ describe '#delete_contact' do
2796
+ it_should_behave_like 'an api request' do
2797
+ let(:command) { :delete_contact }
2798
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids].pop] }
2799
+ end
2800
+ end
2801
+
2802
+ describe '#delete_file' do
2803
+ it_should_behave_like 'an api request' do
2804
+ let(:command) { :delete_file }
2805
+ let(:args) { [DATA_COLLECTOR[:crm_file_ids].pop] }
2806
+ end
2807
+ end
2808
+
2809
+ describe '#delete_tag' do
2810
+ it_should_behave_like 'an api request' do
2811
+ let(:command) { :delete_tag }
2812
+ let(:args) { [ENTITY_TYPES.last, DATA_COLLECTOR[:crm_tag_ids].pop] }
2813
+ end
2814
+ end
2815
+
2816
+ describe '#remove_tag' do
2817
+ it_should_behave_like 'an api request' do
2818
+ let(:command) { :remove_tag }
2819
+ let(:args) { [(entity = ENTITY_TYPES.sample).sub('company', 'contact'), random_id(entity.to_sym), random_id(:crm_tag)] }
2820
+ end
2821
+ end
2822
+
2823
+ describe '#delete_unused_tags' do
2824
+ it_should_behave_like 'an api request' do
2825
+ let(:command) { :delete_unused_tags }
2826
+ let(:args) { [ENTITY_TYPES.sample.sub('company', 'contact')] }
2827
+ end
2828
+ end
2829
+
2830
+ describe '#delete_task_template' do
2831
+ it_should_behave_like 'an api request' do
2832
+ let(:command) { :delete_task_template }
2833
+ let(:args) { [DATA_COLLECTOR[:task_template_ids].pop] }
2834
+ end
2835
+ end
2836
+
2837
+ describe '#delete_task_template_container' do
2838
+ it_should_behave_like 'an api request' do
2839
+ let(:command) { :delete_task_template_container }
2840
+ let(:args) { [DATA_COLLECTOR[:task_template_container_ids].pop] }
2841
+ end
2842
+ end
2843
+
2844
+ describe '#delete_opportunity_group' do
2845
+ it_should_behave_like 'an api request' do
2846
+ let(:command) { :delete_opportunity_group }
2847
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].pop] }
2848
+ end
2849
+ end
2850
+
2851
+ describe '#delete_opportunity' do
2852
+ it_should_behave_like 'an api request' do
2853
+ let(:command) { :delete_opportunity }
2854
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].pop] }
2855
+ end
2856
+ end
2857
+
2858
+ describe '#delete_opportunity_group_by_filter' do
2859
+ it_should_behave_like 'an api request' do
2860
+ let(:command) { :delete_opportunity_group_by_filter }
2861
+ end
2862
+ end
2863
+
2864
+ describe '#delete_opportunity_stage' do
2865
+ it_should_behave_like 'an api request' do
2866
+ let(:command) { :delete_opportunity_stage }
2867
+ let(:args) { [DATA_COLLECTOR[:opportunity_stage_ids].pop] }
2868
+ end
2869
+ end
2870
+ end
2871
+
2872
+ describe '[Community]' do
2873
+
2874
+ let(:teamlab_module) { :community }
2875
+
2876
+ describe '#create_project' do
2877
+ it_should_behave_like 'an api request' do
2878
+ let(:command) { :create_post }
2879
+ let(:args) { [random_word, random_word] }
2880
+ let(:add_data_to_collector) { true }
2881
+ let(:data_param) { :community_post_ids }
2882
+ let(:param_names) { %w(id) }
2883
+ end
2884
+ end
2885
+
2886
+ describe '#add_comment' do
2887
+ it_should_behave_like 'an api request' do
2888
+ let(:command) { :create_post }
2889
+ let(:args) { [random_id(:community_post), random_word] }
2890
+ let(:add_data_to_collector) { true }
2891
+ let(:data_param) { :community_post_comment_ids }
2892
+ let(:param_names) { %w(id) }
2893
+ end
2894
+ end
2895
+
2896
+ describe '#add_bookmark' do
2897
+ it_should_behave_like 'an api request' do
2898
+ let(:command) { :add_bookmark }
2899
+ let(:args) { [SOME_URL, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(', ')}] }
2900
+ let(:add_data_to_collector) { true }
2901
+ let(:data_param) { :bookmark_ids }
2902
+ let(:param_names) { %w(id) }
2903
+ end
2904
+ end
2905
+
2906
+ describe '#add_comment_to_bookmark' do
2907
+ it_should_behave_like 'an api request' do
2908
+ let(:command) { :add_comment_to_bookmark }
2909
+ let(:args) { [random_id(:bookmark), random_word] }
2910
+ let(:add_data_to_collector) { true }
2911
+ let(:data_param) { :bookmark_comment_ids }
2912
+ let(:param_names) { %w(id) }
2913
+ end
2914
+ end
2915
+
2916
+ describe '#create_event' do
2917
+ it_should_behave_like 'an api request' do
2918
+ let(:command) { :create_event }
2919
+ let(:args) { [random_word, random_word] }
2920
+ let(:add_data_to_collector) { true }
2921
+ let(:data_param) { :event_ids }
2922
+ let(:param_names) { %w(id) }
2923
+ end
2924
+ end
2925
+
2926
+ describe '#create_poll' do
2927
+ it_should_behave_like 'an api request' do
2928
+ let(:command) { :create_event }
2929
+ let(:args) { [random_word, random_word, {type: 'Poll'}] }
2930
+ let(:add_data_to_collector) { true }
2931
+ let(:data_param) { :poll_ids }
2932
+ let(:param_names) { %w(id) }
2933
+ end
2934
+ end
2935
+
2936
+ describe '#add_thread_to_category' do
2937
+ it_should_behave_like 'an api request' do
2938
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
2939
+ let(:command) { :add_thread_to_category }
2940
+ let(:args) { [-1, random_word, random_word, random_word] }
2941
+ let(:add_data_to_collector) { true }
2942
+ let(:data_param) { :thread_ids }
2943
+ let(:param_names) { %w(id) }
2944
+ end
2945
+ end
2946
+
2947
+ describe '#add_topic_to_thread' do
2948
+ it_should_behave_like 'an api request' do
2949
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
2950
+ let(:command) { :add_topic_to_thread }
2951
+ let(:args) { [random_id(:thread), random_word, random_word] }
2952
+ let(:add_data_to_collector) { true }
2953
+ let(:data_param) { :thread_topic_ids }
2954
+ let(:param_names) { %w(id) }
2955
+ end
2956
+ end
2957
+
2958
+ describe '#add_post_to_topic' do
2959
+ it_should_behave_like 'an api request' do
2960
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
2961
+ let(:command) { :add_post_to_topic }
2962
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, random_word, random_word] }
2963
+ let(:add_data_to_collector) { true }
2964
+ let(:data_param) { :topic_post_ids }
2965
+ let(:param_names) { %w(id) }
2966
+ end
2967
+ end
2968
+
2969
+ describe '#create_page' do
2970
+ it_should_behave_like 'an api request' do
2971
+ let(:command) { :create_page }
2972
+ let(:args) { [random_word, random_word] }
2973
+ let(:add_data_to_collector) { true }
2974
+ let(:data_param) { :wiki_page_name_ids }
2975
+ let(:param_names) { %w(name) }
2976
+ end
2977
+ end
2978
+
2979
+ describe '#create_wiki_page_comment' do
2980
+ it_should_behave_like 'an api request' do
2981
+ let(:command) { :create_wiki_page_comment }
2982
+ let(:args) { [random_id(:wiki_page_name), random_word] }
2983
+ let(:add_data_to_collector) { true }
2984
+ let(:data_param) { :wiki_page_comment_ids }
2985
+ let(:param_names) { %w(id) }
2986
+ end
2987
+ end
2988
+
2989
+ describe '#upload_files' do
2990
+ it_should_behave_like 'an api request' do
2991
+ let(:command) { :upload_files }
2992
+ let(:args) { [random_id(:wiki_pages_name), FILES_TO_UPLOAD] }
2993
+ let(:add_data_to_collector) { true }
2994
+ let(:data_param) { :wiki_page_file_name_ids }
2995
+ let(:param_names) { %w(name) }
2996
+ end
2997
+ end
2998
+
2999
+ describe '#update_post' do
3000
+ it_should_behave_like 'an api request' do
3001
+ let(:command) { :update_post }
3002
+ let(:args) { [random_id(:community_post), random_word, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(',')}] }
3003
+ end
3004
+ end
3005
+
3006
+ describe '#get_all_posts' do
3007
+ it_should_behave_like 'an api request' do
3008
+ let(:command) { :get_all_posts }
3009
+ end
3010
+ end
3011
+
3012
+ describe '#get_blog_tags' do
3013
+ it_should_behave_like 'an api request' do
3014
+ let(:command) { :get_blog_tags }
3015
+ end
3016
+ end
3017
+
3018
+ describe '#get_my_posts' do
3019
+ it_should_behave_like 'an api request' do
3020
+ let(:command) { :get_my_posts }
3021
+ end
3022
+ end
3023
+
3024
+ describe '#get_post_by_id' do
3025
+ it_should_behave_like 'an api request' do
3026
+ let(:command) { :get_post }
3027
+ let(:args) { [random_id(:community_post)] }
3028
+ end
3029
+ end
3030
+
3031
+ describe '#get_posts_by_tag' do
3032
+ it_should_behave_like 'an api request' do
3033
+ let(:command) { :get_posts_by_tag }
3034
+ let(:args) { [random_word(4)] }
3035
+ end
3036
+ end
3037
+
3038
+ describe '#search_posts' do
3039
+ it_should_behave_like 'an api request' do
3040
+ let(:command) { :search_posts }
3041
+ let(:args) { [random_word] }
3042
+ end
3043
+ end
3044
+
3045
+ describe '#get_user_posts' do
3046
+ it_should_behave_like 'an api request' do
3047
+ let(:command) { :get_user_posts }
3048
+ let(:args) { [DATA_COLLECTOR[:self_username].sample] }
3049
+ end
3050
+ end
3051
+
3052
+ describe '#get_comments' do
3053
+ it_should_behave_like 'an api request' do
3054
+ let(:command) { :get_comments }
3055
+ let(:args) { [random_id(:community_post)] }
3056
+ end
3057
+ end
3058
+
3059
+ describe '#get_all_bookmarks' do
3060
+ it_should_behave_like 'an api request' do
3061
+ let(:command) { :get_all_bookmarks }
3062
+ end
3063
+ end
3064
+
3065
+ describe '#get_all_bookmark_tags' do
3066
+ it_should_behave_like 'an api request' do
3067
+ let(:command) { :get_all_bookmark_tags }
3068
+ end
3069
+ end
3070
+
3071
+ describe '#get_bookmark' do
3072
+ it_should_behave_like 'an api request' do
3073
+ let(:command) { :get_bookmark }
3074
+ let(:args) { [random_id(:bookmark)] }
3075
+ end
3076
+ end
3077
+
3078
+ describe '#get_bookmarks_added_by_me' do
3079
+ it_should_behave_like 'an api request' do
3080
+ let(:command) { :get_bookmarks_added_by_me }
3081
+ end
3082
+ end
3083
+
3084
+ describe '#get_my_favourite_bookmarks' do
3085
+ it_should_behave_like 'an api request' do
3086
+ let(:command) { :get_my_favourite_bookmarks }
3087
+ end
3088
+ end
3089
+
3090
+ describe '#get_top_of_day_bookmarks' do
3091
+ it_should_behave_like 'an api request' do
3092
+ let(:command) { :get_top_of_day_bookmarks }
3093
+ end
3094
+ end
3095
+
3096
+ describe '#get_top_of_week_bookmarks' do
3097
+ it_should_behave_like 'an api request' do
3098
+ let(:command) { :get_top_of_week_bookmarks }
3099
+ end
3100
+ end
3101
+
3102
+ describe '#get_top_of_month_bookmarks' do
3103
+ it_should_behave_like 'an api request' do
3104
+ let(:command) { :get_top_of_month_bookmarks }
3105
+ end
3106
+ end
3107
+
3108
+ describe '#get_top_of_year_bookmarks' do
3109
+ it_should_behave_like 'an api request' do
3110
+ let(:command) { :get_top_of_year_bookmarks }
3111
+ end
3112
+ end
3113
+
3114
+ describe '#get_bookmarks_by_tag' do
3115
+ it_should_behave_like 'an api request' do
3116
+ let(:command) { :get_bookmarks_by_tag }
3117
+ let(:args) { [random_word(4)] }
3118
+ end
3119
+ end
3120
+
3121
+ describe '#get_recently_added_bookmarks' do
3122
+ it_should_behave_like 'an api request' do
3123
+ let(:command) { :get_recently_added_bookmarks }
3124
+ end
3125
+ end
3126
+
3127
+ describe '#get_bookmark_comments' do
3128
+ it_should_behave_like 'an api request' do
3129
+ let(:command) { :get_bookmark_comments }
3130
+ let(:args) { [random_id(:bookmark)] }
3131
+ end
3132
+ end
3133
+
3134
+ describe '#search_bookmarks' do
3135
+ it_should_behave_like 'an api request' do
3136
+ let(:command) { :search_bookmarks }
3137
+ let(:args) { [random_word] }
3138
+ end
3139
+ end
3140
+
3141
+ describe '#update_event' do
3142
+ it_should_behave_like 'an api request' do
3143
+ let(:command) { :update_event }
3144
+ let(:args) { [random_id(:event), random_word, random_word] }
3145
+ end
3146
+ end
3147
+
3148
+ describe '#get_all_events' do
3149
+ it_should_behave_like 'an api request' do
3150
+ let(:command) { :get_all_events }
3151
+ end
3152
+ end
3153
+
3154
+ describe '#get_my_events' do
3155
+ it_should_behave_like 'an api request' do
3156
+ let(:command) { :get_my_events }
3157
+ end
3158
+ end
3159
+
3160
+ describe '#get_event' do
3161
+ it_should_behave_like 'an api request' do
3162
+ let(:command) { :get_event }
3163
+ let(:args) { [random_id(:event)] }
3164
+ end
3165
+ end
3166
+
3167
+ describe '#search_events' do
3168
+ it_should_behave_like 'an api request' do
3169
+ let(:command) { :search_events }
3170
+ let(:args) { [random_word] }
3171
+ end
3172
+ end
3173
+
3174
+ describe '#vote_for_event' do
3175
+ it_should_behave_like 'an api request' do
3176
+ let(:command) { :vote_for_event }
3177
+ let(:args) { [random_id(:poll), rand(2)] }
3178
+ end
3179
+ end
3180
+
3181
+ describe '#add_comment_to_event' do
3182
+ it_should_behave_like 'an api request' do
3183
+ let(:command) { :add_comment_to_event }
3184
+ let(:args) { [random_id(:event), random_word] }
3185
+ end
3186
+ end
3187
+
3188
+ describe '#get_forums' do
3189
+ it_should_behave_like 'an api request' do
3190
+ let(:command) { :get_forums }
3191
+ end
3192
+ end
3193
+
3194
+ describe '#get_thread_topics' do
3195
+ it_should_behave_like 'an api request' do
3196
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
3197
+ let(:command) { :get_thread_topics }
3198
+ let(:args) { [random_id(:thread)] }
3199
+ end
3200
+ end
3201
+
3202
+ describe '#get_last_updated_topics' do
3203
+ it_should_behave_like 'an api request' do
3204
+ let(:command) { :get_last_updated_topics }
3205
+ end
3206
+ end
3207
+
3208
+ describe '#get_posts' do
3209
+ it_should_behave_like 'an api request' do
3210
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
3211
+ let(:command) { :get_posts }
3212
+ let(:args) { [random_id(:thread_topic)] }
3213
+ end
3214
+ end
3215
+
3216
+ describe '#search_topics' do
3217
+ it_should_behave_like 'an api request' do
3218
+ let(:command) { :search_topics }
3219
+ let(:args) { [random_word(5)] }
3220
+ end
3221
+ end
3222
+
3223
+ describe '#update_topic_in_thread' do
3224
+ it_should_behave_like 'an api request' do
3225
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
2116
3226
  let(:command) { :update_topic_in_thread }
2117
- let(:args) { [TOPIC_ID] }
3227
+ let(:args) { [random_id(:thread_topic), random_word, random_word] }
2118
3228
  end
2119
3229
  end
2120
3230
 
2121
3231
  describe '#update_post_in_topic' do
2122
3232
  it_should_behave_like 'an api request' do
3233
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
2123
3234
  let(:command) { :update_post_in_topic }
2124
- let(:args) { [TOPIC_ID, POST_ID] }
3235
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, random_id(:topic_post)] }
2125
3236
  end
2126
3237
  end
2127
3238
 
@@ -2134,77 +3245,143 @@ end
2134
3245
  describe '#get_wiki_page' do
2135
3246
  it_should_behave_like 'an api request' do
2136
3247
  let(:command) { :get_wiki_page }
2137
- let(:args) { [WIKI_PAGE_NAME] }
3248
+ let(:args) { [random_id(:wiki_page_name)] }
2138
3249
  end
2139
3250
  end
2140
3251
 
2141
3252
  describe '#get_wiki_file_info' do
2142
3253
  it_should_behave_like 'an api request' do
2143
3254
  let(:command) { :get_wiki_file_info }
2144
- let(:args) { [WIKI_FILE_NAME] }
3255
+ let(:args) { [random_id(:wiki_page_file_name)] }
2145
3256
  end
2146
3257
  end
2147
3258
 
2148
3259
  describe '#get_page_history' do
2149
3260
  it_should_behave_like 'an api request' do
2150
3261
  let(:command) { :get_page_history }
2151
- let(:args) { [WIKI_PAGE_NAME] }
3262
+ let(:args) { [random_id(:wiki_page_name)] }
2152
3263
  end
2153
3264
  end
2154
3265
 
2155
3266
  describe '#get_all_page_comments' do
2156
3267
  it_should_behave_like 'an api request' do
2157
3268
  let(:command) { :get_all_page_comments }
2158
- let(:args) { [WIKI_PAGE_NAME] }
3269
+ let(:args) { [random_id(:wiki_page_name)] }
2159
3270
  end
2160
3271
  end
2161
3272
 
2162
3273
  describe '#search_wiki_pages_by_name' do
2163
3274
  it_should_behave_like 'an api request' do
2164
3275
  let(:command) { :search_wiki_pages_by_name }
2165
- let(:args) { [RANDOM_TITLE] }
3276
+ let(:args) { [random_word] }
2166
3277
  end
2167
3278
  end
2168
3279
 
2169
3280
  describe '#search_wiki_pages_by_content' do
2170
3281
  it_should_behave_like 'an api request' do
2171
3282
  let(:command) { :search_wiki_pages_by_content }
2172
- let(:args) { [RANDOM_TITLE] }
3283
+ let(:args) { [random_word] }
2173
3284
  end
2174
3285
  end
2175
3286
 
2176
- describe '#create_page' do
3287
+ describe '#update_wiki_page' do
2177
3288
  it_should_behave_like 'an api request' do
2178
- let(:command) { :create_page }
2179
- let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
3289
+ let(:command) { :update_wiki_page }
3290
+ let(:args) { [random_id(:wiki_page_name), random_word] }
2180
3291
  end
2181
3292
  end
2182
3293
 
2183
- describe '#create_wiki_page_comment' do
3294
+ describe '#update_wiki_page_comment' do
2184
3295
  it_should_behave_like 'an api request' do
2185
- let(:command) { :create_wiki_page_comment }
2186
- let(:args) { [WIKI_PAGE_NAME, RANDOM_NOTE] }
3296
+ let(:command) { :update_wiki_page_comment }
3297
+ let(:args) { [random_id(:wiki_page_comment), random_word] }
2187
3298
  end
2188
3299
  end
2189
3300
 
2190
- describe '#update_wiki_page' do
3301
+ describe '#delete_post' do
2191
3302
  it_should_behave_like 'an api request' do
2192
- let(:command) { :update_wiki_page }
2193
- let(:args) { [WIKI_PAGE_NAME, RANDOM_NOTE] }
3303
+ let(:command) { :delete_post }
3304
+ let(:args) { [DATA_COLLECTOR[:community_post_ids].pop] }
2194
3305
  end
2195
3306
  end
2196
3307
 
2197
- describe '#update_wiki_page_comment' do
3308
+ describe '#delete_post_in_topic' do
2198
3309
  it_should_behave_like 'an api request' do
2199
- let(:command) { :update_wiki_page_comment }
2200
- let(:args) { [WIKI_PAGE_COMMENT_ID, RANDOM_NOTE] }
3310
+ pending 'http://bugzserver/show_bug.cgi?id=24054'
3311
+ let(:command) { :delete_post_in_topic }
3312
+ let(:args) { [DATA_COLLECTOR[:thread_topic_ids].last, DATA_COLLECTOR[:topic_post_ids].pop] }
3313
+ end
3314
+ end
3315
+
3316
+ describe '#delete_wiki_page_comment' do
3317
+ it_should_behave_like 'an api request' do
3318
+ let(:command) { :delete_wiki_page_comment }
3319
+ let(:args) { [DATA_COLLECTOR[:wiki_page_comment_ids].pop] }
3320
+ end
3321
+ end
3322
+
3323
+ describe '#delete_wiki_file' do
3324
+ it_should_behave_like 'an api request' do
3325
+ let(:command) { :delete_wiki_file }
3326
+ let(:args) { [DATA_COLLECTOR[:wiki_page_file_name_ids].pop] }
3327
+ end
3328
+ end
3329
+
3330
+ describe '#delete_wiki_page' do
3331
+ it_should_behave_like 'an api request' do
3332
+ let(:command) { :delete_wiki_page }
3333
+ let(:args) { [DATA_COLLECTOR[:wiki_page_name_ids].pop] }
2201
3334
  end
2202
3335
  end
2203
3336
  end
2204
3337
 
2205
3338
  describe '[Calendar]' do
3339
+
2206
3340
  let(:teamlab_module) { :calendar }
2207
3341
 
3342
+ describe '#create_calendar' do
3343
+ it_should_behave_like 'an api request' do
3344
+ let(:command) { :create_calendar }
3345
+ let(:args) { [random_word, TIME_ZONES.sample] }
3346
+ let(:add_data_to_collector) { true }
3347
+ let(:data_param) { :calendar_ids }
3348
+ let(:param_names) { %w(objectId) }
3349
+ end
3350
+ end
3351
+
3352
+ describe '#get_icalc_link' do
3353
+ it_should_behave_like 'an api request' do
3354
+ let(:command) { :get_icalc_link }
3355
+ i = -1
3356
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1]] }
3357
+ let(:add_data_to_collector) { true }
3358
+ let(:data_param) { :ical_link_ids }
3359
+ let(:param_names) { %w() }
3360
+ end
3361
+ end
3362
+
3363
+ describe '#create_calendar_by_ical_link' do
3364
+ it_should_behave_like 'an api request' do
3365
+ let(:command) { :create_calendar_by_ical_link }
3366
+ let(:args) { [random_id(:ical_link)] }
3367
+ let(:add_data_to_collector) { true }
3368
+ let(:data_param) { :calendar_ids }
3369
+ let(:param_names) { %w(objectId) }
3370
+ end
3371
+ end
3372
+
3373
+ describe '#add_event' do
3374
+ it_should_behave_like 'an api request' do
3375
+ pending 'http://bugzserver/show_bug.cgi?id=24071'
3376
+ let(:command) { :add_event }
3377
+ i = -1
3378
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], random_word] }
3379
+ let(:add_data_to_collector) { true }
3380
+ let(:data_param) { :event_ids }
3381
+ let(:param_names) { %w(id) }
3382
+ end
3383
+ end
3384
+
2208
3385
  describe '#get_default_access' do
2209
3386
  it_should_behave_like 'an api request' do
2210
3387
  let(:command) { :get_default_access }
@@ -2214,7 +3391,7 @@ end
2214
3391
  describe '#get_calendar' do
2215
3392
  it_should_behave_like 'an api request' do
2216
3393
  let(:command) { :get_calendar }
2217
- let(:args) { [CALENDAR_ID] }
3394
+ let(:args) { [random_id(:calendar)] }
2218
3395
  end
2219
3396
  end
2220
3397
 
@@ -2224,51 +3401,276 @@ end
2224
3401
  end
2225
3402
  end
2226
3403
 
2227
- describe '#get_icalc_link' do
3404
+ describe '#get_access_parameters' do
2228
3405
  it_should_behave_like 'an api request' do
2229
- let(:command) { :get_icalc_link }
2230
- let(:args) { [CALENDAR_ID] }
3406
+ let(:command) { :get_access_parameters }
3407
+ let(:args) { [random_id(:calendar)] }
2231
3408
  end
2232
3409
  end
2233
3410
 
2234
- describe '#get_access_parameters' do
3411
+ describe '#get_icalc_feed' do
2235
3412
  it_should_behave_like 'an api request' do
2236
- let(:command) { :get_access_parameters }
2237
- let(:args) { [CALENDAR_ID] }
3413
+ pending 'Выкачивает .ics файл. Response в IDE выглядит извращенно'
3414
+ let(:command) { :get_icalc_feed }
3415
+ i = -1
3416
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], DATA_COLLECTOR[:ical_link_ids][i].split('/').last] }
2238
3417
  end
2239
3418
  end
2240
3419
 
2241
- describe '#create_calendar' do
3420
+ describe '#get_calendar_events' do
2242
3421
  it_should_behave_like 'an api request' do
2243
- let(:command) { :create_calendar }
2244
- let(:args) { [RANDOM_TITLE] }
3422
+ pending 'http://bugzserver/show_bug.cgi?id=24069'
3423
+ let(:command) { :get_calendar_events }
3424
+ let(:args) { [DateTime.commercial(2014).to_s, DateTime.commercial(2015).to_s] }
2245
3425
  end
2246
3426
  end
2247
3427
 
2248
- #describe '#create_calendar_by_ical_link' do
2249
- # it_should_behave_like 'an api request' do
2250
- # let(:command) { :create_calendar_by_ical_link } #ХЗ ГДЕ ВЗЯТЬ ЛИНКУ
2251
- # let(:args) { [RANDOM_TITLE] }
2252
- # end
2253
- #end
3428
+ describe '#get_calendars_and_subscriptions' do
3429
+ it_should_behave_like 'an api request' do
3430
+ pending 'http://bugzserver/show_bug.cgi?id=24069'
3431
+ let(:command) { :get_calendars_and_subscriptions }
3432
+ let(:args) { [DateTime.commercial(2014).to_s, DateTime.commercial(2015).to_s] }
3433
+ end
3434
+ end
3435
+
3436
+ describe '#create_calendar_by_ical_link' do
3437
+ it_should_behave_like 'an api request' do
3438
+ let(:command) { :create_calendar_by_ical_link } #ХЗ ГДЕ ВЗЯТЬ ЛИНКУ
3439
+ let(:args) { [random_id(:ical_link), random_word] }
3440
+ end
3441
+ end
3442
+
3443
+ describe '#import_ical' do
3444
+ it_should_behave_like 'an api request' do
3445
+ pending 'Upload File'
3446
+ let(:command) { :import_ical }
3447
+ let(:args) { [random_id(:calendar), CALENDAR_TO_UPLOAD] }
3448
+ end
3449
+ end
3450
+
3451
+ describe '#update_calendar' do
3452
+ it_should_behave_like 'an api request' do
3453
+ let(:command) { :update_calendar }
3454
+ let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample] }
3455
+ end
3456
+ end
3457
+
3458
+ describe '#update_calendar_user_view' do
3459
+ it_should_behave_like 'an api request' do
3460
+ let(:command) { :update_calendar_user_view }
3461
+ let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample] }
3462
+ end
3463
+ end
3464
+
3465
+ describe '#manage_subscriptions' do
3466
+ it_should_behave_like 'an api request' do
3467
+ pending 'http://bugzserver/show_bug.cgi?id=24072'
3468
+ let(:command) { :manage_subscriptions }
3469
+ let(:args) { [[random_word]] }
3470
+ end
3471
+ end
3472
+
3473
+ describe '#update_event' do
3474
+ it_should_behave_like 'an api request' do
3475
+ pending 'http://bugzserver/show_bug.cgi?id=24071'
3476
+ let(:command) { :update_event }
3477
+ i = -1
3478
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], DATA_COLLECTOR[:event_ids][i], random_word] }
3479
+ end
3480
+ end
3481
+
3482
+ describe '#unsubscribe_from_event' do
3483
+ it_should_behave_like 'an api request' do
3484
+ let(:command) { :unsubscribe_from_event }
3485
+ let(:args) { [random_id(:event)] }
3486
+ end
3487
+ end
3488
+
3489
+ describe '#remove_event' do
3490
+ it_should_behave_like 'an api request' do
3491
+ let(:command) { :remove_event }
3492
+ let(:args) { [random_id(:event)] }
3493
+ end
3494
+ end
2254
3495
 
3496
+ describe '#delete_event_series' do
3497
+ it_should_behave_like 'an api request' do
3498
+ let(:command) { :delete_event_series }
3499
+ let(:args) { [DATA_COLLECTOR[:event_ids].pop] }
3500
+ end
3501
+ end
2255
3502
 
3503
+ describe '#delete_calendar' do
3504
+ it_should_behave_like 'an api request' do
3505
+ let(:command) { :delete_calendar }
3506
+ let(:args) { [DATA_COLLECTOR[:calendar_ids].pop] }
3507
+ end
3508
+ end
2256
3509
  end
2257
3510
 
2258
3511
  describe '[Mail]' do
2259
- let(:teamlab_module) { :mail }
2260
3512
 
2261
- describe '#get_tag_list' do
2262
- it_should_behave_like 'an api request' do
2263
- let(:command) { :get_tag_list }
3513
+ describe 'Preparing enviroment' do
3514
+ describe '#add_user' do
3515
+ it_should_behave_like 'an api request' do
3516
+ let(:teamlab_module) { :people }
3517
+ let(:command) { :add_user }
3518
+ let(:args) { [false, random_email, random_word.capitalize, random_word.capitalize] }
3519
+ let(:add_data_to_collector) { true }
3520
+ let(:data_param) { :user_ids }
3521
+ let(:param_names) { %w(id) }
3522
+ end
3523
+ end
3524
+
3525
+ describe '#get_self' do
3526
+ it_should_behave_like 'an api request' do
3527
+ let(:teamlab_module) { :people }
3528
+ let(:command) { :get_self }
3529
+ let(:add_data_to_collector) { true }
3530
+ let(:data_param) { :self_username }
3531
+ let(:param_names) { %w(userName) }
3532
+ end
3533
+ end
3534
+
3535
+ describe '#get_my_files' do
3536
+ it_should_behave_like 'an api request' do
3537
+ let(:teamlab_module) { :files }
3538
+ let(:command) { :get_my_files }
3539
+ let(:add_data_to_collector) { true }
3540
+ let(:data_param) { :my_documents_ids }
3541
+ let(:param_names) { %w(current id) }
3542
+ end
3543
+ end
3544
+
3545
+ describe '#create_file' do
3546
+ it_should_behave_like 'an api request' do
3547
+ let(:teamlab_module) { :files }
3548
+ let(:command) { :create_file }
3549
+ let(:args) { [random_id(:my_documents), random_word] }
3550
+ let(:add_data_to_collector) { true }
3551
+ let(:data_param) { :file_ids }
3552
+ let(:param_names) { %w(id) }
3553
+ end
3554
+ end
3555
+
3556
+ describe '#create_person' do
3557
+ it_should_behave_like 'an api request' do
3558
+ let(:teamlab_module) { :crm }
3559
+ let(:command) { :create_person }
3560
+ let(:args) { [random_word.capitalize, random_word.capitalize] }
3561
+ let(:add_data_to_collector) { true }
3562
+ let(:data_param) { :contact_ids }
3563
+ let(:param_names) { %w(id) }
3564
+ end
3565
+ end
3566
+
3567
+ describe '#create_project' do
3568
+ it_should_behave_like 'an api request' do
3569
+ let(:teamlab_module) { :project }
3570
+ let(:command) { :create_project }
3571
+ let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool] }
3572
+ let(:add_data_to_collector) { true }
3573
+ let(:data_param) { :project_ids }
3574
+ let(:param_names) { %w(id) }
3575
+ end
2264
3576
  end
2265
3577
  end
2266
3578
 
3579
+ let(:teamlab_module) { :mail }
3580
+
2267
3581
  describe '#create_tag' do
2268
3582
  it_should_behave_like 'an api request' do
2269
3583
  let(:command) { :create_tag }
2270
3584
  let(:args) { [random_word(4), {style: rand(15)}] }
2271
3585
  end
2272
3586
  end
3587
+
3588
+ describe '#create_account_by_email' do
3589
+ it_should_behave_like 'an api request' do
3590
+ let(:command) { :create_account_by_email }
3591
+ let(:args) { [USERNAME, PASSWORD] }
3592
+ end
3593
+ end
3594
+
3595
+
3596
+
3597
+
3598
+
3599
+ ########################################################################################################################
3600
+ ############################################# END CREATING #############################################################
3601
+ ########################################################################################################################
3602
+
3603
+ describe '#get_filtered_messages' do
3604
+ it_should_behave_like 'an api request' do
3605
+ let(:command) { :get_filtered_messages }
3606
+ let(:args) { [2] }
3607
+ end
3608
+ end
3609
+
3610
+ describe '#get_message' do
3611
+ it_should_behave_like 'an api request' do
3612
+ let(:command) { :get_message }
3613
+ let(:args) {message_id}
3614
+ end
3615
+ end
3616
+
3617
+ describe '#get_message_template' do
3618
+ it_should_behave_like 'an api request' do
3619
+ let(:command) { :get_message_template }
3620
+ end
3621
+ end
3622
+
3623
+ describe '#get_account_list' do
3624
+ it_should_behave_like 'an api request' do
3625
+ let(:command) { :get_account_list }
3626
+ end
3627
+ end
3628
+
3629
+ describe '#get_tag_list' do
3630
+ it_should_behave_like 'an api request' do
3631
+ let(:command) { :get_tag_list }
3632
+ end
3633
+ end
3634
+
3635
+
3636
+
3637
+ ########################################################################################################################
3638
+ ############################################### DELETING ###############################################################
3639
+ ########################################################################################################################
3640
+
3641
+ describe 'Cleaning enviroment' do
3642
+
3643
+ describe '#delete_file' do
3644
+ it_should_behave_like 'an api request' do
3645
+ let(:teamlab_module) { :files }
3646
+ let(:command) { :delete_file }
3647
+ let(:args) { [DATA_COLLECTOR[:file_ids].pop] }
3648
+ end
3649
+ end
3650
+
3651
+ describe '#delete_user' do
3652
+ it_should_behave_like 'an api request' do
3653
+ let(:teamlab_module) { :people }
3654
+ let(:command) { :delete_user }
3655
+ let(:args) { [DATA_COLLECTOR[:user_ids].pop] }
3656
+ end
3657
+ end
3658
+
3659
+ describe '#delete_contact' do
3660
+ it_should_behave_like 'an api request' do
3661
+ let(:teamlab_module) { :crm }
3662
+ let(:command) { :delete_contact }
3663
+ let(:args) { [DATA_COLLECTOR[:contact_ids].pop] }
3664
+ end
3665
+ end
3666
+
3667
+ describe '#delete_project' do
3668
+ it_should_behave_like 'an api request' do
3669
+ let(:teamlab_module) { :project }
3670
+ let(:command) { :delete_project }
3671
+ let(:args) { [DATA_COLLECTOR[:project_ids].pop] }
3672
+ end
3673
+ end
3674
+ end
2273
3675
  end
2274
3676
  end