diff options
author | Jiangge Zhang <tonyseek@gmail.com> | 2015-06-03 02:04:58 +0800 |
---|---|---|
committer | Jiangge Zhang <tonyseek@gmail.com> | 2015-06-03 02:04:58 +0800 |
commit | a051184195b54c6ccae7c7172805f741b0c099bd (patch) | |
tree | c2d8f34af9fc215be60f75caaa1c3fa317a95094 /tests/hazmat/primitives/twofactor/test_hotp.py | |
parent | 09617e98d361d8277ea056e9e0f657c6e38f1178 (diff) | |
download | cryptography-a051184195b54c6ccae7c7172805f741b0c099bd.tar.gz cryptography-a051184195b54c6ccae7c7172805f741b0c099bd.tar.bz2 cryptography-a051184195b54c6ccae7c7172805f741b0c099bd.zip |
Follow the review advice: turn URI generator into methods.
Diffstat (limited to 'tests/hazmat/primitives/twofactor/test_hotp.py')
-rw-r--r-- | tests/hazmat/primitives/twofactor/test_hotp.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py index ba40488a..3359dac2 100644 --- a/tests/hazmat/primitives/twofactor/test_hotp.py +++ b/tests/hazmat/primitives/twofactor/test_hotp.py @@ -14,7 +14,6 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.hashes import MD5, SHA1 from cryptography.hazmat.primitives.twofactor import InvalidToken from cryptography.hazmat.primitives.twofactor.hotp import HOTP -from cryptography.hazmat.primitives.twofactor.utils import get_provisioning_uri from ....utils import ( load_nist_vectors, load_vectors_from_file, raises_unsupported_algorithm @@ -97,18 +96,15 @@ class TestHOTP(object): secret = b"12345678901234567890" hotp = HOTP(secret, 6, SHA1(), backend) - assert get_provisioning_uri(hotp, "Alice Smith", counter=1) == ( + assert hotp.get_provisioning_uri("Alice Smith", 1) == ( "otpauth://hotp/Alice%20Smith?digits=6&secret=GEZDGNBV" "GY3TQOJQGEZDGNBVGY3TQOJQ&algorithm=SHA1&counter=1") - assert get_provisioning_uri(hotp, "Alice Smith", 'Foo', counter=1) == ( + assert hotp.get_provisioning_uri("Alice Smith", 1, issuer='Foo') == ( "otpauth://hotp/Foo:Alice%20Smith?digits=6&secret=GEZD" "GNBVGY3TQOJQGEZDGNBVGY3TQOJQ&algorithm=SHA1&issuer=Foo" "&counter=1") - with pytest.raises(RuntimeError): - get_provisioning_uri(hotp, "Alice Smith", 'World') # counter lost - def test_invalid_backend(): secret = b"12345678901234567890" |