From cf7a3dbb5671da216fbe1996c583243cb24db264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 25 Feb 2025 15:44:08 +0100 Subject: [PATCH] fixup! (WIP) Add tests --- tests/test_signatures.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/test_signatures.py b/tests/test_signatures.py index 9740da2..c7ca9b4 100644 --- a/tests/test_signatures.py +++ b/tests/test_signatures.py @@ -259,8 +259,19 @@ def test_stores_signatures_updates_last_log_index(valid_signature, mocker, tmp_p with open(signatures_path / "last_log_index", "w") as f: f.write("50") -def test_convert_oci_images_signatures(): - pass + # Mock get_log_index_from_signatures to return a higher value + mocker.patch( + "dangerzone.updater.signatures.get_log_index_from_signatures", + return_value=100, + ) + + # Call store_signatures + store_signatures(signatures, image_digest, TEST_PUBKEY_PATH) + + # Verify that the log index file was updated + assert (signatures_path / "last_log_index").exists() + with open(signatures_path / "last_log_index", "r") as f: + assert f.read() == "100" def test_is_update_available_nothing_local():