Skip to content
Snippets Groups Projects
Commit 89b25118 authored by I. Nüske's avatar I. Nüske
Browse files

TST: Unittest for config timeout option support of tuples and None

parent 99db34bb
No related branches found
No related tags found
2 merge requests!175BUG: Request responses without the "Set-Cookie" header no longer overwrite the...,!167Separate connect/read timeouts in pylinkahead.ini
Pipeline #58759 passed
[Connection]
url=https://localhost:10443/
password_method = unauthenticated
timeout = None
[Connection]
url=https://localhost:10443/
password_method = unauthenticated
timeout = (1,20)
......@@ -24,6 +24,7 @@
from os import environ, getcwd, remove
from os.path import expanduser, isfile, join
from pathlib import Path
import linkahead as db
import pytest
......@@ -66,3 +67,18 @@ def test_config_ini_via_envvar(temp_ini_files):
assert expanduser("~/.pylinkahead.ini") in db.configuration._read_config_files()
# test configuration file in cwd
assert join(getcwd(), "pylinkahead.ini") in db.configuration._read_config_files()
def test_config_timeout_option():
expected_results = [None, (1, 20)]
# Iterate through timeout test configs
test_configs = Path(__file__).parent/'test_configs'
for test_config in test_configs.rglob('pylinkahead-timeout*.ini'):
# Test that test configs can be parsed
db.configure(str(test_config))
dct = db.configuration.config_to_yaml(db.get_config())
# Test that resulting dict has correct content for timeout
assert 'Connection' in dct
assert 'timeout' in dct['Connection']
assert dct['Connection']['timeout'] in expected_results
expected_results.remove(dct['Connection']['timeout'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment