Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #13304 -- Updated auth decorators so they can be used with call…
…able classes. Thanks to Horst Gutmann for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
- Loading branch information
1 parent
736b751
commit 056c940
Showing
3 changed files
with
32 additions
and
5 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from unittest import TestCase | ||
|
||
from django.contrib.auth.decorators import login_required | ||
|
||
|
||
class LoginRequiredTestCase(TestCase): | ||
""" | ||
Tests the login_required decorators | ||
""" | ||
def testCallable(self): | ||
""" | ||
Check that login_required is assignable to callable objects. | ||
""" | ||
class CallableView(object): | ||
def __call__(self, *args, **kwargs): | ||
pass | ||
login_required(CallableView()) | ||
|
||
def testView(self): | ||
""" | ||
Check that login_required is assignable to normal views. | ||
""" | ||
def normal_view(request): | ||
pass | ||
login_required(normal_view) |