Failing test for Accept-Encoding header

This commit is contained in:
Cory Benfield 2014-02-23 14:57:03 +00:00
parent da3a0bb9fc
commit 673336ff8f

View file

@ -277,6 +277,17 @@ class TwythonAPITestCase(unittest.TestCase):
"""Test attempting to get a header when no API call was made raises a TwythonError""" """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') 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 # Static methods
def test_construct_api_url(self): def test_construct_api_url(self):
"""Test constructing a Twitter API url works as we expect""" """Test constructing a Twitter API url works as we expect"""