From 7ee7c453a00488e088434e36eccde07bbe1d9ba9 Mon Sep 17 00:00:00 2001 From: Alan Crosswell Date: Fri, 23 Aug 2019 14:27:30 -0400 Subject: [PATCH] failing test for #6888 --- tests/schemas/test_get_path_from_regex.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/schemas/test_get_path_from_regex.py diff --git a/tests/schemas/test_get_path_from_regex.py b/tests/schemas/test_get_path_from_regex.py new file mode 100644 index 000000000..a006c661d --- /dev/null +++ b/tests/schemas/test_get_path_from_regex.py @@ -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[^/.]+)/relationships/(?P\w+)' + expected_path = '/entries/{pk}/relationships/{related_field}' + enumerator = EndpointEnumerator(patterns={}) + path = enumerator.get_path_from_regex(path_regex) + assert path == expected_path