Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/ci-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Create environment variable files for secrets:
$ cp vuforia_secrets.env.example ci_secrets/vuforia_secrets_1.env
$ ...

Populate every variable listed in :file:`vuforia_secrets.env.example`. Each file needs distinct active Cloud database credentials so concurrent jobs do not modify the same database.
Populate every variable listed in :file:`vuforia_secrets.env.example`.
Each file needs distinct active Cloud database credentials so concurrent jobs do not modify the same database.
The files can share the inactive Cloud, active and inactive VuMark, and Model Target credentials.
Add at least as many consecutively numbered files, starting at zero, as there are builds in the GitHub test matrix.

Expand Down
9 changes: 5 additions & 4 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Create an environment variable file for secrets:
$ cp vuforia_secrets.env.example vuforia_secrets.env

Some tests require Vuforia credentials.
To run these tests, add the Vuforia credentials to the file :file:`vuforia_secrets.env`. See :ref:`connecting-to-vuforia`.
To run these tests, add the Vuforia credentials to the file :file:`vuforia_secrets.env`.
See :ref:`connecting-to-vuforia`.

Then run ``pytest``:

Expand All @@ -72,7 +73,8 @@ Connecting to Vuforia
To connect to Vuforia, Vuforia target databases must be created via the Vuforia Web UI.
Then, secret keys must be set as environment variables.

The test infrastructure allows those keys to be set in the file :file:`vuforia_secrets.env`. See :file:`vuforia_secrets.env.example` for the environment variables to set.
The test infrastructure allows those keys to be set in the file :file:`vuforia_secrets.env`.
See :file:`vuforia_secrets.env.example` for the environment variables to set.

Do not use a target database that you are using for other purposes.
This is because the test suite adds and deletes targets.
Expand Down Expand Up @@ -101,8 +103,7 @@ To create databases without using the browser, use :file:`admin/create_secrets_f
$ python admin/create_secrets_files.py
# Each generated file gets its own active Cloud database credentials.

For the complete archive and GitHub Actions setup procedure, see
:doc:`ci-setup`.
For the complete archive and GitHub Actions setup procedure, see :doc:`ci-setup`.

.. _Vuforia License Manager: https://developer.vuforia.com/vui/develop/licenses
.. _Vuforia Target Manager: https://developer.vuforia.com/vui/develop/databases
Expand Down
42 changes: 10 additions & 32 deletions docs/source/differences-to-vws.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ The mock is accurate immediately with regards to images.

The mock does not count recognitions.
Real Vuforia's recognition counts lag behind its queries by far longer than a test runs, so a query in the mock does not change any count either.
Set the counts you want to see instead:
:paramref:`mock_vws.database.CloudDatabase.total_recos`,
:paramref:`mock_vws.database.CloudDatabase.current_month_recos`,
:paramref:`mock_vws.database.CloudDatabase.previous_month_recos` and
:paramref:`mock_vws.database.CloudDatabase.reco_threshold` for the database
summary report, and
:meth:`mock_vws.MockVWS.set_target_recognition_counts` for the counts of a
target, which the target summary report and the reco counts report show.
Set the counts you want to see instead: :paramref:`mock_vws.database.CloudDatabase.total_recos`, :paramref:`mock_vws.database.CloudDatabase.current_month_recos`, :paramref:`mock_vws.database.CloudDatabase.previous_month_recos` and :paramref:`mock_vws.database.CloudDatabase.reco_threshold` for the database summary report, and :meth:`mock_vws.MockVWS.set_target_recognition_counts` for the counts of a target, which the target summary report and the reco counts report show.
Targets are created by API requests, so their counts are set after the target is created.
The Flask and Docker mock has an equivalent target manager endpoint, described in :doc:`docker`.

Expand Down Expand Up @@ -198,8 +191,7 @@ The mock only limits requests whose access key belongs to a database, because th
The mock applies no limit by default.
Applying a limit of two requests per minute to ``GET /targets`` by default would break the tests of anything which uses the mock.

Set ``request_rate_limits`` to
:data:`mock_vws.request_rate_limits.DOCUMENTED_REQUEST_RATE_LIMITS` to apply
Set ``request_rate_limits`` to :data:`mock_vws.request_rate_limits.DOCUMENTED_REQUEST_RATE_LIMITS` to apply
the limits which real Vuforia applies::

from mock_vws import MockVWS
Expand Down Expand Up @@ -229,9 +221,7 @@ Configurable Cloud Query failures
---------------------------------

The Vuforia Cloud Query API documents failure responses with JSON, arbitrary content, or no body.
Use
:paramref:`mock_vws.MockVWS.cloud_query_failure_response` to make every Cloud
Query request return a particular documented failure shape through the
Use :paramref:`mock_vws.MockVWS.cloud_query_failure_response` to make every Cloud Query request return a particular documented failure shape through the
in-process ``requests``, ``httpx`` and ``httpx2`` backends::

from mock_vws import CloudQueryFailureResponse, MockVWS
Expand Down Expand Up @@ -291,11 +281,8 @@ The other three come from Vuforia's result codes table rather than from a respon
:ref:`unverified-additional-result-codes`


* ``TargetQuotaReached`` is returned when adding a target to a
:class:`mock_vws.database.CloudDatabase` which already contains
``target_quota`` targets.
* ``ProjectSuspended`` is returned with status code 403 by every VWS endpoint when a database uses the
:attr:`mock_vws.states.States.PROJECT_SUSPENDED` state.
* ``TargetQuotaReached`` is returned when adding a target to a :class:`mock_vws.database.CloudDatabase` which already contains ``target_quota`` targets.
* ``ProjectSuspended`` is returned with status code 403 by every VWS endpoint when a database uses the :attr:`mock_vws.states.States.PROJECT_SUSPENDED` state.
Real Vuforia has returned this result code for a database which passed its monthly recognition threshold, but its status code, body and headers were not recorded, and reads such as ``GET /targets`` and the database summary kept working there.
* ``ProjectHasNoApiAccess`` is returned by VWS endpoints when a database uses the :attr:`mock_vws.states.States.PROJECT_HAS_NO_API_ACCESS` state.
This casing comes from Vuforia's result codes table, as no response from a real database in this state has been seen.
Expand All @@ -322,16 +309,10 @@ The Model Target Web API mock supports OAuth2 token requests, standard and advan
The generated dataset download is a small valid ``full-dataset.zip`` with the same ``MTDataset.dat`` and ``MTDataset.xml`` filenames as Vuforia.
Its contents are synthetic request metadata and minimal XML, not a real Vuforia Engine Model Target dataset.
Use :paramref:`mock_vws.MockVWS.model_target_generation_failure` to make in-process Model Target datasets finish with a ``failed`` status and an ``error`` object.
The failure is returned after the configured
:paramref:`~mock_vws.MockVWS.processing_time_seconds`, so callers can test
both processing and failed states.
The failure is returned after the configured :paramref:`~mock_vws.MockVWS.processing_time_seconds`, so callers can test both processing and failed states.
This configuration is not supported by the Flask/Docker backend.
Use
:paramref:`mock_vws.MockVWS.model_target_training_allowance_exceeded` to make
in-process Model Target dataset creation return Vuforia's ``TRAINING_ALLOWANCE_EXCEEDED`` response.
Set the
:envvar:`MODEL_TARGET_TRAINING_ALLOWANCE_EXCEEDED` environment variable to
``true`` to configure the same response in the Flask/Docker backend. Use :paramref:`mock_vws.MockVWS.model_target_generation_warning` to make successful in-process Model Target datasets include a Vuforia-shaped ``warning`` object after processing completes. This configuration is not supported by the Flask/Docker backend.
Use :paramref:`mock_vws.MockVWS.model_target_training_allowance_exceeded` to make in-process Model Target dataset creation return Vuforia's ``TRAINING_ALLOWANCE_EXCEEDED`` response.
Set the :envvar:`MODEL_TARGET_TRAINING_ALLOWANCE_EXCEEDED` environment variable to ``true`` to configure the same response in the Flask/Docker backend. Use :paramref:`mock_vws.MockVWS.model_target_generation_warning` to make successful in-process Model Target datasets include a Vuforia-shaped ``warning`` object after processing completes. This configuration is not supported by the Flask/Docker backend.
Model Target API routes require a three-part JSON Web Token with JSON object header and payload parts, a non-``none`` ``alg`` value, and a non-empty base64url-encoded signature, such as the token returned by the mock OAuth2 route.
The mock does not verify token signatures, payload claims such as expiry, or token revocation.
The OAuth2 route supports both the ``client_credentials`` and ``password`` grants.
Expand Down Expand Up @@ -397,9 +378,7 @@ Setting recognition counts is mock-only, because real Vuforia's counts are delay
As with real Vuforia, the report is served with a ``text/plain`` content type rather than a CSV one.

Real Vuforia assigns a database an ID, which the target manager shows.
The ID of a database in the mock is
:paramref:`mock_vws.database.CloudDatabase.database_id`, which defaults to a
random string, so the path of a request to this endpoint is built by reading that attribute rather than by looking the ID up.
The ID of a database in the mock is :paramref:`mock_vws.database.CloudDatabase.database_id`, which defaults to a random string, so the path of a request to this endpoint is built by reading that attribute rather than by looking the ID up.
As real Vuforia does, the mock returns a 401 response with the ``AuthenticationFailure`` result code for a request which is signed with valid server keys but which names any other database, including one named by its name rather than by its ID.

Real Vuforia returns a presigned URL for cloud storage, of this form:
Expand All @@ -416,8 +395,7 @@ Real Vuforia returns a presigned URL for cloud storage, of this form:
&X-Amz-Signature=...

The mock returns a URL with the same path and the same query parameters, served by the mock itself rather than by cloud storage.
The URL returned by the Flask and Docker mock is built from the
:envvar:`VWS_BASE_URL` environment variable.
The URL returned by the Flask and Docker mock is built from the :envvar:`VWS_BASE_URL` environment variable.
The credential, the security token and the signature are placeholders of the right shape.
The mock does not check the signature, so a URL whose signature or file name has been changed, which real Vuforia refuses with a ``SignatureDoesNotMatch`` error document, is served by the mock as if it were signed.

Expand Down
3 changes: 1 addition & 2 deletions docs/source/unreleased.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Unreleased changes
==================

Changes that have landed on the main branch but are not yet part of a tagged release.
These entries are assembled into the
:doc:`changelog` when the next release is published.
These entries are assembled into the :doc:`changelog` when the next release is published.

.. towncrier-draft-entries::
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dev = [
# use it to lint shell commands in GitHub workflow files.
"shellcheck-py==0.11.0.1",
"shfmt-py==4.2.0",
"snapper-fmt==0.11.1",
"snapper-fmt==0.11.2",
"sphinx==9.1.0",
"sphinx-copybutton==0.5.2",
"sphinx-lint==1.0.2",
Expand Down
16 changes: 8 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading