Redmine 4.1.7
This commit is contained in:
parent
55458d3479
commit
3ca3c37487
103 changed files with 2426 additions and 431 deletions
|
@ -229,4 +229,51 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
|||
assert attachment.digest.present?
|
||||
assert File.exist? attachment.diskfile
|
||||
end
|
||||
|
||||
test "POST /uploads.json should be compatible with an fcgi's input" do
|
||||
set_tmp_attachments_directory
|
||||
assert_difference 'Attachment.count' do
|
||||
post(
|
||||
'/uploads.json',
|
||||
:headers => {
|
||||
"CONTENT_TYPE" => 'application/octet-stream',
|
||||
"CONTENT_LENGTH" => '12',
|
||||
"rack.input" => Rack::RewindableInput.new(StringIO.new('File content'))
|
||||
}.merge(credentials('jsmith'))
|
||||
)
|
||||
assert_response :created
|
||||
end
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Hash, json['upload']
|
||||
token = json['upload']['token']
|
||||
assert token.present?
|
||||
assert attachment = Attachment.find_by_token(token)
|
||||
assert_equal 12, attachment.filesize
|
||||
assert File.exist? attachment.diskfile
|
||||
end
|
||||
|
||||
test "POST /uploads.json should be compatible with a uwsgi's input" do
|
||||
set_tmp_attachments_directory
|
||||
assert_difference 'Attachment.count' do
|
||||
request_body = Rack::RewindableInput.new(StringIO.new('File content'))
|
||||
# Uwsgi_IO object does not have size method
|
||||
request_body.instance_eval('undef :size', __FILE__, __LINE__)
|
||||
post(
|
||||
'/uploads.json',
|
||||
:headers => {
|
||||
"CONTENT_TYPE" => 'application/octet-stream',
|
||||
"CONTENT_LENGTH" => '12',
|
||||
"rack.input" => request_body
|
||||
}.merge(credentials('jsmith'))
|
||||
)
|
||||
assert_response :created
|
||||
end
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Hash, json['upload']
|
||||
token = json['upload']['token']
|
||||
assert token.present?
|
||||
assert attachment = Attachment.find_by_token(token)
|
||||
assert_equal 12, attachment.filesize
|
||||
assert File.exist? attachment.diskfile
|
||||
end
|
||||
end
|
||||
|
|
|
@ -653,6 +653,34 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||
assert_response 422
|
||||
end
|
||||
|
||||
test "POST /issues.json with invalid project_id and any assigned_to_id should respond with 422" do
|
||||
post(
|
||||
'/issues.json',
|
||||
:params => {
|
||||
:issue => {
|
||||
:project_id => 999,
|
||||
:assigned_to_id => 1,
|
||||
:subject => 'API'
|
||||
}
|
||||
},
|
||||
:headers => credentials('jsmith'))
|
||||
assert_response 422
|
||||
end
|
||||
|
||||
test "POST /issues.json with invalid project_id and any fixed_version_id should respond with 422" do
|
||||
post(
|
||||
'/issues.json',
|
||||
:params => {
|
||||
:issue => {
|
||||
:project_id => 999,
|
||||
:fixed_version_id => 1,
|
||||
:subject => 'API'
|
||||
}
|
||||
},
|
||||
:headers => credentials('jsmith'))
|
||||
assert_response 422
|
||||
end
|
||||
|
||||
test "PUT /issues/:id.xml" do
|
||||
assert_difference('Journal.count') do
|
||||
put(
|
||||
|
|
|
@ -119,6 +119,17 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
|
|||
assert_equal 'jsmith', page.content.author.login
|
||||
end
|
||||
|
||||
test "GET /projects/:project_id/wiki/:title/:version.xml should not includ author if not exists" do
|
||||
WikiContentVersion.find_by_id(2).update(author_id: nil)
|
||||
|
||||
get '/projects/ecookbook/wiki/CookBook_documentation/2.xml'
|
||||
assert_response 200
|
||||
assert_equal 'application/xml', response.media_type
|
||||
assert_select 'wiki_page' do
|
||||
assert_select 'author', 0
|
||||
end
|
||||
end
|
||||
|
||||
test "PUT /projects/:project_id/wiki/:title.xml with current versino should update wiki page" do
|
||||
assert_no_difference 'WikiPage.count' do
|
||||
assert_difference 'WikiContent::Version.count' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue