summary refs log tree commit diff
path: root/tests/rest/admin
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-21 16:15:20 +0100
committerErik Johnston <erik@matrix.org>2020-10-21 16:53:40 +0100
commitd8902d4bd59bcecc46e595df5902385cf46c55d9 (patch)
treea152aa2fd9e6c672727df5f0fa28e33f0971b4df /tests/rest/admin
parentPrivacy policy applies to authenticated entity (diff)
downloadsynapse-d8902d4bd59bcecc46e595df5902385cf46c55d9.tar.xz
MAU limits are based off of the *authenticated* user
Diffstat (limited to 'tests/rest/admin')
-rw-r--r--tests/rest/admin/test_user.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rest/admin/test_user.py b/tests/rest/admin/test_user.py
index 754d13f179..8632c97713 100644
--- a/tests/rest/admin/test_user.py
+++ b/tests/rest/admin/test_user.py
@@ -1325,3 +1325,20 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase):
 
         # Sending an event on their behalf should work fine
         self.helper.send_event(room_id, "com.example.test", tok=puppet_token)
+
+    @override_config(
+        {"limit_usage_by_mau": True, "max_mau_value": 1, "mau_trial_days": 0}
+    )
+    def test_mau_limit(self):
+        # Create a room as the admin user. This will bump the monthly active users to 1.
+        room_id = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok)
+
+        # Trying to join as the other user should fail.
+        self.helper.join(
+            room_id, user=self.other_user, tok=self.other_user_tok, expect_code=403
+        )
+
+        # Logging in as the other user and joining a room should work, even
+        # though they should be denied.
+        puppet_token = self._get_token()
+        self.helper.join(room_id, user=self.other_user, tok=puppet_token)