parent
8ea617a00f
commit
3a12803124
@ -1,46 +0,0 @@
|
||||
commit c5047b3dc1800dda7a6a02766c9bafdaa139014e
|
||||
Author: Garrett Holmstrom <gholms@devzero.com>
|
||||
Date: Fri Jan 29 16:37:13 2016 -0800
|
||||
|
||||
Decode request bodies before passing them to json
|
||||
|
||||
AWSAuthConnection._mexe encodes request bodies as UTF-8, mutating the
|
||||
original request object in the process. This breaks kinesis's unit
|
||||
tests on at least python 3.4 and 3.5 on Fedora, because those unit tests
|
||||
call json.loads, which expect str objects rather than the bytes objects
|
||||
that _mexe converted it to.
|
||||
|
||||
This commit makes the test cases decode request bodies before feeding
|
||||
them to json.loads.
|
||||
|
||||
Index: boto-2.39.0/tests/unit/kinesis/test_kinesis.py
|
||||
===================================================================
|
||||
--- boto-2.39.0.orig/tests/unit/kinesis/test_kinesis.py
|
||||
+++ boto-2.39.0/tests/unit/kinesis/test_kinesis.py
|
||||
@@ -36,7 +36,7 @@ class TestKinesis(AWSMockServiceTestCase
|
||||
self.service_connection.put_record('stream-name',
|
||||
b'\x00\x01\x02\x03\x04\x05', 'partition-key')
|
||||
|
||||
- body = json.loads(self.actual_request.body)
|
||||
+ body = json.loads(self.actual_request.body.decode('utf-8'))
|
||||
self.assertEqual(body['Data'], 'AAECAwQF')
|
||||
|
||||
target = self.actual_request.headers['X-Amz-Target']
|
||||
@@ -47,7 +47,7 @@ class TestKinesis(AWSMockServiceTestCase
|
||||
self.service_connection.put_record('stream-name',
|
||||
'data', 'partition-key')
|
||||
|
||||
- body = json.loads(self.actual_request.body)
|
||||
+ body = json.loads(self.actual_request.body.decode('utf-8'))
|
||||
self.assertEqual(body['Data'], 'ZGF0YQ==')
|
||||
|
||||
target = self.actual_request.headers['X-Amz-Target']
|
||||
@@ -66,7 +66,7 @@ class TestKinesis(AWSMockServiceTestCase
|
||||
self.service_connection.put_records(stream_name='stream-name',
|
||||
records=[record_binary, record_str])
|
||||
|
||||
- body = json.loads(self.actual_request.body)
|
||||
+ body = json.loads(self.actual_request.body.decode('utf-8'))
|
||||
self.assertEqual(body['Records'][0]['Data'], 'AAECAwQF')
|
||||
self.assertEqual(body['Records'][1]['Data'], 'ZGF0YQ==')
|
||||
|
Loading…
Reference in new issue