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

github.com/dax/jcl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Rousselie <dax@happycoders.org>2008-05-20 00:15:48 +0400
committerDavid Rousselie <dax@happycoders.org>2008-05-20 00:15:48 +0400
commit3d286c3efe0f21e762c5cd9657961440ac67f932 (patch)
treeb71c8cd17bce61298ca7d1def659f80751011aa8 /src
parent2ea561c9cc70311555b6ce65a11130f53b51f439 (diff)
Correct threads tests
darcs-hash:20080519201548-86b55-448f18676bd232a91e598c9d25c34576af854b69.gz
Diffstat (limited to 'src')
-rw-r--r--src/jcl/jabber/feeder.py13
-rw-r--r--src/jcl/jabber/tests/command.py6
-rw-r--r--src/jcl/jabber/tests/component.py8
-rw-r--r--src/jcl/model/account.py3
-rw-r--r--src/jcl/runner.py2
5 files changed, 16 insertions, 16 deletions
diff --git a/src/jcl/jabber/feeder.py b/src/jcl/jabber/feeder.py
index 49dcd19..5fc8c53 100644
--- a/src/jcl/jabber/feeder.py
+++ b/src/jcl/jabber/feeder.py
@@ -4,18 +4,18 @@
## Login : David Rousselie <dax@happycoders.org>
## Started on Wed Aug 9 21:04:42 2006 David Rousselie
## $Id$
-##
+##
## Copyright (C) 2006 David Rousselie
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
-##
+##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -70,13 +70,13 @@ class FeederComponent(JCLComponent):
self.check_interval = 1
self.__logger = logging.getLogger("jcl.jabber.FeederComponent")
-
+
def handle_tick(self):
"""Implement main feed/send behavior"""
model.db_connect()
self.handler.handle(\
- None, self.lang.get_default_lang_class(),
- self.handler.filter(None,
+ None, self.lang.get_default_lang_class(),
+ self.handler.filter(None,
self.lang.get_default_lang_class()))
model.db_disconnect()
@@ -160,4 +160,3 @@ class FeederHandler(Handler):
for data in self.feeder.feed(_account):
self.sender.send(_account, data)
return []
-
diff --git a/src/jcl/jabber/tests/command.py b/src/jcl/jabber/tests/command.py
index 38bac63..6da72de 100644
--- a/src/jcl/jabber/tests/command.py
+++ b/src/jcl/jabber/tests/command.py
@@ -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)
diff --git a/src/jcl/jabber/tests/component.py b/src/jcl/jabber/tests/component.py
index e7c5fbc..7b6f366 100644
--- a/src/jcl/jabber/tests/component.py
+++ b/src/jcl/jabber/tests/component.py
@@ -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)
diff --git a/src/jcl/model/account.py b/src/jcl/model/account.py
index 60a702d..7bd0775 100644
--- a/src/jcl/model/account.py
+++ b/src/jcl/model/account.py
@@ -247,7 +247,7 @@ def get_all_accounts_count(account_class=Account, filter=None):
else:
accounts_count = account_class.select(filter).count()
return accounts_count
-
+
class PresenceAccount(Account):
DO_NOTHING = 0
DO_SOMETHING = 1
@@ -387,4 +387,3 @@ class LegacyJID(InheritableSQLObject):
legacy_address = StringCol()
jid = StringCol()
account = ForeignKey('Account')
-
diff --git a/src/jcl/runner.py b/src/jcl/runner.py
index 588bd08..5c1537e 100644
--- a/src/jcl/runner.py
+++ b/src/jcl/runner.py
@@ -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,