def test_flaskify_path(): assert utils.flaskify_path("{test-path}") == "<test_path>" assert utils.flaskify_path("api/{test-path}") == "api/<test_path>" assert utils.flaskify_path("my-api/{test-path}") == "my-api/<test_path>" assert utils.flaskify_path("foo_bar/{a-b}/{c_d}") == "foo_bar/<a_b>/<c_d>" assert utils.flaskify_path("foo/{a}/{b}", {'a': 'integer'}) == "foo/<int:a>/<b>" assert utils.flaskify_path("foo/{a}/{b}", {'a': 'number'}) == "foo/<float:a>/<b>"
def test_flaskify_path(): assert utils.flaskify_path("{test-path}") == "<test_path>" assert utils.flaskify_path("api/{test-path}") == "api/<test_path>" assert utils.flaskify_path("my-api/{test-path}") == "my-api/<test_path>" assert utils.flaskify_path("foo_bar/{a-b}/{c_d}") == "foo_bar/<a_b>/<c_d>" assert utils.flaskify_path("foo/{a}/{b}", {'a': 'integer'}) == "foo/<int:a>/<b>" assert utils.flaskify_path("foo/{a}/{b}", {'a': 'number'}) == "foo/<float:a>/<b>" assert utils.flaskify_path("foo/{a}/{b}", {'a': 'path'}) == "foo/<path:a>/<b>"
def add_paths(self, paths: list = None): """ Adds the paths defined in the specification as endpoints """ paths = paths or self.specification.get("paths", dict()) for path, methods in paths.items(): logger.debug("Adding %s%s...", self.base_url, path) path = utils.flaskify_path(path) # TODO Error handling for method, endpoint in methods.items(): try: self.add_operation(method, path, endpoint) except: logger.exception("Failed to add operation for %s %s%s", method.upper(), self.base_url, path)
def test_flaskify_path(): assert utils.flaskify_path("{test-path}") == "<test_path>" assert utils.flaskify_path("api/{test-path}") == "api/<test_path>" assert utils.flaskify_path("my-api/{test-path}") == "my-api/<test_path>" assert utils.flaskify_path("foo_bar/{a-b}/{c_d}") == "foo_bar/<a_b>/<c_d>"
def test_flaskify_path(): assert utils.flaskify_path("{test-path}") == "<test_path>" assert utils.flaskify_path("api/{test-path}") == "api/<test_path>"