Skip to content

Commit 8ab0c1b

Browse files
committed
Start of tests for inactive project
1 parent 888c082 commit 8ab0c1b

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import base64
2+
import io
3+
import uuid
4+
from time import sleep
5+
6+
import pytest
7+
import requests
8+
import timeout_decorator
9+
from requests import codes
10+
from requests.structures import CaseInsensitiveDict
11+
12+
from mock_vws import MockVWS
13+
from mock_vws._constants import ResultCodes
14+
from tests.mock_vws.utils import (
15+
Endpoint,
16+
add_target_to_vws,
17+
database_summary,
18+
delete_target,
19+
query,
20+
wait_for_target_processed,
21+
)
22+
from tests.mock_vws.utils.assertions import assert_vws_response
23+
from tests.mock_vws.utils.authorization import (
24+
VuforiaDatabaseKeys,
25+
authorization_header,
26+
rfc_1123_date,
27+
)
28+
29+
30+
@pytest.mark.usefixtures('verify_mock_vuforia_inactive')
31+
class TestInactiveProject:
32+
"""
33+
Tests for inactive projects.
34+
"""
35+
36+
def test_inactive_project(
37+
self,
38+
inactive_database_keys: VuforiaDatabaseKeys,
39+
endpoint: Endpoint,
40+
) -> None:
41+
"""
42+
The project's active state does not affect the database summary.
43+
"""
44+
endpoint_headers = dict(endpoint.prepared_request.headers)
45+
content = endpoint.prepared_request.body or b''
46+
assert isinstance(content, bytes)
47+
date = rfc_1123_date()
48+
49+
authorization_string = authorization_header(
50+
access_key=endpoint.access_key,
51+
secret_key=endpoint.secret_key,
52+
method=str(endpoint.prepared_request.method),
53+
content=content,
54+
content_type=endpoint.auth_header_content_type,
55+
date=date,
56+
request_path=endpoint.prepared_request.path_url,
57+
)
58+
59+
headers = {
60+
**endpoint_headers,
61+
'Authorization': authorization_string,
62+
'Date': date,
63+
}
64+
65+
endpoint.prepared_request.headers = CaseInsensitiveDict(data=headers)
66+
session = requests.Session()
67+
response = session.send( # type: ignore
68+
request=endpoint.prepared_request,
69+
)
70+
71+
assert_vws_response(
72+
response=response,
73+
status_code=endpoint.successful_headers_status_code,
74+
result_code=endpoint.successful_headers_result_code,
75+
)

0 commit comments

Comments
 (0)