Python: Expand Django 2/3 routing tests with 1.x way

Added it to the `testapp` so it's easy to run the server to SEE that it works.

Added it to `routing_test` so it's obvious this is supported by our modeling
when we _know_ it's running Django 2/3.
This commit is contained in:
Rasmus Wriedt Larsen
2020-10-23 13:43:27 +02:00
parent ae60ac211b
commit be166d9c02
3 changed files with 17 additions and 0 deletions

View File

@@ -97,3 +97,13 @@ urlpatterns = [
# We should not report there is a request parameter called `not_valid!`
path("not_valid/<not_valid!>", not_valid_identifier), # $routeSetup="not_valid/<not_valid!>"
]
# This version 1.x way of defining urls is deprecated in Django 3.1, but still works
from django.conf.urls import url
def deprecated(request): # $f-:routeHandler
return HttpResponse('deprecated')
urlpatterns = [
url(r"^deprecated/", deprecated), # $f-:routeSetup="^deprecated/"
]

View File

@@ -1,5 +1,8 @@
from django.urls import path, re_path
# This version 1.x way of defining urls is deprecated in Django 3.1, but still works
from django.conf.urls import url
from . import views
urlpatterns = [
@@ -8,4 +11,5 @@ urlpatterns = [
# inline expectation tests (which thinks the `$` would mark the beginning of a new
# line)
re_path(r"^ba[rz]/", views.bar_baz), # $routeSetup="^ba[rz]/"
url(r"^deprecated/", views.deprecated), # $f-routeSetup="^deprecated/"
]

View File

@@ -5,3 +5,6 @@ def foo(request: HttpRequest): # $routeHandler
def bar_baz(request: HttpRequest): # $routeHandler
return HttpResponse("bar_baz")
def deprecated(request: HttpRequest): # $f-:routeHandler
return HttpResponse("deprecated")