test: add test_port.py
This commit is contained in:
parent
10f2f0d326
commit
5d090fca45
2 changed files with 25 additions and 2 deletions
23
tests/test_port.py
Normal file
23
tests/test_port.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from compose_viz.port import Port, Protocol
|
||||
|
||||
|
||||
def test_port_init_normal() -> None:
|
||||
try:
|
||||
p = Port(host_port="8080", container_port="80")
|
||||
|
||||
assert p.host_port == "8080"
|
||||
assert p.container_port == "80"
|
||||
assert p.protocol == Protocol.tcp
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
||||
|
||||
def test_port_with_protocol() -> None:
|
||||
try:
|
||||
p = Port(host_port="8080", container_port="80", protocol=Protocol.udp)
|
||||
|
||||
assert p.host_port == "8080"
|
||||
assert p.container_port == "80"
|
||||
assert p.protocol == Protocol.udp
|
||||
except Exception as e:
|
||||
assert False, e
|
|
@ -1,7 +1,7 @@
|
|||
from compose_viz.volume import Volume, VolumeType
|
||||
|
||||
|
||||
def test_extend_init_normal() -> None:
|
||||
def test_volume_init_normal() -> None:
|
||||
try:
|
||||
v = Volume(source="./foo", target="./bar")
|
||||
|
||||
|
@ -12,7 +12,7 @@ def test_extend_init_normal() -> None:
|
|||
assert False, e
|
||||
|
||||
|
||||
def test_extend_with_type() -> None:
|
||||
def test_volume_with_type() -> None:
|
||||
try:
|
||||
v = Volume(source="./foo", target="./bar", type=VolumeType.bind)
|
||||
|
||||
|
|
Loading…
Reference in a new issue