Exemplo n.º 1
0
def email_console():
    db.printAllEmails()
    address = raw_input(" Email: ")

    try:
        verified = email.verify(address)
        if verified:
            print("\n \"" + address + "\" is a valid email address.\n")
        else:
            print("\n \"" + address + "\" is not a valid email address.\n")

        db.saveEmail(address, verified)
    except Exception as e:
        print("\n Try again: " + type(e).__name__ + "\n")
Exemplo n.º 2
0
def api_email():
    if 'address' in request.args:
        try:
            verified = email.verify(request.args['address'])

            return jsonify(db.saveEmail(verified, request.args['address']))
        except:
            pass
    elif not request.args:
        return jsonify(db.getEmails())
    return flask.jsonify(
        error=400,
        text=str(
            "Bad Request: The requested URL requires either no parameters (to view all email requests in the database) or the argument 'email' as a string."
        )), 400
Exemplo n.º 3
0
def test_email_can_contain_equals():
    assert email.verify(some_string + "=" + "@" + domain)
Exemplo n.º 4
0
def test_email_cannot_contain_right_carrot():
    assert not(email.verify(some_string + ">" + "@" + domain))
Exemplo n.º 5
0
def test_email_cannot_contain_backslash():
    assert not(email.verify(some_string + "\\" + "@" + domain))
Exemplo n.º 6
0
def test_email_cannot_contain_doublequote():
    assert not(email.verify(some_string + "\"" + "@" + domain))
Exemplo n.º 7
0
def test_email_cannot_contain_comma():
    assert not(email.verify(some_string + "," + "@" + domain))
Exemplo n.º 8
0
def test_email_can_contain_pipe():
    assert email.verify(some_string + "|" + "@" + domain)
Exemplo n.º 9
0
def test_email_can_contain_rightbracket():
    assert email.verify(some_string + "}" + "@" + domain)
Exemplo n.º 10
0
def test_email_string_ends_wo_period():
    assert not(email.verify("a.@" + domain))
Exemplo n.º 11
0
def test_email_string_consecutive_periods():
    assert not(email.verify("a....a@" + domain))
    assert not(email.verify("a...a@" + domain))
    assert not(email.verify("a..a@" + domain))
    assert email.verify("a.a@" + domain)
Exemplo n.º 12
0
def test_email_contains_string_at_domain():
    assert not(email.verify("@test"))
    assert not(email.verify("test@"))
    assert email.verify("test@" + domain)
Exemplo n.º 13
0
def test_email_string_starts_wo_period():
    assert not(email.verify(".a@" + domain))
Exemplo n.º 14
0
def test_email_domain_must_have_period():
    assert not(email.verify(some_string + "@test"))
Exemplo n.º 15
0
def test_email_domain_cannot_contain_doublehypen():
    assert not(email.verify(some_string + "@" + "--" + domain))
Exemplo n.º 16
0
def test_email_contains_one_atsymbol():
    assert not(email.verify(some_string + "@@" + domain))
    assert not(email.verify(some_string))
    assert email.verify(some_string + "@" + domain)
Exemplo n.º 17
0
def test_email_can_contain_carrot():
    assert email.verify(some_string + "^" + "@" + domain)
Exemplo n.º 18
0
def test_email_cannot_start_nonnumeric():
    assert not(email.verify("0" + some_string + "@" + domain))
    assert email.verify(some_string + "@" + domain)
Exemplo n.º 19
0
def test_email_can_contain_underscorek():
    assert email.verify(some_string + "_" + "@" + domain)
Exemplo n.º 20
0
def test_email_can_contain_exclamationpoint():
    assert email.verify(some_string + "!" + "@" + domain)
Exemplo n.º 21
0
def test_email_verify_returns_boolean():
    address = "test"
    assert isinstance(email.verify(address), bool)
Exemplo n.º 22
0
def test_email_can_contain_dollarsign():
    assert email.verify(some_string + "$" + "@" + domain)
Exemplo n.º 23
0
def test_email_can_contain_questionmark():
    assert email.verify(some_string + "?" + "@" + domain)
Exemplo n.º 24
0
def test_email_can_contain_percentsign():
    assert email.verify(some_string + "%" + "@" + domain)
Exemplo n.º 25
0
def test_email_cannot_contain_right_parenthesis():
    assert not(email.verify(some_string + ")" + "@" + domain))
Exemplo n.º 26
0
def test_email_cannot_contain_atsymbol():
    assert not(email.verify(some_string + "@" + "@" + domain))
Exemplo n.º 27
0
def test_email_cannot_contain_semicolon():
    assert not(email.verify(some_string + ";" + "@" + domain))
Exemplo n.º 28
0
def test_email_can_contain_minus():
    assert email.verify(some_string + "-" + "@" + domain)
Exemplo n.º 29
0
def test_email_can_contain_asterisk():
    assert email.verify(some_string + "*" + "@" + domain)
Exemplo n.º 30
0
def test_email_cannot_contain_left_bracket():
    assert not(email.verify(some_string + "[" + "@" + domain))