qase-python-commons 3.1.9__py3-none-any.whl → 4.1.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qase/__init__.py +3 -0
- qase/commons/client/api_v1_client.py +269 -175
- qase/commons/client/api_v2_client.py +163 -26
- qase/commons/client/base_api_client.py +23 -6
- qase/commons/config.py +162 -23
- qase/commons/logger.py +82 -13
- qase/commons/models/__init__.py +0 -2
- qase/commons/models/attachment.py +11 -8
- qase/commons/models/basemodel.py +12 -3
- qase/commons/models/config/framework.py +17 -0
- qase/commons/models/config/qaseconfig.py +34 -0
- qase/commons/models/config/run.py +19 -0
- qase/commons/models/config/testops.py +45 -3
- qase/commons/models/external_link.py +41 -0
- qase/commons/models/relation.py +16 -6
- qase/commons/models/result.py +16 -31
- qase/commons/models/run.py +17 -2
- qase/commons/models/runtime.py +9 -0
- qase/commons/models/step.py +45 -12
- qase/commons/profilers/__init__.py +4 -3
- qase/commons/profilers/db.py +965 -5
- qase/commons/reporters/core.py +60 -10
- qase/commons/reporters/report.py +11 -6
- qase/commons/reporters/testops.py +56 -27
- qase/commons/status_mapping/__init__.py +12 -0
- qase/commons/status_mapping/status_mapping.py +237 -0
- qase/commons/util/__init__.py +9 -0
- qase/commons/util/host_data.py +147 -0
- qase/commons/utils.py +95 -0
- {qase_python_commons-3.1.9.dist-info → qase_python_commons-4.1.9.dist-info}/METADATA +16 -11
- qase_python_commons-4.1.9.dist-info/RECORD +45 -0
- {qase_python_commons-3.1.9.dist-info → qase_python_commons-4.1.9.dist-info}/WHEEL +1 -1
- qase/commons/models/suite.py +0 -13
- qase_python_commons-3.1.9.dist-info/RECORD +0 -40
- {qase_python_commons-3.1.9.dist-info → qase_python_commons-4.1.9.dist-info}/top_level.txt +0 -0
qase/commons/models/step.py
CHANGED
|
@@ -5,6 +5,7 @@ from enum import Enum
|
|
|
5
5
|
from typing import Optional, Union, Dict, List, Type
|
|
6
6
|
from .attachment import Attachment
|
|
7
7
|
from .basemodel import BaseModel
|
|
8
|
+
from .. import QaseUtils
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class StepType(Enum):
|
|
@@ -20,6 +21,7 @@ class StepTextData(BaseModel):
|
|
|
20
21
|
def __init__(self, action: str, expected_result: Optional[str] = None):
|
|
21
22
|
self.action = action
|
|
22
23
|
self.expected_result = expected_result
|
|
24
|
+
self.input_data = None
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
class StepAssertData(BaseModel):
|
|
@@ -30,10 +32,11 @@ class StepAssertData(BaseModel):
|
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
class StepGherkinData(BaseModel):
|
|
33
|
-
def __init__(self, keyword: str, name: str, line: int):
|
|
35
|
+
def __init__(self, keyword: str, name: str, line: int, data: Optional[str] = None):
|
|
34
36
|
self.keyword = keyword
|
|
35
37
|
self.name = name
|
|
36
38
|
self.line = line
|
|
39
|
+
self.data = data
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
class StepRequestData(BaseModel):
|
|
@@ -42,10 +45,20 @@ class StepRequestData(BaseModel):
|
|
|
42
45
|
self.response_body = None
|
|
43
46
|
self.status_code = None
|
|
44
47
|
if isinstance(request_body, bytes):
|
|
45
|
-
|
|
48
|
+
try:
|
|
49
|
+
request_body = request_body.decode('utf-8')
|
|
50
|
+
except UnicodeDecodeError:
|
|
51
|
+
# For binary data (like file uploads), keep as base64 encoded string
|
|
52
|
+
import base64
|
|
53
|
+
request_body = base64.b64encode(request_body).decode('ascii')
|
|
46
54
|
self.request_body = request_body
|
|
47
55
|
if isinstance(request_headers, bytes):
|
|
48
|
-
|
|
56
|
+
try:
|
|
57
|
+
request_headers = request_headers.decode('utf-8')
|
|
58
|
+
except UnicodeDecodeError:
|
|
59
|
+
# For binary headers, keep as base64 encoded string
|
|
60
|
+
import base64
|
|
61
|
+
request_headers = base64.b64encode(request_headers).decode('ascii')
|
|
49
62
|
self.request_headers = request_headers
|
|
50
63
|
self.request_method = request_method
|
|
51
64
|
self.request_url = request_url
|
|
@@ -55,16 +68,33 @@ class StepRequestData(BaseModel):
|
|
|
55
68
|
self.status_code = status_code
|
|
56
69
|
|
|
57
70
|
if isinstance(response_body, bytes):
|
|
58
|
-
|
|
71
|
+
try:
|
|
72
|
+
response_body = response_body.decode('utf-8')
|
|
73
|
+
except UnicodeDecodeError:
|
|
74
|
+
# For binary data (like file downloads), keep as base64 encoded string
|
|
75
|
+
import base64
|
|
76
|
+
response_body = base64.b64encode(response_body).decode('ascii')
|
|
59
77
|
self.response_body = response_body
|
|
60
78
|
if isinstance(response_headers, bytes):
|
|
61
|
-
|
|
79
|
+
try:
|
|
80
|
+
response_headers = response_headers.decode('utf-8')
|
|
81
|
+
except UnicodeDecodeError:
|
|
82
|
+
# For binary headers, keep as base64 encoded string
|
|
83
|
+
import base64
|
|
84
|
+
response_headers = base64.b64encode(response_headers).decode('ascii')
|
|
62
85
|
self.response_headers = response_headers
|
|
63
86
|
|
|
64
87
|
|
|
65
88
|
class StepDbQueryData(BaseModel):
|
|
66
|
-
def __init__(self, query: str, expected_result: str
|
|
89
|
+
def __init__(self, query: str, expected_result: str = None,
|
|
90
|
+
database_type: str = None, execution_time: float = None,
|
|
91
|
+
rows_affected: int = None, connection_info: str = None):
|
|
67
92
|
self.query = query
|
|
93
|
+
self.expected_result = expected_result
|
|
94
|
+
self.database_type = database_type
|
|
95
|
+
self.execution_time = execution_time
|
|
96
|
+
self.rows_affected = rows_affected
|
|
97
|
+
self.connection_info = connection_info
|
|
68
98
|
|
|
69
99
|
|
|
70
100
|
class StepSleepData(BaseModel):
|
|
@@ -74,21 +104,25 @@ class StepSleepData(BaseModel):
|
|
|
74
104
|
|
|
75
105
|
class StepExecution(BaseModel):
|
|
76
106
|
def __init__(self, status: Optional[str] = 'untested', end_time: int = 0, duration: int = 0):
|
|
77
|
-
self.start_time =
|
|
107
|
+
self.start_time = QaseUtils.get_real_time()
|
|
78
108
|
self.status = status
|
|
79
109
|
self.end_time = end_time
|
|
80
110
|
self.duration = duration
|
|
111
|
+
self.attachments = []
|
|
81
112
|
|
|
82
113
|
def set_status(self, status: Optional[str]):
|
|
83
|
-
if status in ['passed', 'failed', 'skipped', 'blocked', 'untested']:
|
|
114
|
+
if status in ['passed', 'failed', 'skipped', 'blocked', 'untested', 'invalid']:
|
|
84
115
|
self.status = status
|
|
85
116
|
else:
|
|
86
|
-
raise ValueError('Step status must be one of: passed, failed, skipped, blocked, untested')
|
|
117
|
+
raise ValueError('Step status must be one of: passed, failed, skipped, blocked, untested, invalid')
|
|
87
118
|
|
|
88
119
|
def complete(self):
|
|
89
|
-
self.end_time =
|
|
120
|
+
self.end_time = QaseUtils.get_real_time()
|
|
90
121
|
self.duration = int((self.end_time - self.start_time) * 1000)
|
|
91
122
|
|
|
123
|
+
def add_attachment(self, attachment: Attachment):
|
|
124
|
+
self.attachments.append(attachment)
|
|
125
|
+
|
|
92
126
|
|
|
93
127
|
class Step(BaseModel):
|
|
94
128
|
def __init__(self,
|
|
@@ -107,7 +141,6 @@ class Step(BaseModel):
|
|
|
107
141
|
self.data = data
|
|
108
142
|
self.parent_id = parent_id
|
|
109
143
|
self.execution = StepExecution()
|
|
110
|
-
self.attachments = []
|
|
111
144
|
self.steps = []
|
|
112
145
|
|
|
113
146
|
def set_parent_id(self, parent_id: Optional[str]):
|
|
@@ -132,4 +165,4 @@ class Step(BaseModel):
|
|
|
132
165
|
self.steps = steps
|
|
133
166
|
|
|
134
167
|
def add_attachment(self, attachment: Attachment):
|
|
135
|
-
self.
|
|
168
|
+
self.execution.add_attachment(attachment)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from .network import NetworkProfiler, NetworkProfilerSingleton
|
|
2
2
|
from .sleep import SleepProfiler
|
|
3
|
-
from .db import
|
|
3
|
+
from .db import DatabaseProfiler, DatabaseProfilerSingleton
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
6
|
NetworkProfiler,
|
|
7
7
|
NetworkProfilerSingleton,
|
|
8
8
|
SleepProfiler,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
DatabaseProfiler,
|
|
10
|
+
DatabaseProfilerSingleton
|
|
11
|
+
]
|