Parametrize the default kasp test cases

Make use of pytest.mark.parametrize to split up the many default kasp
test cases into separate tests.
This commit is contained in:
Matthijs Mekking 2025-04-22 12:06:14 +02:00
parent ee7120eb34
commit 7d670b7fe7
3 changed files with 535 additions and 435 deletions

View file

@ -16,7 +16,7 @@ from pathlib import Path
import re
import subprocess
import time
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, Tuple, Union
from datetime import datetime, timedelta, timezone
@ -332,7 +332,9 @@ class Key:
)
return value
def get_signing_state(self, offline_ksk=False, zsk_missing=False) -> (bool, bool):
def get_signing_state(
self, offline_ksk=False, zsk_missing=False
) -> Tuple[bool, bool]:
"""
This returns the signing state derived from the key states, KRRSIGState
and ZRRSIGState.
@ -348,6 +350,7 @@ class Key:
# Fetch key timing metadata.
now = KeyTimingMetadata.now()
activate = self.get_timing("Activate")
assert activate is not None # to silence mypy - its implied by line above
inactive = self.get_timing("Inactive", must_exist=False)
active = now >= activate

View file

@ -42,6 +42,12 @@ def with_tsan(*args): # pylint: disable=unused-argument
return feature_test("--tsan")
def with_algorithm(name: str):
key = f"{name}_SUPPORTED"
assert key in os.environ, f"{key} env variable undefined"
return pytest.mark.skipif(os.getenv(key) != "1", reason=f"{name} is not supported")
without_fips = pytest.mark.skipif(
feature_test("--have-fips-mode"), reason="FIPS support enabled in the build"
)
@ -58,7 +64,6 @@ with_json_c = pytest.mark.skipif(
not feature_test("--have-json-c"), reason="json-c support disabled in the build"
)
softhsm2_environment = pytest.mark.skipif(
not (
os.getenv("SOFTHSM2_CONF")

File diff suppressed because it is too large Load diff