From aba1074b012b7151515e41a48c4d9013859b4f91 Mon Sep 17 00:00:00 2001 From: SivolcC Date: Wed, 23 Sep 2020 14:49:35 +0200 Subject: [PATCH] Adjusted unit tests --- vaultlocker/tests/functional/test_keystorage.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vaultlocker/tests/functional/test_keystorage.py b/vaultlocker/tests/functional/test_keystorage.py index bf84599..1087ac6 100644 --- a/vaultlocker/tests/functional/test_keystorage.py +++ b/vaultlocker/tests/functional/test_keystorage.py @@ -38,7 +38,17 @@ def test_encrypt(self, _luks_open, _luks_format, _systemd, args.block_device = ['/dev/sdb'] args.retry = -1 + def mock_path_exists_side_effect(arg): + if arg in ['/usr/lib/systemd/system/vaultlocker-decrypt@.service', + '/etc/systemd/system/vaultlocker-decrypt@.service']: + return True + else: + return False + + mock_pathexists = mock.patch('os.path.exists').start() + mock_pathexists.side_effect = mock_path_exists_side_effect shell.encrypt(args, self.config) + _luks_format.assert_called_once_with(mock.ANY, '/dev/sdb', 'passed-UUID')