Skip to content

Commit 07729ac

Browse files
committed
fix: Clean up
1 parent 32a14b8 commit 07729ac

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

tests/test_unit_tests.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,67 +1074,5 @@ def test_sign_file(self):
10741074
if os.path.exists(output_path):
10751075
os.remove(output_path)
10761076

1077-
1078-
class TestCreateSigner(unittest.TestCase):
1079-
"""Test cases for the create_signer function."""
1080-
1081-
def setUp(self):
1082-
"""Set up test fixtures."""
1083-
self.data_dir = FIXTURES_DIR
1084-
1085-
# Load test certificates and key
1086-
with open(os.path.join(self.data_dir, "es256_certs.pem"), "rb") as cert_file:
1087-
self.certs = cert_file.read().decode('utf-8')
1088-
with open(os.path.join(self.data_dir, "es256_private.key"), "rb") as key_file:
1089-
self.key = key_file.read().decode('utf-8')
1090-
1091-
def test_create_signer_with_callback(self):
1092-
"""Test creating a signer with a callback function."""
1093-
def mock_sign_callback(data: bytes) -> bytes:
1094-
"""Mock signing callback that returns a fake signature."""
1095-
# Return a fake signature (64 bytes for ES256)
1096-
return b"fake_signature_" + b"0" * 50
1097-
1098-
# Test with ES256 algorithm
1099-
signer = create_signer(
1100-
callback=mock_sign_callback,
1101-
alg=SigningAlg.ES256,
1102-
certs=self.certs
1103-
)
1104-
1105-
# Verify the signer was created successfully
1106-
self.assertIsInstance(signer, Signer)
1107-
self.assertFalse(signer.closed)
1108-
1109-
# Test that reserve_size works
1110-
reserve_size = signer.reserve_size()
1111-
self.assertIsInstance(reserve_size, int)
1112-
self.assertGreaterEqual(reserve_size, 0)
1113-
1114-
# Clean up
1115-
signer.close()
1116-
1117-
def test_create_signer_callback_error_handling(self):
1118-
"""Test that callback errors are properly handled."""
1119-
def error_callback(data: bytes) -> bytes:
1120-
"""Callback that raises an exception."""
1121-
raise ValueError("Test callback error")
1122-
1123-
# The create_signer function doesn't wrap callbacks with error handling
1124-
# The error handling happens when the callback is actually called during signing
1125-
# So creating the signer should succeed, but using it might fail
1126-
signer = create_signer(
1127-
callback=error_callback,
1128-
alg=SigningAlg.ES256,
1129-
certs=self.certs
1130-
)
1131-
1132-
# Verify the signer was created successfully
1133-
self.assertIsInstance(signer, Signer)
1134-
self.assertFalse(signer.closed)
1135-
1136-
# Clean up
1137-
signer.close()
1138-
11391077
if __name__ == '__main__':
11401078
unittest.main()

0 commit comments

Comments
 (0)