Skip to content

Commit

Permalink
Adjust test_get_gzip to set Accept-Encoding header
Browse files Browse the repository at this point in the history
requests 2.26.0 added brotli support and now gets its Accept-Encoding
header from urllib3.util.make_headers. The latter appends ",br" to it
if the brotli or brotlicffi packages are installed, thus breaking the
test_django_whitenoise.py::test_get_gzip test.

Adjust test_get_gzip to explicitly set "Accept-Encoding" to "gzip".
  • Loading branch information
foutrelis committed Dec 8, 2021
1 parent ebd1ee5 commit ab5d4ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_django_whitenoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_unversioned_file_not_cached_forever(server, static_files, _collect_stat

def test_get_gzip(server, static_files, _collect_static):
url = storage.staticfiles_storage.url(static_files.js_path)
response = server.get(url)
response = server.get(url, headers={"Accept-Encoding": "gzip"})
assert response.content == static_files.js_content
assert response.headers["Content-Encoding"] == "gzip"
assert response.headers["Vary"] == "Accept-Encoding"
Expand Down

0 comments on commit ab5d4ae

Please sign in to comment.