pytests passed
This commit is contained in:
parent
9095b57b23
commit
1c8f016208
1 changed files with 15 additions and 6 deletions
|
@ -3,14 +3,20 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from kiwi_scp._constants import COMPOSE_FILE_NAME
|
from kiwi_scp._constants import COMPOSE_FILE_NAME
|
||||||
|
from kiwi_scp.config import KiwiConfig
|
||||||
from kiwi_scp.instance import Project
|
from kiwi_scp.instance import Project
|
||||||
|
|
||||||
|
|
||||||
class TestDefault:
|
class TestDefault:
|
||||||
def test_example(self):
|
cfg = KiwiConfig()
|
||||||
p = Project(Path("example/hello-world.project"))
|
|
||||||
|
|
||||||
ss = p.get_services()
|
def test_example(self):
|
||||||
|
p = Project(
|
||||||
|
directory=Path("example/hello-world.project"),
|
||||||
|
config=TestDefault.cfg,
|
||||||
|
)
|
||||||
|
|
||||||
|
ss = p.services
|
||||||
|
|
||||||
assert len(ss.content) == 5
|
assert len(ss.content) == 5
|
||||||
|
|
||||||
|
@ -18,14 +24,17 @@ class TestDefault:
|
||||||
|
|
||||||
assert s.name == "greeter"
|
assert s.name == "greeter"
|
||||||
|
|
||||||
ss2 = p.get_services(["nonexistent"])
|
ss2 = p.services.filter_existing(["nonexistent"])
|
||||||
|
|
||||||
assert len(ss2.content) == 0
|
assert len(ss2.content) == 0
|
||||||
|
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
p = Project(Path("nonexistent"))
|
p = Project(
|
||||||
|
directory=Path("nonexistent"),
|
||||||
|
config=TestDefault.cfg,
|
||||||
|
)
|
||||||
|
|
||||||
with pytest.raises(FileNotFoundError) as exc_info:
|
with pytest.raises(FileNotFoundError) as exc_info:
|
||||||
p.get_services()
|
_ = p.services
|
||||||
|
|
||||||
assert exc_info.value.filename == f"nonexistent/{COMPOSE_FILE_NAME}"
|
assert exc_info.value.filename == f"nonexistent/{COMPOSE_FILE_NAME}"
|
||||||
|
|
Loading…
Reference in a new issue