diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-10-20 11:30:57 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-10-20 11:30:57 -0700 |
commit | 4f286cec7a28169ac8939cc01aa6fdead47ac58e (patch) | |
tree | 3bb8b3c71a6e93310139d02872956a4d3a301f03 | |
parent | d5b592d95d3844f902378ac4d97ea8a0e8843600 (diff) | |
download | cryptography-4f286cec7a28169ac8939cc01aa6fdead47ac58e.tar.gz cryptography-4f286cec7a28169ac8939cc01aa6fdead47ac58e.tar.bz2 cryptography-4f286cec7a28169ac8939cc01aa6fdead47ac58e.zip |
Handle non-iterable arguments reasonable
-rw-r--r-- | cryptography/fernet.py | 1 | ||||
-rw-r--r-- | tests/test_fernet.py | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/cryptography/fernet.py b/cryptography/fernet.py index 6bc401de..4f98feec 100644 --- a/cryptography/fernet.py +++ b/cryptography/fernet.py @@ -131,6 +131,7 @@ class Fernet(object): class MultiFernet(object): def __init__(self, fernets): + fernets = list(fernets) if not fernets: raise ValueError( "MultiFernet requires at least one Fernet instance" diff --git a/tests/test_fernet.py b/tests/test_fernet.py index 91af32ad..58f89cbf 100644 --- a/tests/test_fernet.py +++ b/tests/test_fernet.py @@ -146,3 +146,7 @@ class TestMultiFernet(object): def test_no_fernets(self, backend): with pytest.raises(ValueError): MultiFernet([]) + + def test_non_iterable_argument(self, backend): + with pytest.raises(TypeError): + MultiFernet(None) |