summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/config/test_register.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/service/test/unit/config/test_register.py b/service/test/unit/config/test_register.py
new file mode 100644
index 00000000..7c09fb2c
--- /dev/null
+++ b/service/test/unit/config/test_register.py
@@ -0,0 +1,20 @@
+import unittest
+
+from pixelated.config.register import validate_username
+
+
+class TestRegister(unittest.TestCase):
+
+ def test_username_raises_error_when_it_contains_uppercase_letters(self):
+ with self.assertRaises(ValueError):
+ validate_username('INVALIDUSERNAME')
+
+ def test_username_raises_error_when_it_contains_special_characters(self):
+ with self.assertRaises(ValueError):
+ validate_username('invalid@username')
+
+ def test_username_pass_when_valid(self):
+ try:
+ validate_username('valid_username-123')
+ except:
+ self.fail('Valid username should not raise an exception')