summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMax Nikitenko <moaddib666@gmail.com>2021-03-07 10:35:55 +0200
committerGitHub <noreply@github.com>2021-03-07 14:35:55 +0600
commit2a704e35856bda908f5f122d1aaabebc6b469b0c (patch)
tree37e625a393e5f69a8ab797a30f2df6d779f0d21c /t
parentfccbb0d5d6b46d5f1750049467229a8db963cbf3 (diff)
downloadkombu-2a704e35856bda908f5f122d1aaabebc6b469b0c.tar.gz
fix: non kombu json message decoding in SQS transport (#1306)
* fix: non kombu json message decoding in SQS transport * fix: non kombu json message decoding in SQS transport - add tests Co-authored-by: Max Nikitenko <max.nikitenko@namecheap.com>
Diffstat (limited to 't')
-rw-r--r--t/unit/transport/test_SQS.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/t/unit/transport/test_SQS.py b/t/unit/transport/test_SQS.py
index 12bc81e9..3302527e 100644
--- a/t/unit/transport/test_SQS.py
+++ b/t/unit/transport/test_SQS.py
@@ -4,8 +4,7 @@ NOTE: The SQSQueueMock and SQSConnectionMock classes originally come from
http://github.com/pcsforeducation/sqs-mock-python. They have been patched
slightly.
"""
-
-
+import base64
import os
import pytest
import random
@@ -330,6 +329,14 @@ class test_Channel:
with pytest.raises(Empty):
self.channel._get_bulk(self.queue_name)
+ def test_is_base64_encoded(self):
+ raw = b'{"id": "4cc7438e-afd4-4f8f-a2f3-f46567e7ca77","task": "celery.task.PingTask",' \
+ b'"args": [],"kwargs": {},"retries": 0,"eta": "2009-11-17T12:30:56.527191"}'
+ b64_enc = base64.b64encode(raw)
+ assert self.channel._Channel__b64_encoded(b64_enc)
+ assert not self.channel._Channel__b64_encoded(raw)
+ assert not self.channel._Channel__b64_encoded(b"test123")
+
def test_messages_to_python(self):
from kombu.asynchronous.aws.sqs.message import Message