-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e9684f
commit f38d74c
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
import django | ||
|
||
from django.test import SimpleTestCase, override_settings | ||
from django.urls import reverse | ||
|
||
|
||
@unittest.skipIf(django.VERSION < (5, 1), | ||
"Django below 5.1 is not supported login_not_required") | ||
class LoginNotRequiredTestCase(SimpleTestCase): | ||
@override_settings( | ||
MIDDLEWARE=[ | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.auth.middleware.LoginRequiredMiddleware", | ||
"debug_toolbar.middleware.DebugToolbarMiddleware", | ||
] | ||
) | ||
def test_login_not_required(self): | ||
raise Exception("Django 5.1") | ||
# render_panel | ||
# self.client.get(reverse('dj')) | ||
# DEBUG_TOOLBAR_CONFIG = { | ||
# # Django's test client sets wsgi.multiprocess to True inappropriately | ||
# "RENDER_PANELS": False, | ||
# # IS_RUNNING_TESTS must be False even though we're running tests because we're running the toolbar's own tests. | ||
# "IS_RUNNING_TESTS": False, | ||
# } |