add get_str_list() for config

Converts a config value written as a comma-sparated list into
a Python list of strings.
This commit is contained in:
Sarah Hoffmann
2022-05-29 13:53:50 +02:00
parent b593fe9c3e
commit 61d813bfef
5 changed files with 30 additions and 5 deletions

View File

@@ -173,6 +173,23 @@ def test_get_int_empty(make_config):
config.get_int('DATABASE_MODULE_PATH')
@pytest.mark.parametrize("value,outlist", [('sd', ['sd']),
('dd,rr', ['dd', 'rr']),
(' a , b ', ['a', 'b'])])
def test_get_str_list_success(make_config, monkeypatch, value, outlist):
config = make_config()
monkeypatch.setenv('NOMINATIM_MYLIST', value)
assert config.get_str_list('MYLIST') == outlist
def test_get_str_list_empty(make_config):
config = make_config()
assert config.get_str_list('LANGUAGES') is None
def test_get_path_empty(make_config):
config = make_config()