Patch #32094 » remove_unnecessary_calls_to_set_tmp_attachments_directory.patch
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
|
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
|
||
|
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||
|
end
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_diff_replace_cannot_convert_content
|
||
| ... | ... | |
|
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
|
||
|
end
|
||
|
end
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_diff_latin_1
|
||
| ... | ... | |
|
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||
|
end
|
||
|
end
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_should_save_diff_type_as_user_preference
|
||
| ... | ... | |
|
}
|
||
|
assert_response :success
|
||
|
assert_equal 'text/html', @response.content_type
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_text_file_utf_8
|
||
| ... | ... | |
|
assert_equal 'text/html', @response.content_type
|
||
|
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||
|
end
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_image
|
||
| ... | ... | |
|
}
|
||
|
assert_equal 'text/html', @response.content_type
|
||
|
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_file_from_private_issue_without_permission
|
||
| ... | ... | |
|
:id => 15
|
||
|
}
|
||
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_file_from_private_issue_with_permission
|
||
| ... | ... | |
|
}
|
||
|
assert_response :success
|
||
|
assert_select 'h2', :text => /private.diff/
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_show_file_without_container_should_be_allowed_to_author
|
||
| ... | ... | |
|
assert_select 'ul.pages li.next', :text => /next/i
|
||
|
assert_select 'ul.pages li.previous', :text => /previous/i
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_text_file
|
||
| ... | ... | |
|
:id => 4
|
||
|
}
|
||
|
assert_response 304
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_js_file
|
||
| ... | ... | |
|
}
|
||
|
assert_response :success
|
||
|
assert_equal 'text/x-ruby', @response.content_type
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_should_assign_better_content_type_than_application_octet_stream
|
||
| ... | ... | |
|
}
|
||
|
assert_response :success
|
||
|
assert_equal 'text/x-ruby', @response.content_type
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename)
|
||
|
assert_equal 'application/octet-stream', @response.content_type
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_missing_file
|
||
| ... | ... | |
|
:id => 2
|
||
|
}
|
||
|
assert_response 404
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_download_should_be_denied_without_permission
|
||
| ... | ... | |
|
:id => 7
|
||
|
}
|
||
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
if convert_installed?
|
||
| test/integration/api_test/attachments_test.rb | ||
|---|---|---|
|
test "GET /attachments/:id.xml should deny access without credentials" do
|
||
|
get '/attachments/7.xml'
|
||
|
assert_response 401
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
test "GET /attachments/download/:id/:filename should return the attachment content" do
|
||
|
get '/attachments/download/7/archive.zip', :headers => credentials('jsmith')
|
||
|
assert_response :success
|
||
|
assert_equal 'application/zip', @response.content_type
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
test "GET /attachments/download/:id/:filename should deny access without credentials" do
|
||
|
get '/attachments/download/7/archive.zip'
|
||
|
assert_response 401
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
test "GET /attachments/thumbnail/:id should return the thumbnail" do
|
||