diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-02-07 15:30:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 15:30:04 +0000 |
commit | 799001f2c0b31d72b95a252a3808da25987e1ed3 (patch) | |
tree | 4ef02d19d99632feae18b69907d8a4913ea281ce /tests/replication | |
parent | Add typing to synapse.federation.sender (#6871) (diff) | |
download | synapse-799001f2c0b31d72b95a252a3808da25987e1ed3.tar.xz |
Add a `make_event_from_dict` method (#6858)
... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
Diffstat (limited to 'tests/replication')
-rw-r--r-- | tests/replication/slave/storage/test_events.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/replication/slave/storage/test_events.py b/tests/replication/slave/storage/test_events.py index b1b037006d..d31210fbe4 100644 --- a/tests/replication/slave/storage/test_events.py +++ b/tests/replication/slave/storage/test_events.py @@ -15,7 +15,7 @@ import logging from canonicaljson import encode_canonical_json -from synapse.events import FrozenEvent, _EventInternalMetadata +from synapse.events import FrozenEvent, _EventInternalMetadata, make_event_from_dict from synapse.events.snapshot import EventContext from synapse.handlers.room import RoomEventSource from synapse.replication.slave.storage.events import SlavedEventStore @@ -90,7 +90,9 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase): msg_dict["content"] = {} msg_dict["unsigned"]["redacted_by"] = redaction.event_id msg_dict["unsigned"]["redacted_because"] = redaction - redacted = FrozenEvent(msg_dict, msg.internal_metadata.get_dict()) + redacted = make_event_from_dict( + msg_dict, internal_metadata_dict=msg.internal_metadata.get_dict() + ) self.check("get_event", [msg.event_id], redacted) def test_backfilled_redactions(self): @@ -110,7 +112,9 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase): msg_dict["content"] = {} msg_dict["unsigned"]["redacted_by"] = redaction.event_id msg_dict["unsigned"]["redacted_because"] = redaction - redacted = FrozenEvent(msg_dict, msg.internal_metadata.get_dict()) + redacted = make_event_from_dict( + msg_dict, internal_metadata_dict=msg.internal_metadata.get_dict() + ) self.check("get_event", [msg.event_id], redacted) def test_invites(self): @@ -345,7 +349,7 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase): if redacts is not None: event_dict["redacts"] = redacts - event = FrozenEvent(event_dict, internal_metadata_dict=internal) + event = make_event_from_dict(event_dict, internal_metadata_dict=internal) self.event_id += 1 |