def test_flaskify_path(): assert flask_utils.flaskify_path("{test-path}") == "<test_path>" assert flask_utils.flaskify_path("api/{test-path}") == "api/<test_path>" assert flask_utils.flaskify_path("my-api/{test-path}") == "my-api/<test_path>" assert flask_utils.flaskify_path("foo_bar/{a-b}/{c_d}") == "foo_bar/<a_b>/<c_d>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'integer'}) == "foo/<int:a>/<b>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'number'}) == "foo/<float:a>/<b>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'path'}) == "foo/<path:a>/<b>" assert flask_utils.flaskify_path("foo/{a}", {'a': 'path'}) == "foo/<path:a>"
def _add_operation_internal(self, method, path, operation): operation_id = operation.operation_id logger.debug('... Adding %s -> %s', method.upper(), operation_id, extra=vars(operation)) flask_path = flask_utils.flaskify_path(path, operation.get_path_parameter_types()) endpoint_name = flask_utils.flaskify_endpoint(operation.operation_id, operation.randomize_endpoint) function = operation.function self.blueprint.add_url_rule(flask_path, endpoint_name, function, methods=[method])
def _add_operation_internal(self, method, path, operation): operation_id = operation.operation_id logger.debug('... Adding %s -> %s', method.upper(), operation_id, extra=vars(operation)) flask_path = flask_utils.flaskify_path(path, operation.get_path_parameter_types()) endpoint_name = flask_utils.flaskify_endpoint(operation.operation_id, operation.randomize_endpoint) function = operation.function self.blueprint.add_url_rule(flask_path, endpoint_name, function, methods=[method])
def test_flaskify_path(): assert flask_utils.flaskify_path("{test-path}") == "<test_path>" assert flask_utils.flaskify_path("api/{test-path}") == "api/<test_path>" assert flask_utils.flaskify_path( "my-api/{test-path}") == "my-api/<test_path>" assert flask_utils.flaskify_path( "foo_bar/{a-b}/{c_d}") == "foo_bar/<a_b>/<c_d>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'integer'}) == "foo/<int:a>/<b>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'number'}) == "foo/<float:a>/<b>" assert flask_utils.flaskify_path("foo/{a}/{b}", {'a': 'path'}) == "foo/<path:a>/<b>"