-
Notifications
You must be signed in to change notification settings - Fork 186
only logout with POST, fixes #126 #144
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
only logout with POST, fixes #126 #144
Conversation
Codecov Report
@@ Coverage Diff @@
## master #144 +/- ##
==========================================
+ Coverage 96.65% 97.43% +0.78%
==========================================
Files 6 6
Lines 239 234 -5
==========================================
- Hits 231 228 -3
+ Misses 8 6 -2
Continue to review full report at Codecov.
|
|
Please also add a test with a request factory sending a |
tests/test_views.py
Outdated
| self.assertEqual(response.status_code, 302) | ||
| self.assertEqual(response.url, '/example-logout') | ||
| response = logout_view(request) | ||
| self.assertEqual(response.status_code, 405) |
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 there a reason we want to test get when we only implement post? I suggest we remove this test if that doesn't affect coverage.
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.
You're right. It's simply part of Django. No point testing Django. Will remove.
| return import_from_settings('LOGOUT_REDIRECT_URL', '/') | ||
|
|
||
| def dispatch(self, request, *args, **kwargs): | ||
| def post(self, request): |
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.
What about CSRF? Does it work by default?
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.
Tests test that automatically. As long as the view doesn't have a csrf_exempt decorator it should be using CSRF.
|
|
I believe I've address the CSRF question. |
No description provided.