fix ad-hoc command complete support
This commit is contained in:
@@ -316,9 +316,9 @@ class IMAPAccount(MailAccount):
|
||||
+ " (" + str(self.mailbox) + "). SSL="
|
||||
+ str(self.ssl))
|
||||
if self.ssl:
|
||||
self.connection = imaplib.IMAP4_SSL(self.host, self.port)
|
||||
self.connection = imaplib.IMAP4_SSL(self.host, int(self.port))
|
||||
else:
|
||||
self.connection = imaplib.IMAP4(self.host, self.port)
|
||||
self.connection = imaplib.IMAP4(self.host, int(self.port))
|
||||
self.connection.login(self.login, self.password)
|
||||
self.connected = True
|
||||
|
||||
@@ -501,9 +501,9 @@ class POP3Account(MailAccount):
|
||||
+ str(self.login) + "@" + str(self.host) + ":" +
|
||||
str(self.port) + ". SSL=" + str(self.ssl))
|
||||
if self.ssl:
|
||||
self.connection = poplib.POP3_SSL(self.host, self.port)
|
||||
self.connection = poplib.POP3_SSL(self.host, int(self.port))
|
||||
else:
|
||||
self.connection = poplib.POP3(self.host, self.port)
|
||||
self.connection = poplib.POP3(self.host, int(self.port))
|
||||
try:
|
||||
self.connection.apop(self.login, self.password)
|
||||
except:
|
||||
@@ -737,7 +737,7 @@ class GlobalSMTPAccount(AbstractSMTPAccount):
|
||||
+ str(type(self.port)) + ", value: "
|
||||
+ str(self.port))
|
||||
self.port = int(self.port)
|
||||
smtp_connection.connect(self.host, self.port)
|
||||
smtp_connection.connect(self.host, int(self.port))
|
||||
self.__say_hello(smtp_connection)
|
||||
if self.tls:
|
||||
smtp_connection.starttls()
|
||||
|
||||
@@ -38,12 +38,6 @@ import jmc.model.account as account
|
||||
from jmc.model.account import MailAccount, IMAPAccount, POP3Account, \
|
||||
AbstractSMTPAccount, GlobalSMTPAccount, SMTPAccount
|
||||
|
||||
if sys.platform == "win32":
|
||||
DB_PATH = "/c|/temp/test.db"
|
||||
else:
|
||||
DB_PATH = "/tmp/test.db"
|
||||
DB_URL = "sqlite://" + DB_PATH# + "?debug=1&debugThreading=1"
|
||||
|
||||
class JMCRunner_TestCase(JCLTestCase):
|
||||
def setUp(self):
|
||||
JCLTestCase.setUp(self, tables=[Account, PresenceAccount, User,
|
||||
@@ -58,6 +52,7 @@ class JMCRunner_TestCase(JCLTestCase):
|
||||
self.type_globalsmtp_name = Lang.en.type_globalsmtp_name
|
||||
|
||||
def tearDown(self):
|
||||
JCLTestCase.tearDown(self)
|
||||
self.runner = None
|
||||
sys.argv = [""]
|
||||
account.smtp_default_login = self.smtp_default_login
|
||||
@@ -255,7 +250,7 @@ class JMCRunner_TestCase(JCLTestCase):
|
||||
|
||||
def test__run(self):
|
||||
self.runner.pid_file = "/tmp/jmc.pid"
|
||||
self.runner.db_url = DB_URL
|
||||
self.runner.db_url = self.db_url
|
||||
def do_nothing():
|
||||
return (False, 0)
|
||||
self.runner._run(do_nothing)
|
||||
@@ -271,7 +266,6 @@ class JMCRunner_TestCase(JCLTestCase):
|
||||
POP3Account.dropTable()
|
||||
SMTPAccount.dropTable()
|
||||
model.db_disconnect()
|
||||
os.unlink(DB_PATH)
|
||||
self.assertFalse(os.access("/tmp/jmc.pid", os.F_OK))
|
||||
|
||||
def test_run_without_smtp_default_account(self):
|
||||
@@ -284,7 +278,7 @@ class JMCRunner_TestCase(JCLTestCase):
|
||||
|
||||
self.runner.enable_smtp_default_account = False
|
||||
self.runner.pid_file = "/tmp/jmc.pid"
|
||||
self.runner.db_url = DB_URL
|
||||
self.runner.db_url = self.db_url
|
||||
self.runner.config = None
|
||||
old_run_func = MailComponent.run
|
||||
MailComponent.run = run_func
|
||||
@@ -305,7 +299,7 @@ class JMCRunner_TestCase(JCLTestCase):
|
||||
|
||||
self.runner.enable_smtp_default_account = True
|
||||
self.runner.pid_file = "/tmp/jmc.pid"
|
||||
self.runner.db_url = DB_URL
|
||||
self.runner.db_url = self.db_url
|
||||
self.runner.config = None
|
||||
old_run_func = MailComponent.run
|
||||
MailComponent.run = run_func
|
||||
|
||||
Reference in New Issue
Block a user