Skip to content

Commit cf2aa37

Browse files
committed
Add quotas to database summary [skip ci]
1 parent 940aaae commit cf2aa37

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ On the real Vuforia Web Services, targets sometimes get stuck in the processing
200200
For example, targets with the name ``\uffff`` get stuck in the processing state.
201201
On the mock, no targets get stuck in the processing state.
202202

203+
Database summary quotas
204+
~~~~~~~~~~~~~~~~~~~~~~~
205+
206+
The database summary endpoint returns quotas which match the quotas given for a free license.
207+
203208
.. |Build Status| image:: https://travis-ci.org/adamtheturtle/vws-python.svg?branch=master
204209
:target: https://travis-ci.org/adamtheturtle/vws-python
205210
.. |codecov| image:: https://codecov.io/gh/adamtheturtle/vws-python/branch/master/graph/badge.svg

src/mock_vws/_mock_web_services_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,13 @@ def database_summary(
509509
'active_images': active_images,
510510
'inactive_images': inactive_images,
511511
'failed_images': failed_images,
512-
'target_quota': '',
512+
'target_quota': 1000,
513513
'total_recos': '',
514514
'current_month_recos': '',
515515
'previous_month_recos': '',
516516
'processing_images': processing_images,
517-
'reco_threshold': '',
518-
'request_quota': '',
517+
'reco_threshold': 1000,
518+
'request_quota': 100000,
519519
'request_usage': '',
520520
}
521521
return json_dump(body)

tests/mock_vws/test_database_summary.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,26 @@ def test_processing_images(
359359
)
360360

361361

362+
@pytest.mark.usefixtures('verify_mock_vuforia')
363+
class TestQuotas:
364+
"""
365+
Tests for the mock of the database summary endpoint at `GET /summary`.
366+
"""
367+
368+
def test_quotas(self, vuforia_database_keys: VuforiaDatabaseKeys) -> None:
369+
"""
370+
Quotas are included in the database summary.
371+
These match the quotas given for a free license.
372+
"""
373+
response = database_summary(
374+
vuforia_database_keys=vuforia_database_keys,
375+
)
376+
377+
assert response.json()['target_quota'] == 1000
378+
assert response.json()['request_quota'] == 100000
379+
assert response.json()['reco_threshold'] == 1000
380+
381+
362382
@pytest.mark.usefixtures('verify_mock_vuforia_inactive')
363383
class TestInactiveProject:
364384
"""

0 commit comments

Comments
 (0)