Patch #32886 » 0001-Replace-content_type-with-media_type.patch
test/functional/attachments_controller_test.rb | ||
---|---|---|
45 | 45 |
) |
46 | 46 |
assert_response :success |
47 | 47 | |
48 |
assert_equal 'text/html', @response.content_type
|
|
48 |
assert_equal 'text/html', @response.media_type
|
|
49 | 49 |
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ |
50 | 50 |
assert_select 'td.line-code', :text => /Demande créée avec succès/ |
51 | 51 |
end |
... | ... | |
64 | 64 |
) |
65 | 65 |
assert_response :success |
66 | 66 | |
67 |
assert_equal 'text/html', @response.content_type
|
|
67 |
assert_equal 'text/html', @response.media_type
|
|
68 | 68 |
assert_select 'th.filename', :text => /issues_controller.rb\t\(r\?vision 1484\)/ |
69 | 69 |
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/ |
70 | 70 |
end |
... | ... | |
84 | 84 |
) |
85 | 85 |
assert_response :success |
86 | 86 | |
87 |
assert_equal 'text/html', @response.content_type
|
|
87 |
assert_equal 'text/html', @response.media_type
|
|
88 | 88 |
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ |
89 | 89 |
assert_select 'td.line-code', :text => /Demande créée avec succès/ |
90 | 90 |
end |
... | ... | |
136 | 136 |
} |
137 | 137 |
) |
138 | 138 |
assert_response :success |
139 |
assert_equal 'text/html', @response.content_type
|
|
139 |
assert_equal 'text/html', @response.media_type
|
|
140 | 140 |
assert_select 'th.filename', :text => 'test1.txt' |
141 | 141 |
end |
142 | 142 | |
143 | 143 |
def test_show_text_file |
144 | 144 |
get(:show, :params => {:id => 4}) |
145 | 145 |
assert_response :success |
146 |
assert_equal 'text/html', @response.content_type
|
|
146 |
assert_equal 'text/html', @response.media_type
|
|
147 | 147 |
end |
148 | 148 | |
149 | 149 |
def test_show_text_file_utf_8 |
... | ... | |
155 | 155 |
assert_equal 'japanese-utf-8.txt', a.filename |
156 | 156 |
get(:show, :params => {:id => a.id}) |
157 | 157 |
assert_response :success |
158 |
assert_equal 'text/html', @response.content_type
|
|
158 |
assert_equal 'text/html', @response.media_type
|
|
159 | 159 |
assert_select 'tr#L1' do |
160 | 160 |
assert_select 'th.line-num', :text => '1' |
161 | 161 |
assert_select 'td', :text => /日本語/ |
... | ... | |
172 | 172 |
assert_equal 'iso8859-1.txt', a.filename |
173 | 173 |
get(:show, :params => {:id => a.id}) |
174 | 174 |
assert_response :success |
175 |
assert_equal 'text/html', @response.content_type
|
|
175 |
assert_equal 'text/html', @response.media_type
|
|
176 | 176 |
assert_select 'tr#L7' do |
177 | 177 |
assert_select 'th.line-num', :text => '7' |
178 | 178 |
assert_select 'td', :text => /Demande cr\?\?e avec succ\?s/ |
... | ... | |
190 | 190 |
assert_equal 'iso8859-1.txt', a.filename |
191 | 191 |
get(:show, :params => {:id => a.id}) |
192 | 192 |
assert_response :success |
193 |
assert_equal 'text/html', @response.content_type
|
|
193 |
assert_equal 'text/html', @response.media_type
|
|
194 | 194 |
assert_select 'tr#L7' do |
195 | 195 |
assert_select 'th.line-num', :text => '7' |
196 | 196 |
assert_select 'td', :text => /Demande créée avec succès/ |
... | ... | |
204 | 204 |
Attachment.find(4).update_attribute :filesize, 754.kilobyte |
205 | 205 |
get(:show, :params => {:id => 4}) |
206 | 206 |
assert_response :success |
207 |
assert_equal 'text/html', @response.content_type
|
|
207 |
assert_equal 'text/html', @response.media_type
|
|
208 | 208 |
assert_select '.nodata', :text => 'No preview available. Download the file instead.' |
209 | 209 |
end |
210 | 210 |
end |
... | ... | |
218 | 218 |
assert_equal 'testfile.md', a.filename |
219 | 219 |
get(:show, :params => {:id => a.id}) |
220 | 220 |
assert_response :success |
221 |
assert_equal 'text/html', @response.content_type
|
|
221 |
assert_equal 'text/html', @response.media_type
|
|
222 | 222 |
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>" |
223 | 223 |
end |
224 | 224 | |
... | ... | |
231 | 231 |
assert_equal 'testfile.textile', a.filename |
232 | 232 |
get(:show, :params => {:id => a.id}) |
233 | 233 |
assert_response :success |
234 |
assert_equal 'text/html', @response.content_type
|
|
234 |
assert_equal 'text/html', @response.media_type
|
|
235 | 235 |
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n\n\t<h2>Header 2</h2>\n\n\n\t<h3>Header 3</h3>" |
236 | 236 |
end |
237 | 237 | |
... | ... | |
239 | 239 |
@request.session[:user_id] = 2 |
240 | 240 |
get(:show, :params => {:id => 16}) |
241 | 241 |
assert_response :success |
242 |
assert_equal 'text/html', @response.content_type
|
|
242 |
assert_equal 'text/html', @response.media_type
|
|
243 | 243 |
assert_select 'img.filecontent', :src => attachments(:attachments_010).filename |
244 | 244 |
end |
245 | 245 | |
246 | 246 |
def test_show_other_with_no_preview |
247 | 247 |
@request.session[:user_id] = 2 |
248 | 248 |
get(:show, :params => {:id => 6}) |
249 |
assert_equal 'text/html', @response.content_type
|
|
249 |
assert_equal 'text/html', @response.media_type
|
|
250 | 250 |
assert_select '.nodata', :text => 'No preview available. Download the file instead.' |
251 | 251 |
end |
252 | 252 | |
... | ... | |
301 | 301 |
def test_download_text_file |
302 | 302 |
get(:download, :params => {:id => 4}) |
303 | 303 |
assert_response :success |
304 |
assert_equal 'application/x-ruby', @response.content_type
|
|
304 |
assert_equal 'application/x-ruby', @response.media_type
|
|
305 | 305 |
etag = @response.etag |
306 | 306 |
assert_not_nil etag |
307 | 307 | |
... | ... | |
320 | 320 | |
321 | 321 |
get(:download, :params => {:id => attachment.id}) |
322 | 322 |
assert_response :success |
323 |
assert_equal 'text/javascript', @response.content_type
|
|
323 |
assert_equal 'text/javascript', @response.media_type
|
|
324 | 324 |
end |
325 | 325 | |
326 | 326 |
def test_download_version_file_with_issue_tracking_disabled |
... | ... | |
333 | 333 |
Attachment.find(4).update_attribute(:content_type, '') |
334 | 334 |
get(:download, :params => {:id => 4}) |
335 | 335 |
assert_response :success |
336 |
assert_equal 'text/x-ruby', @response.content_type
|
|
336 |
assert_equal 'text/x-ruby', @response.media_type
|
|
337 | 337 |
end |
338 | 338 | |
339 | 339 |
def test_download_should_assign_better_content_type_than_application_octet_stream |
340 | 340 |
Attachment.find(4).update! :content_type => "application/octet-stream" |
341 | 341 |
get(:download, :params => {:id => 4}) |
342 | 342 |
assert_response :success |
343 |
assert_equal 'text/x-ruby', @response.content_type
|
|
343 |
assert_equal 'text/x-ruby', @response.media_type
|
|
344 | 344 |
end |
345 | 345 | |
346 | 346 |
def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined |
347 | 347 |
get(:download, :params => {:id => 22}) |
348 | 348 |
assert_response :success |
349 | 349 |
assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename) |
350 |
assert_equal 'application/octet-stream', @response.content_type
|
|
350 |
assert_equal 'application/octet-stream', @response.media_type
|
|
351 | 351 |
end |
352 | 352 | |
353 | 353 |
def test_download_missing_file |
... | ... | |
371 | 371 |
} |
372 | 372 |
) |
373 | 373 |
assert_response :success |
374 |
assert_equal 'image/png', response.content_type
|
|
374 |
assert_equal 'image/png', response.media_type
|
|
375 | 375 | |
376 | 376 |
etag = @response.etag |
377 | 377 |
assert_not_nil etag |
... | ... | |
459 | 459 |
} |
460 | 460 |
) |
461 | 461 |
assert_response :success |
462 |
assert_equal 'image/png', response.content_type
|
|
462 |
assert_equal 'image/png', response.media_type
|
|
463 | 463 |
end |
464 | 464 |
else |
465 | 465 |
puts '(GhostScript convert not available)' |
test/functional/auth_sources_controller_test.rb | ||
---|---|---|
197 | 197 |
:term => 'foo' |
198 | 198 |
} |
199 | 199 |
assert_response :success |
200 |
assert_equal 'application/json', response.content_type
|
|
200 |
assert_equal 'application/json', response.media_type
|
|
201 | 201 |
json = ActiveSupport::JSON.decode(response.body) |
202 | 202 |
assert_kind_of Array, json |
203 | 203 |
assert_equal 2, json.size |
test/functional/custom_fields_controller_test.rb | ||
---|---|---|
263 | 263 |
}, |
264 | 264 |
:xhr => true |
265 | 265 |
assert_response :success |
266 |
assert_equal 'text/javascript', response.content_type
|
|
266 |
assert_equal 'text/javascript', response.media_type
|
|
267 | 267 | |
268 | 268 |
assert_include '<option selected=\"selected\" value=\"list\">List<\/option>', response.body |
269 | 269 |
end |
test/functional/gantts_controller_test.rb | ||
---|---|---|
142 | 142 |
:format => 'pdf' |
143 | 143 |
} |
144 | 144 |
assert_response :success |
145 |
assert_equal 'application/pdf', @response.content_type
|
|
145 |
assert_equal 'application/pdf', @response.media_type
|
|
146 | 146 |
assert @response.body.starts_with?('%PDF') |
147 | 147 |
end |
148 | 148 | |
... | ... | |
151 | 151 |
:format => 'pdf' |
152 | 152 |
} |
153 | 153 |
assert_response :success |
154 |
assert_equal 'application/pdf', @response.content_type
|
|
154 |
assert_equal 'application/pdf', @response.media_type
|
|
155 | 155 |
assert @response.body.starts_with?('%PDF') |
156 | 156 |
end |
157 | 157 | |
... | ... | |
162 | 162 |
:format => 'png' |
163 | 163 |
} |
164 | 164 |
assert_response :success |
165 |
assert_equal 'image/png', @response.content_type
|
|
165 |
assert_equal 'image/png', @response.media_type
|
|
166 | 166 |
end |
167 | 167 |
end |
168 | 168 |
test/functional/groups_controller_test.rb | ||
---|---|---|
191 | 191 |
:xhr => true |
192 | 192 |
) |
193 | 193 |
assert_response :success |
194 |
assert_equal 'text/javascript', response.content_type
|
|
194 |
assert_equal 'text/javascript', response.media_type
|
|
195 | 195 |
end |
196 | 196 | |
197 | 197 |
def test_add_users |
... | ... | |
217 | 217 |
:xhr => true |
218 | 218 |
) |
219 | 219 |
assert_response :success |
220 |
assert_equal 'text/javascript', response.content_type
|
|
220 |
assert_equal 'text/javascript', response.media_type
|
|
221 | 221 |
end |
222 | 222 |
assert_match /John Smith/, response.body |
223 | 223 |
end |
... | ... | |
245 | 245 |
:xhr => true |
246 | 246 |
) |
247 | 247 |
assert_response :success |
248 |
assert_equal 'text/javascript', response.content_type
|
|
248 |
assert_equal 'text/javascript', response.media_type
|
|
249 | 249 |
end |
250 | 250 |
end |
251 | 251 |
test/functional/issue_categories_controller_test.rb | ||
---|---|---|
45 | 45 |
:xhr => true |
46 | 46 |
) |
47 | 47 |
assert_response :success |
48 |
assert_equal 'text/javascript', response.content_type
|
|
48 |
assert_equal 'text/javascript', response.media_type
|
|
49 | 49 |
end |
50 | 50 | |
51 | 51 |
def test_create |
... | ... | |
100 | 100 |
assert_equal 'New category', category.name |
101 | 101 | |
102 | 102 |
assert_response :success |
103 |
assert_equal 'text/javascript', response.content_type
|
|
103 |
assert_equal 'text/javascript', response.media_type
|
|
104 | 104 |
end |
105 | 105 | |
106 | 106 |
def test_create_from_issue_form_with_failure |
... | ... | |
119 | 119 |
end |
120 | 120 | |
121 | 121 |
assert_response :success |
122 |
assert_equal 'text/javascript', response.content_type
|
|
122 |
assert_equal 'text/javascript', response.media_type
|
|
123 | 123 |
assert_include 'Name cannot be blank', response.body |
124 | 124 |
end |
125 | 125 |
test/functional/issue_relations_controller_test.rb | ||
---|---|---|
81 | 81 |
}, |
82 | 82 |
:xhr => true |
83 | 83 |
assert_response :success |
84 |
assert_equal 'text/javascript', response.content_type
|
|
84 |
assert_equal 'text/javascript', response.media_type
|
|
85 | 85 |
end |
86 | 86 |
relation = IssueRelation.order('id DESC').first |
87 | 87 |
assert_equal 1, relation.issue_from_id |
... | ... | |
182 | 182 |
:xhr => true |
183 | 183 | |
184 | 184 |
assert_response :success |
185 |
assert_equal 'text/javascript', response.content_type
|
|
185 |
assert_equal 'text/javascript', response.media_type
|
|
186 | 186 |
end |
187 | 187 |
assert_include 'Related issue cannot be blank', response.body |
188 | 188 |
end |
... | ... | |
217 | 217 |
:xhr => true |
218 | 218 | |
219 | 219 |
assert_response :success |
220 |
assert_equal 'text/javascript', response.content_type
|
|
220 |
assert_equal 'text/javascript', response.media_type
|
|
221 | 221 |
assert_include 'relation-2', response.body |
222 | 222 |
end |
223 | 223 |
end |
test/functional/issues_controller_test.rb | ||
---|---|---|
463 | 463 |
} |
464 | 464 |
) |
465 | 465 |
assert_response :success |
466 |
assert_equal 'application/pdf', response.content_type
|
|
466 |
assert_equal 'application/pdf', response.media_type
|
|
467 | 467 |
end |
468 | 468 | |
469 | 469 |
def test_index_with_query_grouped_by_list_custom_field |
... | ... | |
1081 | 1081 | |
1082 | 1082 |
get(:index, :params => {:format => 'pdf'}) |
1083 | 1083 |
assert_response :success |
1084 |
assert_equal 'application/pdf', @response.content_type
|
|
1084 |
assert_equal 'application/pdf', @response.media_type
|
|
1085 | 1085 | |
1086 | 1086 |
get( |
1087 | 1087 |
:index, |
... | ... | |
1091 | 1091 |
} |
1092 | 1092 |
) |
1093 | 1093 |
assert_response :success |
1094 |
assert_equal 'application/pdf', @response.content_type
|
|
1094 |
assert_equal 'application/pdf', @response.media_type
|
|
1095 | 1095 | |
1096 | 1096 |
get( |
1097 | 1097 |
:index, |
... | ... | |
1102 | 1102 |
} |
1103 | 1103 |
) |
1104 | 1104 |
assert_response :success |
1105 |
assert_equal 'application/pdf', @response.content_type
|
|
1105 |
assert_equal 'application/pdf', @response.media_type
|
|
1106 | 1106 |
end |
1107 | 1107 |
end |
1108 | 1108 |
end |
... | ... | |
1117 | 1117 |
} |
1118 | 1118 |
) |
1119 | 1119 |
assert_response :success |
1120 |
assert_equal 'application/pdf', @response.content_type
|
|
1120 |
assert_equal 'application/pdf', @response.media_type
|
|
1121 | 1121 |
end |
1122 | 1122 | |
1123 | 1123 |
def test_index_atom |
... | ... | |
1129 | 1129 |
} |
1130 | 1130 |
) |
1131 | 1131 |
assert_response :success |
1132 |
assert_equal 'application/atom+xml', response.content_type
|
|
1132 |
assert_equal 'application/atom+xml', response.media_type
|
|
1133 | 1133 | |
1134 | 1134 |
assert_select 'feed' do |
1135 | 1135 |
assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom' |
... | ... | |
1612 | 1612 |
} |
1613 | 1613 |
) |
1614 | 1614 |
assert_response :success |
1615 |
assert_equal 'application/pdf', response.content_type
|
|
1615 |
assert_equal 'application/pdf', response.media_type
|
|
1616 | 1616 |
end |
1617 | 1617 | |
1618 | 1618 |
def test_index_with_description_column |
... | ... | |
1635 | 1635 |
} |
1636 | 1636 |
) |
1637 | 1637 |
assert_response :success |
1638 |
assert_equal 'application/pdf', response.content_type
|
|
1638 |
assert_equal 'application/pdf', response.media_type
|
|
1639 | 1639 |
end |
1640 | 1640 | |
1641 | 1641 |
def test_index_with_last_notes_column |
... | ... | |
1663 | 1663 |
} |
1664 | 1664 |
) |
1665 | 1665 |
assert_response :success |
1666 |
assert_equal 'application/pdf', response.content_type
|
|
1666 |
assert_equal 'application/pdf', response.media_type
|
|
1667 | 1667 |
end |
1668 | 1668 | |
1669 | 1669 |
def test_index_with_last_notes_column_should_display_private_notes_with_permission_only |
... | ... | |
1887 | 1887 |
} |
1888 | 1888 |
} |
1889 | 1889 |
) |
1890 |
assert_equal 'text/html', @response.content_type
|
|
1890 |
assert_equal 'text/html', @response.media_type
|
|
1891 | 1891 |
assert_select_error /Start date cannot be blank/i |
1892 | 1892 |
end |
1893 | 1893 | |
... | ... | |
1902 | 1902 |
:format => 'csv' |
1903 | 1903 |
} |
1904 | 1904 |
) |
1905 |
assert_equal 'text/csv', @response.content_type
|
|
1905 |
assert_equal 'text/csv', @response.media_type
|
|
1906 | 1906 |
assert @response.body.blank? |
1907 | 1907 |
end |
1908 | 1908 | |
... | ... | |
2649 | 2649 |
} |
2650 | 2650 |
) |
2651 | 2651 |
assert_response :success |
2652 |
assert_equal 'application/atom+xml', response.content_type
|
|
2652 |
assert_equal 'application/atom+xml', response.media_type
|
|
2653 | 2653 |
# Inline image |
2654 | 2654 |
assert_select( |
2655 | 2655 |
'content', |
... | ... | |
2668 | 2668 |
} |
2669 | 2669 |
) |
2670 | 2670 |
assert_response :success |
2671 |
assert_equal 'application/pdf', @response.content_type
|
|
2671 |
assert_equal 'application/pdf', @response.media_type
|
|
2672 | 2672 |
assert @response.body.starts_with?('%PDF') |
2673 | 2673 |
end |
2674 | 2674 | |
... | ... | |
2684 | 2684 |
} |
2685 | 2685 |
) |
2686 | 2686 |
assert_response :success |
2687 |
assert_equal 'application/pdf', @response.content_type
|
|
2687 |
assert_equal 'application/pdf', @response.media_type
|
|
2688 | 2688 |
assert @response.body.starts_with?('%PDF') |
2689 | 2689 |
end |
2690 | 2690 |
end |
... | ... | |
2702 | 2702 |
} |
2703 | 2703 |
) |
2704 | 2704 |
assert_response :success |
2705 |
assert_equal 'application/pdf', @response.content_type
|
|
2705 |
assert_equal 'application/pdf', @response.media_type
|
|
2706 | 2706 |
assert @response.body.starts_with?('%PDF') |
2707 | 2707 |
end |
2708 | 2708 | |
... | ... | |
2721 | 2721 |
} |
2722 | 2722 |
) |
2723 | 2723 |
assert_response :success |
2724 |
assert_equal 'application/pdf', @response.content_type
|
|
2724 |
assert_equal 'application/pdf', @response.media_type
|
|
2725 | 2725 |
assert @response.body.starts_with?('%PDF') |
2726 | 2726 |
end |
2727 | 2727 | |
... | ... | |
2734 | 2734 |
} |
2735 | 2735 |
) |
2736 | 2736 |
assert_response :success |
2737 |
assert_equal 'application/pdf', @response.content_type
|
|
2737 |
assert_equal 'application/pdf', @response.media_type
|
|
2738 | 2738 |
assert @response.body.starts_with?('%PDF') |
2739 | 2739 |
end |
2740 | 2740 | |
... | ... | |
2754 | 2754 |
} |
2755 | 2755 |
) |
2756 | 2756 |
assert_response :success |
2757 |
assert_equal 'application/pdf', @response.content_type
|
|
2757 |
assert_equal 'application/pdf', @response.media_type
|
|
2758 | 2758 |
assert @response.body.starts_with?('%PDF') |
2759 | 2759 |
end |
2760 | 2760 | |
... | ... | |
2773 | 2773 |
} |
2774 | 2774 |
) |
2775 | 2775 |
assert_response :success |
2776 |
assert_equal 'application/pdf', @response.content_type
|
|
2776 |
assert_equal 'application/pdf', @response.media_type
|
|
2777 | 2777 |
assert @response.body.starts_with?('%PDF') |
2778 | 2778 |
end |
2779 | 2779 |
end |
... | ... | |
3526 | 3526 |
:xhr => true |
3527 | 3527 |
) |
3528 | 3528 |
assert_response :success |
3529 |
assert_equal 'text/javascript', response.content_type
|
|
3529 |
assert_equal 'text/javascript', response.media_type
|
|
3530 | 3530 |
assert_include 'This is the test_new issue', response.body |
3531 | 3531 |
end |
3532 | 3532 | |
... | ... | |
5343 | 5343 |
:xhr => true |
5344 | 5344 |
) |
5345 | 5345 |
assert_response :success |
5346 |
assert_equal 'text/javascript', response.content_type
|
|
5346 |
assert_equal 'text/javascript', response.media_type
|
|
5347 | 5347 | |
5348 | 5348 |
assert_include 'This is the test_new issue', response.body |
5349 | 5349 |
end |
test/functional/journals_controller_test.rb | ||
---|---|---|
34 | 34 |
:project_id => 1 |
35 | 35 |
} |
36 | 36 |
assert_response :success |
37 |
assert_equal 'application/atom+xml', @response.content_type
|
|
37 |
assert_equal 'application/atom+xml', @response.media_type
|
|
38 | 38 |
end |
39 | 39 | |
40 | 40 |
def test_index_with_invalid_query_id |
... | ... | |
166 | 166 |
:xhr => true |
167 | 167 |
assert_response :success |
168 | 168 | |
169 |
assert_equal 'text/javascript', response.content_type
|
|
169 |
assert_equal 'text/javascript', response.media_type
|
|
170 | 170 |
assert_include '> This is an issue', response.body |
171 | 171 |
end |
172 | 172 | |
... | ... | |
188 | 188 |
}, |
189 | 189 |
:xhr => true |
190 | 190 |
assert_response :success |
191 |
assert_equal 'text/javascript', response.content_type
|
|
191 |
assert_equal 'text/javascript', response.media_type
|
|
192 | 192 |
assert_include 'Redmine Admin wrote in #note-1:', response.body |
193 | 193 |
assert_include '> A comment with a private version', response.body |
194 | 194 |
end |
... | ... | |
203 | 203 |
}, |
204 | 204 |
:xhr => true |
205 | 205 |
assert_response :success |
206 |
assert_equal 'text/javascript', response.content_type
|
|
206 |
assert_equal 'text/javascript', response.media_type
|
|
207 | 207 |
assert_include '> Privates notes', response.body |
208 | 208 | |
209 | 209 |
Role.find(1).remove_permission! :view_private_notes |
... | ... | |
222 | 222 |
}, |
223 | 223 |
:xhr => true |
224 | 224 |
assert_response :success |
225 |
assert_equal 'text/javascript', response.content_type
|
|
225 |
assert_equal 'text/javascript', response.media_type
|
|
226 | 226 |
assert_include 'textarea', response.body |
227 | 227 |
end |
228 | 228 | |
... | ... | |
236 | 236 |
}, |
237 | 237 |
:xhr => true |
238 | 238 |
assert_response :success |
239 |
assert_equal 'text/javascript', response.content_type
|
|
239 |
assert_equal 'text/javascript', response.media_type
|
|
240 | 240 |
assert_include 'textarea', response.body |
241 | 241 | |
242 | 242 |
Role.find(1).remove_permission! :view_private_notes |
... | ... | |
257 | 257 |
}, |
258 | 258 |
:xhr => true |
259 | 259 |
assert_response :success |
260 |
assert_equal 'text/javascript', response.content_type
|
|
260 |
assert_equal 'text/javascript', response.media_type
|
|
261 | 261 |
assert_equal 'Updated notes', Journal.find(2).notes |
262 | 262 |
assert_include 'journal-2-notes', response.body |
263 | 263 |
# response should include journal_indice param for quote link |
... | ... | |
274 | 274 |
}, |
275 | 275 |
:xhr => true |
276 | 276 |
assert_response :success |
277 |
assert_equal 'text/javascript', response.content_type
|
|
277 |
assert_equal 'text/javascript', response.media_type
|
|
278 | 278 |
assert_equal true, Journal.find(2).private_notes |
279 | 279 |
assert_include 'change-2', response.body |
280 | 280 |
assert_include 'journal-2-private_notes', response.body |
... | ... | |
291 | 291 |
}, |
292 | 292 |
:xhr => true |
293 | 293 |
assert_response :success |
294 |
assert_equal 'text/javascript', response.content_type
|
|
294 |
assert_equal 'text/javascript', response.media_type
|
|
295 | 295 |
assert_equal false, Journal.find(2).private_notes |
296 | 296 |
assert_include 'change-2', response.body |
297 | 297 |
assert_include 'journal-2-private_notes', response.body |
... | ... | |
325 | 325 |
}, |
326 | 326 |
:xhr => true |
327 | 327 |
assert_response :success |
328 |
assert_equal 'text/javascript', response.content_type
|
|
328 |
assert_equal 'text/javascript', response.media_type
|
|
329 | 329 |
end |
330 | 330 |
assert_nil Journal.find_by_id(2) |
331 | 331 |
assert_include 'change-2', response.body |
test/functional/members_controller_test.rb | ||
---|---|---|
56 | 56 |
}, |
57 | 57 |
:xhr => true |
58 | 58 |
assert_response :success |
59 |
assert_equal 'text/javascript', response.content_type
|
|
59 |
assert_equal 'text/javascript', response.media_type
|
|
60 | 60 |
end |
61 | 61 | |
62 | 62 |
def test_create |
... | ... | |
133 | 133 |
}, |
134 | 134 |
:xhr => true |
135 | 135 |
assert_response :success |
136 |
assert_equal 'text/javascript', response.content_type
|
|
136 |
assert_equal 'text/javascript', response.media_type
|
|
137 | 137 |
end |
138 | 138 |
assert User.find(7).member_of?(Project.find(1)) |
139 | 139 |
assert User.find(8).member_of?(Project.find(1)) |
... | ... | |
152 | 152 |
}, |
153 | 153 |
:xhr => true |
154 | 154 |
assert_response :success |
155 |
assert_equal 'text/javascript', response.content_type
|
|
155 |
assert_equal 'text/javascript', response.media_type
|
|
156 | 156 |
end |
157 | 157 |
assert_match /alert/, response.body, "Alert message not sent" |
158 | 158 |
end |
... | ... | |
242 | 242 |
}, |
243 | 243 |
:xhr => true |
244 | 244 |
assert_response :success |
245 |
assert_equal 'text/javascript', response.content_type
|
|
245 |
assert_equal 'text/javascript', response.media_type
|
|
246 | 246 |
end |
247 | 247 |
member = Member.find(2) |
248 | 248 |
assert_equal [1], member.role_ids |
... | ... | |
303 | 303 |
}, |
304 | 304 |
:xhr => true |
305 | 305 |
assert_response :success |
306 |
assert_equal 'text/javascript', response.content_type
|
|
306 |
assert_equal 'text/javascript', response.media_type
|
|
307 | 307 |
end |
308 | 308 |
assert_nil Member.find_by_id(2) |
309 | 309 |
assert_include 'tab-content-members', response.body |
test/functional/messages_controller_test.rb | ||
---|---|---|
266 | 266 |
}, |
267 | 267 |
:xhr => true |
268 | 268 |
assert_response :success |
269 |
assert_equal 'text/javascript', response.content_type
|
|
269 |
assert_equal 'text/javascript', response.media_type
|
|
270 | 270 | |
271 | 271 |
assert_include 'RE: First post', response.body |
272 | 272 |
assert_include "Redmine Admin wrote:", response.body |
... | ... | |
281 | 281 |
}, |
282 | 282 |
:xhr => true |
283 | 283 |
assert_response :success |
284 |
assert_equal 'text/javascript', response.content_type
|
|
284 |
assert_equal 'text/javascript', response.media_type
|
|
285 | 285 | |
286 | 286 |
assert_include 'RE: First post', response.body |
287 | 287 |
assert_include 'John Smith wrote in message#3:', response.body |
test/functional/principal_memberships_controller_test.rb | ||
---|---|---|
54 | 54 |
}, |
55 | 55 |
:xhr => true |
56 | 56 |
assert_response :success |
57 |
assert_equal 'text/javascript', response.content_type
|
|
57 |
assert_equal 'text/javascript', response.media_type
|
|
58 | 58 |
end |
59 | 59 | |
60 | 60 |
def test_create_user_membership |
... | ... | |
121 | 121 |
}, |
122 | 122 |
:xhr => true |
123 | 123 |
assert_response :success |
124 |
assert_equal 'text/javascript', response.content_type
|
|
124 |
assert_equal 'text/javascript', response.media_type
|
|
125 | 125 |
end |
126 | 126 |
member = Member.order('id DESC').first |
127 | 127 |
assert_equal User.find(7), member.principal |
... | ... | |
141 | 141 |
}, |
142 | 142 |
:xhr => true |
143 | 143 |
assert_response :success |
144 |
assert_equal 'text/javascript', response.content_type
|
|
144 |
assert_equal 'text/javascript', response.media_type
|
|
145 | 145 |
end |
146 | 146 |
assert_include 'alert', response.body, "Alert message not sent" |
147 | 147 |
assert_include 'Role cannot be empty', response.body, "Error message not sent" |
... | ... | |
191 | 191 |
}, |
192 | 192 |
:xhr => true |
193 | 193 |
assert_response :success |
194 |
assert_equal 'text/javascript', response.content_type
|
|
194 |
assert_equal 'text/javascript', response.media_type
|
|
195 | 195 |
end |
196 | 196 |
assert_equal [2], Member.find(1).role_ids |
197 | 197 |
assert_include '$("#member-1-roles").html("Developer").show();', response.body |
... | ... | |
216 | 216 |
}, |
217 | 217 |
:xhr => true |
218 | 218 |
assert_response :success |
219 |
assert_equal 'text/javascript', response.content_type
|
|
219 |
assert_equal 'text/javascript', response.media_type
|
|
220 | 220 |
end |
221 | 221 |
assert_nil Member.find_by_id(1) |
222 | 222 |
assert_include 'tab-content-memberships', response.body |
... | ... | |
228 | 228 |
}, |
229 | 229 |
:xhr => true |
230 | 230 |
assert_response :success |
231 |
assert_equal 'text/javascript', response.content_type
|
|
231 |
assert_equal 'text/javascript', response.media_type
|
|
232 | 232 |
end |
233 | 233 | |
234 | 234 |
def test_create_group_membership |
... | ... | |
254 | 254 |
}, |
255 | 255 |
:xhr => true |
256 | 256 |
assert_response :success |
257 |
assert_equal 'text/javascript', response.content_type
|
|
257 |
assert_equal 'text/javascript', response.media_type
|
|
258 | 258 |
end |
259 | 259 |
assert_match /OnlineStore/, response.body |
260 | 260 |
end |
... | ... | |
270 | 270 |
}, |
271 | 271 |
:xhr => true |
272 | 272 |
assert_response :success |
273 |
assert_equal 'text/javascript', response.content_type
|
|
273 |
assert_equal 'text/javascript', response.media_type
|
|
274 | 274 |
end |
275 | 275 |
assert_match /alert/, response.body, "Alert message not sent" |
276 | 276 |
end |
... | ... | |
298 | 298 |
}, |
299 | 299 |
:xhr => true |
300 | 300 |
assert_response :success |
301 |
assert_equal 'text/javascript', response.content_type
|
|
301 |
assert_equal 'text/javascript', response.media_type
|
|
302 | 302 |
end |
303 | 303 |
end |
304 | 304 | |
... | ... | |
319 | 319 |
}, |
320 | 320 |
:xhr => true |
321 | 321 |
assert_response :success |
322 |
assert_equal 'text/javascript', response.content_type
|
|
322 |
assert_equal 'text/javascript', response.media_type
|
|
323 | 323 |
end |
324 | 324 |
end |
325 | 325 |
end |
test/functional/projects_controller_test.rb | ||
---|---|---|
240 | 240 |
:xhr => true |
241 | 241 |
) |
242 | 242 |
assert_response :success |
243 |
assert_equal 'text/javascript', response.content_type
|
|
243 |
assert_equal 'text/javascript', response.media_type
|
|
244 | 244 |
end |
245 | 245 | |
246 | 246 |
def test_autocomplete_js_with_blank_search_term |
... | ... | |
253 | 253 |
:xhr => true |
254 | 254 |
) |
255 | 255 |
assert_response :success |
256 |
assert_equal 'text/javascript', response.content_type
|
|
256 |
assert_equal 'text/javascript', response.media_type
|
|
257 | 257 |
end |
258 | 258 | |
259 | 259 |
test "#index by non-admin user with view_time_entries permission should show overall spent time link" do |
test/functional/queries_controller_test.rb | ||
---|---|---|
706 | 706 |
} |
707 | 707 | |
708 | 708 |
assert_response :success |
709 |
assert_equal 'application/json', response.content_type
|
|
709 |
assert_equal 'application/json', response.media_type
|
|
710 | 710 |
json = ActiveSupport::JSON.decode(response.body) |
711 | 711 |
assert_include ["eCookbook - 2.0", "3", "open"], json |
712 | 712 |
end |
... | ... | |
720 | 720 |
} |
721 | 721 | |
722 | 722 |
assert_response :success |
723 |
assert_equal 'application/json', response.content_type
|
|
723 |
assert_equal 'application/json', response.media_type
|
|
724 | 724 |
json = ActiveSupport::JSON.decode(response.body) |
725 | 725 |
assert_include ["eCookbook - 2.0", "3", "open"], json |
726 | 726 |
end |
... | ... | |
735 | 735 |
} |
736 | 736 | |
737 | 737 |
assert_response :success |
738 |
assert_equal 'application/json', response.content_type
|
|
738 |
assert_equal 'application/json', response.media_type
|
|
739 | 739 |
json = ActiveSupport::JSON.decode(response.body) |
740 | 740 | |
741 | 741 |
# response includes visible version |
... | ... | |
756 | 756 |
} |
757 | 757 | |
758 | 758 |
assert_response :success |
759 |
assert_equal 'application/json', response.content_type
|
|
759 |
assert_equal 'application/json', response.media_type
|
|
760 | 760 |
json = ActiveSupport::JSON.decode(response.body) |
761 | 761 |
assert_equal 4, json.count |
762 | 762 |
assert_include ["Private child of eCookbook","5"], json |
... | ... | |
770 | 770 |
:name => 'assigned_to_id' |
771 | 771 |
} |
772 | 772 |
assert_response :success |
773 |
assert_equal 'application/json', response.content_type
|
|
773 |
assert_equal 'application/json', response.media_type
|
|
774 | 774 |
json = ActiveSupport::JSON.decode(response.body) |
775 | 775 | |
776 | 776 |
assert_equal 6, json.count |
... | ... | |
788 | 788 |
:name => 'author_id' |
789 | 789 |
} |
790 | 790 |
assert_response :success |
791 |
assert_equal 'application/json', response.content_type
|
|
791 |
assert_equal 'application/json', response.media_type
|
|
792 | 792 |
json = ActiveSupport::JSON.decode(response.body) |
793 | 793 | |
794 | 794 |
assert_equal 7, json.count |
... | ... | |
807 | 807 |
:name => 'user_id' |
808 | 808 |
} |
809 | 809 |
assert_response :success |
810 |
assert_equal 'application/json', response.content_type
|
|
810 |
assert_equal 'application/json', response.media_type
|
|
811 | 811 |
json = ActiveSupport::JSON.decode(response.body) |
812 | 812 | |
813 | 813 |
assert_equal 7, json.count |
... | ... | |
827 | 827 |
:name => 'watcher_id' |
828 | 828 |
} |
829 | 829 |
assert_response :success |
830 |
assert_equal 'application/json', response.content_type
|
|
830 |
assert_equal 'application/json', response.media_type
|
|
831 | 831 |
json = ActiveSupport::JSON.decode(response.body) |
832 | 832 | |
833 | 833 |
assert_equal 1, json.count |
... | ... | |
844 | 844 |
:name => 'watcher_id' |
845 | 845 |
} |
846 | 846 |
assert_response :success |
847 |
assert_equal 'application/json', response.content_type
|
|
847 |
assert_equal 'application/json', response.media_type
|
|
848 | 848 |
json = ActiveSupport::JSON.decode(response.body) |
849 | 849 | |
850 | 850 |
assert_equal 6, json.count |
test/functional/repositories_controller_test.rb | ||
---|---|---|
331 | 331 |
:xhr => true |
332 | 332 |
) |
333 | 333 |
assert_response :success |
334 |
assert_equal 'text/javascript', response.content_type
|
|
334 |
assert_equal 'text/javascript', response.media_type
|
|
335 | 335 |
end |
336 | 336 |
assert_equal [2], Changeset.find(103).issue_ids |
337 | 337 |
assert_include 'related-issues', response.body |
... | ... | |
371 | 371 |
:xhr => true |
372 | 372 |
) |
373 | 373 |
assert_response :success |
374 |
assert_equal 'text/javascript', response.content_type
|
|
374 |
assert_equal 'text/javascript', response.media_type
|
|
375 | 375 |
end |
376 | 376 |
assert_include 'alert("Issue is invalid")', response.body |
377 | 377 |
end |
... | ... | |
393 | 393 |
:xhr => true |
394 | 394 |
) |
395 | 395 |
assert_response :success |
396 |
assert_equal 'text/javascript', response.content_type
|
|
396 |
assert_equal 'text/javascript', response.media_type
|
|
397 | 397 |
end |
398 | 398 |
assert_equal [1], Changeset.find(103).issue_ids |
399 | 399 |
assert_include 'related-issue-2', response.body |
... | ... | |
413 | 413 |
} |
414 | 414 |
) |
415 | 415 |
assert_response :success |
416 |
assert_equal 'application/json', response.content_type
|
|
416 |
assert_equal 'application/json', response.media_type
|
|
417 | 417 |
data = ActiveSupport::JSON.decode(response.body) |
418 | 418 |
assert_not_nil data['labels'] |
419 | 419 |
assert_not_nil data['commits'] |
... | ... | |
430 | 430 |
} |
431 | 431 |
) |
432 | 432 |
assert_response :success |
433 |
assert_equal 'application/json', response.content_type
|
|
433 |
assert_equal 'application/json', response.media_type
|
|
434 | 434 |
data = ActiveSupport::JSON.decode(response.body) |
435 | 435 |
assert_not_nil data['labels'] |
436 | 436 |
assert_not_nil data['commits'] |
test/functional/repositories_filesystem_controller_test.rb | ||
---|---|---|
95 | 95 |
:path => repository_path_hash(['test'])[:param] |
96 | 96 |
} |
97 | 97 |
assert_response :success |
98 |
assert_equal 'application/octet-stream', @response.content_type
|
|
98 |
assert_equal 'application/octet-stream', @response.media_type
|
|
99 | 99 |
end |
100 | 100 | |
101 | 101 |
def test_show_non_ascii_contents |
... | ... | |
138 | 138 |
:path => repository_path_hash(['japanese', 'big-file.txt'])[:param] |
139 | 139 |
} |
140 | 140 |
assert_response :success |
141 |
assert_equal 'text/html', @response.content_type
|
|
141 |
assert_equal 'text/html', @response.media_type
|
|
142 | 142 |
assert_select 'p.nodata' |
143 | 143 |
end |
144 | 144 |
end |
test/functional/repositories_subversion_controller_test.rb | ||
---|---|---|
249 | 249 |
} |
250 | 250 |
) |
251 | 251 |
assert_response :success |
252 |
assert_equal 'text/html', @response.content_type
|
|
252 |
assert_equal 'text/html', @response.media_type
|
|
253 | 253 |
assert_select 'p.nodata' |
254 | 254 |
end |
255 | 255 |
end |
... | ... | |
470 | 470 |
} |
471 | 471 |
) |
472 | 472 |
assert_response :success |
473 |
assert_equal 'text/x-patch', @response.content_type
|
|
473 |
assert_equal 'text/x-patch', @response.media_type
|
|
474 | 474 |
assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first |
475 | 475 |
end |
476 | 476 |
test/functional/sys_controller_test.rb | ||
---|---|---|
34 | 34 |
def test_projects_with_repository_enabled |
35 | 35 |
get :projects |
36 | 36 |
assert_response :success |
37 |
assert_equal 'application/json', @response.content_type
|
|
37 |
assert_equal 'application/json', @response.media_type
|
|
38 | 38 | |
39 | 39 |
data = ActiveSupport::JSON.decode(response.body) |
40 | 40 | |
... | ... | |
56 | 56 |
:repository => { :url => 'file:///create/project/repository/subproject2'} |
57 | 57 |
} |
58 | 58 |
assert_response :created |
59 |
assert_equal 'application/json', @response.content_type
|
|
59 |
assert_equal 'application/json', @response.media_type
|
|
60 | 60 | |
61 | 61 |
r = Project.find(4).repository |
62 | 62 |
assert r.is_a?(Repository::Subversion) |
test/functional/timelog_controller_test.rb | ||
---|---|---|
1341 | 1341 |
def test_index_atom_feed |
1342 | 1342 |
get :index, :params => {:project_id => 1, :format => 'atom'} |
1343 | 1343 |
assert_response :success |
1344 |
assert_equal 'application/atom+xml', @response.content_type
|
|
1344 |
assert_equal 'application/atom+xml', @response.media_type
|
|
1345 | 1345 |
assert_select 'entry > title', :text => /7\.65 hours/ |
1346 | 1346 |
end |
1347 | 1347 |
test/functional/versions_controller_test.rb | ||
---|---|---|
228 | 228 |
@request.session[:user_id] = 2 |
229 | 229 |
get :new, :params => {:project_id => '1'}, :xhr => true |
230 | 230 |
assert_response :success |
231 |
assert_equal 'text/javascript', response.content_type
|
|
231 |
assert_equal 'text/javascript', response.media_type
|
|
232 | 232 |
end |
233 | 233 | |
234 | 234 |
def test_create |
... | ... | |
252 | 252 |
assert_equal 1, version.project_id |
253 | 253 | |
254 | 254 |
assert_response :success |
255 |
assert_equal 'text/javascript', response.content_type
|
|
255 |
assert_equal 'text/javascript', response.media_type
|
|
256 | 256 |
assert_include 'test_add_version_from_issue_form', response.body |
257 | 257 |
end |
258 | 258 | |
... | ... | |
262 | 262 |
post :create, :params => {:project_id => '1', :version => {:name => ''}}, :xhr => true |
263 | 263 |
end |
264 | 264 |
assert_response :success |
265 |
assert_equal 'text/javascript', response.content_type
|
|
265 |
assert_equal 'text/javascript', response.media_type
|
|
266 | 266 |
end |
267 | 267 | |
268 | 268 |
def test_get_edit |
test/functional/wiki_controller_test.rb | ||
---|---|---|
1009 | 1009 |
get :export, :params => {:project_id => 'ecookbook'} |
1010 | 1010 | |
1011 | 1011 |
assert_response :success |
1012 |
assert_equal "text/html", @response.content_type
|
|
1012 |
assert_equal "text/html", @response.media_type
|
|
1013 | 1013 | |
1014 | 1014 |
assert_select "a[name=?]", "CookBook_documentation" |
1015 | 1015 |
assert_select "a[name=?]", "Another_page" |
... | ... | |
1021 | 1021 |
get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'} |
1022 | 1022 | |
1023 | 1023 |
assert_response :success |
1024 |
assert_equal 'application/pdf', @response.content_type
|
|
1024 |
assert_equal 'application/pdf', @response.media_type
|
|
1025 | 1025 |
assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition'] |
1026 | 1026 |
assert @response.body.starts_with?('%PDF') |
1027 | 1027 |
end |
... | ... | |
1086 | 1086 |
get :show, :params => {:project_id => 1, :format => 'pdf'} |
1087 | 1087 |
assert_response :success |
1088 | 1088 | |
1089 |
assert_equal 'application/pdf', @response.content_type
|
|
1089 |
assert_equal 'application/pdf', @response.media_type
|
|
1090 | 1090 |
assert_equal 'attachment; filename="CookBook_documentation.pdf"', |
1091 | 1091 |
@response.headers['Content-Disposition'] |
1092 | 1092 |
end |
... | ... | |
1096 | 1096 |
get :show, :params => {:project_id => 1, :format => 'html'} |
1097 | 1097 |
assert_response :success |
1098 | 1098 | |
1099 |
assert_equal 'text/html', @response.content_type
|
|
1099 |
assert_equal 'text/html', @response.media_type
|
|
1100 | 1100 |
assert_equal 'attachment; filename="CookBook_documentation.html"', |
1101 | 1101 |
@response.headers['Content-Disposition'] |
1102 | 1102 |
assert_select 'h1', :text => /CookBook documentation/ |
... | ... | |
1107 | 1107 |
get :show, :params => {:project_id => 1, :format => 'html', :version => 2} |
1108 | 1108 |
assert_response :success |
1109 | 1109 | |
1110 |
assert_equal 'text/html', @response.content_type
|
|
1110 |
assert_equal 'text/html', @response.media_type
|
|
1111 | 1111 |
assert_equal 'attachment; filename="CookBook_documentation.html"', |
1112 | 1112 |
@response.headers['Content-Disposition'] |
1113 | 1113 |
assert_select 'h1', :text => /CookBook documentation v2/ |
... | ... | |
1118 | 1118 |
get :show, :params => {:project_id => 1, :format => 'txt'} |
1119 | 1119 |
assert_response :success |
1120 | 1120 | |
1121 |
assert_equal 'text/plain', @response.content_type
|
|
1121 |
assert_equal 'text/plain', @response.media_type
|
|
1122 | 1122 |
assert_equal 'attachment; filename="CookBook_documentation.txt"', |
1123 | 1123 |
@response.headers['Content-Disposition'] |
1124 | 1124 |
assert_include 'h1. CookBook documentation', @response.body |
... | ... | |
1129 | 1129 |
get :show, :params => {:project_id => 1, :format => 'txt', :version => 2} |
1130 | 1130 |
assert_response :success |
1131 | 1131 | |
1132 |
assert_equal 'text/plain', @response.content_type
|
|
1132 |
assert_equal 'text/plain', @response.media_type
|
|
1133 | 1133 |
assert_equal 'attachment; filename="CookBook_documentation.txt"', |
1134 | 1134 |
@response.headers['Content-Disposition'] |
1135 | 1135 |
assert_include 'h1. CookBook documentation v2', @response.body |
test/integration/api_test/attachments_test.rb | ||
---|---|---|
42 | 42 |
test "GET /attachments/:id.xml should return the attachment" do |
43 | 43 |
get '/attachments/7.xml', :headers => credentials('jsmith') |
44 | 44 |
assert_response :success |
45 |
assert_equal 'application/xml', @response.content_type
|
|
45 |
assert_equal 'application/xml', @response.media_type
|
|
46 | 46 |
assert_select 'attachment id', :text => '7' do |
47 | 47 |
assert_select '~ filename', :text => 'archive.zip' |
48 | 48 |
assert_select '~ content_url', :text => 'http://www.example.com/attachments/download/7/archive.zip' |
... | ... | |
52 | 52 |
test "GET /attachments/:id.xml for image should include thumbnail_url" do |
53 | 53 |
get '/attachments/16.xml', :headers => credentials('jsmith') |
54 | 54 |
assert_response :success |
55 |
assert_equal 'application/xml', @response.content_type
|
|
55 |
assert_equal 'application/xml', @response.media_type
|
|
56 | 56 |
assert_select 'attachment id:contains(16)' do |
57 | 57 |
assert_select '~ thumbnail_url', :text => 'http://www.example.com/attachments/thumbnail/16' |
58 | 58 |
end |
... | ... | |
66 | 66 |
test "GET /attachments/download/:id/:filename should return the attachment content" do |
67 | 67 |
get '/attachments/download/7/archive.zip', :headers => credentials('jsmith') |
68 | 68 |
assert_response :success |
69 |
assert_equal 'application/zip', @response.content_type
|
|
69 |
assert_equal 'application/zip', @response.media_type
|
|
70 | 70 |
end |
71 | 71 | |
72 | 72 |
test "GET /attachments/download/:id/:filename should deny access without credentials" do |
... | ... | |
104 | 104 |
:headers => credentials('jsmith') |
105 | 105 | |
106 | 106 |
assert_response :no_content |
107 |
assert_nil response.content_type
|
|
107 |
assert_nil response.media_type
|
|
108 | 108 |
attachment = Attachment.find(7) |
109 | 109 |
assert_equal 'renamed.zip', attachment.filename |
110 | 110 |
assert_equal 'updated', attachment.description |
... | ... | |
116 | 116 |
:headers => credentials('jsmith') |
117 | 117 | |
118 | 118 |
assert_response 422 |
119 |
assert_equal 'application/json', response.content_type
|
|
119 |
assert_equal 'application/json', response.media_type
|
|
120 | 120 |
json = ActiveSupport::JSON.decode(response.body) |
121 | 121 |
assert_include "File cannot be blank", json['errors'] |
122 | 122 |
end |
... | ... | |
129 | 129 |
"CONTENT_TYPE" => 'application/octet-stream' |
130 | 130 |
}.merge(credentials('jsmith')) |
131 | 131 |
assert_response :created |
132 |
assert_equal 'application/xml', response.content_type
|
|
132 |
assert_equal 'application/xml', response.media_type
|
|
133 | 133 |
end |
134 | 134 | |
135 | 135 |
xml = Hash.from_xml(response.body) |
... | ... | |
160 | 160 |
"CONTENT_TYPE" => 'application/octet-stream' |
161 | 161 |
}.merge(credentials('jsmith')) |
162 | 162 |
assert_response :created |
163 |
assert_equal 'application/json', response.content_type
|
|
163 |
assert_equal 'application/json', response.media_type
|
|
164 | 164 |
end |
165 | 165 | |
166 | 166 |
json = ActiveSupport::JSON.decode(response.body) |
test/integration/api_test/custom_fields_test.rb | ||
---|---|---|
25 | 25 |
test "GET /custom_fields.xml should return custom fields" do |
26 | 26 |
get '/custom_fields.xml', :headers => credentials('admin') |
27 | 27 |
assert_response :success |
28 |
assert_equal 'application/xml', response.content_type
|
|
28 |
assert_equal 'application/xml', response.media_type
|
|
29 | 29 | |
30 | 30 |
assert_select 'custom_fields' do |
31 | 31 |
assert_select 'custom_field' do |
test/integration/api_test/enumerations_test.rb | ||
---|---|---|
25 | 25 |
test "GET /enumerations/issue_priorities.xml should return priorities" do |
26 | 26 |
get '/enumerations/issue_priorities.xml' |
27 | 27 |
assert_response :success |
28 |
assert_equal 'application/xml', response.content_type
|
|
28 |
assert_equal 'application/xml', response.media_type
|
|
29 | 29 |
assert_select 'issue_priorities[type=array]' do |
30 | 30 |
assert_select 'issue_priority:nth-of-type(3)' do |
31 | 31 |
assert_select 'id', :text => '6' |
... | ... | |
43 | 43 |
test "GET /enumerations/invalid_subclass.xml should return 404" do |
44 | 44 |
get '/enumerations/invalid_subclass.xml' |
45 | 45 |
assert_response 404 |
46 |
assert_equal 'application/xml', response.content_type
|
|
46 |
assert_equal 'application/xml', response.media_type
|
|
47 | 47 |
end |
48 | 48 |
end |
test/integration/api_test/groups_test.rb | ||
---|---|---|
30 | 30 |
test "GET /groups.xml should return givable groups" do |
31 | 31 |
get '/groups.xml', :headers => credentials('admin') |
32 | 32 |
assert_response :success |
33 |
assert_equal 'application/xml', response.content_type
|
|
33 |
assert_equal 'application/xml', response.media_type
|
|
34 | 34 | |
35 | 35 |
assert_select 'groups' do |
36 | 36 |
assert_select 'group', Group.givable.count |
... | ... | |
44 | 44 |
test "GET /groups.xml?builtin=1 should return all groups" do |
45 | 45 |
get '/groups.xml?builtin=1', :headers => credentials('admin') |
46 | 46 |
assert_response :success |
47 |
assert_equal 'application/xml', response.content_type
|
|
47 |
assert_equal 'application/xml', response.media_type
|
|
48 | 48 | |
49 | 49 |
assert_select 'groups' do |
50 | 50 |
assert_select 'group', Group.givable.count + 2 |
... | ... | |
67 | 67 |
test "GET /groups.json should return groups" do |
68 | 68 |
get '/groups.json', :headers => credentials('admin') |
69 | 69 |
assert_response :success |
70 |
assert_equal 'application/json', response.content_type
|
|
70 |
assert_equal 'application/json', response.media_type
|
|
71 | 71 | |
72 | 72 |
json = ActiveSupport::JSON.decode(response.body) |
73 | 73 |
groups = json['groups'] |
... | ... | |
80 | 80 |
test "GET /groups/:id.xml should return the group" do |
81 | 81 |
get '/groups/10.xml', :headers => credentials('admin') |
82 | 82 |
assert_response :success |
83 |
assert_equal 'application/xml', response.content_type
|
|
83 |
assert_equal 'application/xml', response.media_type
|
|
84 | 84 | |
85 | 85 |
assert_select 'group' do |
86 | 86 |
assert_select 'name', :text => 'A Team' |
... | ... | |
91 | 91 |
test "GET /groups/:id.xml should return the builtin group" do |
92 | 92 |
get '/groups/12.xml', :headers => credentials('admin') |
93 | 93 |
assert_response :success |
94 |
assert_equal 'application/xml', response.content_type
|
|
94 |
assert_equal 'application/xml', response.media_type
|
|
95 | 95 | |
96 | 96 |
assert_select 'group' do |
97 | 97 |
assert_select 'builtin', :text => 'non_member' |
... | ... | |
102 | 102 |
test "GET /groups/:id.xml should include users if requested" do |
103 | 103 |
get '/groups/10.xml?include=users', :headers => credentials('admin') |
104 | 104 |
assert_response :success |
105 |
assert_equal 'application/xml', response.content_type
|
|
105 |
assert_equal 'application/xml', response.media_type
|
|
106 | 106 | |
107 | 107 |
assert_select 'group' do |
108 | 108 |
assert_select 'users' do |
... | ... | |
115 | 115 |
test "GET /groups/:id.xml include memberships if requested" do |
116 | 116 |
get '/groups/10.xml?include=memberships', :headers => credentials('admin') |
117 | 117 |
assert_response :success |
118 |
assert_equal 'application/xml', response.content_type
|
|
118 |
assert_equal 'application/xml', response.media_type
|
|
119 | 119 | |
120 | 120 |
assert_select 'group' do |
121 | 121 |
assert_select 'memberships' |
... | ... | |
128 | 128 |
:params => {:group => {:name => 'Test', :user_ids => [2, 3]}}, |
129 | 129 |
:headers => credentials('admin') |
130 | 130 |
assert_response :created |
131 |
assert_equal 'application/xml', response.content_type
|
|
131 |
assert_equal 'application/xml', response.media_type
|
|
132 | 132 |
end |
133 | 133 | |
134 | 134 |
group = Group.order('id DESC').first |
... | ... | |
147 | 147 |
:headers => credentials('admin') |
148 | 148 |
end |
149 | 149 |
assert_response :unprocessable_entity |
150 |
assert_equal 'application/xml', response.content_type
|
|
150 |
assert_equal 'application/xml', response.media_type
|
|
151 | 151 | |
152 | 152 |
assert_select 'errors' do |
153 | 153 |
assert_select 'error', :text => /Name cannot be blank/ |
... | ... | |
172 | 172 |
:params => {:group => {:name => ''}}, |
173 | 173 |
:headers => credentials('admin') |
174 | 174 |
assert_response :unprocessable_entity |
175 |
assert_equal 'application/xml', response.content_type
|
|
175 |
assert_equal 'application/xml', response.media_type
|
|
176 | 176 | |
177 | 177 |
assert_select 'errors' do |
178 | 178 |
assert_select 'error', :text => /Name cannot be blank/ |
test/integration/api_test/issue_categories_test.rb | ||
---|---|---|
29 | 29 |
test "GET /projects/:project_id/issue_categories.xml should return the issue categories" do |
30 | 30 |
get '/projects/1/issue_categories.xml', :headers => credentials('jsmith') |
31 | 31 |
assert_response :success |
32 |
assert_equal 'application/xml', @response.content_type
|
|
32 |
assert_equal 'application/xml', @response.media_type
|
|
33 | 33 |
assert_select 'issue_categories issue_category id', :text => '2' |
34 | 34 |
end |
35 | 35 | |
36 | 36 |
test "GET /issue_categories/:id.xml should return the issue category" do |
37 | 37 |
get '/issue_categories/2.xml', :headers => credentials('jsmith') |
38 | 38 |
assert_response :success |
39 |
assert_equal 'application/xml', @response.content_type
|
|
39 |
assert_equal 'application/xml', @response.media_type
|
|
40 | 40 |
assert_select 'issue_category id', :text => '2' |
41 | 41 |
end |
42 | 42 | |
... | ... | |
48 | 48 |
:headers => credentials('jsmith')) |
49 | 49 |
end |
50 | 50 |
assert_response :created |
51 |
assert_equal 'application/xml', @response.content_type
|
|
51 |
assert_equal 'application/xml', @response.media_type
|
|
52 | 52 | |
53 | 53 |
category = IssueCategory.order('id DESC').first |
54 | 54 |
assert_equal 'API', category.name |
... | ... | |
63 | 63 |
:headers => credentials('jsmith')) |
64 | 64 |
end |
65 | 65 |
assert_response :unprocessable_entity |
66 |
assert_equal 'application/xml', @response.content_type
|
|
66 |
assert_equal 'application/xml', @response.media_type
|
|
67 | 67 | |
68 | 68 |
assert_select 'errors error', :text => "Name cannot be blank" |
69 | 69 |
end |
... | ... | |
88 | 88 |
:headers => credentials('jsmith')) |
89 | 89 |
end |
90 | 90 |
assert_response :unprocessable_entity |
91 |
assert_equal 'application/xml', @response.content_type
|
|
91 |
assert_equal 'application/xml', @response.media_type
|
|
92 | 92 | |
93 | 93 |
assert_select 'errors error', :text => "Name cannot be blank" |
94 | 94 |
end |
test/integration/api_test/issue_relations_test.rb | ||
---|---|---|
33 | 33 |
get '/issues/9/relations.xml', :headers => credentials('jsmith') |
34 | 34 | |
35 | 35 |
assert_response :success |
36 |
assert_equal 'application/xml', @response.content_type
|
|
36 |
assert_equal 'application/xml', @response.media_type
|
|
37 | 37 | |
38 | 38 |
assert_select 'relations[type=array] relation id', :text => '1' |
39 | 39 |
end |
... | ... | |
51 | 51 |
assert_equal 'relates', relation.relation_type |
52 | 52 | |
53 | 53 |
assert_response :created |
54 |
assert_equal 'application/xml', @response.content_type
|
|
54 |
assert_equal 'application/xml', @response.media_type
|
|
55 | 55 |
assert_select 'relation id', :text => relation.id.to_s |
56 | 56 |
end |
57 | 57 | |
... | ... | |
70 | 70 |
get '/relations/2.xml', :headers => credentials('jsmith') |
71 | 71 | |
72 | 72 |
assert_response :success |
73 |
assert_equal 'application/xml', @response.content_type
|
|
73 |
assert_equal 'application/xml', @response.media_type
|
|
74 | 74 |
assert_select 'relation id', :text => '2' |
75 | 75 |
end |
76 | 76 |
test/integration/api_test/issue_statuses_test.rb | ||
---|---|---|
26 | 26 |
get '/issue_statuses.xml' |
27 | 27 | |
28 | 28 |
assert_response :success |
29 |
assert_equal 'application/xml', @response.content_type
|
|
29 |
assert_equal 'application/xml', @response.media_type
|
|
30 | 30 |
assert_select 'issue_statuses[type=array] issue_status id', :text => '2' do |
31 | 31 |
assert_select '~ name', :text => 'Assigned' |
32 | 32 |
end |
test/integration/api_test/issues_test.rb | ||
---|---|---|
72 | 72 |
get '/issues.xml?include=relations' |
73 | 73 | |
74 | 74 |
assert_response :success |
75 |
assert_equal 'application/xml', @response.content_type
|
|
75 |
assert_equal 'application/xml', @response.media_type
|
|
76 | 76 | |
77 | 77 |
assert_select 'issue id', :text => '3' do |
78 | 78 |
assert_select '~ relations relation', 1 |
... | ... | |
89 | 89 |
get '/issues.xml?include=attachments' |
90 | 90 | |
91 | 91 |
assert_response :success |
92 |
assert_equal 'application/xml', @response.content_type
|
|
92 |
assert_equal 'application/xml', @response.media_type
|
|
93 | 93 | |
94 | 94 |
assert_select 'issue id', :text => '3' do |
95 | 95 |
assert_select '~ attachments attachment', 4 |
... | ... | |
105 | 105 |
get '/issues.xml', :params => {:f => ['start_date'], :op => {:start_date => '='}} |
106 | 106 | |
107 | 107 |
assert_response :unprocessable_entity |
108 |
assert_equal 'application/xml', @response.content_type
|
|
108 |
assert_equal 'application/xml', @response.media_type
|
|
109 | 109 |
assert_select 'errors error', :text => "Start date cannot be blank" |
110 | 110 |
end |
111 | 111 | |
... | ... | |
371 | 371 |
get '/issues/1.xml?include=watchers', :headers => credentials('jsmith') |
372 | 372 | |
373 | 373 |
assert_response :ok |
374 |
assert_equal 'application/xml', response.content_type
|
|
374 |
assert_equal 'application/xml', response.media_type
|
|
375 | 375 |
assert_select 'issue' do |
376 | 376 |
assert_select 'watchers', Issue.find(1).watchers.count |
377 | 377 |
assert_select 'watchers' do |
... | ... | |
402 | 402 |
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) |
403 | 403 |
get '/issues/3.xml' |
404 | 404 | |
405 |
assert_equal 'application/xml', response.content_type
|
|
405 |
assert_equal 'application/xml', response.media_type
|
|
406 | 406 |
assert_select 'issue' do |