orionis 0.546.0__py3-none-any.whl → 0.548.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.548.0.dist-info}/METADATA +1 -1
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/RECORD +14 -159
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/top_level.txt +0 -1
- orionis-0.546.0.dist-info/zip-safe +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.548.0.dist-info}/WHEEL +0 -0
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/licenses/LICENCE +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.logging.entities.weekly import Weekly
|
|
2
|
-
from orionis.foundation.config.logging.enums.levels import Level
|
|
3
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
|
|
6
|
-
class TestFoundationConfigLoggingWeekly(AsyncTestCase):
|
|
7
|
-
"""
|
|
8
|
-
Test cases for the Weekly logging configuration class.
|
|
9
|
-
|
|
10
|
-
This class contains unit tests for the `Weekly` logging configuration entity,
|
|
11
|
-
including validation of default values, attribute validation, dictionary conversion,
|
|
12
|
-
hashability, and keyword-only initialization.
|
|
13
|
-
|
|
14
|
-
Attributes
|
|
15
|
-
----------
|
|
16
|
-
None
|
|
17
|
-
|
|
18
|
-
Methods
|
|
19
|
-
-------
|
|
20
|
-
testDefaultValues()
|
|
21
|
-
Test that Weekly instance is created with correct default values.
|
|
22
|
-
testPathValidation()
|
|
23
|
-
Test path attribute validation.
|
|
24
|
-
testLevelValidation()
|
|
25
|
-
Test level attribute validation with different input types.
|
|
26
|
-
testRetentionWeeksValidation()
|
|
27
|
-
Test retention_weeks attribute validation.
|
|
28
|
-
testWhitespaceHandling()
|
|
29
|
-
Test whitespace handling in path and level attributes.
|
|
30
|
-
testToDictMethod()
|
|
31
|
-
Test that toDict returns proper dictionary representation.
|
|
32
|
-
testCustomValuesToDict()
|
|
33
|
-
Test that custom values are properly included in dictionary.
|
|
34
|
-
testHashability()
|
|
35
|
-
Test that Weekly maintains hashability due to unsafe_hash=True.
|
|
36
|
-
testKwOnlyInitialization()
|
|
37
|
-
Test that Weekly enforces keyword-only initialization.
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
async def testDefaultValues(self):
|
|
41
|
-
"""
|
|
42
|
-
Test that Weekly instance is created with correct default values.
|
|
43
|
-
|
|
44
|
-
Verifies that the default `path`, `level`, and `retention_weeks` attributes
|
|
45
|
-
of a `Weekly` instance match the expected values.
|
|
46
|
-
|
|
47
|
-
Returns
|
|
48
|
-
-------
|
|
49
|
-
None
|
|
50
|
-
"""
|
|
51
|
-
weekly = Weekly()
|
|
52
|
-
self.assertEqual(weekly.path, "storage/log/weekly.log")
|
|
53
|
-
self.assertEqual(weekly.level, Level.INFO.value)
|
|
54
|
-
self.assertEqual(weekly.retention_weeks, 4)
|
|
55
|
-
|
|
56
|
-
async def testPathValidation(self):
|
|
57
|
-
"""
|
|
58
|
-
Test path attribute validation.
|
|
59
|
-
|
|
60
|
-
Verifies that empty or non-string `path` values raise exceptions,
|
|
61
|
-
and that a valid path does not raise an exception.
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
None
|
|
66
|
-
"""
|
|
67
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
68
|
-
Weekly(path="")
|
|
69
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
70
|
-
Weekly(path=123)
|
|
71
|
-
try:
|
|
72
|
-
Weekly(path="custom/log/path.log")
|
|
73
|
-
except OrionisIntegrityException:
|
|
74
|
-
self.fail("Valid path should not raise exception")
|
|
75
|
-
|
|
76
|
-
async def testLevelValidation(self):
|
|
77
|
-
"""
|
|
78
|
-
Test level attribute validation with different input types.
|
|
79
|
-
|
|
80
|
-
Checks that the `level` attribute accepts string, integer, and enum values,
|
|
81
|
-
and raises exceptions for invalid types or values.
|
|
82
|
-
|
|
83
|
-
Returns
|
|
84
|
-
-------
|
|
85
|
-
None
|
|
86
|
-
"""
|
|
87
|
-
# Test string level
|
|
88
|
-
weekly = Weekly(level="debug")
|
|
89
|
-
self.assertEqual(weekly.level, Level.DEBUG.value)
|
|
90
|
-
|
|
91
|
-
# Test int level
|
|
92
|
-
weekly = Weekly(level=Level.WARNING.value)
|
|
93
|
-
self.assertEqual(weekly.level, Level.WARNING.value)
|
|
94
|
-
|
|
95
|
-
# Test enum level
|
|
96
|
-
weekly = Weekly(level=Level.ERROR)
|
|
97
|
-
self.assertEqual(weekly.level, Level.ERROR.value)
|
|
98
|
-
|
|
99
|
-
# Test invalid cases
|
|
100
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
101
|
-
Weekly(level="invalid")
|
|
102
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
103
|
-
Weekly(level=999)
|
|
104
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
105
|
-
Weekly(level=[])
|
|
106
|
-
|
|
107
|
-
async def testRetentionWeeksValidation(self):
|
|
108
|
-
"""
|
|
109
|
-
Test retention_weeks attribute validation.
|
|
110
|
-
|
|
111
|
-
Ensures that valid `retention_weeks` values are accepted and invalid
|
|
112
|
-
values raise exceptions.
|
|
113
|
-
|
|
114
|
-
Returns
|
|
115
|
-
-------
|
|
116
|
-
None
|
|
117
|
-
"""
|
|
118
|
-
# Test valid values
|
|
119
|
-
try:
|
|
120
|
-
Weekly(retention_weeks=1)
|
|
121
|
-
Weekly(retention_weeks=12)
|
|
122
|
-
Weekly(retention_weeks=6)
|
|
123
|
-
except OrionisIntegrityException:
|
|
124
|
-
self.fail("Valid retention_weeks should not raise exception")
|
|
125
|
-
|
|
126
|
-
# Test invalid values
|
|
127
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
128
|
-
Weekly(retention_weeks=0)
|
|
129
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
130
|
-
Weekly(retention_weeks=13)
|
|
131
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
132
|
-
Weekly(retention_weeks=-1)
|
|
133
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
134
|
-
Weekly(retention_weeks="4")
|
|
135
|
-
|
|
136
|
-
async def testWhitespaceHandling(self):
|
|
137
|
-
"""
|
|
138
|
-
Test whitespace handling in path and level attributes.
|
|
139
|
-
|
|
140
|
-
Verifies that leading and trailing whitespace in `path` and `level`
|
|
141
|
-
attributes are handled as expected.
|
|
142
|
-
|
|
143
|
-
Returns
|
|
144
|
-
-------
|
|
145
|
-
None
|
|
146
|
-
"""
|
|
147
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
148
|
-
weekly = Weekly(path=" logs/app.log ", level=" debug ")
|
|
149
|
-
self.assertEqual(weekly.path, " logs/app.log ")
|
|
150
|
-
self.assertEqual(weekly.level, Level.DEBUG.value)
|
|
151
|
-
|
|
152
|
-
async def testToDictMethod(self):
|
|
153
|
-
"""
|
|
154
|
-
Test that toDict returns proper dictionary representation.
|
|
155
|
-
|
|
156
|
-
Ensures that the `toDict` method returns a dictionary with the correct
|
|
157
|
-
keys and values for a default `Weekly` instance.
|
|
158
|
-
|
|
159
|
-
Returns
|
|
160
|
-
-------
|
|
161
|
-
None
|
|
162
|
-
"""
|
|
163
|
-
weekly = Weekly()
|
|
164
|
-
weekly_dict = weekly.toDict()
|
|
165
|
-
self.assertIsInstance(weekly_dict, dict)
|
|
166
|
-
self.assertEqual(weekly_dict['path'], "storage/log/weekly.log")
|
|
167
|
-
self.assertEqual(weekly_dict['level'], Level.INFO.value)
|
|
168
|
-
self.assertEqual(weekly_dict['retention_weeks'], 4)
|
|
169
|
-
|
|
170
|
-
async def testCustomValuesToDict(self):
|
|
171
|
-
"""
|
|
172
|
-
Test that custom values are properly included in dictionary.
|
|
173
|
-
|
|
174
|
-
Checks that custom attribute values are correctly represented in the
|
|
175
|
-
dictionary returned by `toDict`.
|
|
176
|
-
|
|
177
|
-
Returns
|
|
178
|
-
-------
|
|
179
|
-
None
|
|
180
|
-
"""
|
|
181
|
-
custom_weekly = Weekly(
|
|
182
|
-
path="custom/logs/app.log",
|
|
183
|
-
level="warning",
|
|
184
|
-
retention_weeks=8
|
|
185
|
-
)
|
|
186
|
-
weekly_dict = custom_weekly.toDict()
|
|
187
|
-
self.assertEqual(weekly_dict['path'], "custom/logs/app.log")
|
|
188
|
-
self.assertEqual(weekly_dict['level'], Level.WARNING.value)
|
|
189
|
-
self.assertEqual(weekly_dict['retention_weeks'], 8)
|
|
190
|
-
|
|
191
|
-
async def testHashability(self):
|
|
192
|
-
"""
|
|
193
|
-
Test that Weekly maintains hashability due to unsafe_hash=True.
|
|
194
|
-
|
|
195
|
-
Verifies that `Weekly` instances are hashable and can be used in sets,
|
|
196
|
-
and that identical instances are considered equal.
|
|
197
|
-
|
|
198
|
-
Returns
|
|
199
|
-
-------
|
|
200
|
-
None
|
|
201
|
-
"""
|
|
202
|
-
weekly1 = Weekly()
|
|
203
|
-
weekly2 = Weekly()
|
|
204
|
-
weekly_set = {weekly1, weekly2}
|
|
205
|
-
|
|
206
|
-
self.assertEqual(len(weekly_set), 1)
|
|
207
|
-
|
|
208
|
-
custom_weekly = Weekly(path="custom.log")
|
|
209
|
-
weekly_set.add(custom_weekly)
|
|
210
|
-
self.assertEqual(len(weekly_set), 2)
|
|
211
|
-
|
|
212
|
-
async def testKwOnlyInitialization(self):
|
|
213
|
-
"""
|
|
214
|
-
Test that Weekly enforces keyword-only initialization.
|
|
215
|
-
|
|
216
|
-
Ensures that providing positional arguments to the `Weekly` constructor
|
|
217
|
-
raises a TypeError.
|
|
218
|
-
|
|
219
|
-
Returns
|
|
220
|
-
-------
|
|
221
|
-
None
|
|
222
|
-
"""
|
|
223
|
-
with self.assertRaises(TypeError):
|
|
224
|
-
Weekly("path.log", "info", 4)
|
|
File without changes
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.mail.entities.mail import Mail
|
|
2
|
-
from orionis.foundation.config.mail.entities.mailers import Mailers
|
|
3
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
|
|
6
|
-
class TestFoundationConfigMail(AsyncTestCase):
|
|
7
|
-
"""
|
|
8
|
-
Test suite for the Mail class, covering initialization, validation, and utility methods.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
async def testDefaultInitialization(self):
|
|
12
|
-
"""
|
|
13
|
-
Test default initialization of Mail.
|
|
14
|
-
|
|
15
|
-
Tests that a Mail instance is initialized with the correct default values.
|
|
16
|
-
|
|
17
|
-
Returns
|
|
18
|
-
-------
|
|
19
|
-
None
|
|
20
|
-
|
|
21
|
-
Raises
|
|
22
|
-
------
|
|
23
|
-
AssertionError
|
|
24
|
-
If the default mailer is not 'smtp' or mailers is not an instance of Mailers.
|
|
25
|
-
"""
|
|
26
|
-
mail = Mail()
|
|
27
|
-
self.assertEqual(mail.default, "smtp")
|
|
28
|
-
self.assertIsInstance(mail.mailers, Mailers)
|
|
29
|
-
|
|
30
|
-
async def testDefaultValidation(self):
|
|
31
|
-
"""
|
|
32
|
-
Test validation of the default mailer.
|
|
33
|
-
|
|
34
|
-
Ensures that providing an invalid default mailer raises an exception.
|
|
35
|
-
|
|
36
|
-
Returns
|
|
37
|
-
-------
|
|
38
|
-
None
|
|
39
|
-
|
|
40
|
-
Raises
|
|
41
|
-
------
|
|
42
|
-
OrionisIntegrityException
|
|
43
|
-
If the default mailer is invalid or not a string.
|
|
44
|
-
"""
|
|
45
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
46
|
-
Mail(default="invalid_mailer")
|
|
47
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
48
|
-
Mail(default=123)
|
|
49
|
-
|
|
50
|
-
async def testMailersTypeValidation(self):
|
|
51
|
-
"""
|
|
52
|
-
Test type validation for the mailers attribute.
|
|
53
|
-
|
|
54
|
-
Ensures that assigning a non-Mailers object to mailers raises an exception.
|
|
55
|
-
|
|
56
|
-
Returns
|
|
57
|
-
-------
|
|
58
|
-
None
|
|
59
|
-
|
|
60
|
-
Raises
|
|
61
|
-
------
|
|
62
|
-
OrionisIntegrityException
|
|
63
|
-
If mailers is not an instance of Mailers.
|
|
64
|
-
"""
|
|
65
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
66
|
-
Mail(mailers="invalid_mailers_object")
|
|
67
|
-
|
|
68
|
-
async def testToDictMethod(self):
|
|
69
|
-
"""
|
|
70
|
-
Test the toDict method.
|
|
71
|
-
|
|
72
|
-
Checks that the toDict method returns a dictionary representation of the Mail instance.
|
|
73
|
-
|
|
74
|
-
Returns
|
|
75
|
-
-------
|
|
76
|
-
None
|
|
77
|
-
|
|
78
|
-
Raises
|
|
79
|
-
------
|
|
80
|
-
AssertionError
|
|
81
|
-
If the returned value is not a dict or missing expected fields.
|
|
82
|
-
"""
|
|
83
|
-
mail = Mail()
|
|
84
|
-
result = mail.toDict()
|
|
85
|
-
self.assertIsInstance(result, dict)
|
|
86
|
-
self.assertIn("default", result)
|
|
87
|
-
self.assertIn("mailers", result)
|
|
88
|
-
self.assertEqual(result["default"], "smtp")
|
|
89
|
-
|
|
90
|
-
async def testHashability(self):
|
|
91
|
-
"""
|
|
92
|
-
Test hashability of Mail instances.
|
|
93
|
-
|
|
94
|
-
Ensures that Mail instances are hashable and can be used in sets or as dictionary keys.
|
|
95
|
-
|
|
96
|
-
Returns
|
|
97
|
-
-------
|
|
98
|
-
None
|
|
99
|
-
|
|
100
|
-
Raises
|
|
101
|
-
------
|
|
102
|
-
AssertionError
|
|
103
|
-
If Mail instances are not hashable or set behavior is incorrect.
|
|
104
|
-
"""
|
|
105
|
-
mail1 = Mail()
|
|
106
|
-
mail2 = Mail(default="smtp")
|
|
107
|
-
test_set = {mail1, mail2}
|
|
108
|
-
self.assertEqual(len(test_set), 1)
|
|
109
|
-
|
|
110
|
-
async def testKwOnlyInitialization(self):
|
|
111
|
-
"""
|
|
112
|
-
Test keyword-only initialization enforcement.
|
|
113
|
-
|
|
114
|
-
Ensures that Mail requires keyword arguments for initialization.
|
|
115
|
-
|
|
116
|
-
Returns
|
|
117
|
-
-------
|
|
118
|
-
None
|
|
119
|
-
|
|
120
|
-
Raises
|
|
121
|
-
------
|
|
122
|
-
TypeError
|
|
123
|
-
If positional arguments are used for initialization.
|
|
124
|
-
"""
|
|
125
|
-
with self.assertRaises(TypeError):
|
|
126
|
-
Mail("smtp", Mailers())
|
|
127
|
-
|
|
128
|
-
async def testValidCustomInitialization(self):
|
|
129
|
-
"""
|
|
130
|
-
Test valid custom initialization.
|
|
131
|
-
|
|
132
|
-
Checks that a Mail instance can be created with valid, non-default values.
|
|
133
|
-
|
|
134
|
-
Returns
|
|
135
|
-
-------
|
|
136
|
-
None
|
|
137
|
-
|
|
138
|
-
Raises
|
|
139
|
-
------
|
|
140
|
-
AssertionError
|
|
141
|
-
If the instance is not initialized with the provided values.
|
|
142
|
-
"""
|
|
143
|
-
mail = Mail(default="smtp", mailers=Mailers())
|
|
144
|
-
self.assertEqual(mail.default, "smtp")
|
|
145
|
-
self.assertIsInstance(mail.mailers, Mailers)
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.mail.entities.file import File
|
|
2
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
3
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
-
|
|
5
|
-
class TestFoundationConfigMailFile(AsyncTestCase):
|
|
6
|
-
"""
|
|
7
|
-
Unit tests for the File entity in the mail configuration module.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
async def testDefaultPathValue(self):
|
|
11
|
-
"""
|
|
12
|
-
Test that the File instance is initialized with the correct default path.
|
|
13
|
-
|
|
14
|
-
Notes
|
|
15
|
-
-----
|
|
16
|
-
Verifies that a new File object has 'storage/mail' as the default path.
|
|
17
|
-
"""
|
|
18
|
-
file = File()
|
|
19
|
-
self.assertEqual(file.path, "storage/mail")
|
|
20
|
-
|
|
21
|
-
async def testPathValidation(self):
|
|
22
|
-
"""
|
|
23
|
-
Test the path validation in the __post_init__ method.
|
|
24
|
-
|
|
25
|
-
Raises
|
|
26
|
-
------
|
|
27
|
-
OrionisIntegrityException
|
|
28
|
-
If the path is not a string or is an empty string.
|
|
29
|
-
|
|
30
|
-
Notes
|
|
31
|
-
-----
|
|
32
|
-
Verifies that non-string paths or empty strings raise OrionisIntegrityException.
|
|
33
|
-
"""
|
|
34
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
35
|
-
File(path=123)
|
|
36
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
37
|
-
File(path="")
|
|
38
|
-
|
|
39
|
-
async def testValidPathAssignment(self):
|
|
40
|
-
"""
|
|
41
|
-
Test that valid path assignments work correctly.
|
|
42
|
-
|
|
43
|
-
Notes
|
|
44
|
-
-----
|
|
45
|
-
Verifies that string paths are accepted and stored properly.
|
|
46
|
-
"""
|
|
47
|
-
test_path = "custom/path/to/mail"
|
|
48
|
-
file = File(path=test_path)
|
|
49
|
-
self.assertEqual(file.path, test_path)
|
|
50
|
-
|
|
51
|
-
async def testToDictMethod(self):
|
|
52
|
-
"""
|
|
53
|
-
Test the toDict method returns a proper dictionary representation.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
dict
|
|
58
|
-
Dictionary representation of the File instance.
|
|
59
|
-
|
|
60
|
-
Notes
|
|
61
|
-
-----
|
|
62
|
-
Checks that the toDict method converts the File instance into a dictionary
|
|
63
|
-
with the expected path field.
|
|
64
|
-
"""
|
|
65
|
-
file = File()
|
|
66
|
-
result = file.toDict()
|
|
67
|
-
self.assertIsInstance(result, dict)
|
|
68
|
-
self.assertEqual(result["path"], "storage/mail")
|
|
69
|
-
|
|
70
|
-
async def testHashability(self):
|
|
71
|
-
"""
|
|
72
|
-
Test that File instances are hashable due to unsafe_hash=True.
|
|
73
|
-
|
|
74
|
-
Notes
|
|
75
|
-
-----
|
|
76
|
-
Verifies that instances can be used in sets or as dictionary keys.
|
|
77
|
-
"""
|
|
78
|
-
file1 = File()
|
|
79
|
-
file2 = File(path="other/path")
|
|
80
|
-
test_set = {file1, file2}
|
|
81
|
-
self.assertEqual(len(test_set), 2)
|
|
82
|
-
|
|
83
|
-
async def testKwOnlyInitialization(self):
|
|
84
|
-
"""
|
|
85
|
-
Test that File requires keyword arguments for initialization.
|
|
86
|
-
|
|
87
|
-
Raises
|
|
88
|
-
------
|
|
89
|
-
TypeError
|
|
90
|
-
If positional arguments are used for initialization.
|
|
91
|
-
|
|
92
|
-
Notes
|
|
93
|
-
-----
|
|
94
|
-
Verifies that the class enforces kw_only=True in its dataclass decorator.
|
|
95
|
-
"""
|
|
96
|
-
with self.assertRaises(TypeError):
|
|
97
|
-
File("storage/mail")
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.mail.entities.mailers import Mailers
|
|
2
|
-
from orionis.foundation.config.mail.entities.smtp import Smtp
|
|
3
|
-
from orionis.foundation.config.mail.entities.file import File
|
|
4
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
5
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
6
|
-
|
|
7
|
-
class TestFoundationConfigMailMailers(AsyncTestCase):
|
|
8
|
-
"""
|
|
9
|
-
Unit tests for the Mailers class.
|
|
10
|
-
|
|
11
|
-
This test suite verifies the correct initialization, type validation,
|
|
12
|
-
custom initialization, dictionary conversion, and keyword-only enforcement
|
|
13
|
-
of the Mailers class.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
async def testDefaultInitialization(self):
|
|
17
|
-
"""
|
|
18
|
-
Test default initialization of Mailers.
|
|
19
|
-
|
|
20
|
-
Ensures that a Mailers instance is initialized with default factories
|
|
21
|
-
and that the `smtp` and `file` attributes are instances of their
|
|
22
|
-
respective types.
|
|
23
|
-
|
|
24
|
-
Returns
|
|
25
|
-
-------
|
|
26
|
-
None
|
|
27
|
-
"""
|
|
28
|
-
mailers = Mailers()
|
|
29
|
-
self.assertIsInstance(mailers.smtp, Smtp)
|
|
30
|
-
self.assertIsInstance(mailers.file, File)
|
|
31
|
-
|
|
32
|
-
async def testTypeValidation(self):
|
|
33
|
-
"""
|
|
34
|
-
Test type validation for smtp and file attributes.
|
|
35
|
-
|
|
36
|
-
Ensures that providing invalid types for `smtp` or `file` raises
|
|
37
|
-
an OrionisIntegrityException.
|
|
38
|
-
|
|
39
|
-
Returns
|
|
40
|
-
-------
|
|
41
|
-
None
|
|
42
|
-
|
|
43
|
-
Raises
|
|
44
|
-
------
|
|
45
|
-
OrionisIntegrityException
|
|
46
|
-
If an invalid type is provided for `smtp` or `file`.
|
|
47
|
-
"""
|
|
48
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
49
|
-
Mailers(smtp="invalid_smtp")
|
|
50
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
51
|
-
Mailers(file="invalid_file")
|
|
52
|
-
|
|
53
|
-
async def testCustomInitialization(self):
|
|
54
|
-
"""
|
|
55
|
-
Test custom initialization with valid parameters.
|
|
56
|
-
|
|
57
|
-
Ensures that valid Smtp and File instances can be provided to the
|
|
58
|
-
Mailers constructor and are correctly assigned.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
None
|
|
63
|
-
"""
|
|
64
|
-
custom_smtp = Smtp()
|
|
65
|
-
custom_file = File()
|
|
66
|
-
mailers = Mailers(smtp=custom_smtp, file=custom_file)
|
|
67
|
-
self.assertIs(mailers.smtp, custom_smtp)
|
|
68
|
-
self.assertIs(mailers.file, custom_file)
|
|
69
|
-
|
|
70
|
-
async def testToDictMethod(self):
|
|
71
|
-
"""
|
|
72
|
-
Test the toDict method of Mailers.
|
|
73
|
-
|
|
74
|
-
Ensures that the `toDict` method returns a dictionary representation
|
|
75
|
-
containing all fields with correct values and types.
|
|
76
|
-
|
|
77
|
-
Returns
|
|
78
|
-
-------
|
|
79
|
-
None
|
|
80
|
-
"""
|
|
81
|
-
mailers = Mailers()
|
|
82
|
-
result = mailers.toDict()
|
|
83
|
-
self.assertIsInstance(result, dict)
|
|
84
|
-
self.assertIn("smtp", result)
|
|
85
|
-
self.assertIn("file", result)
|
|
86
|
-
self.assertIsInstance(result["smtp"], dict)
|
|
87
|
-
self.assertIsInstance(result["file"], dict)
|
|
88
|
-
|
|
89
|
-
async def testKwOnlyInitialization(self):
|
|
90
|
-
"""
|
|
91
|
-
Test keyword-only initialization enforcement.
|
|
92
|
-
|
|
93
|
-
Ensures that the Mailers class enforces keyword-only arguments
|
|
94
|
-
during initialization (i.e., `kw_only=True` in its dataclass decorator).
|
|
95
|
-
|
|
96
|
-
Returns
|
|
97
|
-
-------
|
|
98
|
-
None
|
|
99
|
-
|
|
100
|
-
Raises
|
|
101
|
-
------
|
|
102
|
-
TypeError
|
|
103
|
-
If positional arguments are provided to the constructor.
|
|
104
|
-
"""
|
|
105
|
-
with self.assertRaises(TypeError):
|
|
106
|
-
Mailers(Smtp(), File())
|