Skip to content

Commit 5cd509d

Browse files
authored
Merge pull request #44 from eadwinCode/ninja_0_20_upgrade
Ninja 0.20.0 upgrade
2 parents 1545d70 + ded96d3 commit 5cd509d

File tree

11 files changed

+22
-18
lines changed

11 files changed

+22
-18
lines changed

.github/workflows/test_full.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
15-
django-version: ['<2.1', '<2.2', '<3.0', '<3.1', '<3.2', '<3.3', '<4.1']
14+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
15+
django-version: ['<3.0', '<3.1', '<3.2', '<3.3', '<4.1', '<4.2']
1616

1717
steps:
1818
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ repos:
1414
name: Code Formatting
1515
entry: "make fmt"
1616
types: [python]
17-
language_version: python3.6
17+
language_version: python3.8
1818
language: python
1919
- id: code_linting
2020
args: [ ]
2121
name: Code Linting
2222
entry: "make lint"
2323
types: [ python ]
24-
language_version: python3.6
24+
language_version: python3.8
2525
language: python
2626
- repo: https://github.com/pre-commit/pre-commit-hooks
2727
rev: v2.3.0

ninja_extra/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Django Ninja Extra - Class Based Utility and more for Django Ninja(Fast Django REST framework)"""
22

3-
__version__ = "0.16.0"
3+
__version__ = "0.18.0"
44

55
import django
66

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers = [
2727
"Programming Language :: Python :: 3.8",
2828
"Programming Language :: Python :: 3.9",
2929
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
3031
"Programming Language :: Python :: 3 :: Only",
3132
"Framework :: Django",
3233
"Framework :: Django :: 2.1",

tests/test_route.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
RouteInvalidParameterException,
1717
)
1818
from ninja_extra.controllers.base import get_all_controller_route_function
19-
from ninja_extra.controllers.route.context import RouteContext
19+
from ninja_extra.controllers.route.context import (
20+
RouteContext,
21+
get_route_execution_context,
22+
)
2023
from ninja_extra.exceptions import PermissionDenied
2124
from ninja_extra.permissions import AllowAny
2225

@@ -352,7 +355,7 @@ def test_route_is_protected_by_its_permissions_paramater(self):
352355

353356
def test_route_prep_controller_route_execution_context_works(self):
354357
route_function: RouteFunction = SomeTestController.example
355-
context = route_function.get_route_execution_context(request=anonymous_request)
358+
context = get_route_execution_context(request=anonymous_request)
356359
with route_function._prep_controller_route_execution(context=context) as ctx:
357360
assert isinstance(ctx.controller_instance, SomeTestController)
358361
assert ctx.controller_instance.context
@@ -362,7 +365,7 @@ def test_route_prep_controller_route_execution_context_cleans_controller_after_r
362365
self,
363366
):
364367
route_function: RouteFunction = SomeTestController.example
365-
context = route_function.get_route_execution_context(request=anonymous_request)
368+
context = get_route_execution_context(request=anonymous_request)
366369
with pytest.raises(Exception):
367370
with route_function._prep_controller_route_execution(
368371
context=context

tests/test_testclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def test_add_works(self):
2828

2929

3030
@pytest.mark.skipif(django.VERSION < (3, 1), reason="requires django 3.1 or higher")
31-
@pytest.mark.asyncio
3231
class TestTestAsyncClient:
3332
if not django.VERSION < (3, 1):
3433

34+
@pytest.mark.asyncio
3535
async def test_add_async_works(self):
3636
client = TestAsyncClient(router)
3737
res = await client.get("/add-async", query=dict(a=4, b=6))

tests/test_throthling/test_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def dynamic_throttling_scope(request):
5353

5454

5555
class TestThrottling:
56-
def setup(self):
56+
def setup_method(self):
5757
self.user = ThrottlingMockUser("Ninja")
5858
self.user.set_id(uuid.uuid4())
5959

tests/test_throthling/test_models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@pytest.mark.django_db
1717
class TestAnonRateThrottle:
18-
def setup(self):
18+
def setup_method(self):
1919
self.throttle = AnonRateThrottle()
2020
self.request = HttpRequest()
2121
self.request.user = None
@@ -31,7 +31,7 @@ def test_get_cache_key_returns_correct_value(self):
3131

3232

3333
class TestBaseThrottle:
34-
def setup(self):
34+
def setup_method(self):
3535
self.throttling = BaseThrottle()
3636
self.request = HttpRequest()
3737

@@ -75,7 +75,7 @@ def test_get_ident_with_num_proxies(self, monkeypatch):
7575

7676

7777
class TestSimpleRateThrottle:
78-
def setup(self):
78+
def setup_method(self):
7979
SimpleRateThrottle.scope = "anon"
8080

8181
def test_get_rate_raises_error_if_scope_is_missing(self):
@@ -125,7 +125,7 @@ def test_wait_returns_none_if_there_are_no_available_requests(self):
125125

126126

127127
class TestUserRateThrottle:
128-
def setup(self):
128+
def setup_method(self):
129129
self.throttle = UserRateThrottle()
130130
self.request = HttpRequest()
131131
self.request.user = None
@@ -148,7 +148,7 @@ def test_get_cache_key_returns_correct_value(self):
148148

149149

150150
class TestDynamicRateThrottle:
151-
def setup(self):
151+
def setup_method(self):
152152
self.request = HttpRequest()
153153
self.request.user = None
154154

tests/test_throthling/test_throttle_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def endpoint_3(self, request):
3636

3737

3838
class TestThrottlingControllerSample:
39-
def setup(self):
39+
def setup_method(self):
4040
self.user = ThrottlingMockUser("Ninja")
4141
self.user.set_id(uuid.uuid4())
4242

tests/test_throthling/test_throttle_decorator_on_controllers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def dynamic_throttling_scope(self, request):
3333

3434

3535
class TestThrottledController:
36-
def setup(self):
36+
def setup_method(self):
3737
self.user = ThrottlingMockUser("Ninja")
3838
self.user.set_id(uuid.uuid4())
3939

0 commit comments

Comments
 (0)