Skip to content

Commit

Permalink
Merged 6.0.2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrossello committed Dec 19, 2024
1 parent e9704c7 commit 6551cfb
Show file tree
Hide file tree
Showing 43 changed files with 200 additions and 504 deletions.
59 changes: 48 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
Gemfile.lock
/.project
/.idea
/.vscode
/.loadpath
/.powrc
/.rvmrc
/.ruby-version
/.byebug_history
/config/additional_environment.rb
/config/configuration.yml
/config/database.yml
/config/email.yml
/config/secrets.yml
/config/initializers/session_store.rb
/config/initializers/secret_token.rb
/coverage
/db/*.db
/db/*.sqlite3
/db/*.sqlite3-*
/db/schema.rb
/files/*
/lib/redmine/scm/adapters/mercurial/redminehelper.pyc
/lib/redmine/scm/adapters/mercurial/redminehelper.pyo
/log/*.log*
/log/mongrel_debug
/plugins/*
!/plugins/README
/public/assets/*
/public/dispatch.*
/public/plugin_assets/*
/themes/*
!/themes/README
/tmp/*
/tmp/cache/*
/tmp/pdf/*
/tmp/sessions/*
/tmp/sockets/*
/tmp/test/*
/tmp/thumbnails/*
/vendor/cache
*.rbc

/.bundle
/Gemfile.lock
/Gemfile.local

/node_modules
yarn-error.log
config/overrides
.buildpath
.byebug_history
.project
.metadata/
Gemfile.lock
config/
db/
files/
log/
public/
tmp/
.metadata/
coverage/
20 changes: 7 additions & 13 deletions lib/tasks/testing.rake
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,21 @@ namespace :test do

desc 'Runs all Redmine unit tests along with all the plugins unit tests.'
task(:units => "db:test:prepare") do |t|
$: << "plugins/redmine_testsuites/test"
Rails::TestUnit::Runner.run_from_rake TestsuitesTests::unit_tests
$: << "test"
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb']
end

desc 'Runs all Redmine functional tests along with all the plugins functional tests.'
task(:functionals => "db:test:prepare") do |t|
$: << "plugins/redmine_testsuites/test"
Rails::TestUnit::Runner.run_from_rake TestsuitesTests::functional_tests
end

desc 'Runs all Redmine integration tests along with all the plugins integration tests.'
task(:integration => "db:test:prepare") do |t|
$: << "plugins/redmine_testsuites/test"
Rails::TestUnit::Runner.run_from_rake TestsuitesTests::integration_tests
$: << "test"
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/functional/repositories*_test.rb']
end

task(:routing) do |t|
$: << "plugins/redmine_testsuites/test"
Rails::TestUnit::Runner.run_from_rake TestsuitesTests::routing_tests
$: << "test"
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
end
Rake::Task['test:routing'].comment = "Runs all Redmine routing tests along with all the plugins routing tests."
Rake::Task['test:routing'].comment = "Run the routing tests"

task(:autoload) do |t|
$: << "test"
Expand Down
10 changes: 0 additions & 10 deletions test/fixtures/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ issues_001:
assigned_to_id:
author_id: 2
status_id: 1
<<<<<<< HEAD
start_date: <%= 1.day.ago.to_date.to_s(:db) %>
due_date: <%= 10.day.from_now.to_date.to_s(:db) %>
=======
start_date: <%= 1.day.ago.to_date.to_fs(:db) %>
due_date: <%= 10.day.from_now.to_date.to_fs(:db) %>
>>>>>>> 6.0.1
estimated_hours: 200.0
root_id: 1
lft: 1
Expand Down Expand Up @@ -61,13 +56,8 @@ issues_003:
assigned_to_id: 3
author_id: 2
status_id: 1
<<<<<<< HEAD
start_date: <%= 15.day.ago.to_date.to_s(:db) %>
due_date: <%= 5.day.ago.to_date.to_s(:db) %>
=======
start_date: <%= 15.day.ago.to_date.to_fs(:db) %>
due_date: <%= 5.day.ago.to_date.to_fs(:db) %>
>>>>>>> 6.0.1
estimated_hours: 1.0
root_id: 3
lft: 1
Expand Down
4 changes: 2 additions & 2 deletions test/functional/account_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_get_login
get :login
assert_response :success

assert_select 'input[name=username]'
assert_select 'input[name=password]'
assert_select 'input[name=username][autocomplete=username]'
assert_select 'input[name=password][autocomplete=current-password]'
end

def test_get_login_while_logged_in_should_redirect_to_back_url_if_present
Expand Down
39 changes: 0 additions & 39 deletions test/functional/application_controller_test.rb

This file was deleted.

17 changes: 0 additions & 17 deletions test/functional/attachments_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -530,23 +530,6 @@ def test_edit_all_issue_attachment_by_user_without_edit_issue_permission_on_trac
assert_response :not_found
end

def test_edit_all_issue_attachment_by_user_without_edit_issue_permission_on_tracker_should_return_404
role = Role.find(2)
role.set_permission_trackers 'edit_issues', [2, 3]
role.save!

@request.session[:user_id] = 2

get(
:edit_all,
:params => {
:object_type => 'issues',
:object_id => '4'
}
)
assert_response 404
end

def test_update_all
@request.session[:user_id] = 2
patch(
Expand Down
22 changes: 0 additions & 22 deletions test/functional/groups_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,6 @@ def test_show_should_display_only_visible_users
assert_select 'li', :text => locked_user.name, :count => 0
end

def test_show_group_that_is_not_visible_should_return_404
Role.anonymous.update! :users_visibility => 'members_of_visible_projects'

@request.session[:user_id] = nil
get :show, :params => {:id => 10}
assert_response 404
end

def test_show_should_display_only_visible_users
group = Group.find(10)
locked_user = User.find(5)
group.users << locked_user
assert locked_user.locked?

@request.session[:user_id] = nil
get :show, :params => {:id => group.id}
assert_response :success

assert_select 'li', :text => 'User Misc'
assert_select 'li', :text => locked_user.name, :count => 0
end

def test_new
get :new
assert_response :success
Expand Down
15 changes: 0 additions & 15 deletions test/functional/issue_statuses_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,6 @@ def test_index_should_show_warning_when_no_workflow_is_defined
end
end

def test_index_should_show_warning_when_no_workflow_is_defined
status = IssueStatus.new :name => "No workflow"
status.save!
get :index
assert_response :success
assert_select 'table.issue_statuses tbody' do
assert_select 'tr:not(:last-of-type) span.icon-warning', :count => 0
assert_select 'tr:last-of-type' do
assert_select 'td.name', :text => status.name
assert_select 'td span.icon-warning',
:text => /#{I18n.t(:text_status_no_workflow)}/
end
end
end

def test_new
get :new
assert_response :success
Expand Down
8 changes: 6 additions & 2 deletions test/functional/issues_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,8 @@ def test_show_should_display_watchers_with_gravatars
assert_select 'a[class*=delete]'
end
assert_select "li.user-10" do
assert_select 'img.gravatar[title=?]', 'A Team'
assert_select 'a.group', :text => 'A Team'
assert_select 'svg'
assert_select 'a[href="/groups/10"]'
assert_select 'a[class*=delete]'
end
Expand Down Expand Up @@ -5992,7 +5993,10 @@ def test_get_edit_for_issue_with_transition_warning_should_show_the_warning

assert_response :success
reason = l(:notice_issue_not_closable_by_blocking_issue)
assert_select 'span.icon-warning[title=?]', reason, :text => reason
assert_select 'span.icon-warning[title=?]', reason do
assert_select "svg.icon-svg use:match('href', ?)", /assets\/icons-\w+.svg#icon--warning/
assert_select 'span.icon-label', test: reason
end
end

def test_get_edit_should_display_visible_spent_time_custom_field
Expand Down
39 changes: 2 additions & 37 deletions test/functional/messages_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,43 +106,8 @@ def test_show_should_display_watchers
assert_select 'a[class*=delete]'
end
assert_select "li.user-10" do
assert_select 'img.gravatar[title=?]', 'A Team', is_display_gravatar
assert_select 'a[href="/users/10"]', false
assert_select 'a[class*=delete]'
end
end
end
end

def test_show_should_not_display_watchers_without_permission
@request.session[:user_id] = 2
Role.find(1).remove_permission! :view_message_watchers
message = Message.find(1)
message.add_watcher User.find(2)
message.add_watcher Group.find(10)
get(:show, :params => {:board_id => 1, :id => 1})
assert_select 'div#watchers ul', 0
assert_select 'h3', {text: /Watchers \(\d*\)/, count: 0}
end

def test_show_should_display_watchers
@request.session[:user_id] = 2
message = Message.find(1)
message.add_watcher User.find(2)
message.add_watcher Group.find(10)
[['1', true], ['0', false]].each do |(gravatar_enabled, is_display_gravatar)|
with_settings :gravatar_enabled => gravatar_enabled do
get(:show, :params => {:board_id => 1, :id => 1})
end

assert_select 'div#watchers ul' do
assert_select 'li.user-2' do
assert_select 'img.gravatar[title=?]', 'John Smith', is_display_gravatar
assert_select 'a[href="/users/2"]'
assert_select 'a[class*=delete]'
end
assert_select "li.user-10" do
assert_select 'img.gravatar[title=?]', 'A Team', is_display_gravatar
assert_select 'a.group', :text => 'A Team'
assert_select 'svg'
assert_select 'a[href="/users/10"]', false
assert_select 'a[class*=delete]'
end
Expand Down
6 changes: 3 additions & 3 deletions test/functional/my_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,9 @@ def test_post_destroy_with_unsubscribe_not_allowed_should_not_destroy_account
def test_change_password
get :password
assert_response :success
assert_select 'input[type=password][name=password]'
assert_select 'input[type=password][name=new_password]'
assert_select 'input[type=password][name=new_password_confirmation]'
assert_select 'input[type=password][name=password][autocomplete=current-password]'
assert_select 'input[type=password][name=new_password][autocomplete=new-password]'
assert_select 'input[type=password][name=new_password_confirmation][autocomplete=new-password]'
end

def test_update_password
Expand Down
20 changes: 0 additions & 20 deletions test/functional/news_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ def test_index_with_invalid_project_should_respond_with_302_for_anonymous
end
end

def test_index_with_invalid_project_should_respond_with_302_for_anonymous
Role.anonymous.remove_permission! :view_news
with_settings :login_required => '0' do
get(:index, :params => {:project_id => 999})
assert_response 302
end
end

def test_index_without_permission_should_fail
Role.all.each {|r| r.remove_permission! :view_news}
@request.session[:user_id] = 2
Expand All @@ -83,18 +75,6 @@ def test_index_without_manage_news_permission_should_not_display_add_news_link
assert_select '.add-news-link', count: 1
end

def test_index_without_manage_news_permission_should_not_display_add_news_link
user = User.find(2)
@request.session[:user_id] = user.id
Role.all.each {|r| r.remove_permission! :manage_news}
get :index
assert_select '.add-news-link', count: 0

user.members.first.roles.first.add_permission! :manage_news
get :index
assert_select '.add-news-link', count: 1
end

def test_show
get(:show, :params => {:id => 1})
assert_response :success
Expand Down
2 changes: 1 addition & 1 deletion test/functional/projects_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
:enabled_modules, :enumerations, :boards, :messages,
:attachments, :custom_fields, :custom_values, :time_entries,
:wikis, :wiki_pages, :wiki_contents, :wiki_content_versions,
:roles, :queries
:roles, :queries, :issue_categories

include Redmine::I18n

Expand Down
14 changes: 0 additions & 14 deletions test/functional/queries_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,6 @@ def test_new_should_not_render_show_totals_option_for_query_without_totable_colu
assert_select 'p[class=?]', 'totables_columns', 0
end

def test_new_should_not_render_show_inline_columns_option_for_query_without_available_inline_columns
@request.session[:user_id] = 1
get(:new, :params => {:type => 'ProjectQuery'})
assert_response :success
assert_select 'p[class=?]', 'block_columns', 0
end

def test_new_should_not_render_show_totals_option_for_query_without_totable_columns
@request.session[:user_id] = 1
get(:new, :params => {:type => 'ProjectQuery'})
assert_response :success
assert_select 'p[class=?]', 'totables_columns', 0
end

def test_new_time_entry_query
@request.session[:user_id] = 2
get(:new, :params => {:project_id => 1, :type => 'TimeEntryQuery'})
Expand Down
Loading

0 comments on commit 6551cfb

Please sign in to comment.