Mercurial > libervia-backend
comparison src/test/helpers.py @ 587:952322b1d490
Remove trailing whitespaces.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:34 +0100 |
parents | ca13633d3b6b |
children | 65821b3fa7ab |
comparison
equal
deleted
inserted
replaced
586:6a718ede8be1 | 587:952322b1d490 |
---|---|
20 """ | 20 """ |
21 | 21 |
22 import __builtin__ | 22 import __builtin__ |
23 from twisted.words.protocols.jabber.jid import JID | 23 from twisted.words.protocols.jabber.jid import JID |
24 | 24 |
25 TEST_JID_STR = u"test@example.org/SàT" | 25 TEST_JID_STR = u"test@example.org/SàT" |
26 TEST_JID = JID(u"test@example.org/SàT") | 26 TEST_JID = JID(u"test@example.org/SàT") |
27 TEST_PROFILE = 'test_profile' | 27 TEST_PROFILE = 'test_profile' |
28 | 28 |
29 class DifferentArgsException(Exception): | 29 class DifferentArgsException(Exception): |
30 pass | 30 pass |
31 | 31 |
33 """Class to simulate a SAT instance""" | 33 """Class to simulate a SAT instance""" |
34 | 34 |
35 def __init__(self): | 35 def __init__(self): |
36 self.bridge = FakeBridge() | 36 self.bridge = FakeBridge() |
37 self.memory = FakeMemory() | 37 self.memory = FakeMemory() |
38 self.trigger = FakeTriggerManager() | 38 self.trigger = FakeTriggerManager() |
39 | 39 |
40 | 40 |
41 class FakeBridge(object): | 41 class FakeBridge(object): |
42 """Class to simulate and test bridge calls""" | 42 """Class to simulate and test bridge calls""" |
43 | 43 |
48 print "Args are not equals:" | 48 print "Args are not equals:" |
49 print "args\n----\n%s (sent)\n%s (wanted)" % (args, check_args) | 49 print "args\n----\n%s (sent)\n%s (wanted)" % (args, check_args) |
50 print "kwargs\n------\n%s (sent)\n%s (wanted)" % (kwargs, check_kwargs) | 50 print "kwargs\n------\n%s (sent)\n%s (wanted)" % (kwargs, check_kwargs) |
51 print "--------------------\n\n" | 51 print "--------------------\n\n" |
52 raise DifferentArgsException | 52 raise DifferentArgsException |
53 | 53 |
54 setattr(self, name, checkCall) | 54 setattr(self, name, checkCall) |
55 | 55 |
56 | 56 |
57 class FakeMemory(object): | 57 class FakeMemory(object): |
58 """Class to simulate and test memory object""" | 58 """Class to simulate and test memory object""" |
60 def getProfileName(self, profile_key): | 60 def getProfileName(self, profile_key): |
61 return profile_key | 61 return profile_key |
62 | 62 |
63 def addToHistory(self, from_jid, to_jid, message, _type='chat', timestamp=None, profile=None): | 63 def addToHistory(self, from_jid, to_jid, message, _type='chat', timestamp=None, profile=None): |
64 pass | 64 pass |
65 | 65 |
66 def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'): | 66 def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'): |
67 pass | 67 pass |
68 | 68 |
69 def setPresenceStatus(self, contact_jid, show, priority, statuses, profile_key='@DEFAULT@'): | 69 def setPresenceStatus(self, contact_jid, show, priority, statuses, profile_key='@DEFAULT@'): |
70 pass | 70 pass |
71 | 71 |
72 def addWaitingSub(self, type, contact_jid, profile_key): | 72 def addWaitingSub(self, type, contact_jid, profile_key): |
73 pass | 73 pass |
74 | 74 |
75 def delWaitingSub(self, contact_jid, profile_key): | 75 def delWaitingSub(self, contact_jid, profile_key): |
76 pass | 76 pass |
77 | 77 |
78 class FakeTriggerManager(object): | 78 class FakeTriggerManager(object): |
79 | 79 |
80 def add(self, point_name, callback): | 80 def add(self, point_name, callback): |
81 pass | 81 pass |
82 | 82 |
83 def point(self, point_name, *args, **kwargs): | 83 def point(self, point_name, *args, **kwargs): |
84 """We always return true to continue the action""" | 84 """We always return true to continue the action""" |
85 return True | 85 return True |
86 | 86 |
87 class FakeParent(object): | 87 class FakeParent(object): |