From 920f76cf179eabccbf2a3dbf3139117d34cfde77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Mon, 25 Nov 2024 17:37:09 +0100 Subject: [PATCH] chg: Used .local TLD and added the test test_create_user_not_allowed_login. --- tests/test_web.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_web.py b/tests/test_web.py index 90d43da..3dbfb1b 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -260,6 +260,18 @@ class TestPublic(unittest.TestCase): self.assertTrue(len(comments["data"]) == 0) # 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: if not self.admin_token: # this test is only working if the admin token is set @@ -299,7 +311,7 @@ class TestPublic(unittest.TestCase): return None 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('id' in user, user) uid = user['id']