X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/550c4a3a45814fde5c809334c85f1ebc47659a82..7d46203f5fbf0286b25822f872262d27c9c11e88:/test/jobs/trace_importer_job_test.rb diff --git a/test/jobs/trace_importer_job_test.rb b/test/jobs/trace_importer_job_test.rb index e1ddcc967..c6d44ecce 100644 --- a/test/jobs/trace_importer_job_test.rb +++ b/test/jobs/trace_importer_job_test.rb @@ -52,6 +52,38 @@ class TraceImporterJobTest < ActiveJob::TestCase email = ActionMailer::Base.deliveries.last assert_equal trace.user.email, email.to[0] assert_match(/failure/, email.subject) + assert_no_match(/Start tag expected/, email.text_part.body.to_s, "should not include parser error") + assert_match(%r{jobs/trace_importer_job\.rb}, email.text_part.body.to_s, "should include stack backtrace") + + ActionMailer::Base.deliveries.clear + end + + def test_parse_error_notification + trace = create(:trace, :inserted => false, :fixture => "jpg") + Rails.logger.silence do + TraceImporterJob.perform_now(trace) + end + + email = ActionMailer::Base.deliveries.last + assert_equal trace.user.email, email.to[0] + assert_match(/failure/, email.subject) + assert_match(/Start tag expected/, email.text_part.body.to_s, "should include parser error") + assert_no_match(%r{jobs/trace_importer_job\.rb}, email.text_part.body.to_s, "should not include stack backtrace") + + ActionMailer::Base.deliveries.clear + end + + def test_gz_parse_error_notification + trace = create(:trace, :inserted => false, :fixture => "jpg.gz") + Rails.logger.silence do + TraceImporterJob.perform_now(trace) + end + + email = ActionMailer::Base.deliveries.last + assert_equal trace.user.email, email.to[0] + assert_match(/failure/, email.subject) + assert_match(/Start tag expected/, email.text_part.body.to_s, "should include parser error") + assert_no_match(%r{jobs/trace_importer_job\.rb}, email.text_part.body.to_s, "should not include stack backtrace") ActionMailer::Base.deliveries.clear end