Skip to content

Commit

Permalink
added legacy tests interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu committed Nov 19, 2024
1 parent 3250e5d commit 36fa251
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions services/dynamic-sidecar/tests/unit/test_core_errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# pylint:disable=broad-exception-caught
# pylint:disable=no-member

from simcore_service_dynamic_sidecar.core.errors import (
UnexpectedDockerError,
VolumeNotFoundError,
)
from starlette import status


def test_legacy_interface_unexpected_docker_error():
message = "some_message"
status_code = 42
try:
raise UnexpectedDockerError( # noqa: TRY301
message=message, status_code=status_code
)
except Exception as e:
print(e)
assert e.status_code == status_code # noqa: PT017
assert message in e.message # noqa: PT017


def test_legacy_interface_volume_not_found_error():
try:
raise VolumeNotFoundError( # noqa: TRY301
source_label="some", run_id="run_id", volumes=[{}, {"Name": "a_volume"}]
)
except Exception as e:
print(e)
assert ( # noqa: PT017
e.message
== "Expected 1 got 2 volumes labels with source_label='some', run_id='run_id': Found UNKNOWN a_volume"
)
assert e.status_code == status.HTTP_404_NOT_FOUND # noqa: PT017

0 comments on commit 36fa251

Please sign in to comment.