fix unknown SMTP auth method error

This commit is contained in:
David Rousselie
2010-06-09 13:48:44 +02:00
parent 321d552054
commit c68d23e801
4 changed files with 1017 additions and 3 deletions

View File

@@ -28,5 +28,5 @@ builddeb:
clean: clean:
$(PYTHON) setup.py clean $(PYTHON) setup.py clean
fakeroot $(MAKE) -f $(CURDIR)/debian/rules clean fakeroot $(MAKE) -f $(CURDIR)/debian/rules clean
rm -rf build/ MANIFEST rm -rf build/ MANIFEST .coverage
find . -name '*.pyc' -delete find . -name '*.pyc' -delete

File diff suppressed because it is too large Load Diff

View File

@@ -756,7 +756,7 @@ class GlobalSMTPAccount(AbstractSMTPAccount):
self.__logger.debug("Successfuly to authenticate using " self.__logger.debug("Successfuly to authenticate using "
+ str(auth_method) + " method") + str(auth_method) + " method")
break break
except smtplib.SMTPAuthenticationError, error: except (smtplib.SMTPAuthenticationError, smtplib.SMTPException), error:
self.__logger.debug("Failed to authenticate using " self.__logger.debug("Failed to authenticate using "
+ str(auth_method) + " method") + str(auth_method) + " method")
current_error = error current_error = error

View File

@@ -1097,6 +1097,45 @@ class SMTPAccount_TestCase(Account_TestCase):
smtp_account.send_email(email)) smtp_account.send_email(email))
test_func() test_func()
def test_send_email_esmtp_auth_method_with_no_suitable_auth_method_error(self):
model.db_connect()
smtp_account = SMTPAccount(user=User(jid="user1@test.com"),
name="account11",
jid="account11@jmc.test.com")
smtp_account.host = "localhost"
smtp_account.port = 1025
smtp_account.login = "user"
smtp_account.password = "pass"
model.db_disconnect()
email = smtp_account.create_email("from@test.com",
"to@test.com",
"subject",
"body")
test_func = self.make_test(["220 localhost ESMTP\r\n",
"250-localhost Hello 127.0.0.1\r\n"
+ "250-SIZE 52428800\r\n"
+ "250-AUTH PLAIN LOGIN DIGEST-MD5\r\n"
+ "250-PIPELINING\r\n"
+ "250 HELP\r\n",
"334 asd235r4\r\n",
"235 Authentication succeeded\r\n",
"250 OK\r\n",
"250 Accepted\r\n",
"354 Enter message\r\n",
None, None, None, None,
None, None, None, None,
"250 OK\r\n"],
["ehlo .*\r\n",
"AUTH LOGIN .*\r\n",
".*\r\n",
"mail FROM:<" + str(email['From']) + ">.*",
"rcpt TO:<" + str(email['To']) + ">\r\n",
"data\r\n"] +
email.as_string().split("\n") + [".\r\n"],
lambda self: \
smtp_account.send_email(email))
test_func()
def test_get_default_status_msg(self): def test_get_default_status_msg(self):
""" """
Get default status message for IMAPAccount. Get default status message for IMAPAccount.