/
fixtures_storage.py
51 lines (40 loc) · 1.15 KB
/
fixtures_storage.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
47
48
49
50
51
import pytest
from .fixtures_globals import (
JSON_ASSETS,
JSON_ASSET,
ASSET_ID,
JSON_ORDERS,
JSON_ORDER,
ORDER_ID,
)
from ..context import (
Storage,
)
@pytest.fixture()
def storage_mock(auth_mock, requests_mock):
# assets
url_storage_assets = (
f"{auth_mock._endpoint()}/workspaces/{auth_mock.workspace_id}/assets"
)
requests_mock.get(url=url_storage_assets, json=JSON_ASSETS)
# asset info
url_asset_info = (
f"{auth_mock._endpoint()}/workspaces/{auth_mock.workspace_id}/assets/{ASSET_ID}"
)
requests_mock.get(url=url_asset_info, json=JSON_ASSET)
# orders
url_storage_assets = (
f"{auth_mock._endpoint()}/workspaces/{auth_mock.workspace_id}/orders"
)
requests_mock.get(url=url_storage_assets, json=JSON_ORDERS)
# orders info
url_order_info = (
f"{auth_mock._endpoint()}/workspaces/{auth_mock.workspace_id}/orders/{ORDER_ID}"
)
requests_mock.get(url=url_order_info, json=JSON_ORDER)
storage = Storage(auth=auth_mock)
return storage
@pytest.fixture()
def storage_live(auth_live):
storage = Storage(auth=auth_live)
return storage