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

Commit

Permalink
Add - unit test for module API "create_room" method.
Browse files Browse the repository at this point in the history
  • Loading branch information
buffless-matt committed Aug 2, 2022
1 parent 2c934f6 commit 1a86ec6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/module_api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from synapse.handlers.presence import UserPresenceState
from synapse.handlers.push_rules import InvalidRuleException
from synapse.rest import admin
from synapse.rest.client import login, notifications, presence, profile, room
from synapse.rest.client import directory, login, notifications, presence, profile, room
from synapse.types import create_requester

from tests.events.test_presence_router import send_presence_update, sync_presence
Expand All @@ -40,6 +40,7 @@ class ModuleApiTestCase(HomeserverTestCase):
presence.register_servlets,
profile.register_servlets,
notifications.register_servlets,
directory.register_servlets,
]

def prepare(self, reactor, clock, homeserver):
Expand Down Expand Up @@ -635,6 +636,21 @@ def test_check_push_rules_actions(self) -> None:
[{"set_tweak": "sound", "value": "default"}]
)

def test_create_room(self) -> None:
"""Test that modules can create a room."""
user_id = self.register_user("user", "password")

(result, _) = self.get_success(
self.module_api.create_room(user_id=user_id, config={}, ratelimit=False)
)
room_id = result["room_id"]

channel = self.make_request(
"GET",
f"/_matrix/client/r0/directory/list/room/{room_id}",
)
self.assertEqual(channel.code, 200, channel.result)


class ModuleApiWorkerTestCase(BaseMultiWorkerStreamTestCase):
"""For testing ModuleApi functionality in a multi-worker setup"""
Expand Down

0 comments on commit 1a86ec6

Please sign in to comment.