Add config parser functionality
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -66,7 +66,7 @@ def test_set_property():
|
||||
# invalid type
|
||||
with pytest.raises(ValueError) as exc:
|
||||
x._set_property("cloner_interval", "č")
|
||||
assert exc.exconly() == "ValueError: Invalid value for key cloner_interval: type is <class 'str'>"
|
||||
assert exc.exconly() == "ValueError: Invalid value for key cloner_interval: type is <class 'str'> instead of <class 'int'>, conversion failed"
|
||||
|
||||
x._set_property("cloner_project_name", "č")
|
||||
|
||||
@@ -74,3 +74,15 @@ def test_set_property():
|
||||
with pytest.raises(KeyError) as exc:
|
||||
x._set_property("nonexistent_key", 888)
|
||||
assert exc.exconly() == "KeyError: 'nonexistent_key is not recognized config option'"
|
||||
|
||||
# boolean conversion
|
||||
x._set_property("cloner_submodules", "1")
|
||||
assert x.cloner_submodules == True
|
||||
|
||||
x._set_property("cloner_submodules", "0")
|
||||
assert x.cloner_submodules == False
|
||||
|
||||
# integer conversion
|
||||
x._set_property("cloner_interval", 60)
|
||||
assert x.cloner_interval == 60
|
||||
|
||||
|
||||
Reference in New Issue
Block a user