diff options
author | Jason Robinson <jasonr@matrix.org> | 2019-09-12 11:24:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-12 11:24:33 +0300 |
commit | f1b40694ea7ca460df1b97ff518e40d7e6fe4975 (patch) | |
tree | 91574da19ab927f1d6ccc2e7122c2c6c4ad172aa /tests | |
parent | Use the v2 Identity Service API for lookups (MSC2134 + MSC2140) (#5976) (diff) | |
parent | Ensure support users can be registered even if MAU limit is reached (diff) | |
download | synapse-f1b40694ea7ca460df1b97ff518e40d7e6fe4975.tar.xz |
Merge pull request #6020 from matrix-org/jaywink/allow-support-users-to-register
Ensure support users can be registered even if MAU limit is reached
Diffstat (limited to 'tests')
-rw-r--r-- | tests/api/test_auth.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py index c0cb8ef296..6121efcfa9 100644 --- a/tests/api/test_auth.py +++ b/tests/api/test_auth.py @@ -21,6 +21,7 @@ from twisted.internet import defer import synapse.handlers.auth from synapse.api.auth import Auth +from synapse.api.constants import UserTypes from synapse.api.errors import ( AuthError, Codes, @@ -336,6 +337,23 @@ class AuthTestCase(unittest.TestCase): yield self.auth.check_auth_blocking() @defer.inlineCallbacks + def test_blocking_mau__depending_on_user_type(self): + self.hs.config.max_mau_value = 50 + self.hs.config.limit_usage_by_mau = True + + self.store.get_monthly_active_count = Mock(return_value=defer.succeed(100)) + # Support users allowed + yield self.auth.check_auth_blocking(user_type=UserTypes.SUPPORT) + self.store.get_monthly_active_count = Mock(return_value=defer.succeed(100)) + # Bots not allowed + with self.assertRaises(ResourceLimitError): + yield self.auth.check_auth_blocking(user_type=UserTypes.BOT) + self.store.get_monthly_active_count = Mock(return_value=defer.succeed(100)) + # Real users not allowed + with self.assertRaises(ResourceLimitError): + yield self.auth.check_auth_blocking() + + @defer.inlineCallbacks def test_reserved_threepid(self): self.hs.config.limit_usage_by_mau = True self.hs.config.max_mau_value = 1 |