mirror of
https://github.com/element-hq/synapse
synced 2024-09-12 07:05:12 +00:00
fix tests to accomodate new structure of DAG after room creation
This commit is contained in:
parent
7020aeac52
commit
8f8a264fb2
3 changed files with 11 additions and 13 deletions
|
@ -222,9 +222,10 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
)
|
||||
self.assertEqual(len(alice_sync_result.joined), 1)
|
||||
self.assertEqual(alice_sync_result.joined[0].room_id, room_id)
|
||||
last_room_creation_event_id = (
|
||||
alice_sync_result.joined[0].timeline.events[-1].event_id
|
||||
)
|
||||
last_room_creation_event_ids = [
|
||||
alice_sync_result.joined[0].timeline.events[-1].event_id,
|
||||
alice_sync_result.joined[0].timeline.events[-2].event_id,
|
||||
]
|
||||
|
||||
# Eve, a ne'er-do-well, registers.
|
||||
eve = self.register_user("eve", "password")
|
||||
|
@ -250,7 +251,7 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
self.hs.get_datastores().main,
|
||||
"get_prev_events_for_room",
|
||||
new_callable=MagicMock,
|
||||
return_value=make_awaitable([last_room_creation_event_id]),
|
||||
return_value=make_awaitable(last_room_creation_event_ids),
|
||||
)
|
||||
with mocked_get_prev_events:
|
||||
self.helper.join(room_id, eve, tok=eve_token)
|
||||
|
|
|
@ -710,7 +710,7 @@ class RoomsCreateTestCase(RoomBase):
|
|||
self.assertEqual(HTTPStatus.OK, channel.code, channel.result)
|
||||
self.assertTrue("room_id" in channel.json_body)
|
||||
assert channel.resource_usage is not None
|
||||
self.assertEqual(44, channel.resource_usage.db_txn_count)
|
||||
self.assertEqual(36, channel.resource_usage.db_txn_count)
|
||||
|
||||
def test_post_room_initial_state(self) -> None:
|
||||
# POST with initial_state config key, expect new room id
|
||||
|
@ -723,7 +723,7 @@ class RoomsCreateTestCase(RoomBase):
|
|||
self.assertEqual(HTTPStatus.OK, channel.code, channel.result)
|
||||
self.assertTrue("room_id" in channel.json_body)
|
||||
assert channel.resource_usage is not None
|
||||
self.assertEqual(50, channel.resource_usage.db_txn_count)
|
||||
self.assertEqual(38, channel.resource_usage.db_txn_count)
|
||||
|
||||
def test_post_room_visibility_key(self) -> None:
|
||||
# POST with visibility config key, expect new room id
|
||||
|
|
|
@ -46,10 +46,9 @@ class MessageAcceptTests(unittest.HomeserverTestCase):
|
|||
user_id = UserID("us", "test")
|
||||
our_user = create_requester(user_id)
|
||||
room_creator = self.homeserver.get_room_creation_handler()
|
||||
config = {"preset": "public_chat"}
|
||||
self.room_id = self.get_success(
|
||||
room_creator.create_room(
|
||||
our_user, room_creator._presets_dict["public_chat"], ratelimit=False
|
||||
)
|
||||
room_creator.create_room(our_user, config, ratelimit=False)
|
||||
)[0]["room_id"]
|
||||
|
||||
self.store = self.homeserver.get_datastores().main
|
||||
|
@ -99,10 +98,8 @@ class MessageAcceptTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
|
||||
# Make sure we actually joined the room
|
||||
self.assertEqual(
|
||||
self.get_success(self.store.get_latest_event_ids_in_room(self.room_id))[0],
|
||||
"$join:test.serv",
|
||||
)
|
||||
res = self.get_success(self.store.get_latest_event_ids_in_room(self.room_id))
|
||||
assert "$join:test.serv" in res
|
||||
|
||||
def test_cant_hide_direct_ancestors(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue