Skip to content

Commit

Permalink
luks_device: updated failing unit tests for keyslot support
Browse files Browse the repository at this point in the history
  • Loading branch information
zemdreg committed Oct 15, 2023
1 parent d8944fa commit 7c20340
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions tests/unit/plugins/modules/test_luks_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ def run_command_check(self, command):

# device, remove_key, remove_passphrase, state, label, expected
LUKS_REMOVE_KEY_DATA = (
("dummy", "key", None, "present", None, True),
(None, "key", None, "present", None, False),
(None, "key", None, "present", "labelName", True),
("dummy", None, None, "present", None, False),
("dummy", "key", None, "absent", None, "exception"),
("dummy", None, "foo", "present", None, True),
(None, None, "foo", "present", None, False),
(None, None, "foo", "present", "labelName", True),
("dummy", None, None, "present", None, False),
("dummy", None, "foo", "absent", None, "exception"))
("dummy", "key", None, None, "present", None, True),
(None, "key", None, None, "present", None, False),
(None, "key", None, None, "present", "labelName", True),
("dummy", None, None, None, "present", None, False),
("dummy", "key", None, None, "absent", None, "exception"),
("dummy", None, "foo", None, "present", None, True),
(None, None, "foo", None, "present", None, False),
(None, None, "foo", None, "present", "labelName", True),
("dummy", None, None, None, "present", None, False),
("dummy", None, "foo", None, "absent", None, "exception"))


@pytest.mark.parametrize("device, keyfile, passphrase, state, is_luks, " +
Expand Down Expand Up @@ -291,17 +291,18 @@ def test_luks_add_key(device, keyfile, passphrase, new_keyfile, new_passphrase,
assert expected == "exception"


@pytest.mark.parametrize("device, remove_keyfile, remove_passphrase, state, " +
"label, expected",
((d[0], d[1], d[2], d[3], d[4], d[5])
@pytest.mark.parametrize("device, remove_keyfile, remove_passphrase, remove_keyslot, " +
"state, label, expected",
((d[0], d[1], d[2], d[3], d[4], d[5], d[6])
for d in LUKS_REMOVE_KEY_DATA))
def test_luks_remove_key(device, remove_keyfile, remove_passphrase, state,
def test_luks_remove_key(device, remove_keyfile, remove_passphrase, remove_keyslot, state,
label, expected, monkeypatch):

module = DummyModule()
module.params["device"] = device
module.params["remove_keyfile"] = remove_keyfile
module.params["remove_passphrase"] = remove_passphrase
module.params["remove_keyslot"] = remove_keyslot
module.params["state"] = state
module.params["label"] = label

Expand Down

0 comments on commit 7c20340

Please sign in to comment.