|
16 | 16 | from twisted.internet import defer
|
17 | 17 |
|
18 | 18 | from synapse.api.constants import EduTypes, EventTypes
|
19 |
| -from synapse.api.errors import SynapseError |
20 | 19 | from synapse.events import EventBase
|
21 | 20 | from synapse.federation.units import Transaction
|
22 | 21 | from synapse.handlers.presence import UserPresenceState
|
@@ -639,27 +638,31 @@ def test_check_push_rules_actions(self) -> None:
|
639 | 638 |
|
640 | 639 | def test_create_room(self) -> None:
|
641 | 640 | """Test that modules can create a room."""
|
642 |
| - # First test user existence verification. |
| 641 | + # First test user validation (i.e. user is local). |
643 | 642 | self.get_failure(
|
644 | 643 | self.module_api.create_room(
|
645 |
| - user_id="@user:test", config={}, ratelimit=False |
| 644 | + user_id=f"@user:{self.module_api.server_name}abc", |
| 645 | + config={}, |
| 646 | + ratelimit=False, |
646 | 647 | ),
|
647 |
| - SynapseError, |
| 648 | + RuntimeError, |
648 | 649 | )
|
649 | 650 |
|
650 | 651 | # Now do the happy path.
|
651 | 652 | user_id = self.register_user("user", "password")
|
| 653 | + access_token = self.login(user_id, "password") |
652 | 654 |
|
653 |
| - (result, _) = self.get_success( |
| 655 | + room_id, _ = self.get_success( |
654 | 656 | self.module_api.create_room(user_id=user_id, config={}, ratelimit=False)
|
655 | 657 | )
|
656 |
| - room_id = result["room_id"] |
657 | 658 |
|
658 | 659 | channel = self.make_request(
|
659 | 660 | "GET",
|
660 |
| - f"/_matrix/client/r0/directory/list/room/{room_id}", |
| 661 | + f"/_matrix/client/v3/rooms/{room_id}/state/m.room.create", |
| 662 | + access_token=access_token, |
661 | 663 | )
|
662 | 664 | self.assertEqual(channel.code, 200, channel.result)
|
| 665 | + self.assertEqual(channel.json_body["creator"], user_id) |
663 | 666 |
|
664 | 667 |
|
665 | 668 | class ModuleApiWorkerTestCase(BaseMultiWorkerStreamTestCase):
|
|
0 commit comments