summary refs log tree commit diff
path: root/tests/test_mau.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-09-26 15:16:02 +0100
committerNeil Johnson <neil@matrix.org>2018-09-26 15:16:02 +0100
commit0d14119d428c62ef57bc91912b86361db2c8e9c3 (patch)
tree9fe0c1191c86c5a8012bdf0c9c0a1f03565436c5 /tests/test_mau.py
parentMerge pull request #3927 from matrix-org/erikj/handle_background_errors (diff)
downloadsynapse-github/neilj/batch-unsert-mau-users.tar.xz
Diffstat (limited to 'tests/test_mau.py')
-rw-r--r--tests/test_mau.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_mau.py b/tests/test_mau.py

index bdbacb8448..b38935d8b6 100644 --- a/tests/test_mau.py +++ b/tests/test_mau.py
@@ -16,6 +16,7 @@ """Tests REST events for /rooms paths.""" import json +import logging from mock import Mock, NonCallableMock @@ -32,6 +33,9 @@ from tests.server import ( render, setup_test_homeserver, ) +logger = logging.getLogger(__name__) + +ONE_HOUR = 60 * 60 * 1000 class TestMauLimit(unittest.TestCase): @@ -69,12 +73,15 @@ class TestMauLimit(unittest.TestCase): sync.register_servlets(self.hs, self.resource) def test_simple_deny_mau(self): + # Create and sync so that the MAU counts get updated token1 = self.create_user("kermit1") + logger.debug("create kermit1 token is %s" % token1) self.do_sync_for_user(token1) token2 = self.create_user("kermit2") self.do_sync_for_user(token2) - + # Because adding to + self.reactor.advance(ONE_HOUR) # We've created and activated two users, we shouldn't be able to # register new users with self.assertRaises(SynapseError) as cm: @@ -102,6 +109,7 @@ class TestMauLimit(unittest.TestCase): token3 = self.create_user("kermit3") self.do_sync_for_user(token3) + @unittest.DEBUG def test_trial_delay(self): self.hs.config.mau_trial_days = 1 @@ -120,6 +128,8 @@ class TestMauLimit(unittest.TestCase): self.do_sync_for_user(token1) self.do_sync_for_user(token2) + self.reactor.advance(ONE_HOUR) + # But the third should fail with self.assertRaises(SynapseError) as cm: self.do_sync_for_user(token3)