diff options
author | Matus Valo <matusvalo@users.noreply.github.com> | 2021-05-23 08:09:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-23 12:09:06 +0600 |
commit | 4cf1a2171202f821d93c30b9f635dbefa532ac9a (patch) | |
tree | 9c5356c70e3f26b3acc0aaa01f09808952e35617 /t | |
parent | e6d76d13fc342dec473828a7780c0c2f77b4b738 (diff) | |
download | kombu-4cf1a2171202f821d93c30b9f635dbefa532ac9a.tar.gz |
prepare_accept_content() now raises SerializerNotInstalled instead of KeyError (#1343)
* Fix broken nested() after #1320
* prepare_accept_content now raises SerializerNotInstalled when wrong serializer alias is passed
Diffstat (limited to 't')
-rw-r--r-- | t/unit/test_serialization.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/t/unit/test_serialization.py b/t/unit/test_serialization.py index 82aec807..fe5ea625 100644 --- a/t/unit/test_serialization.py +++ b/t/unit/test_serialization.py @@ -13,7 +13,7 @@ from kombu.serialization import ( raw_encode, register_yaml, register_msgpack, dumps, loads, pickle, pickle_protocol, unregister, register_pickle, enable_insecure_serializers, - disable_insecure_serializers, + disable_insecure_serializers, prepare_accept_content ) from kombu.utils.encoding import str_to_bytes @@ -307,3 +307,12 @@ class test_Serialization: register_msgpack() with pytest.raises(SerializerNotInstalled): loads('foo', 'application/x-msgpack', 'utf-8') + + def test_prepare_accept_content(self): + assert {'application/json'} == prepare_accept_content(['json']) + assert {'application/json'} == prepare_accept_content( + ['application/json']) + + def test_prepare_accept_content_bad_serializer(self): + with pytest.raises(SerializerNotInstalled): + prepare_accept_content(['bad_serializer']) |