Commit 2503eacb authored by Shashank Kumar's avatar Shashank Kumar

tests added

parent 20db5573
v0.0.1
## August 11 2018
- Updating Sign Up module to allow different timezones from the user (Shashank Kumar - realslimshanky)
## July 30 2018
......
import pytest
from modules.signup.utils import (
generate_uuid,
clean_email,
clean_full_name,
hash_password
clean_timezone
)
......@@ -30,3 +28,10 @@ def test_clean_full_name():
assert clean_full_name(' Shashank Kumar') == 'Shashank Kumar'
assert clean_full_name('Shashank Kumar ') == 'Shashank Kumar'
assert clean_full_name(' Shashank Kumar ') == 'Shashank Kumar'
def test_clean_timezone():
# testing cleaning of spaces, tabs and lowercasing of timezone
assert clean_timezone('UTC+00:00') == 'utc+00:00'
assert clean_timezone('UtC+00:00 ') == 'utc+00:00'
assert clean_timezone(' Utc-11:11') == 'utc-11:11'
......@@ -5,7 +5,8 @@ from modules.signup.validations import (
validate_email,
validate_first_pass,
validate_confirm_pass,
validate_full_name
validate_full_name,
validate_timezone
)
......@@ -58,3 +59,16 @@ def test_validate_full_name():
# check for invalid name format
with pytest.raises(SignUpError):
validate_full_name('Sanyam ! Khurana')
def test_validate_timezone():
# check for correct timezone
assert validate_timezone('UTC+05:30')
# check for empty timezone
with pytest.raises(SignUpError):
validate_timezone('')
# check for incorrect timezone
with pytest.raises(SignUpError):
validate_timezone('utc+')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment