Skip to content
Unverified Commit 46a19733 authored by aszlig's avatar aszlig
Browse files

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 40a3f80a, 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: default avataraszlig <aszlig@redmoonstudios.org>
parent 27618b2d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment