Skip to content

Commit 636a3f9

Browse files
Merge pull request #803 from adamtheturtle/database-summary
Add database summary helper
2 parents 2fb0c9c + 25a1d4c commit 636a3f9

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/vws/vws.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,21 @@ def get_target_summary_report(
233233
)
234234

235235
return dict(response.json())
236+
237+
def get_database_summary_report(self) -> Dict[str, Union[str, int]]:
238+
"""
239+
Get a summary report for the database.
240+
241+
Returns:
242+
Details of the database.
243+
"""
244+
response = _target_api_request(
245+
server_access_key=self._server_access_key,
246+
server_secret_key=self._server_secret_key,
247+
method='GET',
248+
content=b'',
249+
request_path='/summary',
250+
base_vws_url=self._base_vws_url,
251+
)
252+
253+
return dict(response.json())
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Tests for helper function for getting a summary report for a Vuforia database.
3+
"""
4+
5+
from vws import VWS
6+
7+
8+
class TestGetDatabaseSummaryReport:
9+
"""
10+
Tests for getting a summary report for a database.
11+
"""
12+
13+
def test_get_target(self, client: VWS) -> None:
14+
"""
15+
Details of a database are returned by ``get_database_summary_report``.
16+
"""
17+
report = client.get_database_summary_report()
18+
expected_keys = {
19+
'active_images',
20+
'current_month_recos',
21+
'failed_images',
22+
'inactive_images',
23+
'name',
24+
'previous_month_recos',
25+
'processing_images',
26+
'reco_threshold',
27+
'request_quota',
28+
'request_usage',
29+
'result_code',
30+
'target_quota',
31+
'total_recos',
32+
'transaction_id',
33+
}
34+
assert report.keys() == expected_keys

0 commit comments

Comments
 (0)