@@ -347,6 +347,15 class MailHandlerTest < ActiveSupport::TestCase | |||||
347 | assert_equal 'caaf384198bcbc9563ab5c058acd73cd', attachment.digest |
|
347 | assert_equal 'caaf384198bcbc9563ab5c058acd73cd', attachment.digest | |
348 | end |
|
348 | end | |
349 |
|
349 | |||
|
350 | def test_should_ignore_emails_from_locked_users | |||
|
351 | User.find(2).lock! | |||
|
352 | ||||
|
353 | MailHandler.any_instance.expects(:dispatch).never | |||
|
354 | assert_no_difference 'Issue.count' do | |||
|
355 | assert_equal false, submit_email('ticket_on_given_project.eml') | |||
|
356 | end | |||
|
357 | end | |||
|
358 | ||||
350 | def test_should_ignore_emails_from_emission_address |
|
359 | def test_should_ignore_emails_from_emission_address | |
351 | Role.anonymous.add_permission!(:add_issues) |
|
360 | Role.anonymous.add_permission!(:add_issues) | |
352 | assert_no_difference 'User.count' do |
|
361 | assert_no_difference 'User.count' do | |
@@ -360,6 +369,7 class MailHandlerTest < ActiveSupport::TestCase | |||||
360 | end |
|
369 | end | |
361 |
|
370 | |||
362 | def test_should_ignore_auto_replied_emails |
|
371 | def test_should_ignore_auto_replied_emails | |
|
372 | MailHandler.any_instance.expects(:dispatch).never | |||
363 | [ |
|
373 | [ | |
364 | "X-Auto-Response-Suppress: OOF", |
|
374 | "X-Auto-Response-Suppress: OOF", | |
365 | "Auto-Submitted: auto-replied", |
|
375 | "Auto-Submitted: auto-replied", | |
@@ -367,7 +377,7 class MailHandlerTest < ActiveSupport::TestCase | |||||
367 | ].each do |header| |
|
377 | ].each do |header| | |
368 | raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) |
|
378 | raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) | |
369 | raw = header + "\n" + raw |
|
379 | raw = header + "\n" + raw | |
370 |
|
380 | |||
371 | assert_no_difference 'Issue.count' do |
|
381 | assert_no_difference 'Issue.count' do | |
372 | assert_equal false, MailHandler.receive(raw), "email with #{header} header was not ignored" |
|
382 | assert_equal false, MailHandler.receive(raw), "email with #{header} header was not ignored" | |
373 | end |
|
383 | end |
General Comments 0
You need to be logged in to leave comments.
Login now