def test_print_config():
    args = '--postgres-host foobar --postgres-port 5432 --postgres-database snafu'.split(
    )
    config = get_configuration(args)
    output = print_configuration(config)
    assert output == 'port=8080, debug=False, postgres_host=foobar, postgres_port=5432, ' \
                     'postgres_database=snafu, postgres_user=None, postgres_password=None'
Beispiel #2
0
from covid19.apiserver.apiserver import main
from covid19.apiserver.configuration import get_configuration

if __name__ == '__main__':
    main(get_configuration())
def test_default_config():
    config = get_configuration([])
    assert config.debug is False
    assert config.port == 8080
    assert config.postgres_database == 'covid19'
def test_redacted_config():
    args = '--postgres-user foo --postgres-password bar'.split()
    config = get_configuration(args)
    output = print_configuration(config)
    assert output == 'port=8080, debug=False, postgres_host=None, postgres_port=5432, ' \
                     'postgres_database=covid19, postgres_user=foo, postgres_password=************'
def test_main_config():
    args = '--port 1234 --postgres-database=covid'.split()
    config = get_configuration(args)
    assert config.port == 1234
    assert config.debug is False
    assert config.postgres_database == "covid"