Actualiza a Redmine 3.4.13
This commit is contained in:
parent
807ff3308d
commit
ecddcaf1d3
224 changed files with 2222 additions and 1000 deletions
|
@ -138,4 +138,14 @@ class AutoCompletesControllerTest < Redmine::ControllerTest
|
|||
assert_include "issue", response.body
|
||||
assert_not_include "Bug #12: Closed issue on a locked version", response.body
|
||||
end
|
||||
|
||||
def test_auto_complete_should_return_json_content_type_response
|
||||
get :issues, :params => {
|
||||
:project_id => 'subproject1',
|
||||
:q => '#13'
|
||||
}
|
||||
|
||||
assert_response :success
|
||||
assert_include 'application/json', response.headers['Content-Type']
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,6 +67,21 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
|||
assert_not_nil e
|
||||
end
|
||||
|
||||
def test_create_with_custom_field_values
|
||||
custom_field = TimeEntryActivityCustomField.generate!
|
||||
assert_difference 'TimeEntryActivity.count' do
|
||||
post :create, :params => {
|
||||
:enumeration => {
|
||||
:type => 'TimeEntryActivity',
|
||||
:name => 'Sample',
|
||||
:custom_field_values => {custom_field.id.to_s => "sample"}
|
||||
}
|
||||
}
|
||||
end
|
||||
assert_redirected_to '/enumerations'
|
||||
assert_equal "sample", Enumeration.find_by(:name => 'Sample').custom_field_values.last.value
|
||||
end
|
||||
|
||||
def test_create_with_failure
|
||||
assert_no_difference 'IssuePriority.count' do
|
||||
post :create, :params => {
|
||||
|
@ -136,6 +151,20 @@ class EnumerationsControllerTest < Redmine::ControllerTest
|
|||
assert_equal 1, Enumeration.find(2).position
|
||||
end
|
||||
|
||||
def test_update_custom_field_values
|
||||
custom_field = TimeEntryActivityCustomField.generate!
|
||||
enumeration = Enumeration.find(9)
|
||||
assert_nil enumeration.custom_field_values.last.value
|
||||
put :update, :params => {
|
||||
:id => enumeration.id,
|
||||
:enumeration => {
|
||||
:custom_field_values => {custom_field.id.to_s => "sample"}
|
||||
}
|
||||
}
|
||||
assert_response 302
|
||||
assert_equal "sample", enumeration.reload.custom_field_values.last.value
|
||||
end
|
||||
|
||||
def test_destroy_enumeration_not_in_use
|
||||
assert_difference 'IssuePriority.count', -1 do
|
||||
delete :destroy, :params => {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
|
|||
# All TimeEntries using project activity
|
||||
project_specific_activity = TimeEntryActivity.find_by_parent_id_and_project_id(9, 1)
|
||||
assert_equal 3, TimeEntry.where(:activity_id => project_specific_activity.id,
|
||||
:project_id => 1).count
|
||||
:project_id => 1).count,
|
||||
"No Time Entries assigned to the project activity"
|
||||
end
|
||||
|
||||
|
@ -185,11 +185,11 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
|
|||
|
||||
# TimeEntries shouldn't have been reassigned on the failed record
|
||||
assert_equal 3, TimeEntry.where(:activity_id => 9,
|
||||
:project_id => 1).count
|
||||
:project_id => 1).count,
|
||||
"Time Entries are not assigned to system activities"
|
||||
# TimeEntries shouldn't have been reassigned on the saved record either
|
||||
assert_equal 1, TimeEntry.where(:activity_id => 10,
|
||||
:project_id => 1).count
|
||||
:project_id => 1).count,
|
||||
"Time Entries are not assigned to system activities"
|
||||
end
|
||||
|
||||
|
|
|
@ -661,6 +661,29 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
|||
assert_select "tr#member-#{member.id}"
|
||||
end
|
||||
|
||||
def test_settings_should_show_tabs_depending_on_permission
|
||||
@request.session[:user_id] = 3
|
||||
project = Project.find(1)
|
||||
role = User.find(3).roles_for_project(project).first
|
||||
|
||||
role.permissions = []
|
||||
role.save
|
||||
get :settings, :params => {
|
||||
:id => project.id
|
||||
}
|
||||
assert_response 403
|
||||
|
||||
role.add_permission! :manage_repository, :manage_boards, :manage_project_activities
|
||||
get :settings, :params => {
|
||||
:id => project.id
|
||||
}
|
||||
assert_response :success
|
||||
assert_select 'a[id^=tab-]', 3
|
||||
assert_select 'a#tab-repositories'
|
||||
assert_select 'a#tab-boards'
|
||||
assert_select 'a#tab-activities'
|
||||
end
|
||||
|
||||
def test_update
|
||||
@request.session[:user_id] = 2 # manager
|
||||
post :update, :params => {
|
||||
|
@ -979,4 +1002,35 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
|||
}
|
||||
assert_select 'body.project-ecookbook'
|
||||
end
|
||||
|
||||
def test_default_search_scope_in_global_page
|
||||
get :index
|
||||
|
||||
assert_select 'div#quick-search form' do
|
||||
assert_select 'input[name=scope][type=hidden]'
|
||||
assert_select 'a[href=?]', '/search'
|
||||
end
|
||||
end
|
||||
|
||||
def test_default_search_scope_for_project_without_subprojects
|
||||
get :show, :params => {
|
||||
:id => 4,
|
||||
}
|
||||
|
||||
assert_select 'div#quick-search form' do
|
||||
assert_select 'input[name=scope][type=hidden]'
|
||||
assert_select 'a[href=?]', '/projects/subproject2/search'
|
||||
end
|
||||
end
|
||||
|
||||
def test_default_search_scope_for_project_with_subprojects
|
||||
get :show, :params => {
|
||||
:id => 1,
|
||||
}
|
||||
|
||||
assert_select 'div#quick-search form' do
|
||||
assert_select 'input[name=scope][type=hidden][value=subprojects]'
|
||||
assert_select 'a[href=?]', '/projects/ecookbook/search?scope=subprojects'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -338,6 +338,46 @@ class SearchControllerTest < Redmine::ControllerTest
|
|||
assert_response 404
|
||||
end
|
||||
|
||||
def test_search_should_include_closed_projects
|
||||
@request.session[:user_id] = 1
|
||||
|
||||
project = Project.find(5)
|
||||
project.close
|
||||
project.save
|
||||
|
||||
# scope all
|
||||
get :index, :params => {:q => 'Issue of a private subproject', :scope => 'all'}
|
||||
assert_response :success
|
||||
|
||||
assert_select '#search-results' do
|
||||
assert_select 'dt.issue', :text => /Bug #6/
|
||||
end
|
||||
|
||||
# scope my_projects
|
||||
get :index, :params => {:q => 'Issue of a private subproject', :scope => 'my_projects'}
|
||||
assert_response :success
|
||||
|
||||
assert_select '#search-results' do
|
||||
assert_select 'dt.issue', :text => /Bug #6/
|
||||
end
|
||||
|
||||
# scope subprojects
|
||||
get :index, :params => {:id => 1, :q => 'Issue of a private subproject', :scope => 'subprojects'}
|
||||
assert_response :success
|
||||
|
||||
assert_select '#search-results' do
|
||||
assert_select 'dt.issue', :text => /Bug #6/
|
||||
end
|
||||
|
||||
# scope project
|
||||
get :index, :params => {:id => 5, :q => 'Issue of a private subproject'}
|
||||
assert_response :success
|
||||
|
||||
assert_select '#search-results' do
|
||||
assert_select 'dt.issue', :text => /Bug #6/
|
||||
end
|
||||
end
|
||||
|
||||
def test_quick_jump_to_issue
|
||||
# issue of a public project
|
||||
get :index, :params => {:q => "3"}
|
||||
|
|
|
@ -276,7 +276,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||
},
|
||||
:continue => '1'
|
||||
}
|
||||
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1'
|
||||
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -293,7 +293,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||
},
|
||||
:continue => '1'
|
||||
}
|
||||
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D='
|
||||
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D=&time_entry%5Bspent_on%5D=2008-03-14'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -310,7 +310,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||
},
|
||||
:continue => '1'
|
||||
}
|
||||
assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D='
|
||||
assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=&time_entry%5Bspent_on%5D=2008-03-14'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -327,7 +327,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||
},
|
||||
:continue => '1'
|
||||
}
|
||||
assert_redirected_to '/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D='
|
||||
assert_redirected_to '/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1&time_entry%5Bproject_id%5D=&time_entry%5Bspent_on%5D=2008-03-14'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue