mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-12 02:50:02 -04:00
Require types in tests.storage. (#14646)
Adds missing type hints to `tests.storage` package and does not allow untyped definitions.
This commit is contained in:
parent
94bc21e69f
commit
3ac412b4e2
36 changed files with 489 additions and 341 deletions
|
@ -14,13 +14,17 @@
|
|||
|
||||
from typing import Iterable, Optional, Set
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
from synapse.api.constants import AccountDataTypes
|
||||
from synapse.server import HomeServer
|
||||
from synapse.util import Clock
|
||||
|
||||
from tests import unittest
|
||||
|
||||
|
||||
class IgnoredUsersTestCase(unittest.HomeserverTestCase):
|
||||
def prepare(self, hs, reactor, clock):
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
self.store = self.hs.get_datastores().main
|
||||
self.user = "@user:test"
|
||||
|
||||
|
@ -55,7 +59,7 @@ class IgnoredUsersTestCase(unittest.HomeserverTestCase):
|
|||
expected_ignored_user_ids,
|
||||
)
|
||||
|
||||
def test_ignoring_users(self):
|
||||
def test_ignoring_users(self) -> None:
|
||||
"""Basic adding/removing of users from the ignore list."""
|
||||
self._update_ignore_list("@other:test", "@another:remote")
|
||||
self.assert_ignored(self.user, {"@other:test", "@another:remote"})
|
||||
|
@ -82,7 +86,7 @@ class IgnoredUsersTestCase(unittest.HomeserverTestCase):
|
|||
# Check the removed user.
|
||||
self.assert_ignorers("@another:remote", {self.user})
|
||||
|
||||
def test_caching(self):
|
||||
def test_caching(self) -> None:
|
||||
"""Ensure that caching works properly between different users."""
|
||||
# The first user ignores a user.
|
||||
self._update_ignore_list("@other:test")
|
||||
|
@ -99,7 +103,7 @@ class IgnoredUsersTestCase(unittest.HomeserverTestCase):
|
|||
self.assert_ignored(self.user, set())
|
||||
self.assert_ignorers("@other:test", {"@second:test"})
|
||||
|
||||
def test_invalid_data(self):
|
||||
def test_invalid_data(self) -> None:
|
||||
"""Invalid data ends up clearing out the ignored users list."""
|
||||
# Add some data and ensure it is there.
|
||||
self._update_ignore_list("@other:test")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue