Skip to content
Snippets Groups Projects
Commit 1e77ac66 authored by Richard van der Hoff's avatar Richard van der Hoff
Browse files

Fix broken unit test

We need power levels for this test to do what it is supposed to do.
parent a502cfec
No related branches found
No related tags found
No related merge requests found
...@@ -606,6 +606,14 @@ class StateTestCase(unittest.TestCase): ...@@ -606,6 +606,14 @@ class StateTestCase(unittest.TestCase):
} }
) )
power_levels = create_event(
type=EventTypes.PowerLevels, state_key="",
content={"users": {
"@foo:bar": "100",
"@user_id:example.com": "100",
}}
)
creation = create_event( creation = create_event(
type=EventTypes.Create, state_key="", type=EventTypes.Create, state_key="",
content={"creator": "@foo:bar"} content={"creator": "@foo:bar"}
...@@ -613,12 +621,14 @@ class StateTestCase(unittest.TestCase): ...@@ -613,12 +621,14 @@ class StateTestCase(unittest.TestCase):
old_state_1 = [ old_state_1 = [
creation, creation,
power_levels,
member_event, member_event,
create_event(type="test1", state_key="1", depth=1), create_event(type="test1", state_key="1", depth=1),
] ]
old_state_2 = [ old_state_2 = [
creation, creation,
power_levels,
member_event, member_event,
create_event(type="test1", state_key="1", depth=2), create_event(type="test1", state_key="1", depth=2),
] ]
...@@ -633,7 +643,7 @@ class StateTestCase(unittest.TestCase): ...@@ -633,7 +643,7 @@ class StateTestCase(unittest.TestCase):
) )
self.assertEqual( self.assertEqual(
old_state_2[2].event_id, context.current_state_ids[("test1", "1")] old_state_2[3].event_id, context.current_state_ids[("test1", "1")]
) )
# Reverse the depth to make sure we are actually using the depths # Reverse the depth to make sure we are actually using the depths
...@@ -641,12 +651,14 @@ class StateTestCase(unittest.TestCase): ...@@ -641,12 +651,14 @@ class StateTestCase(unittest.TestCase):
old_state_1 = [ old_state_1 = [
creation, creation,
power_levels,
member_event, member_event,
create_event(type="test1", state_key="1", depth=2), create_event(type="test1", state_key="1", depth=2),
] ]
old_state_2 = [ old_state_2 = [
creation, creation,
power_levels,
member_event, member_event,
create_event(type="test1", state_key="1", depth=1), create_event(type="test1", state_key="1", depth=1),
] ]
...@@ -659,7 +671,7 @@ class StateTestCase(unittest.TestCase): ...@@ -659,7 +671,7 @@ class StateTestCase(unittest.TestCase):
) )
self.assertEqual( self.assertEqual(
old_state_1[2].event_id, context.current_state_ids[("test1", "1")] old_state_1[3].event_id, context.current_state_ids[("test1", "1")]
) )
def _get_context(self, event, prev_event_id_1, old_state_1, prev_event_id_2, def _get_context(self, event, prev_event_id_1, old_state_1, prev_event_id_2,
......
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