diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-08 20:13:27 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-08 20:13:27 +0100 |
commit | 942d8412c49a1d481f0bedd189eb1598629b103c (patch) | |
tree | ad199a4bd331f2594b98b0094f070a8e7bc68d9c /tests/test_state.py | |
parent | Added number of users in recent rooms. (diff) | |
download | synapse-942d8412c49a1d481f0bedd189eb1598629b103c.tar.xz |
Handle the case where we don't have a common ancestor
Diffstat (limited to '')
-rw-r--r-- | tests/test_state.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_state.py b/tests/test_state.py index 4512475ebd..a9fc3fb85c 100644 --- a/tests/test_state.py +++ b/tests/test_state.py @@ -441,6 +441,30 @@ class StateTestCase(unittest.TestCase): self.assertEqual(1, self.persistence.update_current_state.call_count) @defer.inlineCallbacks + def test_no_common_ancestor(self): + # We do a direct overwriting of the old state, i.e., the new state + # points to the old state. + + old_pdu = new_fake_pdu_entry("A", "test", "mem", "x", None, 5) + new_pdu = new_fake_pdu_entry("B", "test", "mem", "x", None, 10) + + self.persistence.get_unresolved_state_tree.return_value = ( + (ReturnType([new_pdu], [old_pdu]), None) + ) + + is_new = yield self.state.handle_new_state(new_pdu) + + self.assertTrue(is_new) + + self.persistence.get_unresolved_state_tree.assert_called_once_with( + new_pdu + ) + + self.assertEqual(1, self.persistence.update_current_state.call_count) + + self.assertFalse(self.replication.get_pdu.called) + + @defer.inlineCallbacks def test_new_event(self): event = Mock() event.event_id = "12123123@test" |