Skip to content

Commit

Permalink
Verify that the infos are in the exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Hook25 committed Dec 10, 2024
1 parent 0e8e61d commit 9b62340
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion checkbox-ng/plainbox/impl/unit/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9b62340

Please sign in to comment.