failing test for #6888

This commit is contained in:
Alan Crosswell 2019-08-23 14:27:30 -04:00
parent ec1b14174f
commit 7ee7c453a0
No known key found for this signature in database
GPG Key ID: 55819C8ADBD81C72

View File

@ -0,0 +1,11 @@
from rest_framework.schemas.generators import EndpointEnumerator
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+)'
expected_path = '/entries/{pk}/relationships/{related_field}'
enumerator = EndpointEnumerator(patterns={})
path = enumerator.get_path_from_regex(path_regex)
assert path == expected_path