Exemple #1
0
def test_error_email_required_None():
    schema = (email.Email().trim().required('Email is required'))
    result = schema.validate(None)
    assert result['success'] is False
    assert result['error'] is not None
Exemple #2
0
def test_validate_string():
    schema = email.Email()
    result = schema.validate({'name': 'kanpai'})
    assert result['success'] is False
    assert result['error'] is not None
Exemple #3
0
def test_validate_email_required_success():
    schema = (email.Email().trim().required('Email is required'))
    result = schema.validate(' [email protected]')
    assert result['success'] is True
    assert result['error'] is None
Exemple #4
0
def test_validate_stringandpattern_failure():
    schema = email.Email()
    result = schema.validate('a@bcom')
    assert result['success'] is False
    assert result['error'] is not None
Exemple #5
0
def test_validate_stringandpattern_success():
    schema = email.Email()
    result = schema.validate('*****@*****.**')
    assert result['success'] is True
    assert result['error'] is None
Exemple #6
0
def test_validate_string_on_None_data():
    schema = email.Email()
    result = schema.validate(None)
    assert result['success'] is True
    assert result['error'] is None