diff options
author | Neil Johnson <neil@matrix.org> | 2018-12-14 18:20:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 18:20:59 +0000 |
commit | d2f7c4e6b1efbdd3275d02a19220a10cf00a8f66 (patch) | |
tree | 3fc3b14dbbc3effc3974f6f529894c49ef0c1b02 /tests/storage/test_registration.py | |
parent | Settings Fix deleting e2e room keys on xenial (#4295) (diff) | |
download | synapse-d2f7c4e6b1efbdd3275d02a19220a10cf00a8f66.tar.xz |
create support user (#4141)
Allow for the creation of a support user. A support user can access the server, join rooms, interact with other users, but does not appear in the user directory nor does it contribute to monthly active user limits.
Diffstat (limited to 'tests/storage/test_registration.py')
-rw-r--r-- | tests/storage/test_registration.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/storage/test_registration.py b/tests/storage/test_registration.py index 3dfb7b903a..cb3cc4d2e5 100644 --- a/tests/storage/test_registration.py +++ b/tests/storage/test_registration.py @@ -16,6 +16,8 @@ from twisted.internet import defer +from synapse.api.constants import UserTypes + from tests import unittest from tests.utils import setup_test_homeserver @@ -99,6 +101,26 @@ class RegistrationStoreTestCase(unittest.TestCase): user = yield self.store.get_user_by_access_token(self.tokens[0]) self.assertIsNone(user, "access token was not deleted without device_id") + @defer.inlineCallbacks + def test_is_support_user(self): + TEST_USER = "@test:test" + SUPPORT_USER = "@support:test" + + res = yield self.store.is_support_user(None) + self.assertFalse(res) + yield self.store.register(user_id=TEST_USER, token="123", password_hash=None) + res = yield self.store.is_support_user(TEST_USER) + self.assertFalse(res) + + yield self.store.register( + user_id=SUPPORT_USER, + token="456", + password_hash=None, + user_type=UserTypes.SUPPORT + ) + res = yield self.store.is_support_user(SUPPORT_USER) + self.assertTrue(res) + class TokenGenerator: def __init__(self): |