@@ -40,9 +40,7 @@ def test_check_ykman_installed_found(self):
4040
4141 result = yk ._check_ykman_installed ()
4242 assert result is True
43- mock_run .assert_called_once_with (
44- ["ykman" , "--version" ], capture_output = True , check = True
45- )
43+ mock_run .assert_called_once_with (["ykman" , "--version" ], capture_output = True , check = True )
4644 # Second call should use cached value
4745 result2 = yk ._check_ykman_installed ()
4846 assert result2 is True
@@ -149,9 +147,7 @@ def test_encrypt_age_key(self):
149147 # Mock is_available to return True
150148 with patch .object (yk , "is_available" , return_value = True ):
151149 with patch .object (yk , "_check_age_plugin_installed" , return_value = True ):
152- with patch .object (
153- yk , "_get_yubikey_recipient" , return_value = "age1yubikey1testrecipient"
154- ):
150+ with patch .object (yk , "_get_yubikey_recipient" , return_value = "age1yubikey1testrecipient" ):
155151 with patch ("subprocess.run" ) as mock_run :
156152 mock_result = Mock ()
157153 mock_result .stdout = b"ENCRYPTED_DATA"
@@ -176,9 +172,7 @@ def test_decrypt_age_key(self):
176172 # Mock is_available to return True
177173 with patch .object (yk , "is_available" , return_value = True ):
178174 with patch .object (yk , "_check_age_plugin_installed" , return_value = True ):
179- with patch .object (
180- yk , "_get_yubikey_identity" , return_value = "AGE-SECRET-KEY-1TESTIDENTITY"
181- ):
175+ with patch .object (yk , "_get_yubikey_identity" , return_value = "AGE-SECRET-KEY-1TESTIDENTITY" ):
182176 with patch ("tempfile.NamedTemporaryFile" ) as mock_temp :
183177 mock_file = MagicMock ()
184178 mock_file .name = "/tmp/mock.age"
@@ -193,9 +187,7 @@ def test_decrypt_age_key(self):
193187 with patch ("os.unlink" ) as mock_unlink :
194188 decrypted = yk .decrypt_age_key (b"ENCRYPTED_DATA" )
195189 assert decrypted == "DECRYPTED_DATA"
196- mock_file .write .assert_called_once_with (
197- "AGE-SECRET-KEY-1TESTIDENTITY"
198- )
190+ mock_file .write .assert_called_once_with ("AGE-SECRET-KEY-1TESTIDENTITY" )
199191 mock_run .assert_called_once_with (
200192 ["age" , "-d" , "-i" , "/tmp/mock.age" ],
201193 input = b"ENCRYPTED_DATA" ,
@@ -246,9 +238,7 @@ def test_verify_pin_failure(self):
246238 with patch .object (yk , "is_available" , return_value = True ):
247239 with patch (
248240 "subprocess.run" ,
249- side_effect = subprocess .CalledProcessError (
250- 1 , "ykman piv verify-pin" , stderr = "Wrong PIN"
251- ),
241+ side_effect = subprocess .CalledProcessError (1 , "ykman piv verify-pin" , stderr = "Wrong PIN" ),
252242 ):
253243 result = yk .verify_pin ("wrong" )
254244 assert result is False
@@ -294,9 +284,7 @@ def test_change_pin_failure(self):
294284 with patch .object (yk , "is_available" , return_value = True ):
295285 with patch (
296286 "subprocess.run" ,
297- side_effect = subprocess .CalledProcessError (
298- 1 , "ykman piv change-pin" , stderr = "Wrong old PIN"
299- ),
287+ side_effect = subprocess .CalledProcessError (1 , "ykman piv change-pin" , stderr = "Wrong old PIN" ),
300288 ):
301289 result = yk .change_pin ("wrong" , "new" )
302290 assert result is False
0 commit comments