Skip to content

Commit 2fc28cf

Browse files
committed
test: check md5 hash output
1 parent 12735ac commit 2fc28cf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from unittest.mock import patch
2+
import re
23

34
import pytest
45
from typer.testing import CliRunner
@@ -263,13 +264,17 @@ def test_hash_text(mock_anonymizer, mock_spacy_annotator):
263264
)
264265

265266
# Test with custom hash type
267+
mock_anonymizer_instance.anonymize.return_value = AnonymizationResult(
268+
anonymized_text="d41d8cd98f00b204e9800998ecf8427e", anonymized_entities=[]
269+
)
266270
result = runner.invoke(app, ["hash-text", sample_text, "--hash-type", "md5"])
267271

268272
print(f"Exit code: {result.exit_code}")
269273
print(f"Output: {result.stdout}")
270274
print(f"Exception: {result.exception}")
271275

272276
assert result.exit_code == 0
277+
assert re.search(r"[0-9a-f]{32}", result.stdout)
273278
mock_anonymizer.assert_called_with(
274279
anonymizer_type=AnonymizerType.HASH, hash_type=HashType.MD5
275280
)

0 commit comments

Comments
 (0)