mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
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:
@@ -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/"
|
||||
]
|
||||
|
||||
@@ -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/"
|
||||
]
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user