diff options
author | Jordan Cook <jordan.cook.git@proton.me> | 2022-10-20 13:03:45 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook.git@proton.me> | 2022-10-20 13:09:55 -0500 |
commit | 54d85c12bf4aa98e2798f18b7c4719b1ba493770 (patch) | |
tree | d9dd9003a4297c268cff7096e4aaf7a81cba5254 /tests | |
parent | 2cfccd966876349ffbfd5a44a6db684966468b95 (diff) | |
download | requests-cache-54d85c12bf4aa98e2798f18b7c4719b1ba493770.tar.gz |
Explicitly disable pickling CachedSession objects
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_session.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unit/test_session.py b/tests/unit/test_session.py index 53e368c..60e8bb4 100644 --- a/tests/unit/test_session.py +++ b/tests/unit/test_session.py @@ -1,5 +1,6 @@ """CachedSession tests that use mocked responses only""" import json +import pickle from collections import UserDict, defaultdict from datetime import datetime, timedelta from logging import getLogger @@ -76,6 +77,11 @@ def test_repr(mock_session): assert 'cache_control=True' in repr(mock_session) +def test_pickle__disabled(): + with pytest.raises(NotImplementedError): + pickle.dumps(CachedSession(backend='memory')) + + def test_response_defaults(mock_session): """Both cached and new responses should always have the following attributes""" mock_session.settings.expire_after = datetime.utcnow() + timedelta(days=1) |