mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-23 10:30:42 -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
|
@ -12,17 +12,23 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
from synapse.server import HomeServer
|
||||
from synapse.storage.databases.main.transactions import DestinationRetryTimings
|
||||
from synapse.util import Clock
|
||||
from synapse.util.retryutils import MAX_RETRY_INTERVAL
|
||||
|
||||
from tests.unittest import HomeserverTestCase
|
||||
|
||||
|
||||
class TransactionStoreTestCase(HomeserverTestCase):
|
||||
def prepare(self, reactor, clock, homeserver):
|
||||
def prepare(
|
||||
self, reactor: MemoryReactor, clock: Clock, homeserver: HomeServer
|
||||
) -> None:
|
||||
self.store = homeserver.get_datastores().main
|
||||
|
||||
def test_get_set_transactions(self):
|
||||
def test_get_set_transactions(self) -> None:
|
||||
"""Tests that we can successfully get a non-existent entry for
|
||||
destination retries, as well as testing tht we can set and get
|
||||
correctly.
|
||||
|
@ -44,18 +50,18 @@ class TransactionStoreTestCase(HomeserverTestCase):
|
|||
r,
|
||||
)
|
||||
|
||||
def test_initial_set_transactions(self):
|
||||
def test_initial_set_transactions(self) -> None:
|
||||
"""Tests that we can successfully set the destination retries (there
|
||||
was a bug around invalidating the cache that broke this)
|
||||
"""
|
||||
d = self.store.set_destination_retry_timings("example.com", 1000, 50, 100)
|
||||
self.get_success(d)
|
||||
|
||||
def test_large_destination_retry(self):
|
||||
def test_large_destination_retry(self) -> None:
|
||||
d = self.store.set_destination_retry_timings(
|
||||
"example.com", MAX_RETRY_INTERVAL, MAX_RETRY_INTERVAL, MAX_RETRY_INTERVAL
|
||||
)
|
||||
self.get_success(d)
|
||||
|
||||
d = self.store.get_destination_retry_timings("example.com")
|
||||
self.get_success(d)
|
||||
d2 = self.store.get_destination_retry_timings("example.com")
|
||||
self.get_success(d2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue