def test_multiple_writes_to_same_file_record_same_hash(configuration_file): file_api = FileAPI(configuration_file) with file_api.open_for_write(data_product="test", extension="txt") as file: file.write("foo".encode()) with file_api.open_for_write(data_product="test", extension="txt") as file: file.write("bar".encode()) access_log = file_api._generate_access_log() assert (access_log["io"][0]["access_metadata"]["calculated_hash"] == access_log["io"][1]["access_metadata"]["calculated_hash"])
def test_generate_access_log(configuration_file): file_api = FileAPI(configuration_file) file_api.open_for_read(data_product="test", version="1.0.0").close() file_api.open_for_write(data_product="test2", extension="txt").close() assert len(file_api._generate_access_log()["io"]) == 2