Skip to content

Commit e1a16b6

Browse files
committed
Merge remote-tracking branch 'origin/master' into target-record
2 parents 7b0d7ff + 70cfa1f commit e1a16b6

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

src/vws/vws.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def wait_for_target_processed(self, target_id: str) -> None:
189189

190190
def list_targets(self) -> List[str]:
191191
"""
192-
Get a list of targets.
192+
List target IDs.
193193
194194
Returns:
195195
The IDs of all targets in the database.
@@ -204,3 +204,27 @@ def list_targets(self) -> List[str]:
204204
)
205205

206206
return list(response.json()['results'])
207+
208+
def get_target_summary_report(
209+
self,
210+
target_id: str,
211+
) -> Dict[str, Union[str, int]]:
212+
"""
213+
Get a summary report for a target.
214+
215+
Args:
216+
target_id: The ID of the target to get a summary report for.
217+
218+
Returns:
219+
Details of the target.
220+
"""
221+
response = _target_api_request(
222+
server_access_key=self._server_access_key,
223+
server_secret_key=self._server_secret_key,
224+
method='GET',
225+
content=b'',
226+
request_path=f'/summary/{target_id}',
227+
base_vws_url=self._base_vws_url,
228+
)
229+
230+
return dict(response.json())

tests/test_get_target_record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class TestGetTargetRecord:
1212
"""
13-
Test for getting a record of a target.
13+
Tests for getting a record of a target.
1414
"""
1515

1616
def test_get_target_record(
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""
2+
Tests for helper function for getting a summary report for a target in a
3+
Vuforia database.
4+
"""
5+
6+
import io
7+
8+
from vws import VWS
9+
10+
11+
class TestGetTargetSummaryReport:
12+
"""
13+
Tests for getting a summary report for a target.
14+
"""
15+
16+
def test_get_target_summary_report(
17+
self,
18+
client: VWS,
19+
high_quality_image: io.BytesIO,
20+
) -> None:
21+
"""
22+
Details of a target are returned by ``get_target_summary_report``.
23+
"""
24+
target_id = client.add_target(
25+
name='x',
26+
width=1,
27+
image=high_quality_image,
28+
)
29+
30+
result = client.get_target_summary_report(target_id=target_id)
31+
expected_keys = {
32+
'status',
33+
'result_code',
34+
'transaction_id',
35+
'database_name',
36+
'target_name',
37+
'upload_date',
38+
'active_flag',
39+
'tracking_rating',
40+
'total_recos',
41+
'current_month_recos',
42+
'previous_month_recos',
43+
}
44+
assert result.keys() == expected_keys

tests/test_target_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class TestListTargets:
1111
"""
12-
Test for listing targets.
12+
Tests for listing targets.
1313
"""
1414

1515
def test_list_targets(

tests/test_wait_for_target_processed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class TestWaitForTargetProcessed:
1111
"""
12-
Test for waiting for a target to be processed.
12+
Tests for waiting for a target to be processed.
1313
"""
1414

1515
def test_wait_for_target_processed(

0 commit comments

Comments
 (0)