Skip to content

Commit 2347de7

Browse files
adamtheturtleclaude
andcommitted
Fix InvalidTargetType response status code to 422
Real Vuforia returns 422 Unprocessable Entity (not 403 Forbidden) when attempting VuMark generation on a non-VuMark database. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5409f86 commit 2347de7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/mock_vws/_services_validators/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ def __init__(self) -> None:
662662
raised.
663663
"""
664664
super().__init__()
665-
self.status_code = HTTPStatus.FORBIDDEN
665+
self.status_code = HTTPStatus.UNPROCESSABLE_ENTITY
666666
body = {
667667
"transaction_id": uuid.uuid4().hex,
668668
"result_code": ResultCodes.INVALID_TARGET_TYPE.value,

tests/mock_vws/test_vumark_generation_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_empty_instance_id(
149149

150150
@staticmethod
151151
def test_non_vumark_database(
152-
vuforia_database: VuforiaDatabase,
152+
vuforia_database: CloudDatabase,
153153
) -> None:
154154
"""Generating a VuMark instance for a target in a non-VuMark
155155
database returns InvalidTargetType.
@@ -178,8 +178,9 @@ def test_non_vumark_database(
178178
instance_id=uuid4().hex,
179179
accept="image/png",
180180
)
181-
assert response.status_code == HTTPStatus.FORBIDDEN
181+
assert response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
182182
response_json = response.json()
183183
assert (
184-
response_json["result_code"] == ResultCodes.INVALID_TARGET_TYPE.value
184+
response_json["result_code"]
185+
== ResultCodes.INVALID_TARGET_TYPE.value
185186
)

0 commit comments

Comments
 (0)