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