orionis 0.437.0__py3-none-any.whl → 0.438.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.437.0.dist-info → orionis-0.438.0.dist-info}/METADATA +1 -1
- {orionis-0.437.0.dist-info → orionis-0.438.0.dist-info}/RECORD +25 -24
- tests/container/core/__init__.py +0 -0
- tests/container/mocks/mock_complex_classes.py +502 -192
- tests/container/mocks/mock_simple_classes.py +72 -6
- tests/container/validators/test_is_valid_alias.py +1 -1
- tests/foundation/config/database/test_foundation_config_database.py +54 -28
- tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +40 -22
- tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +75 -48
- tests/foundation/config/logging/test_foundation_config_logging_channels.py +49 -37
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +80 -42
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +46 -22
- tests/foundation/config/root/test_foundation_config_root_paths.py +37 -44
- tests/foundation/config/session/test_foundation_config_session.py +65 -20
- tests/foundation/config/startup/test_foundation_config_startup.py +37 -33
- tests/services/introspection/dependencies/test_reflect_dependencies.py +77 -25
- tests/services/introspection/reflection/test_reflection_abstract.py +403 -47
- {orionis-0.437.0.dist-info → orionis-0.438.0.dist-info}/WHEEL +0 -0
- {orionis-0.437.0.dist-info → orionis-0.438.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.437.0.dist-info → orionis-0.438.0.dist-info}/top_level.txt +0 -0
- {orionis-0.437.0.dist-info → orionis-0.438.0.dist-info}/zip-safe +0 -0
- /tests/container/{test_container.py → core/test_container.py} +0 -0
- /tests/container/{test_singleton.py → core/test_singleton.py} +0 -0
- /tests/container/{test_thread_safety.py → core/test_thread_safety.py} +0 -0
|
@@ -7,11 +7,16 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
7
7
|
|
|
8
8
|
async def testDefaultInitialization(self):
|
|
9
9
|
"""
|
|
10
|
-
Test
|
|
10
|
+
Test default initialization of the Session instance.
|
|
11
|
+
|
|
12
|
+
Returns
|
|
13
|
+
-------
|
|
14
|
+
None
|
|
11
15
|
|
|
12
16
|
Notes
|
|
13
17
|
-----
|
|
14
|
-
|
|
18
|
+
Checks that all attributes of the Session instance are set to their correct default values,
|
|
19
|
+
including the generation of the secret_key.
|
|
15
20
|
"""
|
|
16
21
|
session = Session()
|
|
17
22
|
self.assertIsInstance(session.secret_key, str)
|
|
@@ -24,11 +29,15 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
24
29
|
|
|
25
30
|
async def testSecretKeyValidation(self):
|
|
26
31
|
"""
|
|
27
|
-
Test validation
|
|
32
|
+
Test validation of the secret_key attribute.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
None
|
|
28
37
|
|
|
29
38
|
Notes
|
|
30
39
|
-----
|
|
31
|
-
|
|
40
|
+
Ensures that providing an invalid secret_key raises an OrionisIntegrityException.
|
|
32
41
|
"""
|
|
33
42
|
with self.assertRaises(OrionisIntegrityException):
|
|
34
43
|
Session(secret_key="") # Empty string
|
|
@@ -37,11 +46,15 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
37
46
|
|
|
38
47
|
async def testSessionCookieValidation(self):
|
|
39
48
|
"""
|
|
40
|
-
Test validation
|
|
49
|
+
Test validation of the session_cookie attribute.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
None
|
|
41
54
|
|
|
42
55
|
Notes
|
|
43
56
|
-----
|
|
44
|
-
|
|
57
|
+
Ensures that invalid session_cookie values raise an OrionisIntegrityException.
|
|
45
58
|
"""
|
|
46
59
|
with self.assertRaises(OrionisIntegrityException):
|
|
47
60
|
Session(session_cookie="") # Empty string
|
|
@@ -52,11 +65,16 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
52
65
|
|
|
53
66
|
async def testMaxAgeValidation(self):
|
|
54
67
|
"""
|
|
55
|
-
Test validation
|
|
68
|
+
Test validation of the max_age attribute.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
None
|
|
56
73
|
|
|
57
74
|
Notes
|
|
58
75
|
-----
|
|
59
|
-
|
|
76
|
+
Ensures that invalid max_age values raise an OrionisIntegrityException.
|
|
77
|
+
Also verifies that None is accepted as a valid value.
|
|
60
78
|
"""
|
|
61
79
|
with self.assertRaises(OrionisIntegrityException):
|
|
62
80
|
Session(max_age="3600") # String instead of int
|
|
@@ -68,11 +86,16 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
68
86
|
|
|
69
87
|
async def testSameSiteValidation(self):
|
|
70
88
|
"""
|
|
71
|
-
Test validation and normalization
|
|
89
|
+
Test validation and normalization of the same_site attribute.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
None
|
|
72
94
|
|
|
73
95
|
Notes
|
|
74
96
|
-----
|
|
75
|
-
|
|
97
|
+
Ensures that both string and enum inputs for same_site are handled correctly.
|
|
98
|
+
Also checks that invalid values raise an OrionisIntegrityException.
|
|
76
99
|
"""
|
|
77
100
|
# Test string inputs (case-insensitive)
|
|
78
101
|
session1 = Session(same_site="strict")
|
|
@@ -92,11 +115,15 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
92
115
|
|
|
93
116
|
async def testPathValidation(self):
|
|
94
117
|
"""
|
|
95
|
-
Test validation
|
|
118
|
+
Test validation of the path attribute.
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
None
|
|
96
123
|
|
|
97
124
|
Notes
|
|
98
125
|
-----
|
|
99
|
-
|
|
126
|
+
Ensures that invalid path values raise an OrionisIntegrityException.
|
|
100
127
|
"""
|
|
101
128
|
with self.assertRaises(OrionisIntegrityException):
|
|
102
129
|
Session(path="") # Empty string
|
|
@@ -107,11 +134,15 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
107
134
|
|
|
108
135
|
async def testHttpsOnlyValidation(self):
|
|
109
136
|
"""
|
|
110
|
-
Test validation
|
|
137
|
+
Test validation of the https_only attribute.
|
|
138
|
+
|
|
139
|
+
Returns
|
|
140
|
+
-------
|
|
141
|
+
None
|
|
111
142
|
|
|
112
143
|
Notes
|
|
113
144
|
-----
|
|
114
|
-
|
|
145
|
+
Ensures that non-boolean values for https_only raise an OrionisIntegrityException.
|
|
115
146
|
"""
|
|
116
147
|
with self.assertRaises(OrionisIntegrityException):
|
|
117
148
|
Session(https_only="true") # String instead of bool
|
|
@@ -120,11 +151,16 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
120
151
|
|
|
121
152
|
async def testDomainValidation(self):
|
|
122
153
|
"""
|
|
123
|
-
Test validation
|
|
154
|
+
Test validation of the domain attribute.
|
|
155
|
+
|
|
156
|
+
Returns
|
|
157
|
+
-------
|
|
158
|
+
None
|
|
124
159
|
|
|
125
160
|
Notes
|
|
126
161
|
-----
|
|
127
|
-
|
|
162
|
+
Ensures that invalid domain values raise an OrionisIntegrityException.
|
|
163
|
+
Also verifies that None is accepted as a valid value.
|
|
128
164
|
"""
|
|
129
165
|
with self.assertRaises(OrionisIntegrityException):
|
|
130
166
|
Session(domain=".example.com") # Starts with dot
|
|
@@ -139,11 +175,15 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
139
175
|
|
|
140
176
|
async def testToDictMethod(self):
|
|
141
177
|
"""
|
|
142
|
-
Test the toDict method
|
|
178
|
+
Test the toDict method of the Session instance.
|
|
179
|
+
|
|
180
|
+
Returns
|
|
181
|
+
-------
|
|
182
|
+
None
|
|
143
183
|
|
|
144
184
|
Notes
|
|
145
185
|
-----
|
|
146
|
-
|
|
186
|
+
Ensures that the toDict method returns a dictionary containing all fields with correct values.
|
|
147
187
|
"""
|
|
148
188
|
session = Session()
|
|
149
189
|
result = session.toDict()
|
|
@@ -158,11 +198,16 @@ class TestFoundationConfigSession(AsyncTestCase):
|
|
|
158
198
|
|
|
159
199
|
async def testKwOnlyInitialization(self):
|
|
160
200
|
"""
|
|
161
|
-
Test
|
|
201
|
+
Test enforcement of keyword-only initialization for Session.
|
|
202
|
+
|
|
203
|
+
Returns
|
|
204
|
+
-------
|
|
205
|
+
None
|
|
162
206
|
|
|
163
207
|
Notes
|
|
164
208
|
-----
|
|
165
|
-
|
|
209
|
+
Ensures that the Session class enforces keyword-only arguments during initialization
|
|
210
|
+
by raising a TypeError when positional arguments are provided.
|
|
166
211
|
"""
|
|
167
212
|
with self.assertRaises(TypeError):
|
|
168
213
|
Session("key", "session")
|
|
@@ -18,33 +18,35 @@ from unittest.mock import Mock
|
|
|
18
18
|
|
|
19
19
|
class TestFoundationConfigStartup(AsyncTestCase):
|
|
20
20
|
"""
|
|
21
|
-
Test suite for the Configuration dataclass
|
|
21
|
+
Test suite for the `Configuration` dataclass, validating its structure, initialization,
|
|
22
|
+
type enforcement, mutability, equality, and dictionary conversion.
|
|
22
23
|
|
|
23
24
|
Methods
|
|
24
25
|
-------
|
|
25
|
-
testConfigurationIsDataclass
|
|
26
|
-
|
|
27
|
-
testDefaultInitialization
|
|
28
|
-
|
|
29
|
-
testAllSectionsHaveDefaultFactories
|
|
30
|
-
|
|
31
|
-
testTypeValidationInPostInit
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
testConfigurationIsDataclass
|
|
27
|
+
Verify that `Configuration` is a dataclass.
|
|
28
|
+
testDefaultInitialization
|
|
29
|
+
Ensure all fields of `Configuration` are initialized with their default factories and correct types.
|
|
30
|
+
testAllSectionsHaveDefaultFactories
|
|
31
|
+
Check that every field in `Configuration` has a callable default factory.
|
|
32
|
+
testTypeValidationInPostInit
|
|
33
|
+
Confirm that type validation and dictionary conversion occur in `__post_init__`,
|
|
34
|
+
and that invalid types raise `OrionisIntegrityException`.
|
|
35
|
+
testToDictReturnsCompleteDictionary
|
|
36
|
+
Assert that `toDict()` returns a dictionary containing all configuration sections.
|
|
37
|
+
testToDictReturnsNestedStructures
|
|
38
|
+
Ensure that nested configuration sections are represented as dictionaries in `toDict()` output.
|
|
39
|
+
testMetadataIsAccessible
|
|
40
|
+
Validate that field metadata is accessible and contains required keys and types.
|
|
41
|
+
testConfigurationIsMutable
|
|
42
|
+
Check that attributes of `Configuration` can be modified after initialization.
|
|
43
|
+
testConfigurationEquality
|
|
44
|
+
Test equality comparison between `Configuration` instances, especially with differing keys.
|
|
43
45
|
"""
|
|
44
46
|
|
|
45
47
|
def testConfigurationIsDataclass(self):
|
|
46
48
|
"""
|
|
47
|
-
|
|
49
|
+
Verify that `Configuration` is implemented as a dataclass.
|
|
48
50
|
|
|
49
51
|
Returns
|
|
50
52
|
-------
|
|
@@ -54,9 +56,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
54
56
|
|
|
55
57
|
def testDefaultInitialization(self):
|
|
56
58
|
"""
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Ensures all fields are initialized with their default factories.
|
|
59
|
+
Ensure all fields of `Configuration` are initialized with their default factories
|
|
60
|
+
and are instances of their respective entity classes.
|
|
60
61
|
|
|
61
62
|
Returns
|
|
62
63
|
-------
|
|
@@ -79,7 +80,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
79
80
|
|
|
80
81
|
def testAllSectionsHaveDefaultFactories(self):
|
|
81
82
|
"""
|
|
82
|
-
|
|
83
|
+
Check that every field in `Configuration` has a callable default factory.
|
|
83
84
|
|
|
84
85
|
Returns
|
|
85
86
|
-------
|
|
@@ -92,9 +93,9 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
92
93
|
|
|
93
94
|
def testTypeValidationInPostInit(self):
|
|
94
95
|
"""
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
Confirm that type validation and dictionary conversion occur in `__post_init__`.
|
|
97
|
+
Validates that dictionaries are converted to entity instances and invalid types
|
|
98
|
+
raise `OrionisIntegrityException`.
|
|
98
99
|
|
|
99
100
|
Returns
|
|
100
101
|
-------
|
|
@@ -104,7 +105,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
104
105
|
config = Configuration(app={"name": "TestApp"})
|
|
105
106
|
self.assertIsInstance(config.app, App)
|
|
106
107
|
|
|
107
|
-
# Invalid types
|
|
108
|
+
# Invalid types for each section should raise an exception
|
|
108
109
|
sections = [
|
|
109
110
|
('app', 123),
|
|
110
111
|
('auth', 123),
|
|
@@ -127,7 +128,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
127
128
|
|
|
128
129
|
def testToDictReturnsCompleteDictionary(self):
|
|
129
130
|
"""
|
|
130
|
-
|
|
131
|
+
Assert that `toDict()` returns a dictionary containing all configuration sections.
|
|
131
132
|
|
|
132
133
|
Returns
|
|
133
134
|
-------
|
|
@@ -140,7 +141,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
140
141
|
|
|
141
142
|
def testToDictReturnsNestedStructures(self):
|
|
142
143
|
"""
|
|
143
|
-
|
|
144
|
+
Ensure that nested configuration sections are represented as dictionaries
|
|
145
|
+
in the output of `toDict()`.
|
|
144
146
|
|
|
145
147
|
Returns
|
|
146
148
|
-------
|
|
@@ -155,7 +157,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
155
157
|
|
|
156
158
|
def testMetadataIsAccessible(self):
|
|
157
159
|
"""
|
|
158
|
-
|
|
160
|
+
Validate that field metadata is accessible and contains the 'description' key
|
|
161
|
+
as a string and the 'default' key.
|
|
159
162
|
|
|
160
163
|
Returns
|
|
161
164
|
-------
|
|
@@ -170,7 +173,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
170
173
|
|
|
171
174
|
def testConfigurationIsMutable(self):
|
|
172
175
|
"""
|
|
173
|
-
|
|
176
|
+
Check that attributes of `Configuration` can be modified after initialization.
|
|
174
177
|
|
|
175
178
|
Returns
|
|
176
179
|
-------
|
|
@@ -185,7 +188,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
185
188
|
|
|
186
189
|
def testConfigurationEquality(self):
|
|
187
190
|
"""
|
|
188
|
-
Test equality
|
|
191
|
+
Test equality comparison between `Configuration` instances, ensuring that
|
|
192
|
+
instances with differing keys are not considered equal.
|
|
189
193
|
|
|
190
194
|
Returns
|
|
191
195
|
-------
|
|
@@ -13,21 +13,52 @@ from tests.services.introspection.dependencies.mocks.mock_users_permissions impo
|
|
|
13
13
|
|
|
14
14
|
class TestReflectDependencies(AsyncTestCase):
|
|
15
15
|
"""
|
|
16
|
-
Test suite for
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
16
|
+
Test suite for the ReflectDependencies class, which provides utilities for introspecting and resolving dependencies
|
|
17
|
+
in class constructors, methods, and callables.
|
|
18
|
+
|
|
19
|
+
This class contains asynchronous test cases that validate:
|
|
20
|
+
- The correct retrieval and resolution of constructor dependencies for the UserController class.
|
|
21
|
+
- The identification of constructor dependencies as instances of ClassDependency.
|
|
22
|
+
- The resolution of dependencies such as 'user_repository' as KnownDependency instances, including validation
|
|
23
|
+
of their module name, class name, full class path, and type.
|
|
24
|
+
- The reflection and resolution of method dependencies for specific methods (e.g., 'createUserWithPermissions'),
|
|
25
|
+
ensuring they are identified as MethodDependency instances.
|
|
26
|
+
- The resolution of method dependencies such as 'user_permissions' and 'permissions' as KnownDependency instances,
|
|
27
|
+
with correct attributes.
|
|
28
|
+
- That unresolved dependency lists are empty when all dependencies are resolved.
|
|
29
|
+
|
|
30
|
+
Attributes
|
|
31
|
+
----------
|
|
32
|
+
Inherits from AsyncTestCase.
|
|
33
|
+
|
|
34
|
+
Methods
|
|
35
|
+
-------
|
|
36
|
+
testReflectionDependenciesGetConstructorDependencies()
|
|
37
|
+
Tests retrieval and validation of constructor dependencies for UserController.
|
|
38
|
+
|
|
39
|
+
testReflectionDependenciesGetMethodDependencies()
|
|
40
|
+
Tests retrieval and validation of method dependencies for the 'createUserWithPermissions' method.
|
|
41
|
+
|
|
42
|
+
testReflectionDependenciesGetCallableDependencies()
|
|
43
|
+
Tests retrieval and validation of dependencies for a sample asynchronous callable.
|
|
25
44
|
"""
|
|
26
45
|
|
|
27
46
|
async def testReflectionDependenciesGetConstructorDependencies(self):
|
|
28
47
|
"""
|
|
29
|
-
|
|
30
|
-
|
|
48
|
+
Retrieves and validates the constructor dependencies for the UserController class using the ReflectDependencies utility.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
self : TestReflectDependencies
|
|
53
|
+
The test case instance.
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
None
|
|
58
|
+
|
|
59
|
+
Notes
|
|
60
|
+
-----
|
|
61
|
+
This test ensures that:
|
|
31
62
|
- The returned constructor dependencies are an instance of ClassDependency.
|
|
32
63
|
- The list of unresolved dependencies is empty.
|
|
33
64
|
- The 'user_repository' dependency is resolved as an instance of KnownDependency.
|
|
@@ -55,15 +86,25 @@ class TestReflectDependencies(AsyncTestCase):
|
|
|
55
86
|
|
|
56
87
|
async def testReflectionDependenciesGetMethodDependencies(self):
|
|
57
88
|
"""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
- The
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
Retrieves and validates the dependencies for the 'createUserWithPermissions' method of the UserController class
|
|
90
|
+
using the ReflectDependencies utility.
|
|
91
|
+
|
|
92
|
+
This test ensures that:
|
|
93
|
+
- The returned object is an instance of MethodDependency.
|
|
94
|
+
- The unresolved dependencies list is empty.
|
|
95
|
+
- The 'user_permissions' dependency is resolved as a KnownDependency with the expected module name,
|
|
96
|
+
class name, full class path, and type (FakeUserWithPermissions).
|
|
97
|
+
- The 'permissions' dependency is resolved as a KnownDependency with the expected module name,
|
|
98
|
+
class name, full class path, and type (list[str]).
|
|
99
|
+
|
|
100
|
+
Parameters
|
|
101
|
+
----------
|
|
102
|
+
self : TestReflectDependencies
|
|
103
|
+
The test case instance.
|
|
104
|
+
|
|
105
|
+
Returns
|
|
106
|
+
-------
|
|
107
|
+
None
|
|
67
108
|
"""
|
|
68
109
|
|
|
69
110
|
depend = ReflectDependencies(UserController)
|
|
@@ -97,12 +138,23 @@ class TestReflectDependencies(AsyncTestCase):
|
|
|
97
138
|
|
|
98
139
|
async def testReflectionDependenciesGetCallableDependencies(self):
|
|
99
140
|
"""
|
|
100
|
-
Tests the `getCallableDependencies` method of the `ReflectDependencies` class for a
|
|
101
|
-
|
|
102
|
-
|
|
141
|
+
Tests the `getCallableDependencies` method of the `ReflectDependencies` class for a given asynchronous function.
|
|
142
|
+
|
|
143
|
+
Parameters
|
|
144
|
+
----------
|
|
145
|
+
self : TestReflectDependencies
|
|
146
|
+
The test case instance.
|
|
147
|
+
|
|
148
|
+
Returns
|
|
149
|
+
-------
|
|
150
|
+
None
|
|
151
|
+
|
|
152
|
+
Notes
|
|
153
|
+
-----
|
|
154
|
+
This test checks that:
|
|
155
|
+
- The returned dependencies are an instance of `CallableDependency`.
|
|
103
156
|
- There are no unresolved dependencies.
|
|
104
|
-
- The 'x' and 'y' parameters are
|
|
105
|
-
module name, class name, full class path, and type (`int`).
|
|
157
|
+
- The 'x' and 'y' parameters are resolved to their default integer values (3 and 4, respectively).
|
|
106
158
|
"""
|
|
107
159
|
|
|
108
160
|
async def fake_function(x: int = 3, y: int = 4) -> int:
|