summary refs log tree commit diff
path: root/tests/module_api/test_api.py
diff options
context:
space:
mode:
authorAmanda Graven <amanda@amandag.net>2022-04-01 10:31:30 +0200
committerGitHub <noreply@github.com>2022-04-01 09:31:30 +0100
commit4e900ece42eb0d28c2773d328b4ab459b0d3aaf3 (patch)
treed7397f894506bbdc7bbf7bd5b25996664b8d1b14 /tests/module_api/test_api.py
parentMove MSC2654 support behind an experimental configuration flag. (#12295) (diff)
downloadsynapse-4e900ece42eb0d28c2773d328b4ab459b0d3aaf3.tar.xz
Add set_user_admin function to the module API (#12341)
Diffstat (limited to 'tests/module_api/test_api.py')
-rw-r--r--tests/module_api/test_api.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py
index 10dd94b549..36dfe5c36a 100644
--- a/tests/module_api/test_api.py
+++ b/tests/module_api/test_api.py
@@ -96,6 +96,20 @@ class ModuleApiTestCase(HomeserverTestCase):
         self.assertEqual(found_user.user_id.to_string(), user_id)
         self.assertIdentical(found_user.is_admin, True)
 
+    def test_can_set_admin(self):
+        user_id = self.get_success(
+            self.register_user(
+                "alice_wants_admin",
+                "1234",
+                displayname="Alice Powerhungry",
+                admin=False,
+            )
+        )
+        self.get_success(self.module_api.set_user_admin(user_id, True))
+        found_user = self.get_success(self.module_api.get_userinfo_by_id(user_id))
+        self.assertEqual(found_user.user_id.to_string(), user_id)
+        self.assertIdentical(found_user.is_admin, True)
+
     def test_get_userinfo_by_id(self):
         user_id = self.register_user("alice", "1234")
         found_user = self.get_success(self.module_api.get_userinfo_by_id(user_id))