示例#1
0
def test_get_default_options():
    app = Pantam()
    default_config = {
        "actions_folder": "actions",
        "actions_index": "index",
        "on_shutdown": None,
        "debug": False,
        "dev_port": 5000,
        "port": 5000,
        "reload": None,
    }
    assert app.get_config() == default_config
示例#2
0
def test_override_some_options():
    app = Pantam(actions_folder="axs")
    config = {
        "actions_folder": "axs",
        "actions_index": "index",
        "on_shutdown": None,
        "debug": False,
        "dev_port": 5000,
        "port": 5000,
        "reload": None,
    }
    assert app.get_config() == config
示例#3
0
def test_override_all_options():
    callback = lambda: True
    app = Pantam(
        actions_folder="axs",
        actions_index="main",
        on_shutdown=callback,
        debug=True,
        dev_port=5001,
        port=80,
        reload=False,
    )
    config = {
        "actions_folder": "axs",
        "actions_index": "main",
        "on_shutdown": callback,
        "debug": True,
        "dev_port": 5001,
        "port": 80,
        "reload": False,
    }
    assert app.get_config() == config
示例#4
0
def test_set_options_programmatically():
    app = Pantam()
    config = app.get_config()
    config["port"] = 82
    app.set_config(config)
    assert app.get_config() == config