mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-25 15:50:29 -04:00
Add missing type hints to tests.handlers. (#14680)
And do not allow untyped defs in tests.handlers.
This commit is contained in:
parent
54c012c5a8
commit
652d1669c5
22 changed files with 527 additions and 378 deletions
|
@ -14,6 +14,8 @@
|
|||
from typing import Optional
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
from synapse.api.constants import EventTypes, JoinRules
|
||||
from synapse.api.errors import Codes, ResourceLimitError
|
||||
from synapse.api.filtering import Filtering
|
||||
|
@ -23,6 +25,7 @@ from synapse.rest import admin
|
|||
from synapse.rest.client import knock, login, room
|
||||
from synapse.server import HomeServer
|
||||
from synapse.types import UserID, create_requester
|
||||
from synapse.util import Clock
|
||||
|
||||
import tests.unittest
|
||||
import tests.utils
|
||||
|
@ -39,7 +42,7 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
room.register_servlets,
|
||||
]
|
||||
|
||||
def prepare(self, reactor, clock, hs: HomeServer):
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
self.sync_handler = self.hs.get_sync_handler()
|
||||
self.store = self.hs.get_datastores().main
|
||||
|
||||
|
@ -47,7 +50,7 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
# modify its config instead of the hs'
|
||||
self.auth_blocking = self.hs.get_auth_blocking()
|
||||
|
||||
def test_wait_for_sync_for_user_auth_blocking(self):
|
||||
def test_wait_for_sync_for_user_auth_blocking(self) -> None:
|
||||
user_id1 = "@user1:test"
|
||||
user_id2 = "@user2:test"
|
||||
sync_config = generate_sync_config(user_id1)
|
||||
|
@ -82,7 +85,7 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
)
|
||||
self.assertEqual(e.value.errcode, Codes.RESOURCE_LIMIT_EXCEEDED)
|
||||
|
||||
def test_unknown_room_version(self):
|
||||
def test_unknown_room_version(self) -> None:
|
||||
"""
|
||||
A room with an unknown room version should not break sync (and should be excluded).
|
||||
"""
|
||||
|
@ -186,7 +189,7 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
|
|||
self.assertNotIn(invite_room, [r.room_id for r in result.invited])
|
||||
self.assertNotIn(knock_room, [r.room_id for r in result.knocked])
|
||||
|
||||
def test_ban_wins_race_with_join(self):
|
||||
def test_ban_wins_race_with_join(self) -> None:
|
||||
"""Rooms shouldn't appear under "joined" if a join loses a race to a ban.
|
||||
|
||||
A complicated edge case. Imagine the following scenario:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue