Skip to content

Commit 8e75ad7

Browse files
smithdc1auvipy
authored andcommitted
Changed url() to path() and re_path()
url() is deprecated in Django 3.1
1 parent 4655c03 commit 8e75ad7

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

tests/test_introspection_auth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import calendar
22
import datetime
33

4-
from django.conf.urls import include, url
4+
from django.conf.urls import include
55
from django.contrib.auth import get_user_model
66
from django.http import HttpResponse
77
from django.test import TestCase, override_settings
8+
from django.urls import path
89
from django.utils import timezone
910
from oauthlib.common import Request
1011

@@ -64,8 +65,8 @@ def json(self):
6465

6566

6667
urlpatterns = [
67-
url(r"^oauth2/", include("oauth2_provider.urls")),
68-
url(r"^oauth2-test-resource/$", ScopeResourceView.as_view()),
68+
path("oauth2/", include("oauth2_provider.urls")),
69+
path("oauth2-test-resource/", ScopeResourceView.as_view()),
6970
]
7071

7172

tests/test_rest_framework.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from datetime import timedelta
22

3-
from django.conf.urls import include, url
3+
from django.conf.urls import include
44
from django.contrib.auth import get_user_model
55
from django.core.exceptions import ImproperlyConfigured
66
from django.http import HttpResponse
77
from django.test import TestCase
88
from django.test.utils import override_settings
9+
from django.urls import path, re_path
910
from django.utils import timezone
1011
from rest_framework import permissions
1112
from rest_framework.authentication import BaseAuthentication
@@ -109,17 +110,17 @@ class AuthenticationNoneOAuth2View(MockView):
109110

110111

111112
urlpatterns = [
112-
url(r"^oauth2/", include("oauth2_provider.urls")),
113-
url(r"^oauth2-test/$", OAuth2View.as_view()),
114-
url(r"^oauth2-scoped-test/$", ScopedView.as_view()),
115-
url(r"^oauth2-scoped-missing-auth/$", TokenHasScopeViewWrongAuth.as_view()),
116-
url(r"^oauth2-read-write-test/$", ReadWriteScopedView.as_view()),
117-
url(r"^oauth2-resource-scoped-test/$", ResourceScopedView.as_view()),
118-
url(r"^oauth2-authenticated-or-scoped-test/$", AuthenticatedOrScopedView.as_view()),
119-
url(r"^oauth2-method-scope-test/.*$", MethodScopeAltView.as_view()),
120-
url(r"^oauth2-method-scope-fail/$", MethodScopeAltViewBad.as_view()),
121-
url(r"^oauth2-method-scope-missing-auth/$", MethodScopeAltViewWrongAuth.as_view()),
122-
url(r"^oauth2-authentication-none/$", AuthenticationNoneOAuth2View.as_view()),
113+
path("oauth2/", include("oauth2_provider.urls")),
114+
path("oauth2-test/", OAuth2View.as_view()),
115+
path("oauth2-scoped-test/", ScopedView.as_view()),
116+
path("oauth2-scoped-missing-auth/", TokenHasScopeViewWrongAuth.as_view()),
117+
path("oauth2-read-write-test/", ReadWriteScopedView.as_view()),
118+
path("oauth2-resource-scoped-test/", ResourceScopedView.as_view()),
119+
path("oauth2-authenticated-or-scoped-test/", AuthenticatedOrScopedView.as_view()),
120+
re_path(r"oauth2-method-scope-test/.*$", MethodScopeAltView.as_view()),
121+
path("oauth2-method-scope-fail/", MethodScopeAltViewBad.as_view()),
122+
path("oauth2-method-scope-missing-auth/", MethodScopeAltViewWrongAuth.as_view()),
123+
path("oauth2-authentication-none/", AuthenticationNoneOAuth2View.as_view()),
123124
]
124125

125126

0 commit comments

Comments
 (0)