Beispiel #1
0
    def setUp(self):
        self.hostname = "test"
        hs = HomeServer(
            self.hostname,
            db_pool=None,
            datastore=NonCallableMock(spec_set=[
                "persist_event",
                "store_room",
                "get_room",
            ]),
            resource_for_federation=NonCallableMock(),
            http_client=NonCallableMock(spec_set=[]),
            notifier=NonCallableMock(spec_set=["on_new_room_event"]),
            handlers=NonCallableMock(spec_set=[
                "room_member_handler",
                "federation_handler",
            ]),
        )

        self.datastore = hs.get_datastore()
        self.handlers = hs.get_handlers()
        self.notifier = hs.get_notifier()
        self.hs = hs

        self.handlers.federation_handler = FederationHandler(self.hs)
Beispiel #2
0
    def setUp(self):

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

        self.state_handler = NonCallableMock(spec_set=[
            "compute_event_context",
        ])

        self.auth = NonCallableMock(spec_set=[
            "check",
            "check_host_in_room",
        ])

        self.hostname = "test"
        hs = HomeServer(
            self.hostname,
            db_pool=None,
            datastore=NonCallableMock(spec_set=[
                "persist_event",
                "store_room",
                "get_room",
                "get_destination_retry_timings",
                "set_destination_retry_timings",
            ]),
            resource_for_federation=NonCallableMock(),
            http_client=NonCallableMock(spec_set=[]),
            notifier=NonCallableMock(spec_set=["on_new_room_event"]),
            handlers=NonCallableMock(spec_set=[
                "room_member_handler",
                "federation_handler",
            ]),
            config=self.mock_config,
            auth=self.auth,
            state_handler=self.state_handler,
            keyring=Mock(),
        )

        self.datastore = hs.get_datastore()
        self.handlers = hs.get_handlers()
        self.notifier = hs.get_notifier()
        self.hs = hs

        self.handlers.federation_handler = FederationHandler(self.hs)
Beispiel #3
0
 def get_federation_handler(self) -> FederationHandler:
     return FederationHandler(self)