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

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2013-04-08 01:41:15 +0400
committerYann Leboulanger <asterix@lagaule.org>2013-04-08 01:41:15 +0400
commitd2992815ee801d064567af1bca7a39a768094a30 (patch)
treeb27cffb558986a53acc4e1887e605fc2f42867c5 /test/lib
parentaef4452ff56f663f0fc198a92df5ce969e5f1c52 (diff)
re-enable test suite
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/gajim_mocks.py18
-rw-r--r--test/lib/notify.py19
-rw-r--r--test/lib/xmpp_mocks.py3
3 files changed, 31 insertions, 9 deletions
diff --git a/test/lib/gajim_mocks.py b/test/lib/gajim_mocks.py
index 4070641e9..5995bc956 100644
--- a/test/lib/gajim_mocks.py
+++ b/test/lib/gajim_mocks.py
@@ -6,12 +6,12 @@ from mock import Mock
from common import gajim
from common import ged
-from common.connection_handlers import ConnectionHandlersBase
+from common.connection_handlers import ConnectionHandlers
-class MockConnection(Mock, ConnectionHandlersBase):
+class MockConnection(Mock, ConnectionHandlers):
def __init__(self, account, *args):
Mock.__init__(self, *args)
- ConnectionHandlersBase.__init__(self)
+ ConnectionHandlers.__init__(self)
self.name = account
self.connected = 2
@@ -19,6 +19,7 @@ class MockConnection(Mock, ConnectionHandlersBase):
self.blocked_contacts = {}
self.blocked_groups = {}
self.sessions = {}
+ self.nested_group_delimiter = '::'
gajim.interface.instances[account] = {'infos': {}, 'disco': {},
'gc_config': {}, 'search': {}, 'sub_request': {}}
@@ -41,6 +42,9 @@ class MockConnection(Mock, ConnectionHandlersBase):
gajim.connections[account] = self
+ def request_vcard(self, jid):
+ pass
+
class MockWindow(Mock):
def __init__(self, *args):
Mock.__init__(self, *args)
@@ -105,14 +109,14 @@ class MockInterface(Mock):
self.status_sent_to_users = Mock()
if gajim.use_x:
- self.jabber_state_images = {'16': {}, '32': {}, 'opened': {},
- 'closed': {}}
+ self.jabber_state_images = {'16': {}, '24': {}, '32': {},
+ 'opened': {}, 'closed': {}}
import gtkgui_helpers
gtkgui_helpers.make_jabber_state_images()
else:
- self.jabber_state_images = {'16': Mock(), '32': Mock(),
- 'opened': Mock(), 'closed': Mock()}
+ self.jabber_state_images = {'16': Mock(), '24': Mock(),
+ '32': Mock(), 'opened': Mock(), 'closed': Mock()}
class MockLogger(Mock):
diff --git a/test/lib/notify.py b/test/lib/notify.py
index b13d03678..1478879d7 100644
--- a/test/lib/notify.py
+++ b/test/lib/notify.py
@@ -1,7 +1,26 @@
# mock notify module
+from common import gajim
+from common import ged
+
notifications = []
+class Notification:
+ def _nec_notification(self, obj):
+ global notifications
+ notifications.append(obj)
+
+ def clean(self):
+ global notifications
+ notifications = []
+ gajim.ged.remove_event_handler('notification', ged.GUI2,
+ self._nec_notification)
+
+ def __init__(self):
+ gajim.ged.register_event_handler('notification', ged.GUI2,
+ self._nec_notification)
+
+
def notify(event, jid, account, parameters, advanced_notif_num = None):
notifications.append((event, jid, account, parameters, advanced_notif_num))
diff --git a/test/lib/xmpp_mocks.py b/test/lib/xmpp_mocks.py
index 0b4055949..81ba75d04 100644
--- a/test/lib/xmpp_mocks.py
+++ b/test/lib/xmpp_mocks.py
@@ -6,7 +6,7 @@ import threading, time
from mock import Mock
-from common.xmpp import idlequeue
+from nbxmpp import idlequeue
IDLEQUEUE_INTERVAL = 0.2 # polling interval. 200ms is used in Gajim as default
IDLEMOCK_TIMEOUT = 30 # how long we wait for an event
@@ -55,7 +55,6 @@ class IdleMock:
def set_event(self):
self._event.set()
-
class MockConnection(IdleMock, Mock):
'''
Class simulating Connection class from src/common/connection.py