Actualiza a Redmine 3.4.13

This commit is contained in:
Manuel Cillero 2020-07-03 21:39:03 +02:00
parent 807ff3308d
commit ecddcaf1d3
224 changed files with 2222 additions and 1000 deletions

View file

@ -773,6 +773,25 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_index_csv_should_not_change_selected_columns
get :index, :params => {
:set_filter => 1,
:c => ["subject", "due_date"],
:project_id => "ecookbook"
}
assert_response :success
assert_equal [:subject, :due_date], session[:issue_query][:column_names]
get :index, :params => {
:set_filter => 1,
:c =>["all_inline"],
:project_id => "ecookbook",
:format => 'csv'
}
assert_response :success
assert_equal [:subject, :due_date], session[:issue_query][:column_names]
end
def test_index_pdf
["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
with_settings :default_language => lang do
@ -1754,6 +1773,21 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_response :success
end
def test_show_should_format_related_issues_dates
with_settings :date_format => '%d/%m/%Y' do
issue = Issue.generate!(:start_date => '2018-11-29', :due_date => '2018-12-01')
IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => issue, :relation_type => 'relates')
get :show, :params => {
:id => 1
}
assert_response :success
assert_select '#relations td.start_date', :text => '29/11/2018'
assert_select '#relations td.due_date', :text => '01/12/2018'
end
end
def test_show_should_not_disclose_relations_to_invisible_issues
Setting.cross_project_issue_relations = '1'
IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => 'relates')
@ -2093,6 +2127,25 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select "div.description ~ div.attribute.cf_#{field.id} div.value", :text => 'This is a long text'
end
def test_show_custom_fields_with_full_text_formatting_should_be_rendered_using_wiki_class
half_field = IssueCustomField.create!(:name => 'Half width field', :field_format => 'text', :tracker_ids => [1],
:is_for_all => true, :text_formatting => 'full')
full_field = IssueCustomField.create!(:name => 'Full width field', :field_format => 'text', :full_width_layout => '1',
:tracker_ids => [1], :is_for_all => true, :text_formatting => 'full')
issue = Issue.find(1)
issue.custom_field_values = {full_field.id => 'This is a long text', half_field.id => 'This is a short text'}
issue.save!
get :show, :params => {
:id => 1
}
assert_response :success
assert_select "div.attribute.cf_#{half_field.id} div.value div.wiki", 1
assert_select "div.attribute.cf_#{full_field.id} div.value div.wiki", 1
end
def test_show_with_multi_user_custom_field
field = IssueCustomField.create!(:name => 'Multi user', :field_format => 'user', :multiple => true,
:tracker_ids => [1], :is_for_all => true)
@ -3863,6 +3916,29 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'input[type=hidden][name=?][value=?]', 'issue[watcher_user_ids][]', '', 1
end
def test_new_as_copy_should_not_propose_locked_watchers
@request.session[:user_id] = 2
issue = Issue.find(1)
user = User.generate!
user2 = User.generate!
Watcher.create!(:watchable => issue, :user => user)
Watcher.create!(:watchable => issue, :user => user2)
user2.status = User::STATUS_LOCKED
user2.save!
get :new, :params => {
:project_id => 1,
:copy_from => 1
}
assert_select 'input[type=checkbox][name=?][checked=checked]', 'issue[watcher_user_ids][]', 1
assert_select 'input[type=checkbox][name=?][checked=checked][value=?]', 'issue[watcher_user_ids][]', user.id.to_s
assert_select 'input[type=checkbox][name=?][checked=checked][value=?]', 'issue[watcher_user_ids][]', user2.id.to_s, 0
assert_select 'input[type=hidden][name=?][value=?]', 'issue[watcher_user_ids][]', '', 1
end
def test_new_as_copy_with_invalid_issue_should_respond_with_404
@request.session[:user_id] = 2
get :new, :params => {
@ -6110,7 +6186,7 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_bulk_copy_should_allow_copying_the_subtasks
test "bulk copy should allow copying the subtasks" do
issue = Issue.generate_with_descendants!
count = issue.descendants.count
@request.session[:user_id] = 2
@ -6130,10 +6206,9 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal count, copy.descendants.count
end
def test_bulk_copy_should_allow_copying_the_subtasks
test "issue bulk copy copy watcher" do
Watcher.create!(:watchable => Issue.find(1), :user => User.find(3))
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
post :bulk_update, :params => {
:ids => [1],
@ -6141,7 +6216,6 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_watchers => '1',
:issue => {
:project_id => ''
}
}
end
@ -6212,6 +6286,27 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_destroy_issues_with_time_entries_should_show_the_reassign_form
@request.session[:user_id] = 2
with_settings :timelog_required_fields => [] do
assert_no_difference 'Issue.count' do
delete :destroy, :params => {
:ids => [1, 3]
}
end
end
assert_response :success
assert_select 'form' do
assert_select 'input[name=_method][value=delete]'
assert_select 'input[name=todo][value=destroy]'
assert_select 'input[name=todo][value=nullify]'
assert_select 'input[name=todo][value=reassign]'
end
end
def test_destroy_issues_with_time_entries_should_not_show_the_nullify_option_when_issue_is_required_for_time_entries
with_settings :timelog_required_fields => ['issue_id'] do
@request.session[:user_id] = 2
assert_no_difference 'Issue.count' do
delete :destroy, :params => {
:ids => [1, 3]
@ -6221,6 +6316,10 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'form' do
assert_select 'input[name=_method][value=delete]'
assert_select 'input[name=todo][value=destroy]'
assert_select 'input[name=todo][value=nullify]', 0
assert_select 'input[name=todo][value=reassign]'
end
end
end
@ -6259,6 +6358,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_destroy_issues_and_assign_time_entries_to_project
@request.session[:user_id] = 2
with_settings :timelog_required_fields => [] do
assert_difference 'Issue.count', -2 do
assert_no_difference 'TimeEntry.count' do
delete :destroy, :params => {
@ -6267,6 +6367,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
end
end
end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
assert_nil TimeEntry.find(1).issue_id
@ -6345,6 +6446,23 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select '#flash_error', :text => I18n.t(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
end
def test_destroy_issues_and_nullify_time_entries_should_fail_when_issue_is_required_for_time_entries
@request.session[:user_id] = 2
with_settings :timelog_required_fields => ['issue_id'] do
assert_no_difference 'Issue.count' do
assert_no_difference 'TimeEntry.count' do
delete :destroy, :params => {
:ids => [1, 3],
:todo => 'nullify'
}
end
end
end
assert_response :success
assert_select '#flash_error', :text => 'Issue cannot be blank'
end
def test_destroy_issues_from_different_projects
@request.session[:user_id] = 2