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
importcalendar
22
importdatetime
33

4-
fromdjango.conf.urlsimportinclude, url
4+
fromdjango.conf.urlsimportinclude
55
fromdjango.contrib.authimportget_user_model
66
fromdjango.httpimportHttpResponse
77
fromdjango.testimportTestCase, override_settings
8+
fromdjango.urlsimportpath
89
fromdjango.utilsimporttimezone
910
fromoauthlib.commonimportRequest
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
fromdatetimeimporttimedelta
22

3-
fromdjango.conf.urlsimportinclude, url
3+
fromdjango.conf.urlsimportinclude
44
fromdjango.contrib.authimportget_user_model
55
fromdjango.core.exceptionsimportImproperlyConfigured
66
fromdjango.httpimportHttpResponse
77
fromdjango.testimportTestCase
88
fromdjango.test.utilsimportoverride_settings
9+
fromdjango.urlsimportpath, re_path
910
fromdjango.utilsimporttimezone
1011
fromrest_frameworkimportpermissions
1112
fromrest_framework.authenticationimportBaseAuthentication
@@ -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)