From 6b7eac5c51cbef4acd1ab7f48884e7b614f71678 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Sat, 6 Oct 2018 22:02:08 -0400 Subject: Accept inbound emails from a variety of ingresses --- test/unit/controller_test.rb | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 test/unit/controller_test.rb (limited to 'test/unit') diff --git a/test/unit/controller_test.rb b/test/unit/controller_test.rb deleted file mode 100644 index 508e561244..0000000000 --- a/test/unit/controller_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative '../test_helper' - -class ActionMailbox::InboundEmailsControllerTest < ActionDispatch::IntegrationTest - test "receiving a valid RFC 822 message" do - assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do - post_inbound_email "welcome.eml" - end - - assert_response :created - - inbound_email = ActionMailbox::InboundEmail.last - assert_equal file_fixture('../files/welcome.eml').read, inbound_email.raw_email.download - end - - test "rejecting a message of an unsupported type" do - assert_no_difference -> { ActionMailbox::InboundEmail.count } do - post rails_inbound_emails_url, params: { message: fixture_file_upload('files/text.txt', 'text/plain') } - end - - assert_response :unsupported_media_type - end - - private - def post_inbound_email(fixture_name) - post rails_inbound_emails_url, params: { message: fixture_file_upload("files/#{fixture_name}", 'message/rfc822') } - end -end -- cgit v1.2.3 From b3919d01554d31c5486d17332f4a4dde89a23239 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Thu, 18 Oct 2018 10:23:17 -0400 Subject: Don't require Postfix to send form data --- test/unit/inbound_email/message_id_test.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/unit') diff --git a/test/unit/inbound_email/message_id_test.rb b/test/unit/inbound_email/message_id_test.rb index aa9ce90b4c..c744a5bf99 100644 --- a/test/unit/inbound_email/message_id_test.rb +++ b/test/unit/inbound_email/message_id_test.rb @@ -7,9 +7,7 @@ class ActionMailbox::InboundEmail::MessageIdTest < ActiveSupport::TestCase end test "message id is generated if its missing" do - source_without_message_id = "Date: Fri, 28 Sep 2018 11:08:55 -0700\r\nTo: a@example.com\r\nMime-Version: 1.0\r\nContent-Type: text/plain\r\nContent-Transfer-Encoding: 7bit\r\n\r\nHello!" - inbound_email = create_inbound_email Tempfile.new.tap { |raw_email| raw_email.write source_without_message_id } - + inbound_email = create_inbound_email "Date: Fri, 28 Sep 2018 11:08:55 -0700\r\nTo: a@example.com\r\nMime-Version: 1.0\r\nContent-Type: text/plain\r\nContent-Transfer-Encoding: 7bit\r\n\r\nHello!" assert_not_nil inbound_email.message_id end end -- cgit v1.2.3