ConfigFileNotFound exception + run-test script
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
31
tests/lib/test_config_file_not_found.py
Normal file
31
tests/lib/test_config_file_not_found.py
Normal 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"
|
||||
Reference in New Issue
Block a user