Make PresenceAccount_TestCase inheritable

- PresenceAccount subclasses can reuse PresenceAccount_TestCase tests

darcs-hash:20070509161025-86b55-4a6cfb08b0de6dc7e77b63aee4482712da75743b.gz
This commit is contained in:
David Rousselie
2007-05-09 18:10:25 +02:00
parent 24b54799bf
commit 046bade075
2 changed files with 6 additions and 6 deletions

View File

@@ -25,7 +25,7 @@
""" """
__revision__ = "$Id: account.py,v 1.3 2005/09/18 20:24:07 dax Exp $" __revision__ = "$Id: account.py,v 1.3 2005/09/18 20:24:07 dax Exp $"
2
from sqlobject.inheritance import InheritableSQLObject from sqlobject.inheritance import InheritableSQLObject
from sqlobject.col import StringCol, EnumCol, IntCol, BoolCol from sqlobject.col import StringCol, EnumCol, IntCol, BoolCol
from sqlobject.dbconnection import ConnectionHub from sqlobject.dbconnection import ConnectionHub

View File

@@ -132,6 +132,10 @@ class PresenceAccount_TestCase(unittest.TestCase):
Account.createTable(ifNotExists = True) Account.createTable(ifNotExists = True)
PresenceAccount.createTable(ifNotExists = True) PresenceAccount.createTable(ifNotExists = True)
PresenceAccountExample.createTable(ifNotExists = True) PresenceAccountExample.createTable(ifNotExists = True)
self.account = PresenceAccountExample(\
user_jid = "test1@test.com", \
name = "account11", \
jid = "account11@jcl.test.com")
del account.hub.threadConnection del account.hub.threadConnection
def tearDown(self): def tearDown(self):
@@ -156,15 +160,11 @@ class PresenceAccount_TestCase(unittest.TestCase):
def test_possibles_actions(self): def test_possibles_actions(self):
account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL) account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)
account11 = PresenceAccountExample(\
user_jid = "test1@test.com", \
name = "account11", \
jid = "account11@jcl.test.com")
for (field_name, \ for (field_name, \
field_type, \ field_type, \
possibles_actions, \ possibles_actions, \
post_func, \ post_func, \
default_func) in account11.get_register_fields()[1:]: default_func) in self.account.get_register_fields()[1:]:
if possibles_actions is not None: if possibles_actions is not None:
for possible_action in possibles_actions: for possible_action in possibles_actions:
self.assertEquals(post_func(possible_action, default_func), self.assertEquals(post_func(possible_action, default_func),