ConfigFileNotFound exception + run-test script

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-06-26 00:46:56 +02:00
parent 69151619f7
commit 97054b4fcc
4 changed files with 71 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
from repo_cloner.lib.config_file_not_found_error import ConfigFileNotFoundError
from pathlib import PosixPath
def test_type():
x = ConfigFileNotFoundError()
assert isinstance(x, ConfigFileNotFoundError)
def test_return():
x = ConfigFileNotFoundError("/tmp", "cloner.cfg")
s = x.__str__()
assert s == "Config file does not exist: /tmp/cloner.cfg"
def test_str_single_arg():
x = ConfigFileNotFoundError("/tmp")
s = x.__str__()
assert s == "ConfigFileNotFoundError('/tmp')"
def test_return_empty():
x = ConfigFileNotFoundError()
s = x.__str__()
assert s == "ConfigFileNotFoundError()"
def test_posix_path():
d = PosixPath("/nonexistent")
x = ConfigFileNotFoundError(d, "config.cfg")
assert x.__str__() == "Config file does not exist: /nonexistent/config.cfg"