Skip to content

Commit bcd0d57

Browse files
committed
Fixed LookupAllowedTest.test_lookup_allowed() on Django 6+.
1 parent a1ba002 commit bcd0d57

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test_admin.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22

3+
import django
34
from django.contrib.admin import site
45
from django.contrib.auth import get_user_model
56
from django.test import RequestFactory, TestCase
@@ -14,8 +15,14 @@
1415
class LookupAllowedTest(TestCase):
1516
def test_lookup_allowed(self):
1617
admin = RequestAdmin(Request, site)
17-
admin.lookup_allowed("user__username", "foo")
18-
admin.lookup_allowed("response", 200)
18+
if django.VERSION < (5, 0):
19+
admin.lookup_allowed("user__username", "foo")
20+
admin.lookup_allowed("response", 200)
21+
else:
22+
factory = RequestFactory()
23+
request = factory.get("/")
24+
admin.lookup_allowed("user__username", "foo", request)
25+
admin.lookup_allowed("response", 200, request)
1926

2027

2128
class RequestFromTest(TestCase):

0 commit comments

Comments
 (0)