Skip to content

Commit

Permalink
Fix Brotli test to work with updated requests
Browse files Browse the repository at this point in the history
Newer versions of `requests` depend on an updated version of `urllib3`
which transparently decodes Brotli just as it does for gzip.

References #225
  • Loading branch information
evansd committed Sep 12, 2019
1 parent 5477b3d commit ca67144
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion requirements.test.txt
@@ -1,2 +1,6 @@
certifi==2019.9.11
chardet==3.0.4
coverage==4.2
requests==2.11.1
idna==2.8
requests==2.22.0
urllib3==1.25.3
4 changes: 1 addition & 3 deletions tests/test_django_whitenoise.py
Expand Up @@ -17,8 +17,6 @@
from django.core.management import call_command
from django.utils.functional import empty

import brotli

from whitenoise.middleware import WhiteNoiseMiddleware

from .utils import TestServer, Files
Expand Down Expand Up @@ -91,7 +89,7 @@ def test_get_gzip(self):
def test_get_brotli(self):
url = storage.staticfiles_storage.url(self.static_files.js_path)
response = self.server.get(url, headers={'Accept-Encoding': 'gzip, br'})
self.assertEqual(brotli.decompress(response.content), self.static_files.js_content)
self.assertEqual(response.content, self.static_files.js_content)
self.assertEqual(response.headers['Content-Encoding'], 'br')
self.assertEqual(response.headers['Vary'], 'Accept-Encoding')

Expand Down

0 comments on commit ca67144

Please sign in to comment.