diff --git a/newsfragments/3128.change.rst b/newsfragments/3128.change.rst new file mode 100644 index 00000000..2a0cc5a5 --- /dev/null +++ b/newsfragments/3128.change.rst @@ -0,0 +1 @@ +Map the ``ProjectHasNoApiAccess`` result code, as spelled in Vuforia's result codes table, to ``ProjectHasNoAPIAccessError``. The previously mapped ``ProjectHasNoAPIAccess`` casing, which Vuforia does not document, is no longer mapped. diff --git a/pyproject.toml b/pyproject.toml index efcf3a13..7c7d50d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ optional-dependencies.dev = [ "types-requests==2.33.0.20260712", "vale==3.13.0.0", "vulture==2.16", - "vws-python-mock==2026.8.4.2", + "vws-python-mock==2026.8.14", "vws-test-fixtures==2023.3.5", "yamlfix==1.19.1", "zizmor==1.29.0", diff --git a/spelling_private_dict.txt b/spelling_private_dict.txt index 45ed889e..608572ce 100644 --- a/spelling_private_dict.txt +++ b/spelling_private_dict.txt @@ -13,7 +13,7 @@ MaxNumResultsOutOfRange MetadataTooLarge OopsAnErrorOccurredPossiblyBadName OopsAnErrorOccurredPossiblyBadNameError -ProjectHasNoAPIAccess +ProjectHasNoApiAccess ProjectInactive ProjectSuspended QuotaExceeded diff --git a/src/vws/exceptions/vws_exceptions.py b/src/vws/exceptions/vws_exceptions.py index a93dd600..216677f1 100644 --- a/src/vws/exceptions/vws_exceptions.py +++ b/src/vws/exceptions/vws_exceptions.py @@ -109,7 +109,7 @@ class ProjectSuspendedError(VWSError): @beartype class ProjectHasNoAPIAccessError(VWSError): """Exception raised when Vuforia returns a response with a result code - 'ProjectHasNoAPIAccess'. + 'ProjectHasNoApiAccess'. """ @@ -241,7 +241,7 @@ class AuthorizationFailedError(VWSError): "InvalidTargetType": InvalidTargetTypeError, "LicenseCheckFailed": LicenseCheckFailedError, "MetadataTooLarge": MetadataTooLargeError, - "ProjectHasNoAPIAccess": ProjectHasNoAPIAccessError, + "ProjectHasNoApiAccess": ProjectHasNoAPIAccessError, "ProjectInactive": ProjectInactiveError, "ProjectSuspended": ProjectSuspendedError, "QuotaExceeded": QuotaExceededError, diff --git a/tests/test_vws_exceptions.py b/tests/test_vws_exceptions.py index 73ab9f84..5afb6639 100644 --- a/tests/test_vws_exceptions.py +++ b/tests/test_vws_exceptions.py @@ -583,6 +583,29 @@ def test_vwserror_from_result_code() -> None: assert exception.response is response +def test_project_has_no_api_access_casing() -> None: + """The ``ProjectHasNoApiAccess`` result code, as spelled in Vuforia's + result codes table, maps to ``ProjectHasNoAPIAccessError``. + """ + result_code = "ProjectHasNoApiAccess" + response = Response( + text=f'{{"result_code":"{result_code}"}}', + url="https://example.com/targets", + status_code=HTTPStatus.FORBIDDEN, + headers={}, + request_body=None, + tell_position=0, + content=b"", + ) + + exception = VWSError.from_result_code( + result_code=result_code, + response=response, + ) + + assert isinstance(exception, ProjectHasNoAPIAccessError) + + @pytest.mark.parametrize( argnames=("exception_type", "url"), argvalues=[