kiwi-scp/tests/test_instance.py

30 lines
684 B
Python
Raw Permalink Normal View History

2021-10-25 11:00:11 +00:00
from pathlib import Path
from kiwi_scp.instance import Instance
2021-10-26 14:11:28 +00:00
class TestDefault:
def test_example(self):
i = Instance(Path("example"))
2021-10-25 11:00:11 +00:00
2021-10-26 14:11:28 +00:00
assert i.config is not None
assert len(i.config.projects) == 1
2021-10-25 11:00:11 +00:00
2021-11-03 16:35:36 +00:00
pc = i.config.projects[0]
2021-10-25 11:00:11 +00:00
2022-02-21 21:47:19 +00:00
assert pc.name == "hello_world"
2021-10-25 11:00:11 +00:00
2021-10-26 14:11:28 +00:00
def test_empty(self):
i = Instance()
2021-10-25 11:00:11 +00:00
2021-10-26 14:11:28 +00:00
assert i.config is not None
assert len(i.config.projects) == 0
2021-10-25 11:00:11 +00:00
2021-10-26 14:11:28 +00:00
def test_no_such_dir(self):
nonexistent_path = Path("nonexistent")
i = Instance(nonexistent_path)
2021-10-25 11:00:11 +00:00
2021-10-26 14:11:28 +00:00
assert i.directory == nonexistent_path
assert i.config is not None
assert len(i.config.projects) == 0