summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/mail_handler_controller_test.rb15
-rw-r--r--test/unit/mail_handler_test.rb7
2 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 3487d5eb2..a966b774d 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -38,6 +38,21 @@ class MailHandlerControllerTest < ActionController::TestCase
assert_response 201
end
+ def test_should_create_issue_with_options
+ # Enable API and set a key
+ Setting.mail_handler_api_enabled = 1
+ Setting.mail_handler_api_key = 'secret'
+
+ assert_difference 'Issue.count' do
+ post :index, :key => 'secret',
+ :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')),
+ :issue => {:is_private => '1'}
+ end
+ assert_response 201
+ issue = Issue.order(:id => :desc).first
+ assert_equal true, issue.is_private
+ end
+
def test_should_respond_with_422_if_not_created
Project.find('onlinestore').destroy
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 2ae3cb5c1..99900666d 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -94,6 +94,13 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal IssueStatus.find_by_name("Resolved"), issue.status
end
+ def test_add_issue_should_accept_is_private_attribute
+ issue = submit_email('ticket_on_given_project.eml', :issue => {:is_private => '1'})
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ assert_equal true, issue.reload.is_private
+ end
+
def test_add_issue_with_attributes_override
issue = submit_email(
'ticket_with_attributes.eml',