Skip to content

Commit 30511d3

Browse files
committed
_add_target expect success
1 parent ff50342 commit 30511d3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/mock_vws/fixtures/prepared_requests.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Fixtures which prepare requests.
33
"""
44

5+
import base64
6+
import io
57
import json
68
from typing import Any, Dict
79
from urllib.parse import urljoin
@@ -26,12 +28,19 @@
2628
@pytest.fixture()
2729
def _add_target(
2830
vuforia_database_keys: VuforiaDatabaseKeys,
31+
png_rgb: io.BytesIO,
2932
) -> TargetAPIEndpoint:
3033
"""
3134
Return details of the endpoint for adding a target.
3235
"""
36+
image_data = png_rgb.read()
37+
image_data_encoded = base64.b64encode(image_data).decode('ascii')
3338
date = rfc_1123_date()
34-
data: Dict[str, Any] = {}
39+
data: Dict[str, Any] = {
40+
'name': 'example_name',
41+
'width': 1,
42+
'image': image_data_encoded,
43+
}
3544
request_path = '/targets'
3645
content_type = 'application/json'
3746
method = POST
@@ -66,8 +75,8 @@ def _add_target(
6675
prepared_request = request.prepare() # type: ignore
6776

6877
return TargetAPIEndpoint(
69-
successful_headers_status_code=codes.BAD_REQUEST,
70-
successful_headers_result_code=ResultCodes.FAIL,
78+
successful_headers_status_code=codes.CREATED,
79+
successful_headers_result_code=ResultCodes.TARGET_CREATED,
7180
prepared_request=prepared_request,
7281
access_key=access_key,
7382
secret_key=secret_key,

0 commit comments

Comments
 (0)