Пример #1
0
    def test_more_than_max_length_invalid_password(self):
        """Test validation fail for password of length more than max length."""
        pass_field = Field("".join(
            ['x' * (int(self.app.config['MAX_PWD_LEN']) + 1)]))

        with self.assertRaises(ValidationError):
            valid_password(None, pass_field)
Пример #2
0
    def test_less_than_min_length_invalid_password(self):
        """Test validation fail for password of length less than min length."""
        pass_field = Field("".join(
            ['x' * (int(self.app.config['MIN_PWD_LEN']) - 1)]))

        with self.assertRaises(ValidationError):
            valid_password(None, pass_field)
Пример #3
0
    def test_valid_password(self):
        """
        Test validation pass for valid password.
        """
        pass_field = Field("".join(
            ['x' * (int(self.app.config['MAX_PWD_LEN']))]))

        valid_password(None, pass_field)
Пример #4
0
    def test_empty_invalid_password(self):
        """
        Test validation fail for zero length password.
        """
        pass_field = Field("")

        with self.assertRaises(ValidationError):
            valid_password(None, pass_field)