summaryrefslogtreecommitdiff
path: root/tests/test_recursiveloader.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-09-17 12:02:20 +0200
committerMichał Górny <mgorny@gentoo.org>2022-09-17 12:02:20 +0200
commit503bac7e04330c5bd82ba3e7d9878b85d5024a94 (patch)
treea20bca595e1e280281a955e4d8cc09805203ab64 /tests/test_recursiveloader.py
parentb5533242200179fe2a9571417674b400cfebce22 (diff)
downloadgemato-503bac7e04330c5bd82ba3e7d9878b85d5024a94.tar.gz
Fix update w/ require_secure_hashes to require at least one hash
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r--tests/test_recursiveloader.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py
index 860bace..ed24d03 100644
--- a/tests/test_recursiveloader.py
+++ b/tests/test_recursiveloader.py
@@ -2467,6 +2467,7 @@ INSECURE_HASH_TESTS = [
("SHA1", ["SHA1"]),
("SHA512", None),
("SHA1 SHA512", ["SHA1"]),
+ ("", []),
]
@@ -2474,7 +2475,7 @@ INSECURE_HASH_TESTS = [
def test_insecure_hashes(layout_factory, hashes_arg, insecure):
layout = BasicTestLayout
tmp_path = layout_factory.create(layout)
- ctx = (pytest.raises(ManifestInsecureHashes) if insecure
+ ctx = (pytest.raises(ManifestInsecureHashes) if insecure is not None
else contextlib.nullcontext())
with ctx:
ManifestRecursiveLoader(tmp_path / layout.TOP_MANIFEST,
@@ -2497,7 +2498,7 @@ def test_insecure_hashes_update(layout_factory, hashes_arg, insecure, func,
hashes=["SHA512"],
allow_xdev=False,
require_secure_hashes=True)
- ctx = (pytest.raises(ManifestInsecureHashes) if insecure
+ ctx = (pytest.raises(ManifestInsecureHashes) if insecure is not None
else contextlib.nullcontext())
with ctx:
func(m, arg, hashes=hashes_arg.split())
@@ -2519,7 +2520,7 @@ def test_insecure_hashes_update_cli(layout_factory, caplog,
hashes_arg, insecure, command):
layout = BasicTestLayout
tmp_path = layout_factory.create(layout)
- expected = 1 if insecure else 0
+ expected = 1 if insecure is not None else 0
assert gemato.cli.main(["gemato", command, "--hashes", hashes_arg,
"--require-secure-hashes", "--force-rewrite",
str(tmp_path)]) == expected