2022-05-18 18:34:26 +02:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from compose_viz.extends import Extends
|
|
|
|
from compose_viz.service import Service
|
|
|
|
|
|
|
|
|
2022-05-18 18:41:08 +02:00
|
|
|
def test_service_init() -> None:
|
2022-05-18 18:43:45 +02:00
|
|
|
with pytest.raises(
|
|
|
|
AttributeError, match=r"Both image and extends are not defined in service 'frontend', aborting."
|
|
|
|
):
|
2022-05-18 18:34:26 +02:00
|
|
|
Service(name="frontend")
|
|
|
|
|
|
|
|
with pytest.raises(
|
2022-05-18 18:43:45 +02:00
|
|
|
AttributeError, match=r"Only one of image and extends can be defined in service 'frontend', aborting."
|
2022-05-18 18:34:26 +02:00
|
|
|
):
|
|
|
|
Service(
|
|
|
|
name="frontend", image="image", extends=Extends(service_name="frontend", from_file="tests/in/000001.yaml")
|
|
|
|
)
|