stages(kickstart): ensure clearpart dict always has an option set

This commit is contained in:
Michael Vogt 2023-11-09 14:57:28 +01:00
parent cce0eeaba4
commit be85b2342c
2 changed files with 8 additions and 2 deletions

View file

@ -55,8 +55,6 @@ from osbuild.testutil.imports import import_module_from_path
'sshkey --username someusr "ssh-rsa not-really-a-real-key"'
),
({"zerombr": "true"}, "zerombr"),
# no clearpart for an empty dict (will not do anything with options anyway)
({"clearpart": {}}, ""),
({"clearpart": {"all": True}}, "clearpart --all"),
({"clearpart": {"drives": ["hda", "hdb"]}}, "clearpart --drives=hda,hdb",),
({"clearpart": {"drives": ["hda"]}}, "clearpart --drives=hda"),
@ -120,6 +118,7 @@ def test_kickstart(tmp_path, test_input, expected):
@pytest.mark.parametrize("test_data,expected_err", [
# BAD pattern, ensure some obvious ways to write arbitrary
# kickstart files will not work
({"clearpart": {}}, "{} is not valid "),
({"clearpart": {"disklabel": r"\n%pre\necho p0wnd"}}, r"p0wnd' does not match"),
({"clearpart": {"drives": [" --spaces-dashes-not-allowed"]}}, "' --spaces-dashes-not-allowed' does not match"),
({"clearpart": {"drives": ["\n%pre not allowed"]}}, "not allowed' does not match"),