File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
tests/integrations/django Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ from __future__ import absolute_import
2
+
3
+ import django
4
+
5
+ if django .VERSION >= (2 , 0 ):
6
+ # TODO: once we stop supporting django < 2, use the real name of this
7
+ # function (re_path)
8
+ from django .urls import re_path as url
9
+ else :
10
+ from django .conf .urls import url
11
+
12
+
13
+ urlpatterns = [
14
+ url (r"^foo/bar/baz/(?P<param>[\d]+)" , lambda x : "" ),
15
+ ]
Original file line number Diff line number Diff line change @@ -61,3 +61,19 @@ def test_legacy_resolver_newstyle_django20_urlconf():
61
61
resolver = RavenResolver ()
62
62
result = resolver .resolve ("/api/v2/1234/store/" , url_conf )
63
63
assert result == "/api/v2/{project_id}/store/"
64
+
65
+
66
+ def test_legacy_resolver_custom_urlconf_module_name ():
67
+ resolver = RavenResolver ()
68
+ custom_urlconf_module = "tests.integrations.django.myapp.custom_urls"
69
+ result = resolver .resolve ("/foo/bar/baz/1234" , custom_urlconf_module )
70
+ assert result == "/foo/bar/baz/{param}"
71
+
72
+
73
+ def test_legacy_resolver_custom_urlconf_callback ():
74
+ def custom_urlconf_callback ():
75
+ return "tests.integrations.django.myapp.custom_urls"
76
+
77
+ resolver = RavenResolver ()
78
+ result = resolver .resolve ("/foo/bar/baz/1234" , custom_urlconf_callback )
79
+ assert result == "/foo/bar/baz/{param}"
You can’t perform that action at this time.
0 commit comments