Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits:
46a19733 by aszlig at 2017-01-27T20:43:45+01:00
tests: Don't mock received_message_hashes
This fixes the following two test cases from TestChatControlSession in
test/unit/test_sessions.py:
* test_receive_1nocontrol
* test_receive_2already_has_control
The MockConnection object already defines various attributes from the
real Connection object to their corresponding types so that calling code
is able to for example iterate on dicts or lists.
Since 40a3f80aa1afc0cde885d23da28e5c2330f3583c, there exists a new
received_message_hashes attribute, which is expected to be a list but
the default Mock object doesn't define an __iter__ method.
So this leads to the following exception:
Traceback (most recent call last):
File ".../share/gajim/src/common/ged.py", line 93, in raise_event
if handler(*args, **kwargs):
File ".../share/gajim/src/common/connection_handlers.py", line
1137, in _nec_message_received
conn=self, msg_obj=obj))
File ".../share/gajim/src/common/nec.py", line 74, in
push_incoming_event
if event_object.generate():
File ".../share/gajim/src/common/connection_handlers_events.py",
line 1468, in generate
if self.msghash in self.conn.received_message_hashes:
TypeError: argument of type 'instance' is not iterable
Defining received_message_hashes to be a list fixes this.
Signed-off-by: aszlig <[email protected]>
- - - - -
ab3b363e by Philipp Hörist at 2017-01-27T20:55:21+01:00
Merge branch 'fix-connection-mock' into 'gajim_0.16'
tests: Don't mock received_message_hashes
See merge request !47
- - - - -
1 changed file:
- test/lib/gajim_mocks.py
Changes:
=====================================
test/lib/gajim_mocks.py
=====================================
--- a/test/lib/gajim_mocks.py
+++ b/test/lib/gajim_mocks.py
@@ -24,6 +24,7 @@ class MockConnection(Mock, ConnectionHandlers):
self.blocked_groups = {}
self.sessions = {}
self.nested_group_delimiter = '::'
+ self.received_message_hashes = []
gajim.interface.instances[account] = {'infos': {}, 'disco': {},
'gc_config': {}, 'search': {}, 'sub_request': {}}
View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/27618b2dbe668cc81a41e381d44462a9868dc271...ab3b363ec473bf6a4aecb9749d4532e6129ef3f7
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits