Esempio n. 1
0
def test_invalid_email():
    try:
        parse_user('John 5 <john5.>', True)
    except ValueError:
        assert True
    else:
        assert False, "invalid email should raise validation exception"
Esempio n. 2
0
def check_user(ustring, data_typ):
    """
    Check user string is valid or not.
    ERROR: The email of user is blank or invalid.
    """
    try:
        parse_user(ustring, True)
    except ValueError as err:
        error("(%s): %s" % (data_typ, err))
        return 1
    return 0
Esempio n. 3
0
def check_user(ustring, data_typ):
    """
    Check user string is valid or not.
    ERROR: The email of user is blank or invalid.
    """
    try:
        parse_user(ustring, True)
    except ValueError as err:
        error("(%s): %s" % (data_typ, err))
        return 1
    return 0
Esempio n. 4
0
def test_only_first():
    assert parse_user('John') == (
        '', 'John', '')
Esempio n. 5
0
def test_no_email():
    assert parse_user('John 5') == (
        '', 'John', '5')
Esempio n. 6
0
def test_only_email2():
    assert parse_user(' <*****@*****.**>') == (
        '*****@*****.**', '', '')
Esempio n. 7
0
def test_full_user():
    assert parse_user('John 5 <*****@*****.**>') == (
        '*****@*****.**', 'John', '5')
Esempio n. 8
0
def test_name_with_bracket():
    assert parse_user('Dmitriy Korba(surc)') == ('', 'Dmitriy', 'Korba(surc)')
Esempio n. 9
0
def test_first_middle_last_email():
    assert parse_user('John William Lowery <*****@*****.**>') == (
        '*****@*****.**', 'John', 'William Lowery')
Esempio n. 10
0
def test_first_middle_last():
    assert parse_user('John William Lowery') == (
        '', 'John', 'William Lowery')