orionis 0.415.0__py3-none-any.whl → 0.416.0__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.
- orionis/metadata/framework.py +1 -1
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/METADATA +1 -1
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/RECORD +11 -7
- tests/testing/records/__init__.py +0 -0
- tests/testing/records/test_testing_records.py +181 -0
- tests/testing/validators/__init__.py +0 -0
- tests/testing/validators/test_testing_validators.py +449 -0
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/WHEEL +0 -0
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/top_level.txt +0 -0
- {orionis-0.415.0.dist-info → orionis-0.416.0.dist-info}/zip-safe +0 -0
orionis/metadata/framework.py
CHANGED
|
@@ -313,7 +313,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=WW3grNgH-yV2meSSTeO
|
|
|
313
313
|
orionis/foundation/providers/testing_provider.py,sha256=iJSN2RIChbYIL-1ue6vmPmDMCSrvERDkti4Er9MPiLA,1102
|
|
314
314
|
orionis/foundation/providers/workers_provider.py,sha256=kiQjQRyUEyiBX2zcbF_KmqRgvc7Bvxsvg5oMtIvYniM,1075
|
|
315
315
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
316
|
-
orionis/metadata/framework.py,sha256=
|
|
316
|
+
orionis/metadata/framework.py,sha256=UK4GTjXKviZ1FEBPKSAIcGyD7a5qsQ44cEuJFT07ulg,4960
|
|
317
317
|
orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
|
|
318
318
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
319
319
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -483,7 +483,7 @@ orionis/test/validators/web_report.py,sha256=-h3Fe9jY93_kzUhd2NBIqEfCcBpu-8Ei9x3
|
|
|
483
483
|
orionis/test/validators/workers.py,sha256=LGffDKtK6SKixFKzIYPQpI5aFeQPAGXpv_LUtmEu6g4,1102
|
|
484
484
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
485
485
|
orionis/test/view/render.py,sha256=3ICz68l-WF3BtnYqH5m-ktN9UD00MELMbmMnyJDV74A,4768
|
|
486
|
-
orionis-0.
|
|
486
|
+
orionis-0.416.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
|
487
487
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
488
488
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
489
489
|
tests/container/test_container.py,sha256=asv8TkkupVoex6SWod74NBl4dSs7wb9mLmu_glNdNy8,14815
|
|
@@ -569,8 +569,12 @@ tests/testing/enums/test_testing_status.py,sha256=Jld1j4nn1IvK_Cok4k-BIRUg3DiB55
|
|
|
569
569
|
tests/testing/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
570
570
|
tests/testing/output/test_testing_dumper.py,sha256=QWuHEN-ImwiqNszqnsYUOJNwgZB1WM8ussw_DqFkfEY,1063
|
|
571
571
|
tests/testing/output/test_testing_printer.py,sha256=ov4u0FLHtdWt3onXDQr4-uaMMKE3QYZ4Z-K9LGOuUiM,1366
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
orionis-0.
|
|
572
|
+
tests/testing/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
573
|
+
tests/testing/records/test_testing_records.py,sha256=1MY5bCzY9yapjlOPB8t2SJz63V2_iGczqTmtnyHpnlE,6446
|
|
574
|
+
tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
575
|
+
tests/testing/validators/test_testing_validators.py,sha256=QdcF0Vhnnl_kD-PzceHJbUYOqwPTB1Td7YaTv8LTr30,19612
|
|
576
|
+
orionis-0.416.0.dist-info/METADATA,sha256=Kth-ref5_qVq92ry-jE9veJzuSPOiTcYhp3oalo9Hhw,4772
|
|
577
|
+
orionis-0.416.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
578
|
+
orionis-0.416.0.dist-info/top_level.txt,sha256=nkPWzvqkAzAmwPMPo3_iiUgzWMFOGfz6hVwdASslEGE,37
|
|
579
|
+
orionis-0.416.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
580
|
+
orionis-0.416.0.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import tempfile
|
|
3
|
+
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
+
from orionis.test.exceptions import OrionisTestValueError
|
|
5
|
+
from orionis.test.records.logs import TestLogs
|
|
6
|
+
|
|
7
|
+
class TestTestingRecords(AsyncTestCase):
|
|
8
|
+
|
|
9
|
+
async def testCreateAndGetReport(self):
|
|
10
|
+
"""
|
|
11
|
+
Tests the creation of a test report and retrieval of the most recent report.
|
|
12
|
+
|
|
13
|
+
This method creates a test report with all required fields, stores it using
|
|
14
|
+
the `TestLogs` class, and then retrieves the most recent report to verify
|
|
15
|
+
its contents.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
None
|
|
20
|
+
This is a test method and does not return any value. Assertions are used
|
|
21
|
+
to validate expected behavior.
|
|
22
|
+
"""
|
|
23
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
24
|
+
logs = TestLogs(tmpdir)
|
|
25
|
+
|
|
26
|
+
# Prepare a complete test report dictionary
|
|
27
|
+
report = {
|
|
28
|
+
"total_tests": 5,
|
|
29
|
+
"passed": 4,
|
|
30
|
+
"failed": 1,
|
|
31
|
+
"errors": 0,
|
|
32
|
+
"skipped": 0,
|
|
33
|
+
"total_time": 1.23,
|
|
34
|
+
"success_rate": 0.8,
|
|
35
|
+
"timestamp": "2024-06-01T12:00:00"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Serialize the report to JSON and add to the dictionary
|
|
39
|
+
report["json"] = json.dumps(report)
|
|
40
|
+
|
|
41
|
+
# Store the report in the logs
|
|
42
|
+
result = logs.create(report)
|
|
43
|
+
self.assertTrue(result)
|
|
44
|
+
|
|
45
|
+
# Retrieve the most recent report
|
|
46
|
+
reports = logs.get(first=1)
|
|
47
|
+
self.assertEqual(len(reports), 1)
|
|
48
|
+
|
|
49
|
+
# Validate the contents of the retrieved report
|
|
50
|
+
self.assertEqual(json.loads(reports[0][1])["total_tests"], 5)
|
|
51
|
+
|
|
52
|
+
async def testCreateMissingFields(self):
|
|
53
|
+
"""
|
|
54
|
+
Tests error handling when creating a report with missing required fields.
|
|
55
|
+
|
|
56
|
+
This method attempts to create a report without the required 'timestamp'
|
|
57
|
+
field and expects an `OrionisTestValueError` to be raised.
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
None
|
|
62
|
+
This is a test method and does not return any value. Assertions are used
|
|
63
|
+
to validate expected behavior.
|
|
64
|
+
"""
|
|
65
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
66
|
+
logs = TestLogs(tmpdir)
|
|
67
|
+
|
|
68
|
+
# Prepare a report missing the 'timestamp' field
|
|
69
|
+
report = {
|
|
70
|
+
"total_tests": 5,
|
|
71
|
+
"passed": 4,
|
|
72
|
+
"failed": 1,
|
|
73
|
+
"errors": 0,
|
|
74
|
+
"skipped": 0,
|
|
75
|
+
"total_time": 1.23,
|
|
76
|
+
"success_rate": 0.8,
|
|
77
|
+
}
|
|
78
|
+
report["json"] = json.dumps(report)
|
|
79
|
+
|
|
80
|
+
# Expect an error when creating the report
|
|
81
|
+
with self.assertRaises(OrionisTestValueError):
|
|
82
|
+
logs.create(report)
|
|
83
|
+
|
|
84
|
+
async def testResetDatabase(self):
|
|
85
|
+
"""
|
|
86
|
+
Tests the reset functionality of the test logs database.
|
|
87
|
+
|
|
88
|
+
This method creates a report, stores it, and then resets the logs database.
|
|
89
|
+
It verifies that the reset operation returns True.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
None
|
|
94
|
+
This is a test method and does not return any value. Assertions are used
|
|
95
|
+
to validate expected behavior.
|
|
96
|
+
"""
|
|
97
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
98
|
+
logs = TestLogs(tmpdir)
|
|
99
|
+
|
|
100
|
+
# Create and store a single report
|
|
101
|
+
report = {
|
|
102
|
+
"total_tests": 1,
|
|
103
|
+
"passed": 1,
|
|
104
|
+
"failed": 0,
|
|
105
|
+
"errors": 0,
|
|
106
|
+
"skipped": 0,
|
|
107
|
+
"total_time": 0.1,
|
|
108
|
+
"success_rate": 1.0,
|
|
109
|
+
"timestamp": "2024-06-01T12:00:00"
|
|
110
|
+
}
|
|
111
|
+
report["json"] = json.dumps(report)
|
|
112
|
+
logs.create(report)
|
|
113
|
+
|
|
114
|
+
# Reset the logs database and verify success
|
|
115
|
+
self.assertTrue(logs.reset())
|
|
116
|
+
|
|
117
|
+
async def testGetReportsInvalidParams(self):
|
|
118
|
+
"""
|
|
119
|
+
Tests error handling for invalid parameters passed to `TestLogs.get()`.
|
|
120
|
+
|
|
121
|
+
This method checks that passing mutually exclusive or invalid values to
|
|
122
|
+
`get()` raises an `OrionisTestValueError`.
|
|
123
|
+
|
|
124
|
+
Returns
|
|
125
|
+
-------
|
|
126
|
+
None
|
|
127
|
+
This is a test method and does not return any value. Assertions are used
|
|
128
|
+
to validate expected behavior.
|
|
129
|
+
"""
|
|
130
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
131
|
+
logs = TestLogs(tmpdir)
|
|
132
|
+
|
|
133
|
+
# Both 'first' and 'last' should not be provided together
|
|
134
|
+
with self.assertRaises(OrionisTestValueError):
|
|
135
|
+
logs.get(first=1, last=1)
|
|
136
|
+
|
|
137
|
+
# 'first' must be greater than zero
|
|
138
|
+
with self.assertRaises(OrionisTestValueError):
|
|
139
|
+
logs.get(first=0)
|
|
140
|
+
|
|
141
|
+
# 'last' must be greater than zero
|
|
142
|
+
with self.assertRaises(OrionisTestValueError):
|
|
143
|
+
logs.get(last=-1)
|
|
144
|
+
|
|
145
|
+
async def testGetLastReports(self):
|
|
146
|
+
"""
|
|
147
|
+
Tests retrieval of the last N reports and verifies their order.
|
|
148
|
+
|
|
149
|
+
This method creates multiple reports, retrieves the last two, and checks
|
|
150
|
+
that the reports are returned in descending order by their identifier.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
None
|
|
155
|
+
This is a test method and does not return any value. Assertions are used
|
|
156
|
+
to validate expected behavior.
|
|
157
|
+
"""
|
|
158
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
159
|
+
logs = TestLogs(tmpdir)
|
|
160
|
+
|
|
161
|
+
# Create and store three reports with increasing 'total_tests'
|
|
162
|
+
for i in range(3):
|
|
163
|
+
report = {
|
|
164
|
+
"total_tests": i+1,
|
|
165
|
+
"passed": i,
|
|
166
|
+
"failed": 1,
|
|
167
|
+
"errors": 0,
|
|
168
|
+
"skipped": 0,
|
|
169
|
+
"total_time": 0.1 * (i+1),
|
|
170
|
+
"success_rate": 0.5,
|
|
171
|
+
"timestamp": f"2024-06-01T12:00:0{i}"
|
|
172
|
+
}
|
|
173
|
+
report["json"] = json.dumps(report)
|
|
174
|
+
logs.create(report)
|
|
175
|
+
|
|
176
|
+
# Retrieve the last two reports
|
|
177
|
+
reports = logs.get(last=2)
|
|
178
|
+
self.assertEqual(len(reports), 2)
|
|
179
|
+
|
|
180
|
+
# Ensure the reports are ordered by descending identifier
|
|
181
|
+
self.assertTrue(reports[0][0] > reports[1][0])
|
|
File without changes
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
2
|
+
from orionis.support.facades.workers import Workers
|
|
3
|
+
from orionis.test.exceptions import OrionisTestValueError
|
|
4
|
+
from orionis.test.validators import *
|
|
5
|
+
|
|
6
|
+
class TestTestingDumper(AsyncTestCase):
|
|
7
|
+
|
|
8
|
+
async def testValidWorkers(self) -> None:
|
|
9
|
+
"""
|
|
10
|
+
Tests the ValidWorkers validator for correct validation of worker counts.
|
|
11
|
+
|
|
12
|
+
This method verifies that ValidWorkers accepts valid worker counts within the allowed range,
|
|
13
|
+
and raises OrionisTestValueError for invalid values such as zero, negative numbers, values
|
|
14
|
+
exceeding the maximum allowed, and non-integer types.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
None
|
|
19
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
20
|
+
"""
|
|
21
|
+
# Get the maximum allowed number of workers from the Workers facade
|
|
22
|
+
max_allowed = Workers.calculate()
|
|
23
|
+
|
|
24
|
+
# Valid cases: should return the input value if within allowed range
|
|
25
|
+
self.assertEqual(ValidWorkers(1), 1)
|
|
26
|
+
self.assertEqual(ValidWorkers(max_allowed), max_allowed)
|
|
27
|
+
|
|
28
|
+
# Invalid cases: should raise OrionisTestValueError for out-of-range or wrong type
|
|
29
|
+
with self.assertRaises(OrionisTestValueError):
|
|
30
|
+
ValidWorkers(0) # Zero is not allowed
|
|
31
|
+
with self.assertRaises(OrionisTestValueError):
|
|
32
|
+
ValidWorkers(max_allowed + 1) # Exceeds maximum allowed
|
|
33
|
+
with self.assertRaises(OrionisTestValueError):
|
|
34
|
+
ValidWorkers(-5) # Negative value is not allowed
|
|
35
|
+
with self.assertRaises(OrionisTestValueError):
|
|
36
|
+
ValidWorkers("not_an_int") # Non-integer type is not allowed
|
|
37
|
+
|
|
38
|
+
async def testValidBasePath(self) -> None:
|
|
39
|
+
"""
|
|
40
|
+
Tests the ValidBasePath validator for correct validation of base path inputs.
|
|
41
|
+
|
|
42
|
+
This method checks that ValidBasePath accepts valid path strings and Path objects,
|
|
43
|
+
returning a pathlib.Path instance. It also verifies that invalid inputs such as empty strings,
|
|
44
|
+
None, and non-path types raise OrionisTestValueError.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
None
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
None
|
|
53
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
54
|
+
"""
|
|
55
|
+
from orionis.test.validators import ValidBasePath
|
|
56
|
+
from pathlib import Path
|
|
57
|
+
|
|
58
|
+
# Valid cases: should return a Path instance for valid string or Path input
|
|
59
|
+
self.assertIsInstance(ValidBasePath("/tmp"), Path)
|
|
60
|
+
self.assertIsInstance(ValidBasePath(Path("/tmp")), Path)
|
|
61
|
+
|
|
62
|
+
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-path type
|
|
63
|
+
with self.assertRaises(OrionisTestValueError):
|
|
64
|
+
ValidBasePath("")
|
|
65
|
+
with self.assertRaises(OrionisTestValueError):
|
|
66
|
+
ValidBasePath(None)
|
|
67
|
+
with self.assertRaises(OrionisTestValueError):
|
|
68
|
+
ValidBasePath(123)
|
|
69
|
+
|
|
70
|
+
async def testValidExecutionMode(self) -> None:
|
|
71
|
+
"""
|
|
72
|
+
Tests the ValidExecutionMode validator for correct validation of execution mode inputs.
|
|
73
|
+
|
|
74
|
+
This method verifies that ValidExecutionMode accepts valid execution mode strings and enum values,
|
|
75
|
+
returning the corresponding string value. It also checks that invalid inputs such as unknown strings
|
|
76
|
+
and non-enum types raise OrionisTestValueError.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
None
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
None
|
|
85
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
86
|
+
"""
|
|
87
|
+
from orionis.test.validators import ValidExecutionMode
|
|
88
|
+
from orionis.foundation.config.testing.enums.mode import ExecutionMode
|
|
89
|
+
|
|
90
|
+
# Valid cases: should return the string value for valid mode string or enum input
|
|
91
|
+
self.assertEqual(ValidExecutionMode("parallel"), ExecutionMode.PARALLEL.value)
|
|
92
|
+
self.assertEqual(ValidExecutionMode(ExecutionMode.SEQUENTIAL), ExecutionMode.SEQUENTIAL.value)
|
|
93
|
+
|
|
94
|
+
# Invalid cases: should raise OrionisTestValueError for unknown string or non-enum type
|
|
95
|
+
with self.assertRaises(OrionisTestValueError):
|
|
96
|
+
ValidExecutionMode("INVALID") # Unknown execution mode string
|
|
97
|
+
with self.assertRaises(OrionisTestValueError):
|
|
98
|
+
ValidExecutionMode(123) # Non-enum type
|
|
99
|
+
|
|
100
|
+
async def testValidFailFast(self) -> None:
|
|
101
|
+
"""
|
|
102
|
+
Tests the ValidFailFast validator for correct validation of fail-fast configuration.
|
|
103
|
+
|
|
104
|
+
This method verifies that ValidFailFast accepts valid boolean inputs, returning the corresponding
|
|
105
|
+
boolean value. It also checks that invalid inputs, such as non-boolean types or None, raise
|
|
106
|
+
OrionisTestValueError.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
None
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
None
|
|
115
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
116
|
+
"""
|
|
117
|
+
from orionis.test.validators import ValidFailFast
|
|
118
|
+
|
|
119
|
+
# Valid cases: should return True or False for boolean input
|
|
120
|
+
self.assertTrue(ValidFailFast(True))
|
|
121
|
+
self.assertFalse(ValidFailFast(False))
|
|
122
|
+
|
|
123
|
+
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
124
|
+
with self.assertRaises(OrionisTestValueError):
|
|
125
|
+
ValidFailFast("not_bool")
|
|
126
|
+
with self.assertRaises(OrionisTestValueError):
|
|
127
|
+
ValidFailFast(None)
|
|
128
|
+
|
|
129
|
+
async def testValidFolderPath(self) -> None:
|
|
130
|
+
"""
|
|
131
|
+
Tests the ValidFolderPath validator for correct validation of folder path inputs.
|
|
132
|
+
|
|
133
|
+
This method checks that ValidFolderPath accepts valid folder path strings, including those
|
|
134
|
+
with leading or trailing whitespace, and returns the normalized string path. It also verifies
|
|
135
|
+
that invalid inputs such as empty strings, None, or non-string types raise OrionisTestValueError.
|
|
136
|
+
|
|
137
|
+
Returns
|
|
138
|
+
-------
|
|
139
|
+
None
|
|
140
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
141
|
+
"""
|
|
142
|
+
from orionis.test.validators import ValidFolderPath
|
|
143
|
+
|
|
144
|
+
# Valid cases: should return the normalized string path for valid input
|
|
145
|
+
self.assertEqual(ValidFolderPath("/tmp"), "/tmp")
|
|
146
|
+
self.assertEqual(ValidFolderPath(" /tmp "), "/tmp")
|
|
147
|
+
|
|
148
|
+
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
149
|
+
with self.assertRaises(OrionisTestValueError):
|
|
150
|
+
ValidFolderPath("")
|
|
151
|
+
with self.assertRaises(OrionisTestValueError):
|
|
152
|
+
ValidFolderPath(None)
|
|
153
|
+
with self.assertRaises(OrionisTestValueError):
|
|
154
|
+
ValidFolderPath(123)
|
|
155
|
+
|
|
156
|
+
async def testValidModuleName(self) -> None:
|
|
157
|
+
"""
|
|
158
|
+
Tests the ValidModuleName validator for correct validation of module name inputs.
|
|
159
|
+
|
|
160
|
+
This method verifies that ValidModuleName accepts valid non-empty string module names,
|
|
161
|
+
returning the normalized string value. It also checks that invalid inputs such as empty strings,
|
|
162
|
+
None, or non-string types raise OrionisTestValueError.
|
|
163
|
+
|
|
164
|
+
Parameters
|
|
165
|
+
----------
|
|
166
|
+
None
|
|
167
|
+
|
|
168
|
+
Returns
|
|
169
|
+
-------
|
|
170
|
+
None
|
|
171
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
172
|
+
"""
|
|
173
|
+
from orionis.test.validators import ValidModuleName
|
|
174
|
+
|
|
175
|
+
# Valid case: should return the normalized string for a valid module name
|
|
176
|
+
self.assertEqual(ValidModuleName("mod"), "mod")
|
|
177
|
+
|
|
178
|
+
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
179
|
+
with self.assertRaises(OrionisTestValueError):
|
|
180
|
+
ValidModuleName("")
|
|
181
|
+
with self.assertRaises(OrionisTestValueError):
|
|
182
|
+
ValidModuleName(None)
|
|
183
|
+
with self.assertRaises(OrionisTestValueError):
|
|
184
|
+
ValidModuleName(123)
|
|
185
|
+
|
|
186
|
+
async def testValidNamePattern(self) -> None:
|
|
187
|
+
"""
|
|
188
|
+
Tests the ValidNamePattern validator for correct validation of name pattern inputs.
|
|
189
|
+
|
|
190
|
+
This method verifies that ValidNamePattern accepts valid non-empty string patterns and None,
|
|
191
|
+
returning the normalized string pattern or None. It also checks that invalid inputs such as
|
|
192
|
+
empty strings or non-string types raise OrionisTestValueError.
|
|
193
|
+
|
|
194
|
+
Parameters
|
|
195
|
+
----------
|
|
196
|
+
None
|
|
197
|
+
|
|
198
|
+
Returns
|
|
199
|
+
-------
|
|
200
|
+
None
|
|
201
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
202
|
+
"""
|
|
203
|
+
from orionis.test.validators import ValidNamePattern
|
|
204
|
+
|
|
205
|
+
# Valid case: should return the normalized string for a valid pattern
|
|
206
|
+
self.assertEqual(ValidNamePattern("test_*"), "test_*")
|
|
207
|
+
|
|
208
|
+
# Valid case: should return None when input is None
|
|
209
|
+
self.assertIsNone(ValidNamePattern(None))
|
|
210
|
+
|
|
211
|
+
# Invalid cases: should raise OrionisTestValueError for empty string or non-string type
|
|
212
|
+
with self.assertRaises(OrionisTestValueError):
|
|
213
|
+
ValidNamePattern("")
|
|
214
|
+
with self.assertRaises(OrionisTestValueError):
|
|
215
|
+
ValidNamePattern(123)
|
|
216
|
+
|
|
217
|
+
async def testValidPattern(self) -> None:
|
|
218
|
+
"""
|
|
219
|
+
Tests the ValidPattern validator for correct validation of pattern string inputs.
|
|
220
|
+
|
|
221
|
+
This method verifies that ValidPattern accepts valid non-empty string patterns,
|
|
222
|
+
returning the normalized string value. It also checks that invalid inputs such as
|
|
223
|
+
empty strings, None, or non-string types raise OrionisTestValueError.
|
|
224
|
+
|
|
225
|
+
Returns
|
|
226
|
+
-------
|
|
227
|
+
None
|
|
228
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
229
|
+
"""
|
|
230
|
+
from orionis.test.validators import ValidPattern
|
|
231
|
+
|
|
232
|
+
# Valid case: should return the normalized string for a valid pattern
|
|
233
|
+
self.assertEqual(ValidPattern("abc"), "abc")
|
|
234
|
+
|
|
235
|
+
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
236
|
+
with self.assertRaises(OrionisTestValueError):
|
|
237
|
+
ValidPattern("")
|
|
238
|
+
with self.assertRaises(OrionisTestValueError):
|
|
239
|
+
ValidPattern(None)
|
|
240
|
+
with self.assertRaises(OrionisTestValueError):
|
|
241
|
+
ValidPattern(123)
|
|
242
|
+
|
|
243
|
+
async def testValidPersistentDriver(self) -> None:
|
|
244
|
+
"""
|
|
245
|
+
Tests the ValidPersistentDriver validator for correct validation of persistent driver inputs.
|
|
246
|
+
|
|
247
|
+
This method verifies that ValidPersistentDriver accepts valid persistent driver names as strings
|
|
248
|
+
and enum values, returning the corresponding normalized string value. It also checks that invalid
|
|
249
|
+
inputs, such as unknown driver names or non-enum types, raise OrionisTestValueError.
|
|
250
|
+
|
|
251
|
+
Parameters
|
|
252
|
+
----------
|
|
253
|
+
None
|
|
254
|
+
|
|
255
|
+
Returns
|
|
256
|
+
-------
|
|
257
|
+
None
|
|
258
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
259
|
+
"""
|
|
260
|
+
from orionis.test.validators import ValidPersistentDriver
|
|
261
|
+
from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
|
|
262
|
+
|
|
263
|
+
# Valid cases: should return the normalized string for valid driver name or enum input
|
|
264
|
+
self.assertEqual(ValidPersistentDriver("sqlite"), "sqlite")
|
|
265
|
+
self.assertEqual(ValidPersistentDriver(PersistentDrivers.SQLITE), "sqlite")
|
|
266
|
+
|
|
267
|
+
# Invalid cases: should raise OrionisTestValueError for unknown driver name or non-enum type
|
|
268
|
+
with self.assertRaises(OrionisTestValueError):
|
|
269
|
+
ValidPersistentDriver("invalid")
|
|
270
|
+
with self.assertRaises(OrionisTestValueError):
|
|
271
|
+
ValidPersistentDriver(123)
|
|
272
|
+
|
|
273
|
+
async def testValidPersistent(self) -> None:
|
|
274
|
+
"""
|
|
275
|
+
Tests the ValidPersistent validator for correct validation of persistent configuration values.
|
|
276
|
+
|
|
277
|
+
This method verifies that ValidPersistent accepts valid boolean inputs, returning the corresponding
|
|
278
|
+
boolean value. It also checks that invalid inputs, such as non-boolean types or None, raise
|
|
279
|
+
OrionisTestValueError.
|
|
280
|
+
|
|
281
|
+
Parameters
|
|
282
|
+
----------
|
|
283
|
+
None
|
|
284
|
+
|
|
285
|
+
Returns
|
|
286
|
+
-------
|
|
287
|
+
None
|
|
288
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
289
|
+
"""
|
|
290
|
+
from orionis.test.validators import ValidPersistent
|
|
291
|
+
|
|
292
|
+
# Valid cases: should return True or False for boolean input
|
|
293
|
+
self.assertTrue(ValidPersistent(True))
|
|
294
|
+
self.assertFalse(ValidPersistent(False))
|
|
295
|
+
|
|
296
|
+
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
297
|
+
with self.assertRaises(OrionisTestValueError):
|
|
298
|
+
ValidPersistent("not_bool")
|
|
299
|
+
with self.assertRaises(OrionisTestValueError):
|
|
300
|
+
ValidPersistent(None)
|
|
301
|
+
|
|
302
|
+
async def testValidPrintResult(self) -> None:
|
|
303
|
+
"""
|
|
304
|
+
Tests the ValidPrintResult validator for correct validation of print result configuration.
|
|
305
|
+
|
|
306
|
+
This method verifies that ValidPrintResult accepts valid boolean inputs, returning the corresponding
|
|
307
|
+
boolean value. It also checks that invalid inputs, such as non-boolean types or None, raise
|
|
308
|
+
OrionisTestValueError.
|
|
309
|
+
|
|
310
|
+
Parameters
|
|
311
|
+
----------
|
|
312
|
+
None
|
|
313
|
+
|
|
314
|
+
Returns
|
|
315
|
+
-------
|
|
316
|
+
None
|
|
317
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
318
|
+
"""
|
|
319
|
+
from orionis.test.validators import ValidPrintResult
|
|
320
|
+
|
|
321
|
+
# Valid cases: should return True or False for boolean input
|
|
322
|
+
self.assertTrue(ValidPrintResult(True))
|
|
323
|
+
self.assertFalse(ValidPrintResult(False))
|
|
324
|
+
|
|
325
|
+
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
326
|
+
with self.assertRaises(OrionisTestValueError):
|
|
327
|
+
ValidPrintResult("not_bool")
|
|
328
|
+
with self.assertRaises(OrionisTestValueError):
|
|
329
|
+
ValidPrintResult(None)
|
|
330
|
+
|
|
331
|
+
async def testValidTags(self) -> None:
|
|
332
|
+
"""
|
|
333
|
+
Tests the ValidTags validator for correct validation of tag list inputs.
|
|
334
|
+
|
|
335
|
+
This method verifies that ValidTags accepts a list of non-empty string tags, normalizes whitespace,
|
|
336
|
+
and returns a list of cleaned tag strings. It also checks that None is accepted and returns None.
|
|
337
|
+
Invalid cases, such as empty lists, lists containing empty strings or non-string types, and non-list
|
|
338
|
+
inputs, should raise OrionisTestValueError.
|
|
339
|
+
|
|
340
|
+
Returns
|
|
341
|
+
-------
|
|
342
|
+
None
|
|
343
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
344
|
+
"""
|
|
345
|
+
from orionis.test.validators import ValidTags
|
|
346
|
+
|
|
347
|
+
# Valid case: should return a list of normalized tag strings
|
|
348
|
+
self.assertEqual(ValidTags(["a", "b ", " c"]), ["a", "b", "c"])
|
|
349
|
+
|
|
350
|
+
# Valid case: should return None when input is None
|
|
351
|
+
self.assertIsNone(ValidTags(None))
|
|
352
|
+
|
|
353
|
+
# Invalid case: should raise OrionisTestValueError for empty list
|
|
354
|
+
with self.assertRaises(OrionisTestValueError):
|
|
355
|
+
ValidTags([])
|
|
356
|
+
|
|
357
|
+
# Invalid case: should raise OrionisTestValueError for list containing empty string
|
|
358
|
+
with self.assertRaises(OrionisTestValueError):
|
|
359
|
+
ValidTags([""])
|
|
360
|
+
|
|
361
|
+
# Invalid case: should raise OrionisTestValueError for list containing non-string type
|
|
362
|
+
with self.assertRaises(OrionisTestValueError):
|
|
363
|
+
ValidTags([123])
|
|
364
|
+
|
|
365
|
+
# Invalid case: should raise OrionisTestValueError for non-list input
|
|
366
|
+
with self.assertRaises(OrionisTestValueError):
|
|
367
|
+
ValidTags("not_a_list")
|
|
368
|
+
|
|
369
|
+
async def testValidThrowException(self) -> None:
|
|
370
|
+
"""
|
|
371
|
+
Tests the ValidThrowException validator for correct validation of throw exception configuration.
|
|
372
|
+
|
|
373
|
+
This method verifies that ValidThrowException accepts valid boolean inputs, returning the corresponding
|
|
374
|
+
boolean value. It also checks that invalid inputs, such as non-boolean types or None, raise
|
|
375
|
+
OrionisTestValueError.
|
|
376
|
+
|
|
377
|
+
Parameters
|
|
378
|
+
----------
|
|
379
|
+
None
|
|
380
|
+
|
|
381
|
+
Returns
|
|
382
|
+
-------
|
|
383
|
+
None
|
|
384
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
385
|
+
"""
|
|
386
|
+
from orionis.test.validators import ValidThrowException
|
|
387
|
+
|
|
388
|
+
# Valid cases: should return True or False for boolean input
|
|
389
|
+
self.assertTrue(ValidThrowException(True))
|
|
390
|
+
self.assertFalse(ValidThrowException(False))
|
|
391
|
+
|
|
392
|
+
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
393
|
+
with self.assertRaises(OrionisTestValueError):
|
|
394
|
+
ValidThrowException("not_bool")
|
|
395
|
+
with self.assertRaises(OrionisTestValueError):
|
|
396
|
+
ValidThrowException(None)
|
|
397
|
+
|
|
398
|
+
async def testValidVerbosity(self) -> None:
|
|
399
|
+
"""
|
|
400
|
+
Tests the ValidVerbosity validator for correct validation of verbosity mode inputs.
|
|
401
|
+
|
|
402
|
+
This method verifies that ValidVerbosity accepts valid verbosity mode enum values and their corresponding
|
|
403
|
+
integer values, returning the normalized integer value. It also checks that invalid inputs such as
|
|
404
|
+
negative values, unknown integers, or non-integer types raise OrionisTestValueError.
|
|
405
|
+
|
|
406
|
+
Returns
|
|
407
|
+
-------
|
|
408
|
+
None
|
|
409
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
410
|
+
"""
|
|
411
|
+
from orionis.test.validators import ValidVerbosity
|
|
412
|
+
from orionis.foundation.config.testing.enums.verbosity import VerbosityMode
|
|
413
|
+
|
|
414
|
+
# Valid cases: should return the integer value for valid enum or integer input
|
|
415
|
+
self.assertEqual(ValidVerbosity(VerbosityMode.MINIMAL), VerbosityMode.MINIMAL.value)
|
|
416
|
+
self.assertEqual(ValidVerbosity(VerbosityMode.DETAILED.value), VerbosityMode.DETAILED.value)
|
|
417
|
+
|
|
418
|
+
# Invalid cases: should raise OrionisTestValueError for negative, unknown, or non-integer input
|
|
419
|
+
with self.assertRaises(OrionisTestValueError):
|
|
420
|
+
ValidVerbosity(-1)
|
|
421
|
+
with self.assertRaises(OrionisTestValueError):
|
|
422
|
+
ValidVerbosity("not_int")
|
|
423
|
+
with self.assertRaises(OrionisTestValueError):
|
|
424
|
+
ValidVerbosity(999)
|
|
425
|
+
|
|
426
|
+
async def testValidWebReport(self) -> None:
|
|
427
|
+
"""
|
|
428
|
+
Tests the ValidWebReport validator for correct validation of web report configuration.
|
|
429
|
+
|
|
430
|
+
This method verifies that ValidWebReport accepts valid boolean inputs, returning the corresponding
|
|
431
|
+
boolean value. It also checks that invalid inputs, such as non-boolean types or None, raise
|
|
432
|
+
OrionisTestValueError.
|
|
433
|
+
|
|
434
|
+
Returns
|
|
435
|
+
-------
|
|
436
|
+
None
|
|
437
|
+
This method does not return any value. It asserts expected behavior using test assertions.
|
|
438
|
+
"""
|
|
439
|
+
from orionis.test.validators import ValidWebReport
|
|
440
|
+
|
|
441
|
+
# Valid cases: should return True or False for boolean input
|
|
442
|
+
self.assertTrue(ValidWebReport(True))
|
|
443
|
+
self.assertFalse(ValidWebReport(False))
|
|
444
|
+
|
|
445
|
+
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
446
|
+
with self.assertRaises(OrionisTestValueError):
|
|
447
|
+
ValidWebReport("not_bool")
|
|
448
|
+
with self.assertRaises(OrionisTestValueError):
|
|
449
|
+
ValidWebReport(None)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|