Esempio n. 1
0
    def setUp(self):
        self.hostname = "red"

        self.mock_config = NonCallableMock()
        self.mock_config.signing_key = [MockKey()]

        hs = HomeServer(
            self.hostname,
            db_pool=None,
            datastore=NonCallableMock(spec_set=[
                "store_room",
                "snapshot_room",
                "persist_event",
                "get_joined_hosts_for_room",
            ]),
            http_client=NonCallableMock(spec_set=[]),
            notifier=NonCallableMock(spec_set=["on_new_room_event"]),
            handlers=NonCallableMock(spec_set=[
                "room_creation_handler",
                "message_handler",
            ]),
            auth=NonCallableMock(spec_set=["check", "add_auth_events"]),
            ratelimiter=NonCallableMock(spec_set=[
                "send_message",
            ]),
            config=self.mock_config,
        )

        self.federation = NonCallableMock(spec_set=[
            "handle_new_event",
        ])

        self.handlers = hs.get_handlers()

        self.handlers.room_creation_handler = RoomCreationHandler(hs)
        self.room_creation_handler = self.handlers.room_creation_handler

        self.message_handler = self.handlers.message_handler

        self.ratelimiter = hs.get_ratelimiter()
        self.ratelimiter.send_message.return_value = (True, 0)
Esempio n. 2
0
 def build_room_creation_handler(self):
     return RoomCreationHandler(self)
Esempio n. 3
0
 def get_room_creation_handler(self) -> RoomCreationHandler:
     return RoomCreationHandler(self)