crowdin-api 1.3.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,5 +9,176 @@ describe Crowdin::ApiResources::SourceFiles do
9
9
  expect(list_branches).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#add_branch' do
14
+ it 'when request are valid', :default do
15
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches")
16
+ add_branch = @crowdin.add_branch({}, project_id)
17
+ expect(add_branch).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#get_branch' do
22
+ let(:branch_id) { 1 }
23
+
24
+ it 'when request are valid', :default do
25
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/#{branch_id}")
26
+ get_branch = @crowdin.get_branch(branch_id, project_id)
27
+ expect(get_branch).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#delete_branch' do
32
+ let(:branch_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/#{branch_id}")
36
+ delete_branch = @crowdin.delete_branch(branch_id, project_id)
37
+ expect(delete_branch).to eq(200)
38
+ end
39
+ end
40
+
41
+ describe '#edit_branch' do
42
+ let(:branch_id) { 1 }
43
+
44
+ it 'when request are valid', :default do
45
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/#{branch_id}")
46
+ edit_branch = @crowdin.edit_branch(branch_id, {}, project_id)
47
+ expect(edit_branch).to eq(200)
48
+ end
49
+ end
50
+
51
+ describe '#list_directories' do
52
+ it 'when request are valid', :default do
53
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories")
54
+ list_directories = @crowdin.list_directories({}, project_id)
55
+ expect(list_directories).to eq(200)
56
+ end
57
+ end
58
+
59
+ describe '#add_directory' do
60
+ it 'when request are valid', :default do
61
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories")
62
+ add_directory = @crowdin.add_directory({}, project_id)
63
+ expect(add_directory).to eq(200)
64
+ end
65
+ end
66
+
67
+ describe '#get_directory' do
68
+ let(:directory_id) { 1 }
69
+
70
+ it 'when request are valid', :default do
71
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/#{directory_id}")
72
+ get_directory = @crowdin.get_directory(directory_id, project_id)
73
+ expect(get_directory).to eq(200)
74
+ end
75
+ end
76
+
77
+ describe '#delete_directory' do
78
+ let(:directory_id) { 1 }
79
+
80
+ it 'when request are valid', :default do
81
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/#{directory_id}")
82
+ delete_directory = @crowdin.delete_directory(directory_id, project_id)
83
+ expect(delete_directory).to eq(200)
84
+ end
85
+ end
86
+
87
+ describe '#edit_directory' do
88
+ let(:directory_id) { 1 }
89
+
90
+ it 'when request are valid', :default do
91
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/#{directory_id}")
92
+ edit_directory = @crowdin.edit_directory(directory_id, {}, project_id)
93
+ expect(edit_directory).to eq(200)
94
+ end
95
+ end
96
+
97
+ describe '#list_files' do
98
+ it 'when request are valid', :default do
99
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files")
100
+ list_files = @crowdin.list_files({}, project_id)
101
+ expect(list_files).to eq(200)
102
+ end
103
+ end
104
+
105
+ describe '#add_file' do
106
+ it 'when request are valid', :default do
107
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files")
108
+ add_file = @crowdin.add_file({}, project_id)
109
+ expect(add_file).to eq(200)
110
+ end
111
+ end
112
+
113
+ describe '#get_file' do
114
+ let(:file_id) { 1 }
115
+
116
+ it 'when request are valid', :default do
117
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}")
118
+ get_file = @crowdin.get_file(file_id, project_id)
119
+ expect(get_file).to eq(200)
120
+ end
121
+ end
122
+
123
+ describe '#update_or_restore_file' do
124
+ let(:file_id) { 1 }
125
+
126
+ it 'when request are valid', :default do
127
+ stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}")
128
+ update_or_restore_file = @crowdin.update_or_restore_file(file_id, {}, project_id)
129
+ expect(update_or_restore_file).to eq(200)
130
+ end
131
+ end
132
+
133
+ describe '#delete_file' do
134
+ let(:file_id) { 1 }
135
+
136
+ it 'when request are valid', :default do
137
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}")
138
+ delete_file = @crowdin.delete_file(file_id, project_id)
139
+ expect(delete_file).to eq(200)
140
+ end
141
+ end
142
+
143
+ describe '#edit_file' do
144
+ let(:file_id) { 1 }
145
+
146
+ it 'when request are valid', :default do
147
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}")
148
+ edit_file = @crowdin.edit_file(file_id, {}, project_id)
149
+ expect(edit_file).to eq(200)
150
+ end
151
+ end
152
+
153
+ describe '#download_file' do
154
+ let(:file_id) { 1 }
155
+
156
+ it 'when request are valid', :default do
157
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}/download")
158
+ download_file = @crowdin.download_file(file_id, nil, project_id)
159
+ expect(download_file).to eq(200)
160
+ end
161
+ end
162
+
163
+ describe '#list_file_revisions' do
164
+ let(:file_id) { 1 }
165
+
166
+ it 'when request are valid', :default do
167
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}/revisions")
168
+ list_file_revisions = @crowdin.list_file_revisions(file_id, {}, project_id)
169
+ expect(list_file_revisions).to eq(200)
170
+ end
171
+ end
172
+
173
+ describe '#get_file_revision' do
174
+ let(:file_id) { 1 }
175
+ let(:revision_id) { 1 }
176
+
177
+ it 'when request are valid', :default do
178
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}/revisions/#{revision_id}")
179
+ get_file_revision = @crowdin.get_file_revision(file_id, revision_id, project_id)
180
+ expect(get_file_revision).to eq(200)
181
+ end
182
+ end
12
183
  end
13
184
  end
@@ -9,5 +9,33 @@ describe Crowdin::ApiResources::Storages do
9
9
  expect(list_storages).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#add_storage' do
14
+ it 'when request are valid', :default do
15
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/storages")
16
+ add_storage = @crowdin.add_storage('README.md')
17
+ expect(add_storage).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#get_storage' do
22
+ let(:storage_id) { 1 }
23
+
24
+ it 'when request are valid', :default do
25
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/storages/#{storage_id}")
26
+ get_storage = @crowdin.get_storage(storage_id)
27
+ expect(get_storage).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#delete_storage' do
32
+ let(:storage_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/storages/#{storage_id}")
36
+ delete_storage = @crowdin.delete_storage(storage_id)
37
+ expect(delete_storage).to eq(200)
38
+ end
39
+ end
12
40
  end
13
41
  end
@@ -9,5 +9,43 @@ describe Crowdin::ApiResources::StringComments do
9
9
  expect(list_string_comments).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#add_string_comment' do
14
+ it 'when request are valid', :default do
15
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments")
16
+ add_string_comment = @crowdin.add_string_comment({}, project_id)
17
+ expect(add_string_comment).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#get_string_comment' do
22
+ let(:string_comment_id) { 1 }
23
+
24
+ it 'when request are valid', :default do
25
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments/#{string_comment_id}")
26
+ get_string_comment = @crowdin.get_string_comment(string_comment_id, project_id)
27
+ expect(get_string_comment).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#delete_string_comment' do
32
+ let(:string_comment_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments/#{string_comment_id}")
36
+ delete_string_comment = @crowdin.delete_string_comment(string_comment_id, project_id)
37
+ expect(delete_string_comment).to eq(200)
38
+ end
39
+ end
40
+
41
+ describe '#edit_string_comment' do
42
+ let(:string_comment_id) { 1 }
43
+
44
+ it 'when request are valid', :default do
45
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments/#{string_comment_id}")
46
+ edit_string_comment = @crowdin.edit_string_comment(string_comment_id, {}, project_id)
47
+ expect(edit_string_comment).to eq(200)
48
+ end
49
+ end
12
50
  end
13
51
  end
@@ -9,5 +9,133 @@ describe Crowdin::ApiResources::StringTranslations do
9
9
  expect(list_translation_approvals).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#add_approval' do
14
+ it 'when request are valid', :default do
15
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/approvals")
16
+ add_approval = @crowdin.add_approval({}, project_id)
17
+ expect(add_approval).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#get_approval' do
22
+ let(:approval_id) { 1 }
23
+
24
+ it 'when request are valid', :default do
25
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/approvals/#{approval_id}")
26
+ get_approval = @crowdin.get_approval(approval_id, project_id)
27
+ expect(get_approval).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#remove_approval' do
32
+ let(:approval_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/approvals/#{approval_id}")
36
+ remove_approval = @crowdin.remove_approval(approval_id, project_id)
37
+ expect(remove_approval).to eq(200)
38
+ end
39
+ end
40
+
41
+ describe '#list_language_translations' do
42
+ let(:language_id) { 1 }
43
+
44
+ it 'when request are valid', :default do
45
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/languages/#{language_id}/translations")
46
+ list_language_translations = @crowdin.list_language_translations(language_id, {}, project_id)
47
+ expect(list_language_translations).to eq(200)
48
+ end
49
+ end
50
+
51
+ describe '#list_string_translations' do
52
+ it 'when request are valid', :default do
53
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations")
54
+ list_string_translations = @crowdin.list_string_translations({}, project_id)
55
+ expect(list_string_translations).to eq(200)
56
+ end
57
+ end
58
+
59
+ describe '#add_translation' do
60
+ it 'when request are valid', :default do
61
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations")
62
+ add_translation = @crowdin.add_translation({}, project_id)
63
+ expect(add_translation).to eq(200)
64
+ end
65
+ end
66
+
67
+ describe '#delete_string_translations' do
68
+ it 'when request are valid', :default do
69
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations")
70
+ delete_string_translations = @crowdin.delete_string_translations({}, project_id)
71
+ expect(delete_string_translations).to eq(200)
72
+ end
73
+ end
74
+
75
+ describe '#get_translation' do
76
+ let(:translation_id) { 1 }
77
+
78
+ it 'when request are valid', :default do
79
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/#{translation_id}")
80
+ get_translation = @crowdin.get_translation(translation_id, {}, project_id)
81
+ expect(get_translation).to eq(200)
82
+ end
83
+ end
84
+
85
+ describe '#restore_translation' do
86
+ let(:translation_id) { 1 }
87
+
88
+ it 'when request are valid', :default do
89
+ stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/#{translation_id}")
90
+ restore_translation = @crowdin.restore_translation(translation_id, project_id)
91
+ expect(restore_translation).to eq(200)
92
+ end
93
+ end
94
+
95
+ describe '#delete_translation' do
96
+ let(:translation_id) { 1 }
97
+
98
+ it 'when request are valid', :default do
99
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/#{translation_id}")
100
+ delete_translation = @crowdin.delete_translation(translation_id, project_id)
101
+ expect(delete_translation).to eq(200)
102
+ end
103
+ end
104
+
105
+ describe '#list_translation_votes' do
106
+ it 'when request are valid', :default do
107
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/votes")
108
+ list_translation_votes = @crowdin.list_translation_votes({}, project_id)
109
+ expect(list_translation_votes).to eq(200)
110
+ end
111
+ end
112
+
113
+ describe '#add_vote' do
114
+ it 'when request are valid', :default do
115
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/votes")
116
+ add_vote = @crowdin.add_vote({}, project_id)
117
+ expect(add_vote).to eq(200)
118
+ end
119
+ end
120
+
121
+ describe '#get_vote' do
122
+ let(:vote_id) { 1 }
123
+
124
+ it 'when request are valid', :default do
125
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/votes/#{vote_id}")
126
+ get_vote = @crowdin.get_vote(vote_id, project_id)
127
+ expect(get_vote).to eq(200)
128
+ end
129
+ end
130
+
131
+ describe '#cancel_vote' do
132
+ let(:vote_id) { 1 }
133
+
134
+ it 'when request are valid', :default do
135
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/votes/#{vote_id}")
136
+ cancel_vote = @crowdin.cancel_vote(vote_id, project_id)
137
+ expect(cancel_vote).to eq(200)
138
+ end
139
+ end
12
140
  end
13
141
  end
@@ -9,5 +9,92 @@ describe Crowdin::ApiResources::Teams do
9
9
  expect(add_team_to_project).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#list_teams' do
14
+ it 'when request are valid', :enterprise do
15
+ stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/teams")
16
+ list_teams = @crowdin.list_teams({})
17
+ expect(list_teams).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#add_team' do
22
+ it 'when request are valid', :enterprise do
23
+ stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/teams")
24
+ add_team = @crowdin.add_team({})
25
+ expect(add_team).to eq(200)
26
+ end
27
+ end
28
+
29
+ describe '#get_team' do
30
+ let(:team_id) { 1 }
31
+
32
+ it 'when request are valid', :enterprise do
33
+ stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}")
34
+ get_team = @crowdin.get_team(team_id, {})
35
+ expect(get_team).to eq(200)
36
+ end
37
+ end
38
+
39
+ describe '#delete_team' do
40
+ let(:team_id) { 1 }
41
+
42
+ it 'when request are valid', :enterprise do
43
+ stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}")
44
+ delete_team = @crowdin.delete_team(team_id)
45
+ expect(delete_team).to eq(200)
46
+ end
47
+ end
48
+
49
+ describe '#edit_team' do
50
+ let(:team_id) { 1 }
51
+
52
+ it 'when request are valid', :enterprise do
53
+ stub_request(:patch, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}")
54
+ edit_team = @crowdin.edit_team(team_id, {})
55
+ expect(edit_team).to eq(200)
56
+ end
57
+ end
58
+
59
+ describe '#team_members_list' do
60
+ let(:team_id) { 1 }
61
+
62
+ it 'when request are valid', :enterprise do
63
+ stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}/members")
64
+ team_members_list = @crowdin.team_members_list(team_id, {})
65
+ expect(team_members_list).to eq(200)
66
+ end
67
+ end
68
+
69
+ describe '#add_team_members' do
70
+ let(:team_id) { 1 }
71
+
72
+ it 'when request are valid', :enterprise do
73
+ stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}/members")
74
+ add_team_members = @crowdin.add_team_members(team_id, {})
75
+ expect(add_team_members).to eq(200)
76
+ end
77
+ end
78
+
79
+ describe '#delete_all_team_members' do
80
+ let(:team_id) { 1 }
81
+
82
+ it 'when request are valid', :enterprise do
83
+ stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}/members")
84
+ delete_all_team_members = @crowdin.delete_all_team_members(team_id)
85
+ expect(delete_all_team_members).to eq(200)
86
+ end
87
+ end
88
+
89
+ describe '#delete_team_member' do
90
+ let(:team_id) { 1 }
91
+ let(:member_id) { 1 }
92
+
93
+ it 'when request are valid', :enterprise do
94
+ stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/teams/#{team_id}/members/#{member_id}")
95
+ delete_team_member = @crowdin.delete_team_member(team_id, member_id)
96
+ expect(delete_team_member).to eq(200)
97
+ end
98
+ end
12
99
  end
13
100
  end
@@ -9,5 +9,106 @@ describe Crowdin::ApiResources::TranslationMemory do
9
9
  expect(list_tms).to eq(200)
10
10
  end
11
11
  end
12
+
13
+ describe '#add_tm' do
14
+ it 'when request are valid', :default do
15
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/tms")
16
+ add_tm = @crowdin.add_tm
17
+ expect(add_tm).to eq(200)
18
+ end
19
+ end
20
+
21
+ describe '#get_tm' do
22
+ let(:tm_id) { 1 }
23
+
24
+ it 'when request are valid', :default do
25
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}")
26
+ get_tm = @crowdin.get_tm(tm_id)
27
+ expect(get_tm).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#delete_tm' do
32
+ let(:tm_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}")
36
+ delete_tm = @crowdin.delete_tm(tm_id)
37
+ expect(delete_tm).to eq(200)
38
+ end
39
+ end
40
+
41
+ describe '#edit_tm' do
42
+ let(:tm_id) { 1 }
43
+
44
+ it 'when request are valid', :default do
45
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}")
46
+ edit_tm = @crowdin.edit_tm(tm_id)
47
+ expect(edit_tm).to eq(200)
48
+ end
49
+ end
50
+
51
+ describe '#clear_tm' do
52
+ let(:tm_id) { 1 }
53
+
54
+ it 'when request are valid', :default do
55
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/segments")
56
+ clear_tm = @crowdin.clear_tm(tm_id)
57
+ expect(clear_tm).to eq(200)
58
+ end
59
+ end
60
+
61
+ describe '#export_tm' do
62
+ let(:tm_id) { 1 }
63
+
64
+ it 'when request are valid', :default do
65
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/exports")
66
+ export_tm = @crowdin.export_tm(tm_id)
67
+ expect(export_tm).to eq(200)
68
+ end
69
+ end
70
+
71
+ describe '#check_tm_export_status' do
72
+ let(:tm_id) { 1 }
73
+ let(:export_id) { 1 }
74
+
75
+ it 'when request are valid', :default do
76
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/exports/#{export_id}")
77
+ check_tm_export_status = @crowdin.check_tm_export_status(tm_id, export_id)
78
+ expect(check_tm_export_status).to eq(200)
79
+ end
80
+ end
81
+
82
+ describe '#download_tm' do
83
+ let(:tm_id) { 1 }
84
+ let(:export_id) { 1 }
85
+
86
+ it 'when request are valid', :default do
87
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/exports/#{export_id}/download")
88
+ download_tm = @crowdin.download_tm(tm_id, export_id)
89
+ expect(download_tm).to eq(200)
90
+ end
91
+ end
92
+
93
+ describe '#import_tm' do
94
+ let(:tm_id) { 1 }
95
+
96
+ it 'when request are valid', :default do
97
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/imports")
98
+ import_tm = @crowdin.import_tm(tm_id)
99
+ expect(import_tm).to eq(200)
100
+ end
101
+ end
102
+
103
+ describe '#check_tm_import_status' do
104
+ let(:tm_id) { 1 }
105
+ let(:import_id) { 1 }
106
+
107
+ it 'when request are valid', :default do
108
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/tms/#{tm_id}/imports/#{import_id}")
109
+ check_tm_import_status = @crowdin.check_tm_import_status(tm_id, import_id)
110
+ expect(check_tm_import_status).to eq(200)
111
+ end
112
+ end
12
113
  end
13
114
  end
@@ -11,5 +11,51 @@ describe Crowdin::ApiResources::TranslationStatus do
11
11
  expect(get_branch_progress).to eq(200)
12
12
  end
13
13
  end
14
+
15
+ describe '#get_directory_progress' do
16
+ let(:directory_id) { 1 }
17
+
18
+ it 'when request are valid', :default do
19
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/#{directory_id}/languages/progress")
20
+ get_directory_progress = @crowdin.get_directory_progress(directory_id, {}, project_id)
21
+ expect(get_directory_progress).to eq(200)
22
+ end
23
+ end
24
+
25
+ describe '#get_file_progress' do
26
+ let(:file_id) { 1 }
27
+
28
+ it 'when request are valid', :default do
29
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/#{file_id}/languages/progress")
30
+ get_file_progress = @crowdin.get_file_progress(file_id, {}, project_id)
31
+ expect(get_file_progress).to eq(200)
32
+ end
33
+ end
34
+
35
+ describe '#get_language_progress' do
36
+ let(:language_id) { 1 }
37
+
38
+ it 'when request are valid', :default do
39
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/languages/#{language_id}/progress")
40
+ get_language_progress = @crowdin.get_language_progress(language_id, {}, project_id)
41
+ expect(get_language_progress).to eq(200)
42
+ end
43
+ end
44
+
45
+ describe '#get_project_progress' do
46
+ it 'when request are valid', :default do
47
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/languages/progress")
48
+ get_project_progress = @crowdin.get_project_progress({}, project_id)
49
+ expect(get_project_progress).to eq(200)
50
+ end
51
+ end
52
+
53
+ describe '#get_qa_progress' do
54
+ it 'when request are valid', :default do
55
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/qa-checks")
56
+ get_qa_progress = @crowdin.get_qa_progress({}, project_id)
57
+ expect(get_qa_progress).to eq(200)
58
+ end
59
+ end
14
60
  end
15
61
  end
data/spec/spec_helper.rb CHANGED
@@ -21,7 +21,10 @@ RSpec.configure do |config|
21
21
  config.include_context 'crowdin_client_options'
22
22
 
23
23
  config.before(:each) do |spec|
24
- @crowdin = Crowdin::Client.new { |cfg| cfg.organization_domain = 'domain' } if spec.metadata[:enterprise]
25
- @crowdin = Crowdin::Client.new if spec.metadata[:default]
24
+ @crowdin = if spec.metadata[:enterprise]
25
+ Crowdin::Client.new { |cfg| cfg.organization_domain = organization_domain }
26
+ else # default
27
+ Crowdin::Client.new
28
+ end
26
29
  end
27
30
  end
@@ -82,4 +82,10 @@ describe 'Crowdin Client' do
82
82
  expect(@crowdin.config.base_url).to eq("https://#{full_organization_domain}")
83
83
  end
84
84
  end
85
+
86
+ describe 'Crowdin Client fetch_all' do
87
+ it 'should raise error if fetch_all is called for unsupported methods' do
88
+ expect { @crowdin.fetch_all(:add_bundle).to raise_error(Crowdin::Errors::FetchAllProcessingError) }
89
+ end
90
+ end
85
91
  end