Add config parser functionality
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -102,3 +102,25 @@ def test_has_config(tmp_path: PosixPath):
|
||||
|
||||
tmp_path.joinpath("config", "cloner.cfg").touch()
|
||||
assert X.has_config
|
||||
|
||||
|
||||
def test_config_file(tmp_path: PosixPath):
|
||||
X = RepoDirStructure(tmp_path)
|
||||
assert X.config_file == tmp_path.joinpath("config", "cloner.cfg").__str__()
|
||||
|
||||
|
||||
def test_get_config(tmp_path: PosixPath):
|
||||
tmp_path.joinpath("config").mkdir()
|
||||
tmp_path.joinpath("cache").mkdir()
|
||||
tmp_path.joinpath("repos").mkdir()
|
||||
|
||||
X = RepoDirStructure(tmp_path)
|
||||
# no file provided
|
||||
with pytest.raises(ConfigFileNotFoundError) as excinfo:
|
||||
X.config
|
||||
|
||||
# create config file
|
||||
tmp_path.joinpath("config", "cloner.cfg").touch()
|
||||
X = RepoDirStructure(tmp_path)
|
||||
assert X.has_config == True
|
||||
assert 5 == X.config.cloner_interval
|
||||
|
||||
Reference in New Issue
Block a user