From 720a950d7f1a54bf6fd39e752598848b594d36c7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 24 Aug 2015 09:24:32 +0200 Subject: [PATCH] If we have to many failed logins, we need to handle another error message. --- test/unit/email_helper_test.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/unit/email_helper_test.rb b/test/unit/email_helper_test.rb index 3ec4b687d..b49bcc37d 100644 --- a/test/unit/email_helper_test.rb +++ b/test/unit/email_helper_test.rb @@ -209,7 +209,14 @@ class EmailHelperTest < ActiveSupport::TestCase } ) assert_equal('invalid', result[:result]) - assert_equal('Authentication failed, invalid credentials!', result[:message_human]) + + # if we have to many failed logins, we need to handle another error message +puts "DEBUG #{result.inspect}" + if !result[:message_human].empty? + assert_equal('Authentication failed, invalid credentials!', result[:message_human]) + else + assert_match(/Web login required/, result[:message]) + end assert_equal('imap.gmail.com', result[:settings][:options][:host]) # dovecot @@ -335,7 +342,14 @@ class EmailHelperTest < ActiveSupport::TestCase 'some@example.com', ) assert_equal('invalid', result[:result]) - assert_equal('Authentication failed!', result[:message_human]) + + # if we have to many failed logins, we need to handle another error message +puts "DEBUG #{result.inspect}" + if !result[:message_human].empty? + assert_equal('Authentication failed!', result[:message_human]) + else + assert_match(/Web login required/, result[:message]) + end assert_equal('smtp.gmail.com', result[:settings][:options][:host]) # dovecot