Redmine 4.1.7

This commit is contained in:
Manuel Cillero 2023-07-07 08:08:27 +02:00
parent 55458d3479
commit 3ca3c37487
103 changed files with 2426 additions and 431 deletions

View file

@ -20,6 +20,7 @@
require File.expand_path('../../../../test_helper', __FILE__)
class Redmine::CipheringTest < ActiveSupport::TestCase
fixtures :auth_sources
def test_password_should_be_encrypted
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
@ -106,4 +107,12 @@ class Redmine::CipheringTest < ActiveSupport::TestCase
assert_equal 'bar', r.read_attribute(:password)
end
end
def test_encrypt_all_and_decrypt_all_should_skip_validation
auth_source = auth_sources(:auth_sources_001)
# validator checks if AuthSource#host is present
auth_source.update_column(:host, nil)
assert AuthSource.encrypt_all(:account_password)
assert AuthSource.decrypt_all(:account_password)
end
end

View file

@ -44,6 +44,12 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
def gantt_start
@gantt.date_from
end
private :gantt_start
def gantt_end
@gantt.date_to
end
private :gantt_end
# Creates a Gantt chart for a 4 week span
def create_gantt(project=Project.generate!, options={})
@ -354,6 +360,26 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
assert_select 'div.task_todo[style*="left:28px"]', 1
end
test "#line todo line should appear if it ends on the leftmost date in the gantt" do
create_gantt
[gantt_start - 1, gantt_start].each do |start_date|
@output_buffer = @gantt.line(start_date, gantt_start, 30, false, 'line', :format => :html, :zoom => 4)
# the leftmost date (Date.today - 14 days)
assert_select 'div.task_todo[style*="left:0px"]', 1, @output_buffer
assert_select 'div.task_todo[style*="width:2px"]', 1, @output_buffer
end
end
test "#line todo line should appear if it starts on the rightmost date in the gantt" do
create_gantt
[gantt_end, gantt_end + 1].each do |end_date|
@output_buffer = @gantt.line(gantt_end, end_date, 30, false, 'line', :format => :html, :zoom => 4)
# the rightmost date (Date.today + 14 days)
assert_select 'div.task_todo[style*="left:112px"]', 1, @output_buffer
assert_select 'div.task_todo[style*="width:2px"]', 1, @output_buffer
end
end
test "#line todo line should be the total width" do
create_gantt
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
@ -424,6 +450,9 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
@output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4)
assert_select "div.starting", 1
assert_select 'div.starting[style*="left:28px"]', 1
# starting marker on the leftmost boundary of the gantt
@output_buffer = @gantt.line(gantt_start, today + 7, 30, true, 'line', :format => :html, :zoom => 4)
assert_select 'div.starting[style*="left:0px"]', 1
end
test "#line starting marker should not appear if the start date is before gantt start date" do
@ -437,6 +466,9 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
@output_buffer = @gantt.line(today - 7, today + 7, 30, true, 'line', :format => :html, :zoom => 4)
assert_select "div.ending", 1
assert_select 'div.ending[style*="left:88px"]', 1
# ending marker on the rightmost boundary of the gantt
@output_buffer = @gantt.line(today - 7, gantt_end, 30, true, 'line', :format => :html, :zoom => 4)
assert_select 'div.ending[style*="left:116px"]', 1
end
test "#line ending marker should not appear if the end date is before gantt start date" do

View file

@ -23,7 +23,8 @@ class Redmine::ProjectJumpBoxTest < ActiveSupport::TestCase
fixtures :users, :projects, :user_preferences
def setup
@user = User.find_by_login 'dlopper'
@user = User.find_by_login 'jsmith'
User.current = @user
@ecookbook = Project.find 'ecookbook'
@onlinestore = Project.find 'onlinestore'
end
@ -142,4 +143,16 @@ class Redmine::ProjectJumpBoxTest < ActiveSupport::TestCase
assert_equal @onlinestore, pjb.recently_used_projects.first
assert_equal @ecookbook, pjb.recently_used_projects.last
end
def test_recents_list_should_include_only_visible_projects
@user = User.find_by_login 'dlopper'
User.current = @user
pjb = Redmine::ProjectJumpBox.new @user
pjb.project_used @ecookbook
pjb.project_used @onlinestore
assert_equal 1, pjb.recently_used_projects.size
assert_equal @ecookbook, pjb.recently_used_projects.first
end
end