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

Commit 6b2dd48

Browse files
committed
Add a test for upgrading a room with a custom room type
1 parent 29600f1 commit 6b2dd48

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/rest/client/test_upgrade_room.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,33 @@ def test_space(self) -> None:
263263
self.assertIn((EventTypes.SpaceChild, self.room_id), state_ids)
264264
# The child that was removed should not be copied over.
265265
self.assertNotIn((EventTypes.SpaceChild, old_room_id), state_ids)
266+
267+
def test_custom_room_type(self) -> None:
268+
"""Test upgrading a room that has a custom room type set."""
269+
test_room_type = "com.example.my_custom_room_type"
270+
271+
# Create a room with a custom room type.
272+
room_id = self.helper.create_room_as(
273+
self.creator,
274+
tok=self.creator_token,
275+
extra_content={
276+
"creation_content": {EventContentFields.ROOM_TYPE: test_room_type}
277+
},
278+
)
279+
280+
# Upgrade the room!
281+
channel = self._upgrade_room(room_id=room_id)
282+
self.assertEqual(200, channel.code, channel.result)
283+
self.assertIn("replacement_room", channel.json_body)
284+
285+
new_room_id = channel.json_body["replacement_room"]
286+
287+
state_ids = self.get_success(self.store.get_current_state_ids(new_room_id))
288+
289+
# Ensure the new room is the same type as the old room.
290+
create_event = self.get_success(
291+
self.store.get_event(state_ids[(EventTypes.Create, "")])
292+
)
293+
self.assertEqual(
294+
create_event.content.get(EventContentFields.ROOM_TYPE), test_room_type
295+
)

0 commit comments

Comments
 (0)