2022-06-26 00:46:56 +02:00
|
|
|
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():
|
2022-06-26 01:15:44 +02:00
|
|
|
x = ConfigFileNotFoundError("/tmp/cfg.cfg")
|
2022-06-26 00:46:56 +02:00
|
|
|
s = x.__str__()
|
2022-06-26 01:15:44 +02:00
|
|
|
assert s == "Config file does not exist: /tmp/cfg.cfg"
|
2022-06-26 00:46:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
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"
|