Skip to content

Commit

Permalink
tests: Add a simple test case for bd_crypto_device_seems_encrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Nov 13, 2024
1 parent 2003ecd commit 6bac76c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/crypto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,24 @@ def test_veracrypt_open_close(self):
self.assertTrue(succ)
self.assertFalse(os.path.exists("/dev/mapper/libblockdevTestTC"))

@tag_test(TestTags.NOSTORAGE)
def test_seems_encrypted(self):
"""Verify that BlockDev.crypto_device_seems_encrypted works"""

# truecrypt device without header
enc = BlockDev.crypto_device_seems_encrypted(self.tc_dev)
self.assertTrue(enc)

ctx = BlockDev.CryptoKeyslotContext(passphrase=self.passphrase)
succ = BlockDev.crypto_tc_open(self.tc_dev, "libblockdevTestTC", ctx)
self.assertTrue(succ)

# the cleartext device is not encrypted
enc = BlockDev.crypto_device_seems_encrypted("/dev/mapper/libblockdevTestTC")
self.assertFalse(enc)

succ = BlockDev.crypto_tc_close("libblockdevTestTC")


class CryptoTestBitlk(CryptoTestCase):

Expand Down

0 comments on commit 6bac76c

Please sign in to comment.