|
2 | 2 | Fixtures which prepare requests. |
3 | 3 | """ |
4 | 4 |
|
| 5 | +import base64 |
| 6 | +import io |
5 | 7 | import json |
6 | 8 | from typing import Any, Dict |
7 | 9 | from urllib.parse import urljoin |
|
26 | 28 | @pytest.fixture() |
27 | 29 | def _add_target( |
28 | 30 | vuforia_database_keys: VuforiaDatabaseKeys, |
| 31 | + png_rgb: io.BytesIO, |
29 | 32 | ) -> TargetAPIEndpoint: |
30 | 33 | """ |
31 | 34 | Return details of the endpoint for adding a target. |
32 | 35 | """ |
| 36 | + image_data = png_rgb.read() |
| 37 | + image_data_encoded = base64.b64encode(image_data).decode('ascii') |
33 | 38 | 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 | + } |
35 | 44 | request_path = '/targets' |
36 | 45 | content_type = 'application/json' |
37 | 46 | method = POST |
@@ -66,8 +75,8 @@ def _add_target( |
66 | 75 | prepared_request = request.prepare() # type: ignore |
67 | 76 |
|
68 | 77 | 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, |
71 | 80 | prepared_request=prepared_request, |
72 | 81 | access_key=access_key, |
73 | 82 | secret_key=secret_key, |
|
0 commit comments