mirror of
https://github.com/element-hq/synapse
synced 2024-10-02 12:42:41 +00:00
Add actual typing for params (not just docstrings)
See https://github.com/element-hq/synapse/pull/17167#discussion_r1611301044
This commit is contained in:
parent
6606ac1d07
commit
ab0b844ce1
2 changed files with 23 additions and 34 deletions
|
@ -20,14 +20,10 @@
|
|||
#
|
||||
from parameterized import parameterized_class
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
from synapse.api.constants import EduTypes
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client import login, sendtodevice, sync
|
||||
from synapse.server import HomeServer
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util import Clock
|
||||
|
||||
from tests.unittest import HomeserverTestCase, override_config
|
||||
|
||||
|
@ -48,10 +44,13 @@ class SendToDeviceTestCase(HomeserverTestCase):
|
|||
Test `/sendToDevice` will deliver messages across to people receiving them over `/sync`.
|
||||
|
||||
Attributes:
|
||||
sync_endpoint (str): The endpoint under test to use for syncing.
|
||||
experimental_features (JsonDict): The experimental features homeserver config to use.
|
||||
sync_endpoint: The endpoint under test to use for syncing.
|
||||
experimental_features: The experimental features homeserver config to use.
|
||||
"""
|
||||
|
||||
sync_endpoint: str
|
||||
experimental_features: JsonDict
|
||||
|
||||
servlets = [
|
||||
admin.register_servlets,
|
||||
login.register_servlets,
|
||||
|
@ -61,14 +60,8 @@ class SendToDeviceTestCase(HomeserverTestCase):
|
|||
|
||||
def default_config(self) -> JsonDict:
|
||||
config = super().default_config()
|
||||
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
|
||||
return config
|
||||
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
|
||||
# throughout the test cases
|
||||
self.sync_endpoint: str = self.sync_endpoint
|
||||
|
||||
def test_user_to_user(self) -> None:
|
||||
"""A to-device message from one user to another should get delivered"""
|
||||
|
||||
|
|
|
@ -704,10 +704,13 @@ class DeviceListSyncTestCase(unittest.HomeserverTestCase):
|
|||
Tests regarding device list (`device_lists`) changes.
|
||||
|
||||
Attributes:
|
||||
sync_endpoint (str): The endpoint under test to use for syncing.
|
||||
experimental_features (JsonDict): The experimental features homeserver config to use.
|
||||
sync_endpoint: The endpoint under test to use for syncing.
|
||||
experimental_features: The experimental features homeserver config to use.
|
||||
"""
|
||||
|
||||
sync_endpoint: str
|
||||
experimental_features: JsonDict
|
||||
|
||||
servlets = [
|
||||
synapse.rest.admin.register_servlets,
|
||||
login.register_servlets,
|
||||
|
@ -718,14 +721,9 @@ class DeviceListSyncTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
def default_config(self) -> JsonDict:
|
||||
config = super().default_config()
|
||||
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
|
||||
config["experimental_features"] = self.experimental_features
|
||||
return config
|
||||
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
|
||||
# throughout the test cases
|
||||
self.sync_endpoint: str = self.sync_endpoint
|
||||
|
||||
def test_receiving_local_device_list_changes(self) -> None:
|
||||
"""Tests that a local users that share a room receive each other's device list
|
||||
changes.
|
||||
|
@ -917,10 +915,13 @@ class DeviceOneTimeKeysSyncTestCase(unittest.HomeserverTestCase):
|
|||
Tests regarding device one time keys (`device_one_time_keys_count`) changes.
|
||||
|
||||
Attributes:
|
||||
sync_endpoint (str): The endpoint under test to use for syncing.
|
||||
experimental_features (JsonDict): The experimental features homeserver config to use.
|
||||
sync_endpoint: The endpoint under test to use for syncing.
|
||||
experimental_features: The experimental features homeserver config to use.
|
||||
"""
|
||||
|
||||
sync_endpoint: str
|
||||
experimental_features: JsonDict
|
||||
|
||||
servlets = [
|
||||
synapse.rest.admin.register_servlets,
|
||||
login.register_servlets,
|
||||
|
@ -930,14 +931,10 @@ class DeviceOneTimeKeysSyncTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
def default_config(self) -> JsonDict:
|
||||
config = super().default_config()
|
||||
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
|
||||
config["experimental_features"] = self.experimental_features
|
||||
return config
|
||||
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
|
||||
# throughout the test cases
|
||||
self.sync_endpoint: str = self.sync_endpoint
|
||||
|
||||
self.e2e_keys_handler = hs.get_e2e_keys_handler()
|
||||
|
||||
def test_no_device_one_time_keys(self) -> None:
|
||||
|
@ -1029,10 +1026,13 @@ class DeviceUnusedFallbackKeySyncTestCase(unittest.HomeserverTestCase):
|
|||
Tests regarding device one time keys (`device_unused_fallback_key_types`) changes.
|
||||
|
||||
Attributes:
|
||||
sync_endpoint (str): The endpoint under test to use for syncing.
|
||||
experimental_features (JsonDict): The experimental features homeserver config to use.
|
||||
sync_endpoint: The endpoint under test to use for syncing.
|
||||
experimental_features: The experimental features homeserver config to use.
|
||||
"""
|
||||
|
||||
sync_endpoint: str
|
||||
experimental_features: JsonDict
|
||||
|
||||
servlets = [
|
||||
synapse.rest.admin.register_servlets,
|
||||
login.register_servlets,
|
||||
|
@ -1042,14 +1042,10 @@ class DeviceUnusedFallbackKeySyncTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
def default_config(self) -> JsonDict:
|
||||
config = super().default_config()
|
||||
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
|
||||
config["experimental_features"] = self.experimental_features
|
||||
return config
|
||||
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
|
||||
# throughout the test cases
|
||||
self.sync_endpoint: str = self.sync_endpoint
|
||||
|
||||
self.store = self.hs.get_datastores().main
|
||||
self.e2e_keys_handler = hs.get_e2e_keys_handler()
|
||||
|
||||
|
|
Loading…
Reference in a new issue