Exemplo n.º 1
0
def test_config_defaults():
    # Load non-existing config (will create a out-commented default config file)
    config = load_config_toml(appname, default_config_str)

    # Check that load_config used defaults
    assert config[section]["somestring"] == "Hello World!"
    assert config[section]["somevalue"] == 12.3
    assert config[section]["somearray"] == ["asd", 123]
Exemplo n.º 2
0
def test_config_override():
    # Create a minimal config file with one overridden value
    config = """[section]
somevalue = 1000.1"""
    save_config_toml(appname, config)

    # Open non-default config file and verify that values are correct
    config = load_config_toml(appname, default_config_str)
    assert config[section]["somevalue"] == 1000.1
Exemplo n.º 3
0
def test_config_no_defaults():
    # Write defaults to file
    save_config_toml(appname, default_config_str)

    # Load written defaults without defaults
    config = load_config_toml(appname, "")
    assert config[section]["somestring"] == "Hello World!"
    assert config[section]["somevalue"] == 12.3
    assert config[section]["somearray"] == ["asd", 123]
Exemplo n.º 4
0
    def __init__(self, testing: bool):
        """
        An instance of loaded settings, containing a list of modules to autostart.
        Constructor takes a `testing` boolean as an argument
        """
        config = load_config_toml("aw-qt", default_config)
        config_section: Any = config[
            "aw-qt" if not testing else "aw-qt-testing"]

        self.autostart_modules: List[str] = config_section["autostart_modules"]
Exemplo n.º 5
0
from aw_core.config import load_config_toml

default_config = """
[server]
host = "localhost"
port = "5600"
storage = "peewee"
cors_origins = ""

[server.custom_static]

[server-testing]
host = "localhost"
port = "5666"
storage = "peewee"
cors_origins = ""

[server-testing.custom_static]
""".strip()

config = load_config_toml("aw-server", default_config)
Exemplo n.º 6
0
def load_config():
    return load_config_toml("aw-client", default_config)
Exemplo n.º 7
0
from aw_core.config import load_config_toml

default_config = """
[aw-watcher-afk]
timeout = 180
poll_time = 5

[aw-watcher-afk-testing]
timeout = 20
poll_time = 1
""".strip()

watcher_config = load_config_toml("aw-watcher-afk", default_config)