From d28cf0a05e6c4ac21f78f0a94f89301892c7abb8 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 25 Apr 2026 06:06:20 +0200 Subject: [PATCH] tweak test_configurable_parameters.py: add iff_present flag apply a parameter only when it exists in the template, will be useful for suci Change-Id: I5811ecde4c4e880bb8dbd22fffe23faafcfe36ad --- tests/unittests/test_configurable_parameters.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unittests/test_configurable_parameters.py b/tests/unittests/test_configurable_parameters.py index 8ecdd9f7..cc043c15 100755 --- a/tests/unittests/test_configurable_parameters.py +++ b/tests/unittests/test_configurable_parameters.py @@ -60,11 +60,12 @@ class ConfigurableParameterTest(unittest.TestCase): ) class Paramtest: - def __init__(self, param_cls, val, expect_val, expect_clean_val=None): + def __init__(self, param_cls, val, expect_val, expect_clean_val=None, iff_present=False): self.param_cls = param_cls self.val = val self.expect_clean_val = expect_clean_val self.expect_val = expect_val + self.iff_present = iff_present param_tests = [ Paramtest(param_cls=p13n.Imsi, val='123456', @@ -397,6 +398,13 @@ class ConfigurableParameterTest(unittest.TestCase): found = list((t.param_cls.get_value_from_pes(pes) or {}).values()) testlog.append(f"previous value: {found}") + if t.iff_present and not found: + testlog.append("skipping, param not in template.") + output = "\nskip: " + "\n ".join(testlog) + outputs.append(output) + print(output) + continue + try: param.apply(pes) except ValueError as e: