summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Schaul <kevin.schaul@gmail.com>2015-02-04 10:17:59 -0500
committerKevin Schaul <kevin.schaul@gmail.com>2015-02-04 10:20:59 -0500
commitb29922f6bf04aa6d575dfb119df09c22aaed5ea0 (patch)
treeb6bd47dad6d92397cdae7e4caf773912c9a80b14 /tests
parentb1cb61eca1632bc9c136f504e11c57d32d6f426d (diff)
downloadboto-b29922f6bf04aa6d575dfb119df09c22aaed5ea0.tar.gz
Add test ensuring Content-Length header is a str
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_connection.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/test_connection.py b/tests/unit/test_connection.py
index 1ad3df6e..69e8816e 100644
--- a/tests/unit/test_connection.py
+++ b/tests/unit/test_connection.py
@@ -524,6 +524,16 @@ class TestHTTPRequest(unittest.TestCase):
{'Some-Header': 'should%20be%20url%20encoded',
'User-Agent': UserAgent})
+ def test_content_length_str(self):
+ request = HTTPRequest('PUT', 'https', 'amazon.com', 443, None,
+ None, {}, {}, 'Body')
+ mock_connection = mock.Mock()
+ request.authorize(mock_connection)
+
+ # Ensure Content-Length header is a str. This is more explicit than
+ # relying on other code cast the value later. (Python 2.7.0, for
+ # example, assumes headers are of type str.)
+ self.assertIsInstance(request.headers['Content-Length'], str)
if __name__ == '__main__':
unittest.main()