orionis 0.546.0__py3-none-any.whl → 0.547.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/console/base/scheduler_event_listener.py +0 -17
- orionis/console/contracts/schedule_event_listener.py +0 -18
- orionis/foundation/config/app/entities/app.py +3 -2
- orionis/foundation/config/app/enums/ciphers.py +5 -19
- orionis/foundation/config/session/entities/session.py +2 -2
- orionis/metadata/framework.py +1 -1
- orionis/services/encrypter/encrypter.py +115 -0
- orionis/services/environment/dynamic/caster.py +35 -27
- orionis/services/environment/key/key_generator.py +32 -11
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/METADATA +1 -1
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/RECORD +15 -159
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/top_level.txt +0 -1
- tests/container/__init__.py +0 -0
- tests/container/context/__init__.py +0 -0
- tests/container/context/test_manager.py +0 -38
- tests/container/context/test_scope.py +0 -32
- tests/container/core/__init__.py +0 -0
- tests/container/core/test_advanced_async.py +0 -234
- tests/container/core/test_async_optimizations.py +0 -268
- tests/container/core/test_container.py +0 -453
- tests/container/core/test_singleton.py +0 -122
- tests/container/core/test_thread_safety.py +0 -90
- tests/container/entities/__init__.py +0 -0
- tests/container/entities/test_binding.py +0 -242
- tests/container/enums/__init__.py +0 -0
- tests/container/enums/test_lifetimes.py +0 -97
- tests/container/facades/__init__.py +0 -0
- tests/container/facades/test_facade.py +0 -78
- tests/container/mocks/__init__.py +0 -0
- tests/container/mocks/mock_advanced_async.py +0 -332
- tests/container/mocks/mock_async_optimizations.py +0 -407
- tests/container/mocks/mock_auto_resolution.py +0 -192
- tests/container/mocks/mock_complex_classes.py +0 -792
- tests/container/mocks/mock_simple_classes.py +0 -98
- tests/container/providers/__init__.py +0 -0
- tests/container/providers/test_providers.py +0 -55
- tests/container/validators/__init__.py +0 -0
- tests/container/validators/test_implements.py +0 -186
- tests/container/validators/test_is_abstract_class.py +0 -147
- tests/container/validators/test_is_callable.py +0 -102
- tests/container/validators/test_is_concrete_class.py +0 -160
- tests/container/validators/test_is_instance.py +0 -150
- tests/container/validators/test_is_not_subclass.py +0 -49
- tests/container/validators/test_is_subclass.py +0 -178
- tests/container/validators/test_is_valid_alias.py +0 -147
- tests/container/validators/test_lifetime.py +0 -106
- tests/example/__init__.py +0 -0
- tests/example/test_example.py +0 -725
- tests/foundation/__init__.py +0 -0
- tests/foundation/config/__init__.py +0 -0
- tests/foundation/config/app/__init__.py +0 -0
- tests/foundation/config/app/test_foundation_config_app.py +0 -262
- tests/foundation/config/auth/__init__.py +0 -0
- tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
- tests/foundation/config/cache/__init__.py +0 -0
- tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
- tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
- tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
- tests/foundation/config/cors/__init__.py +0 -0
- tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
- tests/foundation/config/database/__init__.py +0 -0
- tests/foundation/config/database/test_foundation_config_database.py +0 -158
- tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
- tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
- tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
- tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
- tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
- tests/foundation/config/filesystems/__init__.py +0 -0
- tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
- tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
- tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
- tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
- tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
- tests/foundation/config/logging/__init__.py +0 -0
- tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
- tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
- tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
- tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
- tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
- tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
- tests/foundation/config/mail/__init__.py +0 -0
- tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
- tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
- tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
- tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
- tests/foundation/config/queue/__init__.py +0 -0
- tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
- tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
- tests/foundation/config/root/__init__.py +0 -0
- tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
- tests/foundation/config/session/__init__.py +0 -0
- tests/foundation/config/session/test_foundation_config_session.py +0 -213
- tests/foundation/config/startup/__init__.py +0 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
- tests/foundation/config/testing/__init__.py +0 -0
- tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
- tests/metadata/__init__.py +0 -0
- tests/metadata/test_metadata_framework.py +0 -140
- tests/metadata/test_metadata_package.py +0 -139
- tests/services/__init__.py +0 -0
- tests/services/asynchrony/__init__.py +0 -0
- tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
- tests/services/environment/__init__.py +0 -0
- tests/services/environment/test_services_environment.py +0 -226
- tests/services/introspection/__init__.py +0 -0
- tests/services/introspection/dependencies/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
- tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
- tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
- tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
- tests/services/introspection/reflection/__init__.py +0 -0
- tests/services/introspection/reflection/mock/__init__.py +0 -0
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
- tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
- tests/services/introspection/reflection/test_reflection_callable.py +0 -206
- tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
- tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
- tests/services/introspection/reflection/test_reflection_module.py +0 -567
- tests/services/introspection/test_reflection.py +0 -462
- tests/services/log/__init__.py +0 -0
- tests/services/log/test_log.py +0 -97
- tests/services/system/__init__.py +0 -0
- tests/services/system/test_services_system_imports.py +0 -204
- tests/services/system/test_services_system_workers.py +0 -131
- tests/support/__init__.py +0 -0
- tests/support/entities/__init__.py +0 -0
- tests/support/entities/mock_dataclass.py +0 -40
- tests/support/entities/test_base.py +0 -64
- tests/support/patterns/__init__.py +0 -0
- tests/support/patterns/singleton/__init__.py +0 -0
- tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
- tests/support/standard/__init__.py +0 -0
- tests/support/standard/test_services_std.py +0 -226
- tests/support/wrapper/__init__.py +0 -0
- tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
- tests/testing/__init__.py +0 -0
- tests/testing/cases/__init__.py +0 -0
- tests/testing/cases/test_testing_asynchronous.py +0 -63
- tests/testing/cases/test_testing_synchronous.py +0 -57
- tests/testing/entities/__init__.py +0 -0
- tests/testing/entities/test_testing_result.py +0 -146
- tests/testing/enums/__init__.py +0 -0
- tests/testing/enums/test_testing_status.py +0 -63
- tests/testing/output/__init__.py +0 -0
- tests/testing/output/test_testing_dumper.py +0 -29
- tests/testing/output/test_testing_printer.py +0 -42
- tests/testing/records/__init__.py +0 -0
- tests/testing/records/test_testing_records.py +0 -171
- tests/testing/test_testing_unit.py +0 -164
- tests/testing/validators/__init__.py +0 -0
- tests/testing/validators/test_testing_validators.py +0 -392
- tests/testing/view/__init__.py +0 -0
- tests/testing/view/test_render.py +0 -30
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/WHEEL +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/zip-safe +0 -0
|
@@ -1,392 +0,0 @@
|
|
|
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
|
-
Test the ValidWorkers validator for correct worker count validation.
|
|
11
|
-
|
|
12
|
-
Validates that the ValidWorkers function accepts integer values within the allowed range
|
|
13
|
-
and raises OrionisTestValueError for invalid values such as zero, negative numbers,
|
|
14
|
-
values exceeding the maximum, or non-integer types.
|
|
15
|
-
|
|
16
|
-
Returns
|
|
17
|
-
-------
|
|
18
|
-
None
|
|
19
|
-
"""
|
|
20
|
-
# Get the maximum allowed number of workers from the Workers facade
|
|
21
|
-
max_allowed = Workers.calculate()
|
|
22
|
-
|
|
23
|
-
# Valid cases: should return the input value if within allowed range
|
|
24
|
-
self.assertEqual(ValidWorkers(1), 1)
|
|
25
|
-
self.assertEqual(ValidWorkers(max_allowed), max_allowed)
|
|
26
|
-
|
|
27
|
-
# Invalid cases: should raise OrionisTestValueError for out-of-range or wrong type
|
|
28
|
-
with self.assertRaises(OrionisTestValueError):
|
|
29
|
-
ValidWorkers(0) # Zero is not allowed
|
|
30
|
-
with self.assertRaises(OrionisTestValueError):
|
|
31
|
-
ValidWorkers(max_allowed + 1) # Exceeds maximum allowed
|
|
32
|
-
with self.assertRaises(OrionisTestValueError):
|
|
33
|
-
ValidWorkers(-5) # Negative value is not allowed
|
|
34
|
-
with self.assertRaises(OrionisTestValueError):
|
|
35
|
-
ValidWorkers("not_an_int") # Non-integer type is not allowed
|
|
36
|
-
|
|
37
|
-
async def testValidBasePath(self) -> None:
|
|
38
|
-
"""
|
|
39
|
-
Test the ValidBasePath validator for correct base path validation.
|
|
40
|
-
|
|
41
|
-
Checks that ValidBasePath accepts valid path strings and Path objects, returning a pathlib.Path instance.
|
|
42
|
-
Ensures that invalid inputs such as empty strings, None, and non-path types raise OrionisTestValueError.
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
None
|
|
47
|
-
"""
|
|
48
|
-
from orionis.test.validators import ValidBasePath
|
|
49
|
-
from pathlib import Path
|
|
50
|
-
|
|
51
|
-
# Valid cases: should return a Path instance for valid string or Path input
|
|
52
|
-
self.assertIsInstance(ValidBasePath("/tmp"), Path)
|
|
53
|
-
self.assertIsInstance(ValidBasePath(Path("/tmp")), Path)
|
|
54
|
-
|
|
55
|
-
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-path type
|
|
56
|
-
with self.assertRaises(OrionisTestValueError):
|
|
57
|
-
ValidBasePath("")
|
|
58
|
-
with self.assertRaises(OrionisTestValueError):
|
|
59
|
-
ValidBasePath(None)
|
|
60
|
-
with self.assertRaises(OrionisTestValueError):
|
|
61
|
-
ValidBasePath(123)
|
|
62
|
-
|
|
63
|
-
async def testValidExecutionMode(self) -> None:
|
|
64
|
-
"""
|
|
65
|
-
Test the ValidExecutionMode validator for execution mode validation.
|
|
66
|
-
|
|
67
|
-
Validates that ValidExecutionMode accepts valid execution mode strings and enum values,
|
|
68
|
-
returning the corresponding string value. Ensures that invalid inputs such as unknown strings
|
|
69
|
-
and non-enum types raise OrionisTestValueError.
|
|
70
|
-
|
|
71
|
-
Returns
|
|
72
|
-
-------
|
|
73
|
-
None
|
|
74
|
-
"""
|
|
75
|
-
from orionis.test.validators import ValidExecutionMode
|
|
76
|
-
from orionis.foundation.config.testing.enums.mode import ExecutionMode
|
|
77
|
-
|
|
78
|
-
# Valid cases: should return the string value for valid mode string or enum input
|
|
79
|
-
self.assertEqual(ValidExecutionMode("parallel"), ExecutionMode.PARALLEL.value)
|
|
80
|
-
self.assertEqual(ValidExecutionMode(ExecutionMode.SEQUENTIAL), ExecutionMode.SEQUENTIAL.value)
|
|
81
|
-
|
|
82
|
-
# Invalid cases: should raise OrionisTestValueError for unknown string or non-enum type
|
|
83
|
-
with self.assertRaises(OrionisTestValueError):
|
|
84
|
-
ValidExecutionMode("INVALID") # Unknown execution mode string
|
|
85
|
-
with self.assertRaises(OrionisTestValueError):
|
|
86
|
-
ValidExecutionMode(123) # Non-enum type
|
|
87
|
-
|
|
88
|
-
async def testValidFailFast(self) -> None:
|
|
89
|
-
"""
|
|
90
|
-
Test the ValidFailFast validator for fail-fast configuration validation.
|
|
91
|
-
|
|
92
|
-
Ensures that ValidFailFast accepts valid boolean inputs and returns the corresponding
|
|
93
|
-
boolean value. Raises OrionisTestValueError for non-boolean types or None.
|
|
94
|
-
|
|
95
|
-
Returns
|
|
96
|
-
-------
|
|
97
|
-
None
|
|
98
|
-
"""
|
|
99
|
-
from orionis.test.validators import ValidFailFast
|
|
100
|
-
|
|
101
|
-
# Valid cases: should return True or False for boolean input
|
|
102
|
-
self.assertTrue(ValidFailFast(True))
|
|
103
|
-
self.assertFalse(ValidFailFast(False))
|
|
104
|
-
|
|
105
|
-
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
106
|
-
with self.assertRaises(OrionisTestValueError):
|
|
107
|
-
ValidFailFast("not_bool")
|
|
108
|
-
with self.assertRaises(OrionisTestValueError):
|
|
109
|
-
ValidFailFast(None)
|
|
110
|
-
|
|
111
|
-
async def testValidFolderPath(self) -> None:
|
|
112
|
-
"""
|
|
113
|
-
Test the ValidFolderPath validator for folder path validation.
|
|
114
|
-
|
|
115
|
-
Checks that ValidFolderPath accepts valid folder path strings, including those with whitespace,
|
|
116
|
-
and returns the normalized string path. Ensures that empty strings, None, or non-string types
|
|
117
|
-
raise OrionisTestValueError.
|
|
118
|
-
|
|
119
|
-
Returns
|
|
120
|
-
-------
|
|
121
|
-
None
|
|
122
|
-
"""
|
|
123
|
-
from orionis.test.validators import ValidFolderPath
|
|
124
|
-
|
|
125
|
-
# Valid cases: should return the normalized string path for valid input
|
|
126
|
-
self.assertEqual(ValidFolderPath("/tmp"), "/tmp")
|
|
127
|
-
self.assertEqual(ValidFolderPath(" /tmp "), "/tmp")
|
|
128
|
-
|
|
129
|
-
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
130
|
-
with self.assertRaises(OrionisTestValueError):
|
|
131
|
-
ValidFolderPath("")
|
|
132
|
-
with self.assertRaises(OrionisTestValueError):
|
|
133
|
-
ValidFolderPath(None)
|
|
134
|
-
with self.assertRaises(OrionisTestValueError):
|
|
135
|
-
ValidFolderPath(123)
|
|
136
|
-
|
|
137
|
-
async def testValidModuleName(self) -> None:
|
|
138
|
-
"""
|
|
139
|
-
Test the ValidModuleName validator for module name validation.
|
|
140
|
-
|
|
141
|
-
Validates that ValidModuleName accepts valid non-empty string module names and returns
|
|
142
|
-
the normalized string value. Ensures that empty strings, None, or non-string types
|
|
143
|
-
raise OrionisTestValueError.
|
|
144
|
-
|
|
145
|
-
Returns
|
|
146
|
-
-------
|
|
147
|
-
None
|
|
148
|
-
"""
|
|
149
|
-
from orionis.test.validators import ValidModuleName
|
|
150
|
-
|
|
151
|
-
# Valid case: should return the normalized string for a valid module name
|
|
152
|
-
self.assertEqual(ValidModuleName("mod"), "mod")
|
|
153
|
-
|
|
154
|
-
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
155
|
-
with self.assertRaises(OrionisTestValueError):
|
|
156
|
-
ValidModuleName("")
|
|
157
|
-
with self.assertRaises(OrionisTestValueError):
|
|
158
|
-
ValidModuleName(None)
|
|
159
|
-
with self.assertRaises(OrionisTestValueError):
|
|
160
|
-
ValidModuleName(123)
|
|
161
|
-
|
|
162
|
-
async def testValidNamePattern(self) -> None:
|
|
163
|
-
"""
|
|
164
|
-
Test the ValidNamePattern validator for name pattern validation.
|
|
165
|
-
|
|
166
|
-
Ensures that ValidNamePattern accepts valid non-empty string patterns and None,
|
|
167
|
-
returning the normalized string pattern or None. Raises OrionisTestValueError for
|
|
168
|
-
empty strings or non-string types.
|
|
169
|
-
|
|
170
|
-
Returns
|
|
171
|
-
-------
|
|
172
|
-
None
|
|
173
|
-
"""
|
|
174
|
-
from orionis.test.validators import ValidNamePattern
|
|
175
|
-
|
|
176
|
-
# Valid case: should return the normalized string for a valid pattern
|
|
177
|
-
self.assertEqual(ValidNamePattern("test_*"), "test_*")
|
|
178
|
-
|
|
179
|
-
# Valid case: should return None when input is None
|
|
180
|
-
self.assertIsNone(ValidNamePattern(None))
|
|
181
|
-
|
|
182
|
-
# Invalid cases: should raise OrionisTestValueError for empty string or non-string type
|
|
183
|
-
with self.assertRaises(OrionisTestValueError):
|
|
184
|
-
ValidNamePattern("")
|
|
185
|
-
with self.assertRaises(OrionisTestValueError):
|
|
186
|
-
ValidNamePattern(123)
|
|
187
|
-
|
|
188
|
-
async def testValidPattern(self) -> None:
|
|
189
|
-
"""
|
|
190
|
-
Test the ValidPattern validator for pattern string validation.
|
|
191
|
-
|
|
192
|
-
Validates that ValidPattern accepts valid non-empty string patterns and returns
|
|
193
|
-
the normalized string value. Ensures that empty strings, None, or non-string types
|
|
194
|
-
raise OrionisTestValueError.
|
|
195
|
-
|
|
196
|
-
Returns
|
|
197
|
-
-------
|
|
198
|
-
None
|
|
199
|
-
"""
|
|
200
|
-
from orionis.test.validators import ValidPattern
|
|
201
|
-
|
|
202
|
-
# Valid case: should return the normalized string for a valid pattern
|
|
203
|
-
self.assertEqual(ValidPattern("abc"), "abc")
|
|
204
|
-
|
|
205
|
-
# Invalid cases: should raise OrionisTestValueError for empty string, None, or non-string type
|
|
206
|
-
with self.assertRaises(OrionisTestValueError):
|
|
207
|
-
ValidPattern("")
|
|
208
|
-
with self.assertRaises(OrionisTestValueError):
|
|
209
|
-
ValidPattern(None)
|
|
210
|
-
with self.assertRaises(OrionisTestValueError):
|
|
211
|
-
ValidPattern(123)
|
|
212
|
-
|
|
213
|
-
async def testValidPersistentDriver(self) -> None:
|
|
214
|
-
"""
|
|
215
|
-
Test the ValidPersistentDriver validator for persistent driver validation.
|
|
216
|
-
|
|
217
|
-
Checks that ValidPersistentDriver accepts valid persistent driver names as strings
|
|
218
|
-
and enum values, returning the normalized string value. Ensures that unknown driver
|
|
219
|
-
names or non-enum types raise OrionisTestValueError.
|
|
220
|
-
|
|
221
|
-
Returns
|
|
222
|
-
-------
|
|
223
|
-
None
|
|
224
|
-
"""
|
|
225
|
-
from orionis.test.validators import ValidPersistentDriver
|
|
226
|
-
from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
|
|
227
|
-
|
|
228
|
-
# Valid cases: should return the normalized string for valid driver name or enum input
|
|
229
|
-
self.assertEqual(ValidPersistentDriver("sqlite"), "sqlite")
|
|
230
|
-
self.assertEqual(ValidPersistentDriver(PersistentDrivers.SQLITE), "sqlite")
|
|
231
|
-
|
|
232
|
-
# Invalid cases: should raise OrionisTestValueError for unknown driver name or non-enum type
|
|
233
|
-
with self.assertRaises(OrionisTestValueError):
|
|
234
|
-
ValidPersistentDriver("invalid")
|
|
235
|
-
with self.assertRaises(OrionisTestValueError):
|
|
236
|
-
ValidPersistentDriver(123)
|
|
237
|
-
|
|
238
|
-
async def testValidPersistent(self) -> None:
|
|
239
|
-
"""
|
|
240
|
-
Test the ValidPersistent validator for persistent configuration validation.
|
|
241
|
-
|
|
242
|
-
Validates that ValidPersistent accepts valid boolean inputs and returns the corresponding
|
|
243
|
-
boolean value. Raises OrionisTestValueError for non-boolean types or None.
|
|
244
|
-
|
|
245
|
-
Returns
|
|
246
|
-
-------
|
|
247
|
-
None
|
|
248
|
-
"""
|
|
249
|
-
from orionis.test.validators import ValidPersistent
|
|
250
|
-
|
|
251
|
-
# Valid cases: should return True or False for boolean input
|
|
252
|
-
self.assertTrue(ValidPersistent(True))
|
|
253
|
-
self.assertFalse(ValidPersistent(False))
|
|
254
|
-
|
|
255
|
-
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
256
|
-
with self.assertRaises(OrionisTestValueError):
|
|
257
|
-
ValidPersistent("not_bool")
|
|
258
|
-
with self.assertRaises(OrionisTestValueError):
|
|
259
|
-
ValidPersistent(None)
|
|
260
|
-
|
|
261
|
-
async def testValidPrintResult(self) -> None:
|
|
262
|
-
"""
|
|
263
|
-
Test the ValidPrintResult validator for print result configuration validation.
|
|
264
|
-
|
|
265
|
-
Ensures that ValidPrintResult accepts valid boolean inputs and returns the corresponding
|
|
266
|
-
boolean value. Raises OrionisTestValueError for non-boolean types or None.
|
|
267
|
-
|
|
268
|
-
Returns
|
|
269
|
-
-------
|
|
270
|
-
None
|
|
271
|
-
"""
|
|
272
|
-
from orionis.test.validators import ValidPrintResult
|
|
273
|
-
|
|
274
|
-
# Valid cases: should return True or False for boolean input
|
|
275
|
-
self.assertTrue(ValidPrintResult(True))
|
|
276
|
-
self.assertFalse(ValidPrintResult(False))
|
|
277
|
-
|
|
278
|
-
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
279
|
-
with self.assertRaises(OrionisTestValueError):
|
|
280
|
-
ValidPrintResult("not_bool")
|
|
281
|
-
with self.assertRaises(OrionisTestValueError):
|
|
282
|
-
ValidPrintResult(None)
|
|
283
|
-
|
|
284
|
-
async def testValidTags(self) -> None:
|
|
285
|
-
"""
|
|
286
|
-
Test the ValidTags validator for tag list validation.
|
|
287
|
-
|
|
288
|
-
Validates that ValidTags accepts a list of non-empty string tags, normalizes whitespace,
|
|
289
|
-
and returns a list of cleaned tag strings. Accepts None and returns None. Raises
|
|
290
|
-
OrionisTestValueError for empty lists, lists with empty strings or non-string types,
|
|
291
|
-
and non-list inputs.
|
|
292
|
-
|
|
293
|
-
Returns
|
|
294
|
-
-------
|
|
295
|
-
None
|
|
296
|
-
"""
|
|
297
|
-
from orionis.test.validators import ValidTags
|
|
298
|
-
|
|
299
|
-
# Valid case: should return a list of normalized tag strings
|
|
300
|
-
self.assertEqual(ValidTags(["a", "b ", " c"]), ["a", "b", "c"])
|
|
301
|
-
|
|
302
|
-
# Valid case: should return None when input is None
|
|
303
|
-
self.assertIsNone(ValidTags(None))
|
|
304
|
-
|
|
305
|
-
# Invalid case: should raise OrionisTestValueError for empty list
|
|
306
|
-
with self.assertRaises(OrionisTestValueError):
|
|
307
|
-
ValidTags([])
|
|
308
|
-
|
|
309
|
-
# Invalid case: should raise OrionisTestValueError for list containing empty string
|
|
310
|
-
with self.assertRaises(OrionisTestValueError):
|
|
311
|
-
ValidTags([""])
|
|
312
|
-
|
|
313
|
-
# Invalid case: should raise OrionisTestValueError for list containing non-string type
|
|
314
|
-
with self.assertRaises(OrionisTestValueError):
|
|
315
|
-
ValidTags([123])
|
|
316
|
-
|
|
317
|
-
# Invalid case: should raise OrionisTestValueError for non-list input
|
|
318
|
-
with self.assertRaises(OrionisTestValueError):
|
|
319
|
-
ValidTags("not_a_list")
|
|
320
|
-
|
|
321
|
-
async def testValidThrowException(self) -> None:
|
|
322
|
-
"""
|
|
323
|
-
Test the ValidThrowException validator for throw exception configuration validation.
|
|
324
|
-
|
|
325
|
-
Ensures that ValidThrowException accepts valid boolean inputs and returns the corresponding
|
|
326
|
-
boolean value. Raises OrionisTestValueError for non-boolean types or None.
|
|
327
|
-
|
|
328
|
-
Returns
|
|
329
|
-
-------
|
|
330
|
-
None
|
|
331
|
-
"""
|
|
332
|
-
from orionis.test.validators import ValidThrowException
|
|
333
|
-
|
|
334
|
-
# Valid cases: should return True or False for boolean input
|
|
335
|
-
self.assertTrue(ValidThrowException(True))
|
|
336
|
-
self.assertFalse(ValidThrowException(False))
|
|
337
|
-
|
|
338
|
-
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
339
|
-
with self.assertRaises(OrionisTestValueError):
|
|
340
|
-
ValidThrowException("not_bool")
|
|
341
|
-
with self.assertRaises(OrionisTestValueError):
|
|
342
|
-
ValidThrowException(None)
|
|
343
|
-
|
|
344
|
-
async def testValidVerbosity(self) -> None:
|
|
345
|
-
"""
|
|
346
|
-
Test the ValidVerbosity validator for verbosity mode validation.
|
|
347
|
-
|
|
348
|
-
Validates that ValidVerbosity accepts valid verbosity mode enum values and their corresponding
|
|
349
|
-
integer values, returning the normalized integer value. Ensures that negative values, unknown
|
|
350
|
-
integers, or non-integer types raise OrionisTestValueError.
|
|
351
|
-
|
|
352
|
-
Returns
|
|
353
|
-
-------
|
|
354
|
-
None
|
|
355
|
-
"""
|
|
356
|
-
from orionis.test.validators import ValidVerbosity
|
|
357
|
-
from orionis.foundation.config.testing.enums.verbosity import VerbosityMode
|
|
358
|
-
|
|
359
|
-
# Valid cases: should return the integer value for valid enum or integer input
|
|
360
|
-
self.assertEqual(ValidVerbosity(VerbosityMode.MINIMAL), VerbosityMode.MINIMAL.value)
|
|
361
|
-
self.assertEqual(ValidVerbosity(VerbosityMode.DETAILED.value), VerbosityMode.DETAILED.value)
|
|
362
|
-
|
|
363
|
-
# Invalid cases: should raise OrionisTestValueError for negative, unknown, or non-integer input
|
|
364
|
-
with self.assertRaises(OrionisTestValueError):
|
|
365
|
-
ValidVerbosity(-1)
|
|
366
|
-
with self.assertRaises(OrionisTestValueError):
|
|
367
|
-
ValidVerbosity("not_int")
|
|
368
|
-
with self.assertRaises(OrionisTestValueError):
|
|
369
|
-
ValidVerbosity(999)
|
|
370
|
-
|
|
371
|
-
async def testValidWebReport(self) -> None:
|
|
372
|
-
"""
|
|
373
|
-
Test the ValidWebReport validator for web report configuration validation.
|
|
374
|
-
|
|
375
|
-
Ensures that ValidWebReport accepts valid boolean inputs and returns the corresponding
|
|
376
|
-
boolean value. Raises OrionisTestValueError for non-boolean types or None.
|
|
377
|
-
|
|
378
|
-
Returns
|
|
379
|
-
-------
|
|
380
|
-
None
|
|
381
|
-
"""
|
|
382
|
-
from orionis.test.validators import ValidWebReport
|
|
383
|
-
|
|
384
|
-
# Valid cases: should return True or False for boolean input
|
|
385
|
-
self.assertTrue(ValidWebReport(True))
|
|
386
|
-
self.assertFalse(ValidWebReport(False))
|
|
387
|
-
|
|
388
|
-
# Invalid cases: should raise OrionisTestValueError for non-boolean or None input
|
|
389
|
-
with self.assertRaises(OrionisTestValueError):
|
|
390
|
-
ValidWebReport("not_bool")
|
|
391
|
-
with self.assertRaises(OrionisTestValueError):
|
|
392
|
-
ValidWebReport(None)
|
tests/testing/view/__init__.py
DELETED
|
File without changes
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
2
|
-
from orionis.test.view.render import TestingResultRender
|
|
3
|
-
|
|
4
|
-
class TestTestingRender(AsyncTestCase):
|
|
5
|
-
|
|
6
|
-
async def testMethodsExist(self):
|
|
7
|
-
"""
|
|
8
|
-
Test that required methods exist in the TestingResultRender class.
|
|
9
|
-
|
|
10
|
-
This asynchronous test checks whether the specified methods are present
|
|
11
|
-
in the TestingResultRender class by asserting their existence using hasattr.
|
|
12
|
-
|
|
13
|
-
Returns
|
|
14
|
-
-------
|
|
15
|
-
None
|
|
16
|
-
This method does not return any value.
|
|
17
|
-
"""
|
|
18
|
-
# List of method names that must exist in TestingResultRender
|
|
19
|
-
required_methods = [
|
|
20
|
-
"render"
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
# Validate that each required method exists in the class
|
|
24
|
-
for method_name in required_methods:
|
|
25
|
-
|
|
26
|
-
# Assert that the method is present in TestingResultRender
|
|
27
|
-
self.assertTrue(
|
|
28
|
-
hasattr(TestingResultRender, method_name),
|
|
29
|
-
f"{method_name} does not exist"
|
|
30
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|