Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jan 19, 2018
1 parent 56334c8 commit 6c22639
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 1 addition & 3 deletions tests/replication/slave/storage/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ def persist(
context = EventContext()
context.current_state_ids = state_ids
context.prev_state_ids = state_ids
elif not backfill:
else:
state_handler = self.hs.get_state_handler()
context = yield state_handler.compute_event_context(event)
else:
context = EventContext()

context.push_actions = push_actions

Expand Down
7 changes: 7 additions & 0 deletions tests/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def register_events(self, events):
for e in events:
self._event_id_to_event[e.event_id] = e

def store_state_group(self, *args, **kwargs):
self._next_group += 1
return self._next_group


class DictObj(dict):
def __init__(self, **kwargs):
Expand Down Expand Up @@ -144,6 +148,7 @@ def setUp(self):
"get_events",
"get_next_state_group",
"get_state_group_delta",
"store_state_group",
]
)
hs = Mock(spec_set=[
Expand Down Expand Up @@ -316,6 +321,7 @@ def test_branch_have_banned_conflict(self):
store = StateGroupStore()
self.store.get_state_groups_ids.side_effect = store.get_state_groups_ids
self.store.get_events = store.get_events
self.store.store_state_group = store.store_state_group
store.register_events(graph.walk())

context_store = {}
Expand Down Expand Up @@ -399,6 +405,7 @@ def test_branch_have_perms_conflict(self):
store = StateGroupStore()
self.store.get_state_groups_ids.side_effect = store.get_state_groups_ids
self.store.get_events = store.get_events
self.store.store_state_group = store.store_state_group
store.register_events(graph.walk())

context_store = {}
Expand Down

0 comments on commit 6c22639

Please sign in to comment.