Skip to content

Commit d0c6538

Browse files
adamtheturtleclaude
andcommitted
Implement test_invalid_target_type to validate VuMark database type checking
The test verifies that InvalidTargetTypeError is raised when attempting to generate a VuMark instance using credentials from a CloudDatabase (non-VuMark) database. This was previously a stub pending the mock implementation in vws-python-mock#2961. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent bf64c7f commit d0c6538

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

tests/test_vws_exceptions.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,34 @@ def test_invalid_instance_id(
385385
assert exc.value.response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
386386

387387

388-
def test_invalid_target_type() -> None:
388+
def test_invalid_target_type(
389+
vws_client: VWS,
390+
_mock_database: CloudDatabase, # noqa: PT019
391+
high_quality_image: io.BytesIO,
392+
) -> None:
389393
"""
390-
See https://github.com/VWS-Python/vws-python-mock/issues/2961 for
391-
writing this test.
394+
An ``InvalidTargetType`` exception is raised when trying to generate
395+
a VuMark instance from a non-VuMark database.
392396
"""
397+
target_id = vws_client.add_target(
398+
name="example_target",
399+
width=1,
400+
image=high_quality_image,
401+
active_flag=True,
402+
application_metadata=None,
403+
)
404+
vumark_service = VuMarkService(
405+
server_access_key=_mock_database.server_access_key,
406+
server_secret_key=_mock_database.server_secret_key,
407+
)
408+
with pytest.raises(expected_exception=InvalidTargetTypeError) as exc:
409+
vumark_service.generate_vumark_instance(
410+
target_id=target_id,
411+
instance_id="example_instance_id",
412+
accept=VuMarkAccept.PNG,
413+
)
414+
415+
assert exc.value.response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
393416

394417

395418
def test_base_exception(

0 commit comments

Comments
 (0)