|
6 | 6 | import email.utils |
7 | 7 | import json |
8 | 8 | from string import hexdigits |
9 | | -from typing import Any, Dict, Optional |
10 | | -from urllib.parse import urljoin |
| 9 | +from typing import Optional |
11 | 10 |
|
12 | 11 | import pytz |
13 | | -import requests |
14 | 12 | from requests import Response, codes |
15 | | -from requests_mock import POST |
16 | 13 |
|
17 | 14 | from mock_vws._constants import ResultCodes |
18 | 15 | from tests.mock_vws.utils.authorization import ( |
@@ -153,53 +150,6 @@ def assert_vws_response( |
153 | 150 | assert_valid_date_header(response=response) |
154 | 151 |
|
155 | 152 |
|
156 | | -def add_target_to_vws( |
157 | | - vuforia_database_keys: VuforiaDatabaseKeys, |
158 | | - data: Dict[str, Any], |
159 | | - content_type: str = 'application/json', |
160 | | -) -> Response: |
161 | | - """ |
162 | | - Return a response from a request to the endpoint to add a target. |
163 | | -
|
164 | | - Args: |
165 | | - vuforia_database_keys: The credentials to use to connect to Vuforia. |
166 | | - data: The data to send, in JSON format, to the endpoint. |
167 | | - content_type: The `Content-Type` header to use. |
168 | | -
|
169 | | - Returns: |
170 | | - The response returned by the API. |
171 | | - """ |
172 | | - date = rfc_1123_date() |
173 | | - request_path = '/targets' |
174 | | - |
175 | | - content = bytes(json.dumps(data), encoding='utf-8') |
176 | | - |
177 | | - authorization_string = authorization_header( |
178 | | - access_key=vuforia_database_keys.server_access_key, |
179 | | - secret_key=vuforia_database_keys.server_secret_key, |
180 | | - method=POST, |
181 | | - content=content, |
182 | | - content_type=content_type, |
183 | | - date=date, |
184 | | - request_path=request_path, |
185 | | - ) |
186 | | - |
187 | | - headers = { |
188 | | - 'Authorization': authorization_string, |
189 | | - 'Date': date, |
190 | | - 'Content-Type': content_type, |
191 | | - } |
192 | | - |
193 | | - response = requests.request( |
194 | | - method=POST, |
195 | | - url=urljoin(base='https://vws.vuforia.com/', url=request_path), |
196 | | - headers=headers, |
197 | | - data=content, |
198 | | - ) |
199 | | - |
200 | | - return response |
201 | | - |
202 | | - |
203 | 153 | def assert_query_success(response: Response) -> None: |
204 | 154 | """ |
205 | 155 | Assert that the given response is a success response for performing an |
|
0 commit comments