Beispiel #1
0
 def test_not_alphanumeric_username(self):
     """This test ensures that non-alphanumeric characters are forbidden."""
     with pytest.raises(ValidationError):
         username_validator("hdfg#@$*&((@")
Beispiel #2
0
 def test_too_short_username(self):
     """This test ensures that a username can't be too short."""
     with pytest.raises(ValidationError):
         username_validator("a")
Beispiel #3
0
 def test_too_long_username(self):
     """This test ensures that a username can't be too long."""
     with pytest.raises(ValidationError):
         username_validator("c" * 16)
Beispiel #4
0
 def test_short_username(self):
     """This test ensures that a username of 3 characters is valid."""
     username_validator("b" * 3)
Beispiel #5
0
 def test_long_username(self):
     """This test ensures that a username of 15 characters is valid."""
     username_validator("a" * 15)
Beispiel #6
0
 def test_valid_username(self):
     """This test ensures that alphanumeric characters are valid for a username."""
     username_validator("abcde234")