mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add POP3 timeout error only after 3 failures in a row.
This commit is contained in:
@@ -23,10 +23,39 @@ describe Jobs::PollMailbox do
|
||||
|
||||
describe ".poll_pop3" do
|
||||
|
||||
it "logs an error on pop authentication error" do
|
||||
Net::POP3.any_instance.expects(:start).raises(Net::POPAuthenticationError.new)
|
||||
Discourse.expects(:handle_job_exception)
|
||||
poller.poll_pop3
|
||||
context "pop errors" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
Discourse.expects(:handle_job_exception).at_least_once
|
||||
end
|
||||
|
||||
after do
|
||||
$redis.flushall
|
||||
end
|
||||
|
||||
it "add an admin dashboard message on pop authentication error" do
|
||||
Net::POP3.any_instance.expects(:start)
|
||||
.raises(Net::POPAuthenticationError.new).at_least_once
|
||||
|
||||
poller.poll_pop3
|
||||
|
||||
i18n_key = 'dashboard.poll_pop3_auth_error'
|
||||
|
||||
expect(AdminDashboardData.problem_message_check(i18n_key))
|
||||
.to eq(I18n.t(i18n_key))
|
||||
end
|
||||
|
||||
it "logs an error on pop connection timeout error" do
|
||||
Net::POP3.any_instance.expects(:start).raises(Net::OpenTimeout.new).at_least_once
|
||||
|
||||
4.times { poller.poll_pop3 }
|
||||
|
||||
i18n_key = 'dashboard.poll_pop3_timeout'
|
||||
|
||||
expect(AdminDashboardData.problem_message_check(i18n_key))
|
||||
.to eq(I18n.t(i18n_key))
|
||||
end
|
||||
end
|
||||
|
||||
it "calls enable_ssl when the setting is enabled" do
|
||||
|
||||
Reference in New Issue
Block a user