Skip to content

Commit 0e313dc

Browse files
committed
Add database summary
1 parent 2fb0c9c commit 0e313dc

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""
2+
Tests for helper function for getting a summary report for a Vuforia database.
3+
"""
4+
5+
import io
6+
7+
from vws import VWS
8+
9+
10+
class TestGetDatabaseSummaryReport:
11+
"""
12+
Test for getting a summary report for a database.
13+
"""
14+
15+
def test_get_target(
16+
self,
17+
client: VWS,
18+
high_quality_image: io.BytesIO,
19+
) -> None:
20+
"""
21+
Details of a target are returned by ``get_target_summary``.
22+
"""
23+
report = client.get_database_summary_report()
24+
expected_keys = {
25+
'active_images',
26+
'current_month_recos',
27+
'failed_images',
28+
'inactive_images',
29+
'name',
30+
'previous_month_recos',
31+
'processing_images',
32+
'reco_threshold',
33+
'request_quota',
34+
'request_usage',
35+
'result_code',
36+
'target_quota',
37+
'total_recos',
38+
'transaction_id',
39+
}
40+
assert report.keys() == expected_keys

0 commit comments

Comments
 (0)