Beispiel #1
0
def test_bind_routes_error(logger_mock):
    app = Pantam()
    app.get_actions = Mock(return_value=[
        {
            "file_name": "index.py",
            "module_name": "index",
            "class_name": "index",
            "action_class": MockEmptyAction,
            "action_obj": MockEmptyAction(),
        },
    ])
    app.bind_routes()
    logger_mock.assert_called_with("No methods found for `index` action.")
Beispiel #2
0
def test_bind_routes():
    app = Pantam()
    app.get_actions = Mock(return_value=[
        {
            "file_name": "index.py",
            "module_name": "index",
            "class_name": "index",
            "action_class": MockSmallAction,
            "action_obj": MockSmallAction(),
        },
    ])
    app.bind_routes()
    assert len(app.routes) == 3
    assert app.routes[0].path == "/"
    assert app.routes[1].path == "/{id}"
    assert app.routes[2].path == "/healthz"