mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 07:54:48 -04:00
Convert stats and related calls to async/await (#8192)
This commit is contained in:
parent
b71d4a094c
commit
b49a5b9307
8 changed files with 78 additions and 77 deletions
|
@ -20,8 +20,6 @@ import urllib.parse
|
|||
|
||||
from mock import Mock
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
import synapse.rest.admin
|
||||
from synapse.api.constants import UserTypes
|
||||
from synapse.api.errors import HttpResponseException, ResourceLimitError
|
||||
|
@ -29,6 +27,7 @@ from synapse.rest.client.v1 import login
|
|||
from synapse.rest.client.v2_alpha import sync
|
||||
|
||||
from tests import unittest
|
||||
from tests.test_utils import make_awaitable
|
||||
from tests.unittest import override_config
|
||||
|
||||
|
||||
|
@ -338,7 +337,7 @@ class UserRegisterTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
# Set monthly active users to the limit
|
||||
store.get_monthly_active_count = Mock(
|
||||
return_value=defer.succeed(self.hs.config.max_mau_value)
|
||||
side_effect=lambda: make_awaitable(self.hs.config.max_mau_value)
|
||||
)
|
||||
# Check that the blocking of monthly active users is working as expected
|
||||
# The registration of a new user fails due to the limit
|
||||
|
@ -592,7 +591,7 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
# Set monthly active users to the limit
|
||||
self.store.get_monthly_active_count = Mock(
|
||||
return_value=defer.succeed(self.hs.config.max_mau_value)
|
||||
side_effect=lambda: make_awaitable(self.hs.config.max_mau_value)
|
||||
)
|
||||
# Check that the blocking of monthly active users is working as expected
|
||||
# The registration of a new user fails due to the limit
|
||||
|
@ -632,7 +631,7 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
# Set monthly active users to the limit
|
||||
self.store.get_monthly_active_count = Mock(
|
||||
return_value=defer.succeed(self.hs.config.max_mau_value)
|
||||
side_effect=lambda: make_awaitable(self.hs.config.max_mau_value)
|
||||
)
|
||||
# Check that the blocking of monthly active users is working as expected
|
||||
# The registration of a new user fails due to the limit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue