test: add test_volume.py
This commit is contained in:
parent
de762d79b4
commit
9f9733bec9
2 changed files with 29 additions and 4 deletions
|
@ -5,18 +5,20 @@ from compose_viz.extends import Extends
|
||||||
|
|
||||||
def test_extend_init_normal() -> None:
|
def test_extend_init_normal() -> None:
|
||||||
try:
|
try:
|
||||||
Extends(service_name="frontend", from_file="tests/in/000001.yaml")
|
e = Extends(service_name="frontend", from_file="tests/in/000001.yaml")
|
||||||
|
|
||||||
assert True
|
assert e.service_name == "frontend"
|
||||||
|
assert e.from_file == "tests/in/000001.yaml"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
assert False, e
|
assert False, e
|
||||||
|
|
||||||
|
|
||||||
def test_extend_init_without_from_file() -> None:
|
def test_extend_init_without_from_file() -> None:
|
||||||
try:
|
try:
|
||||||
Extends(service_name="frontend")
|
e = Extends(service_name="frontend")
|
||||||
|
|
||||||
assert True
|
assert e.service_name == "frontend"
|
||||||
|
assert e.from_file is None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
assert False, e
|
assert False, e
|
||||||
|
|
||||||
|
|
23
tests/test_volume.py
Normal file
23
tests/test_volume.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
from compose_viz.volume import Volume, VolumeType
|
||||||
|
|
||||||
|
|
||||||
|
def test_extend_init_normal() -> None:
|
||||||
|
try:
|
||||||
|
v = Volume(source="./foo", target="./bar")
|
||||||
|
|
||||||
|
assert v.source == "./foo"
|
||||||
|
assert v.target == "./bar"
|
||||||
|
assert v.type == VolumeType.volume
|
||||||
|
except Exception as e:
|
||||||
|
assert False, e
|
||||||
|
|
||||||
|
|
||||||
|
def test_extend_with_type() -> None:
|
||||||
|
try:
|
||||||
|
v = Volume(source="./foo", target="./bar", type=VolumeType.bind)
|
||||||
|
|
||||||
|
assert v.source == "./foo"
|
||||||
|
assert v.target == "./bar"
|
||||||
|
assert v.type == VolumeType.bind
|
||||||
|
except Exception as e:
|
||||||
|
assert False, e
|
Loading…
Reference in a new issue