Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix django 3.2 support #466

Merged
merged 6 commits into from
Apr 13, 2021
Merged

Conversation

Jorl17
Copy link
Contributor

@Jorl17 Jorl17 commented Apr 12, 2021

This PR fixes #465 in a series of commits. I broke them up in such small commits so that maintainers can discard any commits that don't seem appropriate to the project.

As pointed out in that issue, this Django commit (which made it to 3.2) in essence made the _headers attribute of HttpResponse public. The proposed fix is the addition of a method called _get_response_headers which does its best to get _headers or headers out of the response that Silk processes. This is to maintain backwards-compatibility with pre 3.2 versions.

In the process of implementing this fix, I also added the recommended DEFAULT_AUTO_FIELD settings option of Django 3.2, and I updated the test migrations (I am unsure why these were outdated -- seems to be some encoding issue?)

Furthermore, I updated all the tests so that we now create Mock response objects with headers and not _headers.

Lastly, I added a simple test to make sure that we are mocking something that actually exists -- we make sure headers or _headers exist in a Django HttpResponse. This test was created so that it would fail unless the proposed fix is applied, which seemed appropriate to me.

Please tell me if there's anything else you need from me :)

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #466 (40e16c1) into master (5292808) will decrease coverage by 0.05%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
- Coverage   82.85%   82.80%   -0.06%     
==========================================
  Files          50       50              
  Lines        2042     2047       +5     
==========================================
+ Hits         1692     1695       +3     
- Misses        350      352       +2     
Impacted Files Coverage Δ
silk/model_factory.py 82.53% <66.66%> (-0.51%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5292808...40e16c1. Read the comment docs.

@auvipy auvipy merged commit a236861 into jazzband:master Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Django 3.2
2 participants