orionis 0.417.0__py3-none-any.whl → 0.419.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.417.0.dist-info → orionis-0.419.0.dist-info}/METADATA +1 -1
- {orionis-0.417.0.dist-info → orionis-0.419.0.dist-info}/RECORD +60 -60
- {orionis-0.417.0.dist-info → orionis-0.419.0.dist-info}/top_level.txt +0 -1
- tests/foundation/config/app/test_foundation_config_app.py +262 -0
- {foundation → tests/foundation}/config/cache/test_foundation_config_cache_file.py +8 -8
- {foundation → tests/foundation}/config/cache/test_foundation_config_cache_stores.py +11 -3
- {foundation → tests/foundation}/config/database/test_foundation_config_database_pgsql.py +5 -5
- {foundation → tests/foundation}/config/queue/test_foundation_config_queue.py +0 -20
- {foundation → tests/foundation}/config/queue/test_foundation_config_queue_brokers.py +0 -13
- tests/foundation/config/root/test_foundation_config_root_paths.py +116 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +199 -0
- tests/testing/view/test_render.py +31 -0
- foundation/config/app/test_foundation_config_app.py +0 -150
- foundation/config/root/test_foundation_config_root_paths.py +0 -201
- foundation/config/startup/test_foundation_config_startup.py +0 -205
- foundation/exceptions/test_foundation_config_exceptions.py +0 -117
- {orionis-0.417.0.dist-info → orionis-0.419.0.dist-info}/WHEEL +0 -0
- {orionis-0.417.0.dist-info → orionis-0.419.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.417.0.dist-info → orionis-0.419.0.dist-info}/zip-safe +0 -0
- {foundation → tests/foundation}/__init__.py +0 -0
- {foundation → tests/foundation}/config/__init__.py +0 -0
- {foundation → tests/foundation}/config/app/__init__.py +0 -0
- {foundation → tests/foundation}/config/auth/__init__.py +0 -0
- {foundation → tests/foundation}/config/auth/test_foundation_config_auth.py +0 -0
- {foundation → tests/foundation}/config/cache/__init__.py +0 -0
- {foundation → tests/foundation}/config/cache/test_foundation_config_cache.py +0 -0
- {foundation → tests/foundation}/config/cors/__init__.py +0 -0
- {foundation → tests/foundation}/config/cors/test_foundation_config_cors.py +0 -0
- {foundation → tests/foundation}/config/database/__init__.py +0 -0
- {foundation → tests/foundation}/config/database/test_foundation_config_database.py +0 -0
- {foundation → tests/foundation}/config/database/test_foundation_config_database_connections.py +0 -0
- {foundation → tests/foundation}/config/database/test_foundation_config_database_mysql.py +0 -0
- {foundation → tests/foundation}/config/database/test_foundation_config_database_oracle.py +0 -0
- {foundation → tests/foundation}/config/database/test_foundation_config_database_sqlite.py +0 -0
- {foundation → tests/foundation}/config/filesystems/__init__.py +0 -0
- {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems.py +0 -0
- {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_aws.py +0 -0
- {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_disks.py +0 -0
- {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_local.py +0 -0
- {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_public.py +0 -0
- {foundation → tests/foundation}/config/logging/__init__.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_channels.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_chunked.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_daily.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_hourly.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_monthly.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_stack.py +0 -0
- {foundation → tests/foundation}/config/logging/test_foundation_config_logging_weekly.py +0 -0
- {foundation → tests/foundation}/config/mail/__init__.py +0 -0
- {foundation → tests/foundation}/config/mail/test_foundation_config_mail.py +0 -0
- {foundation → tests/foundation}/config/mail/test_foundation_config_mail_file.py +0 -0
- {foundation → tests/foundation}/config/mail/test_foundation_config_mail_mailers.py +0 -0
- {foundation → tests/foundation}/config/mail/test_foundation_config_mail_smtp.py +0 -0
- {foundation → tests/foundation}/config/queue/__init__.py +0 -0
- {foundation → tests/foundation}/config/queue/test_foundation_config_queue_database.py +0 -0
- {foundation → tests/foundation}/config/root/__init__.py +0 -0
- {foundation → tests/foundation}/config/session/__init__.py +0 -0
- {foundation → tests/foundation}/config/session/test_foundation_config_session.py +0 -0
- {foundation → tests/foundation}/config/startup/__init__.py +0 -0
- {foundation → tests/foundation}/config/testing/__init__.py +0 -0
- {foundation → tests/foundation}/config/testing/test_foundation_config_testing.py +0 -0
- {foundation/exceptions → tests/testing/view}/__init__.py +0 -0
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
from dataclasses import is_dataclass
|
|
2
|
-
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
3
|
-
from orionis.foundation.config.startup import Configuration
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
from unittest.mock import Mock
|
|
6
|
-
|
|
7
|
-
class TestFoundationConfigStartup(AsyncTestCase):
|
|
8
|
-
"""
|
|
9
|
-
Test suite for the Configuration dataclass.
|
|
10
|
-
|
|
11
|
-
This class contains unit tests to verify the correct behavior of the
|
|
12
|
-
Configuration dataclass, including initialization, type validation,
|
|
13
|
-
dictionary conversion, metadata accessibility, mutability, and equality.
|
|
14
|
-
|
|
15
|
-
Attributes
|
|
16
|
-
----------
|
|
17
|
-
None
|
|
18
|
-
|
|
19
|
-
Methods
|
|
20
|
-
-------
|
|
21
|
-
testConfigurationIsDataclass()
|
|
22
|
-
Test that Configuration is properly defined as a dataclass.
|
|
23
|
-
testDefaultInitialization()
|
|
24
|
-
Test that Configuration can be initialized with default values.
|
|
25
|
-
testAllSectionsHaveDefaultFactories()
|
|
26
|
-
Test that all configuration sections have default factories.
|
|
27
|
-
testTypeValidationInPostInit()
|
|
28
|
-
Test that __post_init__ validates types correctly.
|
|
29
|
-
testToDictReturnsCompleteDictionary()
|
|
30
|
-
Test that toDict() returns a complete dictionary representation.
|
|
31
|
-
testToDictReturnsNestedStructures()
|
|
32
|
-
Test that toDict() properly converts nested dataclasses.
|
|
33
|
-
testMetadataIsAccessible()
|
|
34
|
-
Test that field metadata is properly defined and accessible.
|
|
35
|
-
testConfigurationIsMutable()
|
|
36
|
-
Test that Configuration is mutable (not frozen).
|
|
37
|
-
testConfigurationEquality()
|
|
38
|
-
Test that Configuration instances with same values are equal.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
def testConfigurationIsDataclass(self):
|
|
42
|
-
"""
|
|
43
|
-
Test that Configuration is properly defined as a dataclass.
|
|
44
|
-
|
|
45
|
-
Ensures that the @dataclass decorator was applied correctly.
|
|
46
|
-
|
|
47
|
-
Returns
|
|
48
|
-
-------
|
|
49
|
-
None
|
|
50
|
-
"""
|
|
51
|
-
self.assertTrue(is_dataclass(Configuration))
|
|
52
|
-
|
|
53
|
-
def testDefaultInitialization(self):
|
|
54
|
-
"""
|
|
55
|
-
Test that Configuration can be initialized with default values.
|
|
56
|
-
|
|
57
|
-
Verifies that all default factories work correctly and the instance
|
|
58
|
-
is properly constructed.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
None
|
|
63
|
-
"""
|
|
64
|
-
config = Configuration()
|
|
65
|
-
self.assertIsInstance(config, Configuration)
|
|
66
|
-
|
|
67
|
-
def testAllSectionsHaveDefaultFactories(self):
|
|
68
|
-
"""
|
|
69
|
-
Test that all configuration sections have default factories.
|
|
70
|
-
|
|
71
|
-
Verifies that each field in the Configuration class has a
|
|
72
|
-
default_factory specified.
|
|
73
|
-
|
|
74
|
-
Returns
|
|
75
|
-
-------
|
|
76
|
-
None
|
|
77
|
-
"""
|
|
78
|
-
config = Configuration()
|
|
79
|
-
for field in config.__dataclass_fields__.values():
|
|
80
|
-
self.assertTrue(hasattr(field, 'default_factory'),
|
|
81
|
-
f"Field {field.name} is missing default_factory")
|
|
82
|
-
|
|
83
|
-
def testTypeValidationInPostInit(self):
|
|
84
|
-
"""
|
|
85
|
-
Test that __post_init__ validates types correctly.
|
|
86
|
-
|
|
87
|
-
Verifies that the type checking for each configuration section
|
|
88
|
-
works as expected.
|
|
89
|
-
|
|
90
|
-
Returns
|
|
91
|
-
-------
|
|
92
|
-
None
|
|
93
|
-
"""
|
|
94
|
-
# Test with all correct types (should not raise)
|
|
95
|
-
try:
|
|
96
|
-
Configuration()
|
|
97
|
-
except OrionisIntegrityException:
|
|
98
|
-
self.fail("__post_init__ raised exception with valid types")
|
|
99
|
-
|
|
100
|
-
# Test each section with wrong type
|
|
101
|
-
sections = [
|
|
102
|
-
('paths', Mock()),
|
|
103
|
-
('app', Mock()),
|
|
104
|
-
('auth', Mock()),
|
|
105
|
-
('cache', Mock()),
|
|
106
|
-
('cors', Mock()),
|
|
107
|
-
('database', Mock()),
|
|
108
|
-
('filesystems', Mock()),
|
|
109
|
-
('logging', Mock()),
|
|
110
|
-
('mail', Mock()),
|
|
111
|
-
('queue', Mock()),
|
|
112
|
-
('session', Mock()),
|
|
113
|
-
('testing', Mock())
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
for section_name, wrong_value in sections:
|
|
117
|
-
with self.subTest(section=section_name):
|
|
118
|
-
kwargs = {section_name: wrong_value}
|
|
119
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
120
|
-
Configuration(**kwargs)
|
|
121
|
-
|
|
122
|
-
def testToDictReturnsCompleteDictionary(self):
|
|
123
|
-
"""
|
|
124
|
-
Test that toDict() returns a complete dictionary representation.
|
|
125
|
-
|
|
126
|
-
Verifies that the returned dictionary contains all configuration
|
|
127
|
-
sections with their current values.
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
None
|
|
132
|
-
"""
|
|
133
|
-
config = Configuration()
|
|
134
|
-
config_dict = config.toDict()
|
|
135
|
-
self.assertIsInstance(config_dict, dict)
|
|
136
|
-
self.assertEqual(len(config_dict), len(config.__dataclass_fields__))
|
|
137
|
-
for field in config.__dataclass_fields__:
|
|
138
|
-
self.assertIn(field, config_dict)
|
|
139
|
-
|
|
140
|
-
def testToDictReturnsNestedStructures(self):
|
|
141
|
-
"""
|
|
142
|
-
Test that toDict() properly converts nested dataclasses.
|
|
143
|
-
|
|
144
|
-
Verifies that the dictionary conversion works recursively for
|
|
145
|
-
all nested configuration sections.
|
|
146
|
-
|
|
147
|
-
Returns
|
|
148
|
-
-------
|
|
149
|
-
None
|
|
150
|
-
"""
|
|
151
|
-
config = Configuration()
|
|
152
|
-
config_dict = config.toDict()
|
|
153
|
-
self.assertIsInstance(config_dict['paths'], dict)
|
|
154
|
-
self.assertIsInstance(config_dict['app'], dict)
|
|
155
|
-
self.assertIsInstance(config_dict['database'], dict)
|
|
156
|
-
|
|
157
|
-
def testMetadataIsAccessible(self):
|
|
158
|
-
"""
|
|
159
|
-
Test that field metadata is properly defined and accessible.
|
|
160
|
-
|
|
161
|
-
Verifies that each configuration section field has the expected
|
|
162
|
-
metadata structure with description.
|
|
163
|
-
|
|
164
|
-
Returns
|
|
165
|
-
-------
|
|
166
|
-
None
|
|
167
|
-
"""
|
|
168
|
-
config = Configuration()
|
|
169
|
-
for field in config.__dataclass_fields__.values():
|
|
170
|
-
metadata = field.metadata
|
|
171
|
-
self.assertIn('description', metadata)
|
|
172
|
-
self.assertIsInstance(metadata['description'], str)
|
|
173
|
-
|
|
174
|
-
def testConfigurationIsMutable(self):
|
|
175
|
-
"""
|
|
176
|
-
Test that Configuration is mutable (not frozen).
|
|
177
|
-
|
|
178
|
-
Verifies that attributes can be modified after creation since
|
|
179
|
-
the dataclass isn't marked as frozen.
|
|
180
|
-
|
|
181
|
-
Returns
|
|
182
|
-
-------
|
|
183
|
-
None
|
|
184
|
-
"""
|
|
185
|
-
config = Configuration()
|
|
186
|
-
new_paths = config.paths.__class__()
|
|
187
|
-
|
|
188
|
-
try:
|
|
189
|
-
config.paths = new_paths
|
|
190
|
-
except Exception as e:
|
|
191
|
-
self.fail(f"Should be able to modify attributes, but got {type(e).__name__}")
|
|
192
|
-
|
|
193
|
-
def testConfigurationEquality(self):
|
|
194
|
-
"""
|
|
195
|
-
Test that Configuration instances with same values are equal.
|
|
196
|
-
|
|
197
|
-
Verifies that dataclass equality comparison works as expected.
|
|
198
|
-
|
|
199
|
-
Returns
|
|
200
|
-
-------
|
|
201
|
-
None
|
|
202
|
-
"""
|
|
203
|
-
config1 = Configuration()
|
|
204
|
-
config2 = Configuration()
|
|
205
|
-
self.assertNotEqual(config1, config2)
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
2
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
3
|
-
|
|
4
|
-
class TestFoundationConfigExceptions(AsyncTestCase):
|
|
5
|
-
"""
|
|
6
|
-
Test cases for the OrionisIntegrityException class.
|
|
7
|
-
|
|
8
|
-
Notes
|
|
9
|
-
-----
|
|
10
|
-
These tests verify the initialization, inheritance, string representation,
|
|
11
|
-
handling of different message types, raising and catching, and exception
|
|
12
|
-
chaining behavior of the OrionisIntegrityException.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
async def testExceptionInitialization(self):
|
|
16
|
-
"""
|
|
17
|
-
Test initialization of OrionisIntegrityException with a message.
|
|
18
|
-
|
|
19
|
-
Verifies
|
|
20
|
-
--------
|
|
21
|
-
- The exception stores and returns the provided message correctly.
|
|
22
|
-
"""
|
|
23
|
-
test_msg = "Test integrity violation message"
|
|
24
|
-
exception = OrionisIntegrityException(test_msg)
|
|
25
|
-
self.assertEqual(str(exception), test_msg)
|
|
26
|
-
self.assertEqual(exception.args[0], test_msg)
|
|
27
|
-
|
|
28
|
-
async def testExceptionInheritance(self):
|
|
29
|
-
"""
|
|
30
|
-
Test inheritance of OrionisIntegrityException.
|
|
31
|
-
|
|
32
|
-
Verifies
|
|
33
|
-
--------
|
|
34
|
-
- OrionisIntegrityException properly inherits from Exception.
|
|
35
|
-
- The exception hierarchy is correctly implemented.
|
|
36
|
-
"""
|
|
37
|
-
exception = OrionisIntegrityException("Test")
|
|
38
|
-
self.assertIsInstance(exception, Exception)
|
|
39
|
-
self.assertTrue(issubclass(OrionisIntegrityException, Exception))
|
|
40
|
-
|
|
41
|
-
async def testExceptionStringRepresentation(self):
|
|
42
|
-
"""
|
|
43
|
-
Test string representation of OrionisIntegrityException.
|
|
44
|
-
|
|
45
|
-
Verifies
|
|
46
|
-
--------
|
|
47
|
-
- The __str__ method returns the expected format.
|
|
48
|
-
"""
|
|
49
|
-
test_msg = "Configuration validation failed"
|
|
50
|
-
exception = OrionisIntegrityException(test_msg)
|
|
51
|
-
self.assertEqual(str(exception), test_msg)
|
|
52
|
-
|
|
53
|
-
async def testExceptionWithEmptyMessage(self):
|
|
54
|
-
"""
|
|
55
|
-
Test OrionisIntegrityException with an empty message.
|
|
56
|
-
|
|
57
|
-
Verifies
|
|
58
|
-
--------
|
|
59
|
-
- The exception handles empty messages correctly.
|
|
60
|
-
"""
|
|
61
|
-
exception = OrionisIntegrityException("")
|
|
62
|
-
self.assertEqual(str(exception), "")
|
|
63
|
-
|
|
64
|
-
async def testExceptionWithNonStringMessage(self):
|
|
65
|
-
"""
|
|
66
|
-
Test OrionisIntegrityException with non-string message types.
|
|
67
|
-
|
|
68
|
-
Verifies
|
|
69
|
-
--------
|
|
70
|
-
- The exception converts non-string messages to strings.
|
|
71
|
-
|
|
72
|
-
Tests
|
|
73
|
-
-----
|
|
74
|
-
- Integer message
|
|
75
|
-
- List message
|
|
76
|
-
"""
|
|
77
|
-
# Test with integer
|
|
78
|
-
exception = OrionisIntegrityException(123)
|
|
79
|
-
self.assertEqual(str(exception), "123")
|
|
80
|
-
|
|
81
|
-
# Test with list
|
|
82
|
-
exception = OrionisIntegrityException(["error1", "error2"])
|
|
83
|
-
self.assertEqual(str(exception), "['error1', 'error2']")
|
|
84
|
-
|
|
85
|
-
async def testExceptionRaiseAndCatch(self):
|
|
86
|
-
"""
|
|
87
|
-
Test raising and catching OrionisIntegrityException.
|
|
88
|
-
|
|
89
|
-
Verifies
|
|
90
|
-
--------
|
|
91
|
-
- The exception can be properly raised and caught.
|
|
92
|
-
"""
|
|
93
|
-
test_msg = "Test exception handling"
|
|
94
|
-
try:
|
|
95
|
-
raise OrionisIntegrityException(test_msg)
|
|
96
|
-
except OrionisIntegrityException as e:
|
|
97
|
-
self.assertEqual(str(e), test_msg)
|
|
98
|
-
except Exception:
|
|
99
|
-
self.fail("OrionisIntegrityException should be caught by its specific handler")
|
|
100
|
-
|
|
101
|
-
async def testExceptionChaining(self):
|
|
102
|
-
"""
|
|
103
|
-
Test exception chaining with OrionisIntegrityException.
|
|
104
|
-
|
|
105
|
-
Verifies
|
|
106
|
-
--------
|
|
107
|
-
- The exception works correctly in chained exception scenarios.
|
|
108
|
-
- The __cause__ attribute is set as expected.
|
|
109
|
-
"""
|
|
110
|
-
try:
|
|
111
|
-
try:
|
|
112
|
-
raise ValueError("Original error")
|
|
113
|
-
except ValueError as ve:
|
|
114
|
-
raise OrionisIntegrityException("Wrapper error") from ve
|
|
115
|
-
except OrionisIntegrityException as oe:
|
|
116
|
-
self.assertIsInstance(oe.__cause__, ValueError)
|
|
117
|
-
self.assertEqual(str(oe.__cause__), "Original error")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{foundation → tests/foundation}/config/database/test_foundation_config_database_connections.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_aws.py
RENAMED
|
File without changes
|
{foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_disks.py
RENAMED
|
File without changes
|
{foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_local.py
RENAMED
|
File without changes
|
{foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_public.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|