repo-cloner/tests/lib/test_config_file_not_found.py
Václav Valíček 97054b4fcc
ConfigFileNotFound exception + run-test script
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
2022-06-26 00:46:56 +02:00

32 lines
780 B
Python

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"