Reuse PresenceAccount unit tests
darcs-hash:20070513171250-86b55-daf3937f6c3dc004d246cbb81da91b91756993d2.gz
This commit is contained in:
@@ -54,7 +54,7 @@ del account.hub.threadConnection
|
||||
component = MailComponent("jmc.localhost", \
|
||||
"secret", \
|
||||
"127.0.0.1", \
|
||||
5349, \
|
||||
5347, \
|
||||
"sqlite://" + DB_URL)
|
||||
component.run()
|
||||
logger.debug("JMC is exiting")
|
||||
|
||||
@@ -172,16 +172,12 @@ class MailAccount(PresenceAccount):
|
||||
real_class = cls
|
||||
return PresenceAccount.get_register_fields(real_class) + \
|
||||
[("login", "text-single", None, \
|
||||
lambda field_value, default_func: account.mandatory_field("login", \
|
||||
field_value, \
|
||||
default_func), \
|
||||
lambda field_value, default_func: account.mandatory_field(field_value), \
|
||||
lambda : ""), \
|
||||
("password", "text-private", None, password_post_func, \
|
||||
lambda : ""), \
|
||||
("host", "text-single", None, \
|
||||
lambda field_value, default_func: account.mandatory_field("host", \
|
||||
field_value, \
|
||||
default_func), \
|
||||
lambda field_value, default_func: account.mandatory_field(field_value), \
|
||||
lambda : ""), \
|
||||
("port", "text-single", None, \
|
||||
account.int_post_func, \
|
||||
|
||||
@@ -33,6 +33,7 @@ from jcl.model import account
|
||||
from jcl.model.account import Account, PresenceAccount
|
||||
from jmc.model.account import MailAccount, POP3Account, IMAPAccount
|
||||
|
||||
from jcl.model.tests.account import PresenceAccount_TestCase
|
||||
from tests.jmc import email_generator, dummy_server
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -41,7 +42,7 @@ else:
|
||||
DB_PATH = "/tmp/test.db"
|
||||
DB_URL = DB_PATH # + "?debug=1&debugThreading=1"
|
||||
|
||||
class MailAccount_TestCase(unittest.TestCase):
|
||||
class MailAccount_TestCase(PresenceAccount_TestCase):
|
||||
def setUp(self):
|
||||
if os.path.exists(DB_PATH):
|
||||
os.unlink(DB_PATH)
|
||||
@@ -53,6 +54,7 @@ class MailAccount_TestCase(unittest.TestCase):
|
||||
name = "account1", \
|
||||
jid = "account1@jmc.test.com")
|
||||
del account.hub.threadConnection
|
||||
self.account_class = MailAccount
|
||||
|
||||
def tearDown(self):
|
||||
account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)
|
||||
|
||||
Reference in New Issue
Block a user