From 9b6234064a9de0b1d6fa3ce771d3b3807fa6f6a6 Mon Sep 17 00:00:00 2001 From: Hook25 Date: Tue, 10 Dec 2024 11:34:30 +0100 Subject: [PATCH] Verify that the infos are in the exception --- checkbox-ng/plainbox/impl/unit/test_unit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/checkbox-ng/plainbox/impl/unit/test_unit.py b/checkbox-ng/plainbox/impl/unit/test_unit.py index 3a274ae3b4..32b088a4a5 100644 --- a/checkbox-ng/plainbox/impl/unit/test_unit.py +++ b/checkbox-ng/plainbox/impl/unit/test_unit.py @@ -203,12 +203,14 @@ def test_get_record_value(self): self.assertEqual(unit1.get_record_value("key"), "value") self.assertEqual(unit2.get_record_value("key"), "value") self.assertEqual(unit3.get_record_value("key"), "value") - with self.assertRaises(MissingParam): + with self.assertRaises(MissingParam) as mp: # TODO: this is structured badly, if a unit has a template-engine # it is a tempalte, but the definition is in Unit, not # TemplateUnit. Once you fix it, remove the following line unit4.template_id = "template_id" unit4.get_record_value("key") + self.assertIn("template_id", str(mp.exception)) + self.assertIn("missing_param", repr(mp.exception)) self.assertEqual(unit5.get_record_value("key"), None) self.assertEqual(unit5.get_record_value("key", "default"), "default") self.assertEqual(unit6.get_record_value("key"), None)