diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-08-27 15:11:51 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-08-27 15:11:51 +0100 |
commit | a0d1f5a014cf6000cc39231278408789e0019fe8 (patch) | |
tree | fbcf3765aea5fc0ed9a0bad99f41a5a195b02d51 /tests/test_state.py | |
parent | Remove call to get_federation from homeserver (diff) | |
download | synapse-a0d1f5a014cf6000cc39231278408789e0019fe8.tar.xz |
Start updating state handling to use snapshots
Diffstat (limited to '')
-rw-r--r-- | tests/test_state.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_state.py b/tests/test_state.py index e64d15a3a2..58fd0bf3be 100644 --- a/tests/test_state.py +++ b/tests/test_state.py @@ -243,21 +243,24 @@ class StateTestCase(unittest.TestCase): state_pdu = new_fake_pdu_entry("C", "test", "mem", "x", "A", 20) - tup = ("pdu_id", "origin.com", 5) - pdus = [tup] + snapshot = Mock() + snapshot.prev_state_pdu = state_pdu + event_id = "pdu_id@origin.com" - self.persistence.get_latest_pdus_in_context.return_value = pdus - self.persistence.get_current_state_pdu.return_value = state_pdu + def fill_out_prev_events(event): + event.prev_events = [event_id] + event.depth = 6 + snapshot.fill_out_prev_events = fill_out_prev_events - yield self.state.handle_new_event(event) + yield self.state.handle_new_event(event, snapshot) - self.assertLess(tup[2], event.depth) + self.assertLess(5, event.depth) self.assertEquals(1, len(event.prev_events)) prev_id = event.prev_events[0] - self.assertEqual(encode_event_id(tup[0], tup[1]), prev_id) + self.assertEqual(event_id, prev_id) self.assertEqual( encode_event_id(state_pdu.pdu_id, state_pdu.origin), |