|
3 | 3 | """ |
4 | 4 |
|
5 | 5 | import io |
| 6 | +import uuid |
6 | 7 | from pathlib import Path |
7 | 8 | from typing import Dict, Union |
8 | 9 | from urllib.parse import urlparse |
|
14 | 15 |
|
15 | 16 | from mock_vws._constants import ResultCodes |
16 | 17 | from mock_vws.database import VuforiaDatabase |
17 | | -from tests.mock_vws.utils import Endpoint, query |
| 18 | +from tests.mock_vws.utils import Endpoint, get_vws_target, query |
18 | 19 | from tests.mock_vws.utils.assertions import ( |
19 | 20 | assert_valid_date_header, |
20 | 21 | assert_valid_transaction_id, |
@@ -185,6 +186,27 @@ class TestBadKey: |
185 | 186 | Tests for making requests with incorrect keys. |
186 | 187 | """ |
187 | 188 |
|
| 189 | + def test_bad_access_key_services( |
| 190 | + self, |
| 191 | + vuforia_database: VuforiaDatabase, |
| 192 | + ) -> None: |
| 193 | + """ |
| 194 | + If the server access key given does not match any database, a |
| 195 | + ``Fail`` response is returned. |
| 196 | + """ |
| 197 | + keys = vuforia_database |
| 198 | + keys.server_access_key = b'example' |
| 199 | + response = get_vws_target( |
| 200 | + target_id=uuid.uuid4().hex, |
| 201 | + vuforia_database=keys, |
| 202 | + ) |
| 203 | + |
| 204 | + assert_vws_failure( |
| 205 | + response=response, |
| 206 | + status_code=codes.BAD_REQUEST, |
| 207 | + result_code=ResultCodes.FAIL, |
| 208 | + ) |
| 209 | + |
188 | 210 | def test_bad_access_key_query( |
189 | 211 | self, |
190 | 212 | vuforia_database: VuforiaDatabase, |
|
0 commit comments