Skip to content

Commit

Permalink
tests: Add a simple test case for generating LUKS escrow packet
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Feb 26, 2025
1 parent 08f93d8 commit bdeb2ce
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/unit_tests/formats_tests/luks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,14 @@ def test_luks_opal(self):
# cipher and key size are not valid for HW encryption only
self.assertEqual(crypto.opal_format.call_args[1]["cipher"], None)
self.assertEqual(crypto.opal_format.call_args[1]["key_size"], 0)

def test_escrow_packet(self):
fmt = LUKS(device="/dev/test", passphrase="passphrase", escrow_cert="/tmp/escrow.crt")
with patch("blivet.devices.lvm.blockdev.crypto") as crypto:
fmt.escrow(directory="/tmp", backup_passphrase="test")
crypto.escrow_device.assert_called_with("/dev/test", "passphrase", "/tmp/escrow.crt", "/tmp", None)

fmt.add_backup_passphrase = True
with patch("blivet.devices.lvm.blockdev.crypto") as crypto:
fmt.escrow(directory="/tmp", backup_passphrase="test")
crypto.escrow_device.assert_called_with("/dev/test", "passphrase", "/tmp/escrow.crt", "/tmp", "test")

0 comments on commit bdeb2ce

Please sign in to comment.