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
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
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'
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'