mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 17:09:59 +03:00
demonstrate success with trailing /
This commit is contained in:
parent
7ee7c453a0
commit
80394386d0
|
@ -5,7 +5,12 @@ def test_get_path_from_regex():
|
|||
Test that path from regex is correctly formatted.
|
||||
"""
|
||||
path_regex = r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)'
|
||||
path_regex_trailing = path_regex + '/'
|
||||
expected_path = '/entries/{pk}/relationships/{related_field}'
|
||||
expected_path_trailing = expected_path + '/'
|
||||
enumerator = EndpointEnumerator(patterns={})
|
||||
path_trailing = enumerator.get_path_from_regex(path_regex_trailing)
|
||||
assert path_trailing == expected_path_trailing
|
||||
|
||||
path = enumerator.get_path_from_regex(path_regex)
|
||||
assert path == expected_path
|
||||
|
|
Loading…
Reference in New Issue
Block a user