Skip to content

Commit 65ac436

Browse files
Merge pull request #142 from adamtheturtle/new-auth-test
Test for bad access key services
2 parents 4b05927 + 0980b5c commit 65ac436

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/mock_vws/test_authorization_header.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import io
6+
import uuid
67
from pathlib import Path
78
from typing import Dict, Union
89
from urllib.parse import urlparse
@@ -14,7 +15,7 @@
1415

1516
from mock_vws._constants import ResultCodes
1617
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
1819
from tests.mock_vws.utils.assertions import (
1920
assert_valid_date_header,
2021
assert_valid_transaction_id,
@@ -185,6 +186,27 @@ class TestBadKey:
185186
Tests for making requests with incorrect keys.
186187
"""
187188

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+
188210
def test_bad_access_key_query(
189211
self,
190212
vuforia_database: VuforiaDatabase,

0 commit comments

Comments
 (0)