aboutsummaryrefslogtreecommitdiffstats
path: root/test/controllers/ingresses/postfix/inbound_emails_controller_test.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-11-05 09:11:01 -0500
committerGeorge Claghorn <george@basecamp.com>2018-11-05 09:11:01 -0500
commit7755f9b381c007ce98e0858473a9f29f1cd25311 (patch)
tree9130fccc00bf2602cdcf92eda572deec911f6302 /test/controllers/ingresses/postfix/inbound_emails_controller_test.rb
parentcb041ddc7e94da15e2db72188545f78da6cadb53 (diff)
downloadrails-7755f9b381c007ce98e0858473a9f29f1cd25311.tar.gz
rails-7755f9b381c007ce98e0858473a9f29f1cd25311.tar.bz2
rails-7755f9b381c007ce98e0858473a9f29f1cd25311.zip
Read ingress passwords/API keys from encrypted credentials
Fall back to ENV for people who prefer that approach.
Diffstat (limited to 'test/controllers/ingresses/postfix/inbound_emails_controller_test.rb')
-rw-r--r--test/controllers/ingresses/postfix/inbound_emails_controller_test.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/test/controllers/ingresses/postfix/inbound_emails_controller_test.rb b/test/controllers/ingresses/postfix/inbound_emails_controller_test.rb
index a9588791b9..5e0777aa30 100644
--- a/test/controllers/ingresses/postfix/inbound_emails_controller_test.rb
+++ b/test/controllers/ingresses/postfix/inbound_emails_controller_test.rb
@@ -1,8 +1,8 @@
require "test_helper"
-ActionMailbox::Ingresses::Postfix::InboundEmailsController.password = "tbsy84uSV1Kt3ZJZELY2TmShPRs91E3yL4tzf96297vBCkDWgL"
-
class ActionMailbox::Ingresses::Postfix::InboundEmailsControllerTest < ActionDispatch::IntegrationTest
+ setup { ActionMailbox.ingress = :postfix }
+
test "receiving an inbound email from Postfix" do
assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do
post rails_postfix_inbound_emails_url, headers: { "Authorization" => credentials, "Content-Type" => "message/rfc822" },
@@ -51,18 +51,4 @@ class ActionMailbox::Ingresses::Postfix::InboundEmailsControllerTest < ActionDis
end
end
end
-
- private
- delegate :username, :password, :password=, to: ActionMailbox::Ingresses::Postfix::InboundEmailsController
-
- def credentials
- ActionController::HttpAuthentication::Basic.encode_credentials username, password
- end
-
- def switch_password_to(new_password)
- previous_password, self.password = password, new_password
- yield
- ensure
- self.password = previous_password
- end
end