forked from VWS-Python/vws-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
46 lines (37 loc) · 1.11 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Configuration, plugins and fixtures for `pytest`.
"""
from typing import Iterator
import pytest
from mock_vws import MockVWS
from mock_vws.database import VuforiaDatabase
from vws import VWS, CloudRecoService
@pytest.fixture()
def _mock_database() -> Iterator[VuforiaDatabase]:
"""
Yield a mock ``VuforiaDatabase``.
"""
with MockVWS() as mock:
database = VuforiaDatabase()
mock.add_database(database=database)
yield database
@pytest.fixture()
def vws_client(_mock_database: VuforiaDatabase) -> Iterator[VWS]:
"""
Yield a VWS client which connects to a mock database.
"""
yield VWS(
server_access_key=_mock_database.server_access_key,
server_secret_key=_mock_database.server_secret_key,
)
@pytest.fixture()
def cloud_reco_client(
_mock_database: VuforiaDatabase,
) -> Iterator[CloudRecoService]:
"""
Yield a ``CloudRecoService`` client which connects to a mock database.
"""
yield CloudRecoService(
client_access_key=_mock_database.client_access_key,
client_secret_key=_mock_database.client_secret_key,
)