Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -19,7 +21,8 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||
|
||||
class MyControllerTest < Redmine::ControllerTest
|
||||
fixtures :users, :email_addresses, :user_preferences, :roles, :projects, :members, :member_roles,
|
||||
:issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources, :queries
|
||||
:issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources, :queries, :enabled_modules,
|
||||
:journals
|
||||
|
||||
def setup
|
||||
@request.session[:user_id] = 2
|
||||
|
@ -95,7 +98,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
assert_select 'table.issues.sort-by-due-date'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_page_with_issuequery_block_and_no_settings
|
||||
user = User.find(2)
|
||||
user.pref.my_page_layout = {'top' => ['issuequery']}
|
||||
|
@ -125,7 +128,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
assert_select '#block-issuequery' do
|
||||
assert_select 'a[href=?]', "/issues?query_id=#{query.id}"
|
||||
# assert number of columns (columns from query + id column + checkbox column)
|
||||
assert_select 'table.issues th', 6
|
||||
assert_select 'table.issues th', 7
|
||||
# assert results limit
|
||||
assert_select 'table.issues tr.issue', 10
|
||||
assert_select 'table.issues td.assigned_to'
|
||||
|
@ -145,7 +148,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
assert_select '#block-issuequery' do
|
||||
assert_select 'a[href=?]', "/projects/ecookbook/issues?query_id=#{query.id}"
|
||||
# assert number of columns (columns from query + id column + checkbox column)
|
||||
assert_select 'table.issues th', 6
|
||||
assert_select 'table.issues th', 7
|
||||
# assert results limit
|
||||
assert_select 'table.issues tr.issue', 10
|
||||
assert_select 'table.issues td.assigned_to'
|
||||
|
@ -164,7 +167,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
|
||||
assert_select '#block-issuequery' do
|
||||
# assert number of columns (columns from query + id column + checkbox column)
|
||||
assert_select 'table.issues th', 4
|
||||
assert_select 'table.issues th', 5
|
||||
assert_select 'table.issues th', :text => 'Due date'
|
||||
end
|
||||
end
|
||||
|
@ -198,6 +201,50 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
end
|
||||
end
|
||||
|
||||
def test_page_with_activity
|
||||
user = User.find(2)
|
||||
user.pref.my_page_layout = {'top' => ['activity']}
|
||||
user.pref.time_zone = 'UTC'
|
||||
user.pref.save!
|
||||
|
||||
get :page
|
||||
assert_response :success
|
||||
|
||||
assert_select 'div#block-activity' do
|
||||
assert_select 'h3' do
|
||||
assert_select 'a[href=?]', activity_path(from: User.current.today, user_id: user.id), :text => 'Activity'
|
||||
end
|
||||
assert_select 'div#activity' do
|
||||
assert_select 'dt', 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_page_with_updated_issues_block
|
||||
preferences = User.find(2).pref
|
||||
preferences.my_page_layout = {'top' => ['issuesupdatedbyme']}
|
||||
preferences.my_page_settings = {'issuesupdatedbyme' => {}}
|
||||
preferences.save!
|
||||
|
||||
project = Project.find(3)
|
||||
project.close
|
||||
|
||||
get :page
|
||||
|
||||
assert_response :success
|
||||
assert_select '#block-issuesupdatedbyme' do
|
||||
report_url = CGI.unescape(css_select('h3 a').first.attr('href'))
|
||||
assert_match 'f[]=project.status', report_url
|
||||
assert_match 'v[project.status][]=1', report_url
|
||||
assert_match 'f[]=updated_by', report_url
|
||||
assert_match 'v[updated_by][]=me', report_url
|
||||
|
||||
assert_select 'table.issues tbody tr', 2
|
||||
assert_select 'table.issues tbody tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
|
||||
assert_select 'table.issues tbody tr[id=?]', 'issue-14', 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_page_with_all_blocks
|
||||
blocks = Redmine::MyPage.blocks.keys
|
||||
preferences = User.find(2).pref
|
||||
|
@ -209,6 +256,94 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
assert_select 'div.mypage-box', blocks.size
|
||||
end
|
||||
|
||||
def test_page_with_assigned_issues_block_should_not_show_issues_from_closed_projects
|
||||
preferences = User.find(2).pref
|
||||
preferences.my_page_layout = {'top' => ['issuesassignedtome']}
|
||||
preferences.my_page_settings = {'issuesassignedtome' => {}}
|
||||
preferences.save!
|
||||
|
||||
issue = Issue.find(1)
|
||||
issue.assigned_to = User.find(2)
|
||||
issue.save!
|
||||
|
||||
project = Project.find(2)
|
||||
project.close
|
||||
project.save
|
||||
|
||||
get :page
|
||||
|
||||
assert_response :success
|
||||
assert_select '#block-issuesassignedtome table.issues tbody' do
|
||||
report_url = css_select('h3 a').map {|e| e.attr('href')}.first
|
||||
assert_match 'f%5B%5D=project.status', report_url
|
||||
assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
|
||||
|
||||
assert_select 'tr', 1
|
||||
assert_select 'tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
|
||||
assert_select 'tr[id=?]', 'issue-4', 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_page_with_reported_issues_block_should_not_show_issues_from_closed_projects
|
||||
preferences = User.find(2).pref
|
||||
preferences.my_page_layout = {'top' => ['issuesreportedbyme']}
|
||||
preferences.my_page_settings = {'issuesreportedbyme' => {}}
|
||||
preferences.save!
|
||||
|
||||
issue = Issue.find(1)
|
||||
issue.assigned_to = User.find(2)
|
||||
issue.save!
|
||||
|
||||
project = Project.find(2)
|
||||
project.close
|
||||
project.save
|
||||
|
||||
get :page
|
||||
|
||||
assert_response :success
|
||||
assert_select '#block-issuesreportedbyme' do
|
||||
report_url = css_select('h3 a').map {|e| e.attr('href')}.first
|
||||
assert_match 'f%5B%5D=project.status', report_url
|
||||
assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
|
||||
|
||||
assert_select 'table.issues tbody tr', 10
|
||||
assert_select 'table.issues tbody tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
|
||||
assert_select 'table.issues tbody tr[id=?]', 'issue-4', 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_page_with_watched_issues_block_should_not_show_issues_from_closed_projects
|
||||
preferences = User.find(2).pref
|
||||
preferences.my_page_layout = {'top' => ['issueswatched']}
|
||||
preferences.my_page_settings = {'issueswatched' => {}}
|
||||
preferences.save!
|
||||
|
||||
issue = Issue.find(1)
|
||||
issue.watcher_user_ids = ['1', '2']
|
||||
issue.save!
|
||||
|
||||
issue2 = Issue.find(4)
|
||||
issue2.watcher_user_ids = ['2']
|
||||
issue2.save!
|
||||
|
||||
project = Project.find(2)
|
||||
project.close
|
||||
project.save
|
||||
|
||||
get :page
|
||||
|
||||
assert_response :success
|
||||
assert_select '#block-issueswatched table.issues tbody' do
|
||||
report_url = css_select('h3 a').map {|e| e.attr('href')}.first
|
||||
assert_match 'f%5B%5D=project.status', report_url
|
||||
assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
|
||||
|
||||
assert_select 'tr', 1
|
||||
assert_select 'tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
|
||||
assert_select 'tr[id=?]', 'issue-4', 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_my_account_should_show_editable_custom_fields
|
||||
get :account
|
||||
assert_response :success
|
||||
|
@ -229,6 +364,16 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
assert_select 'select[name=?]', 'user[language]'
|
||||
end
|
||||
|
||||
def test_my_account_with_avatar_enabled_should_link_to_edit_avatar
|
||||
with_settings :gravatar_enabled => '1' do
|
||||
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
|
||||
get :account
|
||||
assert_response :success
|
||||
assert_select 'a[href=?] img.gravatar', 'https://gravatar.com'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_my_account_should_not_show_language_select_with_force_default_language_for_loggedin
|
||||
with_settings :force_default_language_for_loggedin => '1' do
|
||||
get :account
|
||||
|
@ -238,7 +383,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
end
|
||||
|
||||
def test_update_account
|
||||
post :account, :params => {
|
||||
put :account, :params => {
|
||||
:user => {
|
||||
:firstname => "Joe",
|
||||
:login => "root",
|
||||
|
@ -246,8 +391,8 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
:group_ids => ['10'],
|
||||
:custom_field_values => {
|
||||
"4" => "0100562500"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,10 +408,10 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
|
||||
def test_update_account_should_send_security_notification
|
||||
ActionMailer::Base.deliveries.clear
|
||||
post :account, :params => {
|
||||
put :account, :params => {
|
||||
:user => {
|
||||
:mail => 'foobar@example.com'
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +538,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
post :update_page, :params => {
|
||||
:settings => {
|
||||
'issuesassignedtome' => {
|
||||
'columns' => ['subject', 'due_date']}
|
||||
'columns' => ['subject', 'due_date']}
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
|
@ -450,7 +595,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
pref = User.find(2).pref
|
||||
pref.my_page_layout = {'left' => ['news', 'calendar','documents']}
|
||||
pref.save!
|
||||
|
||||
|
||||
post :order_blocks, :params => {
|
||||
:group => 'left',
|
||||
:blocks => ['documents', 'calendar', 'news']
|
||||
|
@ -464,7 +609,7 @@ class MyControllerTest < Redmine::ControllerTest
|
|||
pref = User.find(2).pref
|
||||
pref.my_page_layout = {'left' => ['news','documents'], 'right' => ['calendar']}
|
||||
pref.save!
|
||||
|
||||
|
||||
post :order_blocks, :params => {
|
||||
:group => 'left',
|
||||
:blocks => ['news', 'calendar', 'documents']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue