-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Django 1.10 support. #4158
Merged
Merged
Django 1.10 support. #4158
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b0894ed
Added TEMPLATES setting to tests
tomchristie 1a2b325
Remove deprecated view-string in URL conf
tomchristie f11e24e
Replace 'urls = ...' in test classes with override_settings('ROOT_URL…
tomchristie 9c83ff4
Refactor UsingURLPatterns to use override_settings(ROOT_URLCONF=...) …
tomchristie 96aaa24
Get model managers and names in a version-compatible manner.
tomchristie 46f2ec4
Apply override_settings to a TestCase, not a mixin class
tomchristie 9d1ee6f
Use '.callback' property instead of private attributes when inspectin…
tomchristie 437a125
Pass 'user' to template explicitly
tomchristie c65c5e4
Correct sorting of import statements.
tomchristie 7ece633
Remove unused TEMPLATE_LOADERS setting, in favor of TEMPLATES.
tomchristie 0ab1aeb
Remove code style issue
tomchristie b593194
BaseFilter test requires a concrete model
tomchristie 3bdbfdb
Resolve tox.ini issues
tomchristie 3a808a0
Resolve isort differences between local and tox environments
tomchristie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
from django.conf.urls import url | ||
from django.contrib.auth.models import User | ||
from django.test import override_settings | ||
|
||
from rest_framework.authentication import TokenAuthentication | ||
from rest_framework.authtoken.models import Token | ||
|
@@ -20,10 +20,8 @@ def process_response(self, request, response): | |
return response | ||
|
||
|
||
@override_settings(ROOT_URLCONF='tests.test_middleware') | ||
class TestMiddleware(APITestCase): | ||
|
||
urls = 'tests.test_middleware' | ||
|
||
def test_middleware_can_access_user_when_processing_response(self): | ||
user = User.objects.create_user('john', '[email protected]', 'password') | ||
key = 'abcd1234' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed by Django 1.10 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For one reason or another, yes.
I've not dug into why yet, but presumably we were previously having it automatically included by the
RequestContext
. I assume that we could also change our settings in order to resolve this (eg perhaps context processor configuration has moved to being part of theTEMPLATES
dictionary?)In any case it's probably best that we pass it explicitly, rather than relying on the correct context processors being set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified. Previously we were relying on the default value of
TEMPLATE_CONTEXT_PROCESSORS
, which includesdjango.contrib.auth.context_processors.auth
.We could add this in to the
TEMPLATES.OPTIONS.context_processors
inconftest.py
, which would resolve our test cases, but it's better if we pass it explicitly, and not rely on the user settings.