Skip to content

Commit 84bd53f

Browse files
committed
fixed failing tests
1 parent ad8cdb4 commit 84bd53f

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

ninja_jwt/authentication.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def default_user_authentication_rule(user) -> bool:
108108
return user is not None and user.is_active
109109

110110

111-
if django.VERSION > (3, 0):
111+
if not django.VERSION < (3, 1):
112112
from asgiref.sync import sync_to_async
113113

114114
class AsyncJWTBaseAuthentication(JWTBaseAuthentication):
@@ -123,12 +123,10 @@ async def async_jwt_authenticate(
123123
request.user = user
124124
return user
125125

126-
127126
class AsyncJWTAuth(AsyncJWTBaseAuthentication, JWTAuth, AsyncHttpBearer):
128127
async def authenticate(self, request: HttpRequest, token: str) -> Any:
129128
return await self.async_jwt_authenticate(request, token)
130129

131-
132130
class AsyncJWTTokenUserAuth(
133131
AsyncJWTBaseAuthentication, JWTTokenUserAuth, AsyncHttpBearer
134132
):

ninja_jwt/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class NinjaJWTSlidingController(
102102
auto_import = False
103103

104104

105-
if django.VERSION > (3, 0):
105+
if not django.VERSION < (3, 1):
106106

107107
class AsyncTokenVerificationController(TokenVerificationController):
108108
@http_post("/verify", response={200: Schema}, url_name="token_verify")

tests/test_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def username(self):
142142
assert user.username == "bsaget"
143143

144144

145-
if django.VERSION > (3, 0):
145+
if not django.VERSION < (3, 1):
146146
from asgiref.sync import sync_to_async
147147

148148
class TestAsyncJWTAuth(TestJWTAuth):

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_user_can_get_access_and_refresh_tokens_and_use_them(self, monkeypatch):
148148
assert res.data["foo"] == "bar"
149149

150150

151-
if django.VERSION > (3, 0):
151+
if not django.VERSION < (3, 1):
152152
from asgiref.sync import sync_to_async
153153

154154
class TestAsyncTestView(TestTestView):

tests/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
path("api/", api.urls),
3232
]
3333

34-
if django.VERSION > (3, 0):
34+
if not django.VERSION < (3, 1):
3535
AsyncTokenObtainSlidingController = api_controller(
3636
"/token-async",
3737
permissions=[permissions.AllowAny],

tests/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test(self):
1111
return {"foo": "bar"}
1212

1313

14-
if django.VERSION > (3, 0):
14+
if not django.VERSION < (3, 1):
1515

1616
@api_controller("/test-view-async", auth=authentication.AsyncJWTAuth())
1717
class TestAPIAsyncController:

0 commit comments

Comments
 (0)