Exemple #1
0
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>"
Exemple #2
0
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>"
Exemple #3
0
 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)
Exemple #4
0
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>"
Exemple #5
0
def test_flaskify_path():
    assert utils.flaskify_path("{test-path}") == "<test_path>"
    assert utils.flaskify_path("api/{test-path}") == "api/<test_path>"