From 8323bc98f5a9ffe9cb14bd0e262d4d06e30db146 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 5 Dec 2014 08:48:29 +0000 Subject: [PATCH] Adds tests for searching private or archived projects. git-svn-id: http://svn.redmine.org/redmine/trunk@13710 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/search_controller_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index baf37deee..4124985db 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -39,6 +39,29 @@ class SearchControllerTest < ActionController::TestCase assert assigns(:results).include?(Project.find(1)) end + def test_search_on_archived_project_should_return_404 + Project.find(3).archive + get :index, :id => 3 + assert_response 404 + end + + def test_search_on_invisible_project_by_user_should_be_denied + @request.session[:user_id] = 7 + get :index, :id => 2 + assert_response 403 + end + + def test_search_on_invisible_project_by_anonymous_user_should_redirect + get :index, :id => 2 + assert_response 302 + end + + def test_search_on_private_project_by_member_should_succeed + @request.session[:user_id] = 2 + get :index, :id => 2 + assert_response :success + end + def test_search_all_projects with_settings :default_language => 'en' do get :index, :q => 'recipe subproject commit', :all_words => '' -- 2.39.5