Feat: retrieve last log

This commit is contained in:
2025-01-15 18:12:11 +01:00
parent eec3a13dbb
commit 2a387a1bc8
2 changed files with 41 additions and 11 deletions

View File

@@ -30,7 +30,9 @@ def test_add_flux(location, metadata_repository):
flux_id = "my_flux"
metadata_repository.add_flux(flux_id)
metadata_filepath = location / metadata_repository.EXECUTION_FILEMODEL.format(flux_id=flux_id)
metadata_filepath = location / metadata_repository.FILEMODEL["execution"].format(
flux_id=flux_id
)
assert metadata_filepath.exists()
with open(metadata_filepath, "r") as csvfile:
@@ -50,7 +52,9 @@ def test_register_flux_execution(location, metadata_repository):
},
)
metadata_filepath = location / metadata_repository.EXECUTION_FILEMODEL.format(flux_id=flux_id)
metadata_filepath = location / metadata_repository.FILEMODEL["execution"].format(
flux_id=flux_id
)
with open(metadata_filepath, "r") as csvfile:
content = csvfile.read()
assert (
@@ -58,7 +62,7 @@ def test_register_flux_execution(location, metadata_repository):
)
def test_register_and_get_flux_execution(location, metadata_repository):
def test_register_and_get_logs(metadata_repository):
flux_id = "my_flux"
metadata_repository.add_flux(flux_id)
@@ -86,3 +90,27 @@ def test_register_and_get_flux_execution(location, metadata_repository):
output=FluxMetaData(data={"truc": "chose"}),
),
]
def test_register_and_get_last_log(metadata_repository):
flux_id = "my_flux"
metadata_repository.add_flux(flux_id)
metadata_repository.register_flux_execution(
flux_id,
datetime(2023, 3, 15, 14, 30),
output={"truc": "machin"},
)
metadata_repository.register_flux_execution(
flux_id,
datetime(2024, 3, 15, 14, 30),
output={
"truc": "chose",
},
)
logs = metadata_repository.flux(flux_id)
assert logs == ExecutionLog(
datetime=datetime(2024, 3, 15, 14, 30),
output=FluxMetaData(data={"truc": "chose"}),
)