chg: Used .local TLD and added the test test_create_user_not_allowed_login.

This commit is contained in:
Cédric Bonhomme 2024-11-25 17:37:09 +01:00
parent 6ceb31de7d
commit 920f76cf17
Signed by untrusted user who does not match committer: cedric
GPG key ID: A1CB94DE57B7A70D

View file

@ -260,6 +260,18 @@ class TestPublic(unittest.TestCase):
self.assertTrue(len(comments["data"]) == 0) self.assertTrue(len(comments["data"]) == 0)
# Test User # Test User
def test_create_user_not_allowed_login(self) -> None:
if self.public_test:
# Do not run that test against the public instance, it would create users.
return None
instance_config = self.client.get_config_info()
if not instance_config.get('registration'):
return None
for login in ["login", "user", "username", "help", "test", "about", "administration", "account"]:
user = self.client.create_user(name='test Name', login=login,
organisation='test Organization', email='test@testorg.local')
self.assertEqual(user['message'], 'Username not allowed.')
def test_users_info(self) -> None: def test_users_info(self) -> None:
if not self.admin_token: if not self.admin_token:
# this test is only working if the admin token is set # this test is only working if the admin token is set
@ -299,7 +311,7 @@ class TestPublic(unittest.TestCase):
return None return None
user = self.client.create_user(name='test Name', login='alan', user = self.client.create_user(name='test Name', login='alan',
organisation='test Organization', email='test@testorg.lu') organisation='test Organization', email='test@testorg.local')
self.assertTrue(user) self.assertTrue(user)
self.assertTrue('id' in user, user) self.assertTrue('id' in user, user)
uid = user['id'] uid = user['id']