demonstrate success with trailing /

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

View File

@ -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