moto/tests/test_core/test_url_mapping.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
676 B
Python
Raw Normal View History

2013-03-05 13:14:43 +00:00
from moto.core.utils import convert_regex_to_flask_path
def test_flask_path_converting_simple():
assert convert_regex_to_flask_path("/") == "/"
assert convert_regex_to_flask_path("/$") == "/"
2013-03-05 13:14:43 +00:00
assert convert_regex_to_flask_path("/foo") == "/foo"
2013-03-05 13:14:43 +00:00
assert convert_regex_to_flask_path("/foo/bar/") == "/foo/bar/"
2013-03-05 13:14:43 +00:00
def test_flask_path_converting_regex():
assert (
convert_regex_to_flask_path(r"/(?P<key_name>[a-zA-Z0-9\-_]+)")
== r'/<regex("[a-zA-Z0-9\-_]+"):key_name>'
2017-02-24 02:37:43 +00:00
)
2013-03-05 13:14:43 +00:00
assert (
convert_regex_to_flask_path(r"(?P<account_id>\d+)/(?P<queue_name>.*)$")
== r'<regex("\d+"):account_id>/<regex(".*"):queue_name>'
)