diff options
author | Neil Johnson <neil@matrix.org> | 2018-08-31 10:49:14 +0100 |
---|---|---|
committer | Neil Johnson <neil@matrix.org> | 2018-08-31 10:49:14 +0100 |
commit | ea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da (patch) | |
tree | 149068aa0096858c2ad9ff661da4b5108f3a8f98 /tests/api | |
parent | Port storage/ to Python 3 (#3725) (diff) | |
download | synapse-ea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da.tar.xz |
fix bug where preserved threepid user comes to sign up and server is mau blocked
Diffstat (limited to 'tests/api')
-rw-r--r-- | tests/api/test_auth.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py index 54e396d19d..f65a27e5f1 100644 --- a/tests/api/test_auth.py +++ b/tests/api/test_auth.py @@ -468,6 +468,23 @@ class AuthTestCase(unittest.TestCase): 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 + threepid = {'medium': 'email', 'address': 'reserved@server.com'} + unknown_threepid = {'medium': 'email', 'address': 'unreserved@server.com'} + self.hs.config.mau_limits_reserved_threepids = [threepid] + + yield self.store.register(user_id='user1', token="123", password_hash=None) + with self.assertRaises(ResourceLimitError): + yield self.auth.check_auth_blocking() + + with self.assertRaises(ResourceLimitError): + yield self.auth.check_auth_blocking(threepid=unknown_threepid) + + yield self.auth.check_auth_blocking(threepid=threepid) + + @defer.inlineCallbacks def test_hs_disabled(self): self.hs.config.hs_disabled = True self.hs.config.hs_disabled_message = "Reason for being disabled" |