Reuse PresenceAccount unit tests

darcs-hash:20070513171250-86b55-daf3937f6c3dc004d246cbb81da91b91756993d2.gz
This commit is contained in:
David Rousselie
2007-05-13 19:12:50 +02:00
parent 61d7c5e25c
commit cde3a9f16f
4 changed files with 8 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ del account.hub.threadConnection
component = MailComponent("jmc.localhost", \ component = MailComponent("jmc.localhost", \
"secret", \ "secret", \
"127.0.0.1", \ "127.0.0.1", \
5349, \ 5347, \
"sqlite://" + DB_URL) "sqlite://" + DB_URL)
component.run() component.run()
logger.debug("JMC is exiting") logger.debug("JMC is exiting")

View File

@@ -172,16 +172,12 @@ class MailAccount(PresenceAccount):
real_class = cls real_class = cls
return PresenceAccount.get_register_fields(real_class) + \ return PresenceAccount.get_register_fields(real_class) + \
[("login", "text-single", None, \ [("login", "text-single", None, \
lambda field_value, default_func: account.mandatory_field("login", \ lambda field_value, default_func: account.mandatory_field(field_value), \
field_value, \
default_func), \
lambda : ""), \ lambda : ""), \
("password", "text-private", None, password_post_func, \ ("password", "text-private", None, password_post_func, \
lambda : ""), \ lambda : ""), \
("host", "text-single", None, \ ("host", "text-single", None, \
lambda field_value, default_func: account.mandatory_field("host", \ lambda field_value, default_func: account.mandatory_field(field_value), \
field_value, \
default_func), \
lambda : ""), \ lambda : ""), \
("port", "text-single", None, \ ("port", "text-single", None, \
account.int_post_func, \ account.int_post_func, \

View File

@@ -33,6 +33,7 @@ from jcl.model import account
from jcl.model.account import Account, PresenceAccount from jcl.model.account import Account, PresenceAccount
from jmc.model.account import MailAccount, POP3Account, IMAPAccount from jmc.model.account import MailAccount, POP3Account, IMAPAccount
from jcl.model.tests.account import PresenceAccount_TestCase
from tests.jmc import email_generator, dummy_server from tests.jmc import email_generator, dummy_server
if sys.platform == "win32": if sys.platform == "win32":
@@ -41,7 +42,7 @@ else:
DB_PATH = "/tmp/test.db" DB_PATH = "/tmp/test.db"
DB_URL = DB_PATH # + "?debug=1&debugThreading=1" DB_URL = DB_PATH # + "?debug=1&debugThreading=1"
class MailAccount_TestCase(unittest.TestCase): class MailAccount_TestCase(PresenceAccount_TestCase):
def setUp(self): def setUp(self):
if os.path.exists(DB_PATH): if os.path.exists(DB_PATH):
os.unlink(DB_PATH) os.unlink(DB_PATH)
@@ -53,6 +54,7 @@ class MailAccount_TestCase(unittest.TestCase):
name = "account1", \ name = "account1", \
jid = "account1@jmc.test.com") jid = "account1@jmc.test.com")
del account.hub.threadConnection del account.hub.threadConnection
self.account_class = MailAccount
def tearDown(self): def tearDown(self):
account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL) account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)