-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
186 lines (122 loc) · 4.3 KB
/
conftest.py
File metadata and controls
186 lines (122 loc) · 4.3 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import json
import logging
import os
import pathlib
import uuid
import pytest
from reportportal_client import RPLogger
from mpt_api_client import AsyncMPTClient, MPTClient
@pytest.fixture(scope="session")
def base_url():
return os.getenv("MPT_API_BASE_URL")
@pytest.fixture(scope="session")
def api_timeout():
return float(os.getenv("MPT_API_TIMEOUT", "60.0"))
@pytest.fixture
def mpt_vendor(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_VENDOR"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture
def async_mpt_vendor(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_VENDOR"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture
def mpt_ops(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_OPERATIONS"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture
def async_mpt_ops(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_OPERATIONS"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture
def mpt_client(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_CLIENT"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture
def async_mpt_client(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_CLIENT"), base_url=base_url, timeout=api_timeout
) # type: ignore
@pytest.fixture(scope="module")
def rp_logger():
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logging.setLoggerClass(RPLogger)
return logger
@pytest.fixture(scope="session")
def logger():
return logging.getLogger("E2E")
@pytest.fixture(scope="session")
def project_root_path():
return pathlib.Path(__file__).parent.parent.parent
@pytest.fixture
def pdf_fd():
icon_path = pathlib.Path(__file__).parent / "empty.pdf"
with pathlib.Path.open(icon_path, "rb") as fd:
yield fd
@pytest.fixture(scope="session")
def pdf_url():
return "https://sample-files.com/downloads/documents/pdf/basic-text.pdf"
@pytest.fixture(scope="session")
def jpg_url():
return "https://sample-files.com/downloads/images/jpg/color_test_800x600_118kb.jpg"
@pytest.fixture(scope="session")
def video_url():
return "https://www.youtube.com/watch?v=DUMMY1_0000"
@pytest.fixture(scope="session")
def e2e_config(project_root_path):
filename = os.getenv("TEST_CONFIG_FILE", "e2e_config.test.json")
file_path = project_root_path.joinpath(filename)
return json.loads(file_path.read_text())
@pytest.fixture(scope="session")
def product_id(e2e_config):
return e2e_config["catalog.product.id"]
@pytest.fixture
def short_uuid():
return uuid.uuid4().hex[:8]
@pytest.fixture
def uuid_str():
return str(uuid.uuid4())
@pytest.fixture
def logo_fd(project_root_path):
file_path = project_root_path / "tests/data/logo.png"
with file_path.open("rb") as fb:
yield fb
@pytest.fixture(scope="session")
def user_id(e2e_config):
return e2e_config["accounts.user.id"]
@pytest.fixture(scope="session")
def account_id(e2e_config):
return e2e_config["accounts.account.id"]
@pytest.fixture(scope="session")
def seller_id(e2e_config):
return e2e_config["accounts.seller.id"]
@pytest.fixture(scope="session")
def buyer_id(e2e_config):
return e2e_config["accounts.buyer.id"]
@pytest.fixture(scope="session")
def buyer_account_id(e2e_config):
return e2e_config["accounts.buyer.account.id"]
@pytest.fixture(scope="session")
def licensee_id(e2e_config):
return e2e_config["accounts.licensee.id"]
@pytest.fixture(scope="session")
def authorization_id(e2e_config):
return e2e_config["commerce.authorization.id"]
@pytest.fixture(scope="session")
def price_list_id(e2e_config):
return e2e_config["catalog.price_list.id"]
@pytest.fixture(scope="session")
def user_group_id(e2e_config):
return e2e_config["accounts.user_group.id"]
@pytest.fixture(scope="session")
def commerce_product_id(e2e_config):
return e2e_config["commerce.product.id"]
@pytest.fixture
def certificate_id(e2e_config):
return e2e_config["program.certificate.id"]