Correct threads tests

darcs-hash:20080519201548-86b55-448f18676bd232a91e598c9d25c34576af854b69.gz
This commit is contained in:
David Rousselie
2008-05-19 22:15:48 +02:00
parent 2ea561c9cc
commit 3d286c3efe
5 changed files with 16 additions and 16 deletions

View File

@@ -160,4 +160,3 @@ class FeederHandler(Handler):
for data in self.feeder.feed(_account):
self.sender.send(_account, data)
return []

View File

@@ -3017,7 +3017,7 @@ class JCLCommandManagerRestartCommand_TestCase(JCLCommandManagerTestCase):
self.assertTrue(self.comp.running)
threads = threading.enumerate()
self.assertEquals(len(threads), 2)
threading.Event().wait(1)
threading.Event().wait(2)
threads = threading.enumerate()
self.assertEquals(len(threads), 1)
self.assertTrue(self.comp.restart)
@@ -3068,7 +3068,7 @@ class JCLCommandManagerRestartCommand_TestCase(JCLCommandManagerTestCase):
self.assertTrue(self.comp.running)
threads = threading.enumerate()
self.assertEquals(len(threads), 2)
threading.Event().wait(1)
threading.Event().wait(2)
threads = threading.enumerate()
self.assertEquals(len(threads), 1)
self.assertTrue(self.comp.restart)
@@ -3166,7 +3166,7 @@ class JCLCommandManagerShutdownCommand_TestCase(JCLCommandManagerTestCase):
self.assertTrue(self.comp.running)
threads = threading.enumerate()
self.assertEquals(len(threads), 2)
threading.Event().wait(1)
threading.Event().wait(2)
threads = threading.enumerate()
self.assertEquals(len(threads), 1)
self.assertFalse(self.comp.restart)

View File

@@ -3175,13 +3175,15 @@ class AccountManager_TestCase(JCLTestCase):
def test_cancel_account_error(self):
"""Test Account error reset"""
self.comp.stream = MockStream()
self.comp.stream_class = MockStream
_account = Account(user=User(jid="user1@test.com"),
name="account11",
jid="account11@jcl.test.com")
_account.error = "test exception"
result = self.account_manager.cancel_account_error(_account)
self.assertEquals(len(result), 1)
presence = result[0].xmlnode
self.account_manager.cancel_account_error(_account)
self.assertEquals(len(self.comp.stream.sent), 1)
presence = self.comp.stream.sent[0].xmlnode
self.assertEquals(presence.name, "presence")
self.assertEquals(presence.prop("type"), None)
self.assertEquals(presence.prop("from"), _account.jid)

View File

@@ -387,4 +387,3 @@ class LegacyJID(InheritableSQLObject):
legacy_address = StringCol()
jid = StringCol()
account = ForeignKey('Account')

View File

@@ -86,7 +86,7 @@ class JCLRunner(object):
("o", "log-stdout", None,
"\t\t\t\t\tLog on stdout",
lambda arg: self.set_attr("log_stdout", True)),
("f", "log-file", "component",
("f:", "log-file=", "component",
"\t\t\t\t\tLog in file",
lambda arg: self.set_attr("log_file", arg)),
("h", "help", None,