Exemplo n.º 1
0
def test_get_hash():

    # random test

    # make sure the hash of a string is not the same as the string
    assert get_hash("hello") != "hello"
    assert get_hash("strive") != "strive"
Exemplo n.º 2
0
def test_bcrypt():

    bcrypt_hash_pattern = r"^\$2[ayb]\$.{56}$"
    pat = re.compile(bcrypt_hash_pattern)

    new_hash = get_hash("Hello")

    assert pat.search(new_hash)
Exemplo n.º 3
0
def test_bcrypt():

    # check that a hash matches the bcrypt patter (at least if using passlib)
    # *NOTICE* if you don't have passlib, app.py will use another hashing system
    # and this test will fail

    bcrypt_hash_pattern = r"^\$2[ayb]\$.{56}$"
    pat = re.compile(bcrypt_hash_pattern)

    new_hash = get_hash("Hello")

    assert pat.search(new_hash)
Exemplo n.º 4
0
def test_get_hash():
    assert get_hash("hello") != "hello"
    assert get_hash("strive") != "strive"
Exemplo n.º 5
0
def test_hash_computation(testing_string):
    # testing_string = "hello"
    new_hash = get_hash(testing_string)

    assert verify_hash(testing_string, new_hash)