diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-19 14:08:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-19 14:08:48 +0000 |
commit | 06ca18b04225a68769ab742900ec74ce776c2e86 (patch) | |
tree | 72db2b3b95bd049da95e0f257ec77514d835f099 /test/unit/mail_handler_test.rb | |
parent | 9d120c872c1b5849d987e3950f2cf914e1e34fe2 (diff) | |
download | redmine-06ca18b04225a68769ab742900ec74ce776c2e86.tar.gz redmine-06ca18b04225a68769ab742900ec74ce776c2e86.zip |
Adds a 'no_permission_check' option to the MailHandler.
Used with the 'project' option, it allows anyone to submit emails to a private inbox project (#4407).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3195 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mail_handler_test.rb')
-rw-r--r-- | test/unit/mail_handler_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 79cddd93c..a4ae37345 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -165,6 +165,26 @@ class MailHandlerTest < ActiveSupport::TestCase end end + def test_add_issue_by_anonymous_user_on_private_project + Role.anonymous.add_permission!(:add_issues) + assert_no_difference 'User.count' do + assert_no_difference 'Issue.count' do + assert_equal false, submit_email('ticket_by_unknown_user.eml', :issue => {:project => 'onlinestore'}, :unknown_user => 'accept') + end + end + end + + def test_add_issue_by_anonymous_user_on_private_project_without_permission_check + assert_no_difference 'User.count' do + assert_difference 'Issue.count' do + issue = submit_email('ticket_by_unknown_user.eml', :issue => {:project => 'onlinestore'}, :no_permission_check => '1', :unknown_user => 'accept') + assert issue.is_a?(Issue) + assert issue.author.anonymous? + assert !issue.project.is_public? + end + end + end + def test_add_issue_by_created_user Setting.default_language = 'en' assert_difference 'User.count' do |