kiwi-scp/tests/test_instance.py

31 lines
597 B
Python
Raw Normal View History

2021-10-25 11:00:11 +00:00
from pathlib import Path
from kiwi_scp.instance import Instance
def test_example():
i = Instance(Path("example"))
assert i.config is not None
2021-10-26 13:59:38 +00:00
assert len(i.config.projects) == 1
2021-10-25 11:00:11 +00:00
2021-10-26 13:59:38 +00:00
p = i.config.projects[0]
2021-10-25 11:00:11 +00:00
2021-10-26 13:59:38 +00:00
assert p.name == "hello-world.project"
2021-10-25 11:00:11 +00:00
def test_empty():
i = Instance()
assert i.config is not None
2021-10-26 13:59:38 +00:00
assert len(i.config.projects) == 0
2021-10-25 11:00:11 +00:00
def test_no_such_dir():
nonexistent_path = Path("nonexistent")
i = Instance(nonexistent_path)
assert i.directory == nonexistent_path
assert i.config is not None
2021-10-26 13:59:38 +00:00
assert len(i.config.projects) == 0