orionis 0.437.0__py3-none-any.whl → 0.439.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/container/context/scope.py +1 -1
- orionis/metadata/framework.py +1 -1
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/METADATA +1 -1
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/RECORD +36 -35
- tests/container/context/test_manager.py +1 -0
- tests/container/context/test_scope.py +1 -0
- tests/container/core/__init__.py +0 -0
- tests/container/{test_container.py → core/test_container.py} +45 -1
- tests/container/{test_singleton.py → core/test_singleton.py} +5 -0
- tests/container/{test_thread_safety.py → core/test_thread_safety.py} +2 -0
- tests/container/mocks/mock_complex_classes.py +502 -192
- tests/container/mocks/mock_simple_classes.py +72 -6
- tests/container/validators/test_is_not_subclass.py +0 -1
- 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/queue/test_foundation_config_queue_brokers.py +1 -0
- 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 -34
- tests/services/environment/test_services_environment.py +5 -4
- tests/services/introspection/dependencies/test_reflect_dependencies.py +77 -25
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +750 -267
- tests/services/introspection/reflection/test_reflection_abstract.py +514 -83
- tests/services/introspection/reflection/test_reflection_callable.py +85 -35
- tests/services/introspection/reflection/test_reflection_concrete.py +345 -226
- tests/services/introspection/reflection/test_reflection_instance.py +627 -273
- tests/services/introspection/reflection/test_reflection_module.py +346 -175
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/WHEEL +0 -0
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/top_level.txt +0 -0
- {orionis-0.437.0.dist-info → orionis-0.439.0.dist-info}/zip-safe +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")
|
|
@@ -14,37 +14,38 @@ from orionis.foundation.config.queue.entities.queue import Queue
|
|
|
14
14
|
from orionis.foundation.config.session.entities.session import Session
|
|
15
15
|
from orionis.foundation.config.testing.entities.testing import Testing
|
|
16
16
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
17
|
-
from unittest.mock import Mock
|
|
18
17
|
|
|
19
18
|
class TestFoundationConfigStartup(AsyncTestCase):
|
|
20
19
|
"""
|
|
21
|
-
Test suite for the Configuration dataclass
|
|
20
|
+
Test suite for the `Configuration` dataclass, validating its structure, initialization,
|
|
21
|
+
type enforcement, mutability, equality, and dictionary conversion.
|
|
22
22
|
|
|
23
23
|
Methods
|
|
24
24
|
-------
|
|
25
|
-
testConfigurationIsDataclass
|
|
26
|
-
|
|
27
|
-
testDefaultInitialization
|
|
28
|
-
|
|
29
|
-
testAllSectionsHaveDefaultFactories
|
|
30
|
-
|
|
31
|
-
testTypeValidationInPostInit
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
testConfigurationIsDataclass
|
|
26
|
+
Verify that `Configuration` is a dataclass.
|
|
27
|
+
testDefaultInitialization
|
|
28
|
+
Ensure all fields of `Configuration` are initialized with their default factories and correct types.
|
|
29
|
+
testAllSectionsHaveDefaultFactories
|
|
30
|
+
Check that every field in `Configuration` has a callable default factory.
|
|
31
|
+
testTypeValidationInPostInit
|
|
32
|
+
Confirm that type validation and dictionary conversion occur in `__post_init__`,
|
|
33
|
+
and that invalid types raise `OrionisIntegrityException`.
|
|
34
|
+
testToDictReturnsCompleteDictionary
|
|
35
|
+
Assert that `toDict()` returns a dictionary containing all configuration sections.
|
|
36
|
+
testToDictReturnsNestedStructures
|
|
37
|
+
Ensure that nested configuration sections are represented as dictionaries in `toDict()` output.
|
|
38
|
+
testMetadataIsAccessible
|
|
39
|
+
Validate that field metadata is accessible and contains required keys and types.
|
|
40
|
+
testConfigurationIsMutable
|
|
41
|
+
Check that attributes of `Configuration` can be modified after initialization.
|
|
42
|
+
testConfigurationEquality
|
|
43
|
+
Test equality comparison between `Configuration` instances, especially with differing keys.
|
|
43
44
|
"""
|
|
44
45
|
|
|
45
46
|
def testConfigurationIsDataclass(self):
|
|
46
47
|
"""
|
|
47
|
-
|
|
48
|
+
Verify that `Configuration` is implemented as a dataclass.
|
|
48
49
|
|
|
49
50
|
Returns
|
|
50
51
|
-------
|
|
@@ -54,9 +55,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
54
55
|
|
|
55
56
|
def testDefaultInitialization(self):
|
|
56
57
|
"""
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Ensures all fields are initialized with their default factories.
|
|
58
|
+
Ensure all fields of `Configuration` are initialized with their default factories
|
|
59
|
+
and are instances of their respective entity classes.
|
|
60
60
|
|
|
61
61
|
Returns
|
|
62
62
|
-------
|
|
@@ -79,7 +79,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
79
79
|
|
|
80
80
|
def testAllSectionsHaveDefaultFactories(self):
|
|
81
81
|
"""
|
|
82
|
-
|
|
82
|
+
Check that every field in `Configuration` has a callable default factory.
|
|
83
83
|
|
|
84
84
|
Returns
|
|
85
85
|
-------
|
|
@@ -92,9 +92,9 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
92
92
|
|
|
93
93
|
def testTypeValidationInPostInit(self):
|
|
94
94
|
"""
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
Confirm that type validation and dictionary conversion occur in `__post_init__`.
|
|
96
|
+
Validates that dictionaries are converted to entity instances and invalid types
|
|
97
|
+
raise `OrionisIntegrityException`.
|
|
98
98
|
|
|
99
99
|
Returns
|
|
100
100
|
-------
|
|
@@ -104,7 +104,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
104
104
|
config = Configuration(app={"name": "TestApp"})
|
|
105
105
|
self.assertIsInstance(config.app, App)
|
|
106
106
|
|
|
107
|
-
# Invalid types
|
|
107
|
+
# Invalid types for each section should raise an exception
|
|
108
108
|
sections = [
|
|
109
109
|
('app', 123),
|
|
110
110
|
('auth', 123),
|
|
@@ -127,7 +127,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
127
127
|
|
|
128
128
|
def testToDictReturnsCompleteDictionary(self):
|
|
129
129
|
"""
|
|
130
|
-
|
|
130
|
+
Assert that `toDict()` returns a dictionary containing all configuration sections.
|
|
131
131
|
|
|
132
132
|
Returns
|
|
133
133
|
-------
|
|
@@ -140,7 +140,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
140
140
|
|
|
141
141
|
def testToDictReturnsNestedStructures(self):
|
|
142
142
|
"""
|
|
143
|
-
|
|
143
|
+
Ensure that nested configuration sections are represented as dictionaries
|
|
144
|
+
in the output of `toDict()`.
|
|
144
145
|
|
|
145
146
|
Returns
|
|
146
147
|
-------
|
|
@@ -155,7 +156,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
155
156
|
|
|
156
157
|
def testMetadataIsAccessible(self):
|
|
157
158
|
"""
|
|
158
|
-
|
|
159
|
+
Validate that field metadata is accessible and contains the 'description' key
|
|
160
|
+
as a string and the 'default' key.
|
|
159
161
|
|
|
160
162
|
Returns
|
|
161
163
|
-------
|
|
@@ -170,7 +172,7 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
170
172
|
|
|
171
173
|
def testConfigurationIsMutable(self):
|
|
172
174
|
"""
|
|
173
|
-
|
|
175
|
+
Check that attributes of `Configuration` can be modified after initialization.
|
|
174
176
|
|
|
175
177
|
Returns
|
|
176
178
|
-------
|
|
@@ -185,7 +187,8 @@ class TestFoundationConfigStartup(AsyncTestCase):
|
|
|
185
187
|
|
|
186
188
|
def testConfigurationEquality(self):
|
|
187
189
|
"""
|
|
188
|
-
Test equality
|
|
190
|
+
Test equality comparison between `Configuration` instances, ensuring that
|
|
191
|
+
instances with differing keys are not considered equal.
|
|
189
192
|
|
|
190
193
|
Returns
|
|
191
194
|
-------
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from orionis.services.environment.core.dot_env import DotEnv
|
|
3
2
|
from orionis.services.environment.env import Env
|
|
4
3
|
from orionis.services.environment.enums.value_type import EnvironmentValueType
|
|
4
|
+
from orionis.services.environment.key.key_generator import SecureKeyGenerator
|
|
5
5
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
6
6
|
|
|
7
7
|
class TestServicesEnvironment(AsyncTestCase):
|
|
@@ -152,7 +152,7 @@ class TestServicesEnvironment(AsyncTestCase):
|
|
|
152
152
|
self.assertEqual(env.get("CAST_EXAMPLE_SET"), {1, 2, 3})
|
|
153
153
|
|
|
154
154
|
# Set and assert a base64 value with explicit type
|
|
155
|
-
ramdon_text =
|
|
155
|
+
ramdon_text = SecureKeyGenerator.generate()
|
|
156
156
|
env.set("CAST_EXAMPLE_BASE64", ramdon_text, EnvironmentValueType.BASE64)
|
|
157
157
|
self.assertEqual(env.get("CAST_EXAMPLE_BASE64"), ramdon_text)
|
|
158
158
|
|
|
@@ -221,5 +221,6 @@ class TestServicesEnvironment(AsyncTestCase):
|
|
|
221
221
|
self.assertEqual(env.get("EXAMPLE_SET"), {1, 2, 3})
|
|
222
222
|
|
|
223
223
|
# Set and get a base64 value without explicit type
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
ramdon_text = SecureKeyGenerator.generate()
|
|
225
|
+
env.set("EXAMPLE_BASE64", ramdon_text)
|
|
226
|
+
self.assertEqual(env.get("EXAMPLE_BASE64"), ramdon_text)
|
|
@@ -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:
|