Exemplo n.º 1
0
def test_add_hash_explicit_write():
    db = Manifest()

    random_key = helper.random_string(10)
    random_value = helper.random_string(12)

    # Test with explicit True value as 3rd param
    db.add_hash(random_key, random_value, True)

    assert db.check_hash(random_key) == True, 'Lookup for hash did not return True'

    # Instnatiate new db class to confirm random_key exists
    db2 = Manifest()
    assert db2.check_hash(random_key) == True
Exemplo n.º 2
0
def test_add_hash_default_do_not_write():
    db = Manifest()

    random_key = helper.random_string(10)
    random_value = helper.random_string(12)

    # Test with default False value as 3rd param
    db.add_hash(random_key, random_value)

    assert db.check_hash(random_key) == True, 'Lookup for hash did not return True'

    # Instnatiate new db class to confirm random_key does not exist
    db2 = Manifest()
    assert db2.check_hash(random_key) == False
Exemplo n.º 3
0
def test_check_hash_exists():
    db = Manifest()

    random_key = helper.random_string(10)
    random_value = helper.random_string(12)

    # Test with explicit False value as 3rd param
    db.add_hash(random_key, random_value, False)

    assert db.check_hash(random_key) == True, 'Lookup for hash did not return True'
Exemplo n.º 4
0
def test_check_hash_does_not_exist():
    db = Manifest()

    random_key = helper.random_string(10)

    assert db.check_hash(random_key) == False, 'Lookup for hash that should not exist returned True'