From 673336ff8f8a9a647fc8e44cb05f6c8a0ec39c98 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Sun, 23 Feb 2014 14:57:03 +0000 Subject: [PATCH] Failing test for Accept-Encoding header --- tests/test_core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_core.py b/tests/test_core.py index df20660..4870688 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -277,6 +277,17 @@ class TwythonAPITestCase(unittest.TestCase): """Test attempting to get a header when no API call was made raises a TwythonError""" self.assertRaises(TwythonError, self.api.get_lastfunction_header, 'no-api-call-was-made') + @responses.activate + def test_sends_correct_accept_encoding_header(self): + """Test that Twython accepts compressed data.""" + endpoint = 'statuses/home_timeline' + url = self.get_url(endpoint) + self.register_response(responses.GET, url) + + self.api.get(endpoint) + + self.assertEqual('gzip, deflate, compress', responses.calls[0].request.headers['Accept-Encoding']) + # Static methods def test_construct_api_url(self): """Test constructing a Twitter API url works as we expect"""