mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-13 22:35:27 -04:00
Type hints for tests.federation (#14991)
* Make tests.federation pass mypy * Untyped defs in tests.federation.transport * test methods return None * Remaining type hints in tests.federation * Changelog * Avoid an uncessary type-ignore
This commit is contained in:
parent
156cd88eef
commit
0f34abed7c
10 changed files with 127 additions and 94 deletions
|
@ -36,7 +36,9 @@ class FederationClientTest(FederatingHomeserverTestCase):
|
|||
login.register_servlets,
|
||||
]
|
||||
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, homeserver: HomeServer):
|
||||
def prepare(
|
||||
self, reactor: MemoryReactor, clock: Clock, homeserver: HomeServer
|
||||
) -> None:
|
||||
super().prepare(reactor, clock, homeserver)
|
||||
|
||||
# mock out the Agent used by the federation client, which is easier than
|
||||
|
@ -51,7 +53,7 @@ class FederationClientTest(FederatingHomeserverTestCase):
|
|||
self.creator = f"@creator:{self.OTHER_SERVER_NAME}"
|
||||
self.test_room_id = "!room_id"
|
||||
|
||||
def test_get_room_state(self):
|
||||
def test_get_room_state(self) -> None:
|
||||
# mock up some events to use in the response.
|
||||
# In real life, these would have things in `prev_events` and `auth_events`, but that's
|
||||
# a bit annoying to mock up, and the code under test doesn't care, so we don't bother.
|
||||
|
@ -140,7 +142,7 @@ class FederationClientTest(FederatingHomeserverTestCase):
|
|||
["m.room.create", "m.room.member", "m.room.power_levels"],
|
||||
)
|
||||
|
||||
def test_get_pdu_returns_nothing_when_event_does_not_exist(self):
|
||||
def test_get_pdu_returns_nothing_when_event_does_not_exist(self) -> None:
|
||||
"""No event should be returned when the event does not exist"""
|
||||
pulled_pdu_info = self.get_success(
|
||||
self.hs.get_federation_client().get_pdu(
|
||||
|
@ -151,11 +153,11 @@ class FederationClientTest(FederatingHomeserverTestCase):
|
|||
)
|
||||
self.assertEqual(pulled_pdu_info, None)
|
||||
|
||||
def test_get_pdu(self):
|
||||
def test_get_pdu(self) -> None:
|
||||
"""Test to make sure an event is returned by `get_pdu()`"""
|
||||
self._get_pdu_once()
|
||||
|
||||
def test_get_pdu_event_from_cache_is_pristine(self):
|
||||
def test_get_pdu_event_from_cache_is_pristine(self) -> None:
|
||||
"""Test that modifications made to events returned by `get_pdu()`
|
||||
do not propagate back to to the internal cache (events returned should
|
||||
be a copy).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue