Skip to content

Commit

Permalink
Unit tests/initscripts: Support checking warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Till Maas <[email protected]>
  • Loading branch information
tyll committed Feb 20, 2023
1 parent 3ab1a10 commit e4cc5c1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/unit/test_network_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,19 @@ def do_connections_validate_ifcfg(self, input_connections, **kwargs):
content_current = kwargs.get("initscripts_content_current", None)
if content_current:
content_current = content_current[idx]
c = IfcfgUtil.ifcfg_create(
connections, idx, content_current=content_current
warnings = []
config = IfcfgUtil.ifcfg_create(
connections,
idx,
content_current=content_current,
warn_fcn=warnings.append,
)
# pprint("con[%s] = \"%s\"" % (idx, connections[idx]['name']), c)
exp = kwargs.get("initscripts_dict_expected", None)
if exp is not None:
self.assertEqual(exp[idx], c)
expected_config = kwargs.get("initscripts_dict_expected", None)
if expected_config is not None:
self.assertEqual(expected_config[idx], config)
expected_warnings = kwargs.get("initscripts_expected_warnings", [])
self.assertEqual(expected_warnings, warnings)

def do_connections_validate(
self, expected_connections, input_connections, **kwargs
Expand Down

0 comments on commit e4cc5c1

Please sign in to comment.