aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-01 09:57:25 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-01 09:57:25 -0800
commit9b1a82e42bdd546220225430aa06e3b732fb0155 (patch)
tree606953d632264e9fb257ff777b496b55b83d235e
parent58ee8c55acc585fb90a99f6102fa4a7d56072b27 (diff)
downloadcryptography-9b1a82e42bdd546220225430aa06e3b732fb0155.tar.gz
cryptography-9b1a82e42bdd546220225430aa06e3b732fb0155.tar.bz2
cryptography-9b1a82e42bdd546220225430aa06e3b732fb0155.zip
Switch to TypeError
-rw-r--r--cryptography/hazmat/primitives/twofactor/hotp.py2
-rw-r--r--docs/hazmat/primitives/twofactor.rst4
-rw-r--r--tests/hazmat/primitives/twofactor/test_hotp.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/cryptography/hazmat/primitives/twofactor/hotp.py b/cryptography/hazmat/primitives/twofactor/hotp.py
index ed0488f9..88bde715 100644
--- a/cryptography/hazmat/primitives/twofactor/hotp.py
+++ b/cryptography/hazmat/primitives/twofactor/hotp.py
@@ -31,7 +31,7 @@ class HOTP(object):
raise ValueError("Length of HOTP has to be between 6 to 8.")
if not isinstance(algorithm, (SHA1, SHA256, SHA512)):
- raise ValueError("Algorithm must be SHA1, SHA256 or SHA512")
+ raise TypeError("Algorithm must be SHA1, SHA256 or SHA512")
self._key = key
self._length = length
diff --git a/docs/hazmat/primitives/twofactor.rst b/docs/hazmat/primitives/twofactor.rst
index 784b8ed1..0e781439 100644
--- a/docs/hazmat/primitives/twofactor.rst
+++ b/docs/hazmat/primitives/twofactor.rst
@@ -47,7 +47,7 @@ codes (HMAC).
provider.
:raises ValueError: This is raised if the provided ``key`` is shorter than
128 bits or if the ``length`` parameter is not 6, 7 or 8.
- :raises ValueError: This is raised if the provided ``algorithm`` is not
+ :raises TypeError: This is raised if the provided ``algorithm`` is not
:class:`~cryptography.hazmat.primitives.hashes.SHA1()`,
:class:`~cryptography.hazmat.primitives.hashes.SHA256()` or
:class:`~cryptography.hazmat.primitives.hashes.SHA512()`.
@@ -142,7 +142,7 @@ similar to the following code.
provider.
:raises ValueError: This is raised if the provided ``key`` is shorter than
128 bits or if the ``length`` parameter is not 6, 7 or 8.
- :raises ValueError: This is raised if the provided ``algorithm`` is not
+ :raises TypeError: This is raised if the provided ``algorithm`` is not
:class:`~cryptography.hazmat.primitives.hashes.SHA1()`,
:class:`~cryptography.hazmat.primitives.hashes.SHA256()` or
:class:`~cryptography.hazmat.primitives.hashes.SHA512()`.
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index fc74ee7f..4c726b77 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -46,7 +46,7 @@ class TestHOTP(object):
def test_invalid_algorithm(self, backend):
secret = os.urandom(16)
- with pytest.raises(ValueError):
+ with pytest.raises(TypeError):
HOTP(secret, 6, MD5(), backend)
@pytest.mark.parametrize("params", vectors)