Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dax/jmc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rousselie <david.rousselie@happycoders.org>2010-10-19 12:36:06 +0400
committerDavid Rousselie <david.rousselie@happycoders.org>2010-10-19 12:36:06 +0400
commit598300986963d70b79e80cb73fad74ad1cb421be (patch)
treee589cc166d2f908bde2ca8fd8a3e8c8d94013639
parentc68d23e80182c72b177951bd34315f5298e98d70 (diff)
fix ad-hoc command complete support
-rw-r--r--src/jmc/model/account.py10
-rw-r--r--src/jmc/tests/runner.py14
2 files changed, 9 insertions, 15 deletions
diff --git a/src/jmc/model/account.py b/src/jmc/model/account.py
index df30820..1c52c07 100644
--- a/src/jmc/model/account.py
+++ b/src/jmc/model/account.py
@@ -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()
diff --git a/src/jmc/tests/runner.py b/src/jmc/tests/runner.py
index 9b4eb50..a9eb541 100644
--- a/src/jmc/tests/runner.py
+++ b/src/jmc/tests/runner.py
@@ -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