diff --git a/domaintools/api.py b/domaintools/api.py index 22a0849..5df9c6c 100644 --- a/domaintools/api.py +++ b/domaintools/api.py @@ -1,5 +1,5 @@ from datetime import datetime, timedelta, timezone -from hashlib import sha1, sha256, md5 +from hashlib import sha1, sha256 from hmac import new as hmac import re @@ -24,7 +24,7 @@ from domaintools.utils import validate_feeds_parameters -AVAILABLE_KEY_SIGN_HASHES = ["sha1", "sha256", "md5"] +AVAILABLE_KEY_SIGN_HASHES = ["sha1", "sha256"] def delimited(items, character="|"): diff --git a/tests/test_api.py b/tests/test_api.py index 3876d02..a54f1db 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -342,11 +342,20 @@ def test_exception_handling(): API("notauser", "notakey").domain_search("amazon").data() with pytest.raises( ValueError, - match=r"Invalid value 'notahash' for 'key_sign_hash'. Values available are sha1,sha256,md5", + match=r"Invalid value 'notahash' for 'key_sign_hash'. Values available are sha1,sha256", ): API("notauser", "notakey", always_sign_api_key=True, key_sign_hash="notahash").domain_search("amazon") +@vcr.use_cassette +def test_md5_is_not_supported(): + with pytest.raises( + ValueError, + match=r"Invalid value 'md5' for 'key_sign_hash'. Values available are sha1,sha256", + ): + API("notauser", "notakey", always_sign_api_key=True, key_sign_hash="md5").domain_search("amazon") + + @vcr.use_cassette def test_rate_limiting(): domain_searches = ["google"] * 31 diff --git a/tox.ini b/tox.ini index e7c06b0..a2a042e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,16 @@ [tox] -envlist=py39, py310, py311 +envlist = + py39, + py310, + py311 skip_missing_interpreters=true [testenv] -passenv= +passenv = TEST_USER TEST_KEY -deps= +deps = + click==8.1.8 pytest pytest-cov httpx @@ -14,5 +18,6 @@ deps= rich typer . -commands=py.test -s --capture=sys --cov=domaintools --cov=domaintools_async tests +commands = + py.test -s --capture=sys --cov=domaintools --cov=domaintools_async tests coverage html