summary refs log tree commit diff
path: root/tests/rest/client/test_shadow_banned.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-25 14:49:39 -0500
committerGitHub <noreply@github.com>2021-01-25 14:49:39 -0500
commit4a55d267eef1388690e6781b580910e341358f95 (patch)
tree15a03146d09d0b8c3c2f7ef51a3c9ab9123e61ba /tests/rest/client/test_shadow_banned.py
parentFix Python 3.5 old deps build by using a compatible pip version. (#9217) (diff)
downloadsynapse-4a55d267eef1388690e6781b580910e341358f95.tar.xz
Add an admin API for shadow-banning users. (#9209)
This expands the current shadow-banning feature to be usable via
the admin API and adds documentation for it.

A shadow-banned users receives successful responses to their
client-server API requests, but the events are not propagated into rooms.

Shadow-banning a user should be used as a tool of last resort and may lead
to confusing or broken behaviour for the client.
Diffstat (limited to 'tests/rest/client/test_shadow_banned.py')
-rw-r--r--tests/rest/client/test_shadow_banned.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/rest/client/test_shadow_banned.py b/tests/rest/client/test_shadow_banned.py
index e689c3fbea..0ebdf1415b 100644
--- a/tests/rest/client/test_shadow_banned.py
+++ b/tests/rest/client/test_shadow_banned.py
@@ -18,6 +18,7 @@ import synapse.rest.admin
 from synapse.api.constants import EventTypes
 from synapse.rest.client.v1 import directory, login, profile, room
 from synapse.rest.client.v2_alpha import room_upgrade_rest_servlet
+from synapse.types import UserID
 
 from tests import unittest
 
@@ -31,12 +32,7 @@ class _ShadowBannedBase(unittest.HomeserverTestCase):
         self.store = self.hs.get_datastore()
 
         self.get_success(
-            self.store.db_pool.simple_update(
-                table="users",
-                keyvalues={"name": self.banned_user_id},
-                updatevalues={"shadow_banned": True},
-                desc="shadow_ban",
-            )
+            self.store.set_shadow_banned(UserID.from_string(self.banned_user_id), True)
         )
 
         self.other_user_id = self.register_user("otheruser", "pass")