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,242 +0,0 @@
|
|
|
1
|
-
from orionis.container.entities.binding import Binding
|
|
2
|
-
from orionis.container.enums.lifetimes import Lifetime
|
|
3
|
-
from orionis.container.exceptions.type import OrionisContainerTypeError
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
|
|
6
|
-
class TestEntities(AsyncTestCase):
|
|
7
|
-
|
|
8
|
-
async def testBindingInitialization(self):
|
|
9
|
-
"""
|
|
10
|
-
Test initialization of a Binding object with default values.
|
|
11
|
-
|
|
12
|
-
This test verifies that when a Binding instance is created without any arguments,
|
|
13
|
-
all attributes are set to their expected default values.
|
|
14
|
-
|
|
15
|
-
Parameters
|
|
16
|
-
----------
|
|
17
|
-
self : TestBinding
|
|
18
|
-
The test case instance.
|
|
19
|
-
|
|
20
|
-
Returns
|
|
21
|
-
-------
|
|
22
|
-
None
|
|
23
|
-
This method does not return anything. Assertions are used to validate behavior.
|
|
24
|
-
|
|
25
|
-
Raises
|
|
26
|
-
------
|
|
27
|
-
AssertionError
|
|
28
|
-
If any of the default values are incorrect or the Binding initialization fails.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
# Create a Binding instance with default parameters
|
|
32
|
-
binding: Binding = Binding()
|
|
33
|
-
|
|
34
|
-
# Assert that all attributes are set to their default values
|
|
35
|
-
self.assertIsNone(binding.contract) # Default contract should be None
|
|
36
|
-
self.assertIsNone(binding.concrete) # Default concrete should be None
|
|
37
|
-
self.assertIsNone(binding.instance) # Default instance should be None
|
|
38
|
-
self.assertIsNone(binding.function) # Default function should be None
|
|
39
|
-
self.assertEqual(binding.lifetime, Lifetime.TRANSIENT) # Default lifetime should be TRANSIENT
|
|
40
|
-
self.assertFalse(binding.enforce_decoupling) # Default enforce_decoupling should be False
|
|
41
|
-
self.assertIsNone(binding.alias) # Default alias should be None
|
|
42
|
-
|
|
43
|
-
async def testBindingCustomValues(self):
|
|
44
|
-
"""
|
|
45
|
-
Test initialization of a Binding object with custom values.
|
|
46
|
-
|
|
47
|
-
This test verifies that when a Binding instance is created with explicit arguments,
|
|
48
|
-
all attributes are set to the provided custom values, and the object reflects the intended configuration.
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
self : TestBinding
|
|
53
|
-
The test case instance.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
None
|
|
58
|
-
This method does not return anything. Assertions are used to validate correct attribute assignment.
|
|
59
|
-
|
|
60
|
-
Raises
|
|
61
|
-
------
|
|
62
|
-
AssertionError
|
|
63
|
-
If the Binding initialization fails or custom values are not set correctly.
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
# Define dummy contract and concrete classes for testing
|
|
67
|
-
class TestContract: pass
|
|
68
|
-
class TestConcrete: pass
|
|
69
|
-
|
|
70
|
-
# Create an instance for the 'instance' attribute
|
|
71
|
-
instance = TestConcrete()
|
|
72
|
-
|
|
73
|
-
# Define a factory function for the 'function' attribute
|
|
74
|
-
factory_func = lambda: TestConcrete()
|
|
75
|
-
|
|
76
|
-
# Initialize Binding with custom values
|
|
77
|
-
binding = Binding(
|
|
78
|
-
contract=TestContract,
|
|
79
|
-
concrete=TestConcrete,
|
|
80
|
-
instance=instance,
|
|
81
|
-
function=factory_func,
|
|
82
|
-
lifetime=Lifetime.SINGLETON,
|
|
83
|
-
enforce_decoupling=True,
|
|
84
|
-
alias="test_binding"
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
# Assert that all attributes are set to the provided custom values
|
|
88
|
-
self.assertIs(binding.contract, TestContract)
|
|
89
|
-
self.assertIs(binding.concrete, TestConcrete)
|
|
90
|
-
self.assertIs(binding.instance, instance)
|
|
91
|
-
self.assertIs(binding.function, factory_func)
|
|
92
|
-
self.assertEqual(binding.lifetime, Lifetime.SINGLETON)
|
|
93
|
-
self.assertTrue(binding.enforce_decoupling)
|
|
94
|
-
self.assertEqual(binding.alias, "test_binding")
|
|
95
|
-
|
|
96
|
-
async def testBindingPostInitValidation(self):
|
|
97
|
-
"""
|
|
98
|
-
Validates that the `__post_init__` method of the `Binding` class raises appropriate
|
|
99
|
-
exceptions when invalid types are provided for certain attributes.
|
|
100
|
-
|
|
101
|
-
This test ensures that type validation is enforced for the `lifetime`, `enforce_decoupling`,
|
|
102
|
-
and `alias` attributes during initialization. If an invalid type is passed, the
|
|
103
|
-
`OrionisContainerTypeError` should be raised.
|
|
104
|
-
|
|
105
|
-
Parameters
|
|
106
|
-
----------
|
|
107
|
-
self : TestBinding
|
|
108
|
-
The test case instance.
|
|
109
|
-
|
|
110
|
-
Returns
|
|
111
|
-
-------
|
|
112
|
-
None
|
|
113
|
-
This method does not return anything. Assertions are used to validate that
|
|
114
|
-
exceptions are raised for invalid input types.
|
|
115
|
-
|
|
116
|
-
Raises
|
|
117
|
-
------
|
|
118
|
-
AssertionError
|
|
119
|
-
If the expected `OrionisContainerTypeError` is not raised when invalid types
|
|
120
|
-
are provided for the attributes.
|
|
121
|
-
"""
|
|
122
|
-
|
|
123
|
-
# Attempt to initialize Binding with an invalid lifetime type (should raise exception)
|
|
124
|
-
with self.assertRaises(OrionisContainerTypeError):
|
|
125
|
-
Binding(lifetime="not_a_lifetime")
|
|
126
|
-
|
|
127
|
-
# Attempt to initialize Binding with an invalid enforce_decoupling type (should raise exception)
|
|
128
|
-
with self.assertRaises(OrionisContainerTypeError):
|
|
129
|
-
Binding(enforce_decoupling="not_a_bool")
|
|
130
|
-
|
|
131
|
-
# Attempt to initialize Binding with an invalid alias type (should raise exception)
|
|
132
|
-
with self.assertRaises(OrionisContainerTypeError):
|
|
133
|
-
Binding(alias=123)
|
|
134
|
-
|
|
135
|
-
async def testToDictMethod(self):
|
|
136
|
-
"""
|
|
137
|
-
Tests the `toDict` method of the `Binding` class to ensure it returns a correct dictionary representation
|
|
138
|
-
of the binding's attributes.
|
|
139
|
-
|
|
140
|
-
This test verifies that the dictionary contains all expected keys and that their values match the attributes
|
|
141
|
-
set during initialization. It also checks that the types and values are correctly preserved.
|
|
142
|
-
|
|
143
|
-
Parameters
|
|
144
|
-
----------
|
|
145
|
-
self : TestBinding
|
|
146
|
-
The test case instance.
|
|
147
|
-
|
|
148
|
-
Returns
|
|
149
|
-
-------
|
|
150
|
-
None
|
|
151
|
-
This method does not return anything. Assertions are used to validate the correctness of the dictionary representation.
|
|
152
|
-
|
|
153
|
-
Raises
|
|
154
|
-
------
|
|
155
|
-
AssertionError
|
|
156
|
-
If the dictionary representation is incorrect or any attribute does not match the expected value.
|
|
157
|
-
"""
|
|
158
|
-
|
|
159
|
-
# Define dummy contract and concrete classes for testing
|
|
160
|
-
class TestContract: pass
|
|
161
|
-
class TestConcrete: pass
|
|
162
|
-
|
|
163
|
-
# Create a Binding instance with custom values
|
|
164
|
-
binding = Binding(
|
|
165
|
-
contract=TestContract,
|
|
166
|
-
concrete=TestConcrete,
|
|
167
|
-
lifetime=Lifetime.SINGLETON,
|
|
168
|
-
enforce_decoupling=True,
|
|
169
|
-
alias="test_binding"
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
# Get the dictionary representation of the binding
|
|
173
|
-
result = binding.toDict()
|
|
174
|
-
|
|
175
|
-
# Assert that the result is a dictionary
|
|
176
|
-
self.assertIsInstance(result, dict)
|
|
177
|
-
|
|
178
|
-
# Assert that contract and concrete are correctly set
|
|
179
|
-
self.assertIs(result["contract"], TestContract)
|
|
180
|
-
self.assertIs(result["concrete"], TestConcrete)
|
|
181
|
-
|
|
182
|
-
# Assert that instance and function are None by default
|
|
183
|
-
self.assertIsNone(result["instance"])
|
|
184
|
-
self.assertIsNone(result["function"])
|
|
185
|
-
|
|
186
|
-
# Assert that lifetime, enforce_decoupling, and alias are correctly set
|
|
187
|
-
self.assertEqual(result["lifetime"], Lifetime.SINGLETON)
|
|
188
|
-
self.assertTrue(result["enforce_decoupling"])
|
|
189
|
-
self.assertEqual(result["alias"], "test_binding")
|
|
190
|
-
|
|
191
|
-
async def testGetFieldsMethod(self):
|
|
192
|
-
"""
|
|
193
|
-
Tests the `getFields` method of the `Binding` class to ensure it returns accurate field metadata.
|
|
194
|
-
|
|
195
|
-
This test verifies that the returned list contains the expected number of fields, that all expected
|
|
196
|
-
field names are present, and that specific field metadata (such as default values and descriptions)
|
|
197
|
-
are correctly provided for the `lifetime` field.
|
|
198
|
-
|
|
199
|
-
Parameters
|
|
200
|
-
----------
|
|
201
|
-
self : TestBinding
|
|
202
|
-
The test case instance.
|
|
203
|
-
|
|
204
|
-
Returns
|
|
205
|
-
-------
|
|
206
|
-
None
|
|
207
|
-
This method does not return anything. Assertions are used to validate the correctness of the
|
|
208
|
-
field metadata returned by `getFields`.
|
|
209
|
-
|
|
210
|
-
Raises
|
|
211
|
-
------
|
|
212
|
-
AssertionError
|
|
213
|
-
If the field information is incorrect, such as missing fields, incorrect defaults, or missing metadata.
|
|
214
|
-
"""
|
|
215
|
-
|
|
216
|
-
# Create a Binding instance with default parameters
|
|
217
|
-
binding = Binding()
|
|
218
|
-
|
|
219
|
-
# Retrieve field metadata using getFields
|
|
220
|
-
fields_info = binding.getFields()
|
|
221
|
-
|
|
222
|
-
# Assert that the returned value is a list
|
|
223
|
-
self.assertIsInstance(fields_info, list)
|
|
224
|
-
|
|
225
|
-
# Assert that there are exactly 7 fields
|
|
226
|
-
self.assertEqual(len(fields_info), 7)
|
|
227
|
-
|
|
228
|
-
# Extract field names from the metadata
|
|
229
|
-
field_names = [field["name"] for field in fields_info]
|
|
230
|
-
expected_names = ["contract", "concrete", "instance", "function", "lifetime", "enforce_decoupling", "alias"]
|
|
231
|
-
|
|
232
|
-
# Assert that all expected field names are present
|
|
233
|
-
self.assertTrue(all(name in field_names for name in expected_names))
|
|
234
|
-
|
|
235
|
-
# Find the metadata for the 'lifetime' field
|
|
236
|
-
lifetime_field = next(field for field in fields_info if field["name"] == "lifetime")
|
|
237
|
-
|
|
238
|
-
# Assert that the default value for 'lifetime' is correct
|
|
239
|
-
self.assertEqual(lifetime_field["default"], Lifetime.TRANSIENT.value)
|
|
240
|
-
|
|
241
|
-
# Assert that the 'lifetime' field contains a description in its metadata
|
|
242
|
-
self.assertIn("description", lifetime_field["metadata"])
|
|
File without changes
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from orionis.container.enums.lifetimes import Lifetime
|
|
2
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
3
|
-
|
|
4
|
-
class TestLifetime(AsyncTestCase):
|
|
5
|
-
|
|
6
|
-
async def testLifetimeValuesExist(self) -> None:
|
|
7
|
-
"""
|
|
8
|
-
Checks that the `Lifetime` enum contains the expected lifecycle values.
|
|
9
|
-
|
|
10
|
-
This test verifies the presence of the following enum members:
|
|
11
|
-
- `TRANSIENT`
|
|
12
|
-
- `SINGLETON`
|
|
13
|
-
- `SCOPED`
|
|
14
|
-
|
|
15
|
-
Returns
|
|
16
|
-
-------
|
|
17
|
-
None
|
|
18
|
-
This method does not return any value. It asserts the existence of enum members.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
# Assert that each expected enum member exists in Lifetime
|
|
22
|
-
self.assertIn(Lifetime.TRANSIENT, Lifetime)
|
|
23
|
-
self.assertIn(Lifetime.SINGLETON, Lifetime)
|
|
24
|
-
self.assertIn(Lifetime.SCOPED, Lifetime)
|
|
25
|
-
|
|
26
|
-
async def testLifetimeValuesAreUnique(self) -> None:
|
|
27
|
-
"""
|
|
28
|
-
Ensures that all `Lifetime` enum values are unique.
|
|
29
|
-
|
|
30
|
-
This test collects the integer values of all enum members and checks that
|
|
31
|
-
there are no duplicates.
|
|
32
|
-
|
|
33
|
-
Returns
|
|
34
|
-
-------
|
|
35
|
-
None
|
|
36
|
-
This method does not return any value. It asserts uniqueness of enum values.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
# Gather all enum values
|
|
40
|
-
values = [member.value for member in Lifetime]
|
|
41
|
-
|
|
42
|
-
# Assert that all values are unique
|
|
43
|
-
self.assertEqual(len(values), len(set(values)))
|
|
44
|
-
|
|
45
|
-
async def testLifetimeCount(self) -> None:
|
|
46
|
-
"""
|
|
47
|
-
Validates that the `Lifetime` enum defines exactly three lifecycle types.
|
|
48
|
-
|
|
49
|
-
This test ensures that no additional or missing enum members exist.
|
|
50
|
-
|
|
51
|
-
Returns
|
|
52
|
-
-------
|
|
53
|
-
None
|
|
54
|
-
This method does not return any value. It asserts the count of enum members.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
# Assert that there are exactly three members in the Lifetime enum
|
|
58
|
-
self.assertEqual(len(list(Lifetime)), 3)
|
|
59
|
-
|
|
60
|
-
async def testLifetimeStringRepresentation(self) -> None:
|
|
61
|
-
"""
|
|
62
|
-
Verifies the string representation of `Lifetime` enum members.
|
|
63
|
-
|
|
64
|
-
This test checks that converting each enum member to a string yields the expected format.
|
|
65
|
-
|
|
66
|
-
Returns
|
|
67
|
-
-------
|
|
68
|
-
None
|
|
69
|
-
This method does not return any value. It asserts string representations.
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
# Assert that string representations match expected format
|
|
73
|
-
self.assertEqual(str(Lifetime.TRANSIENT), "Lifetime.TRANSIENT")
|
|
74
|
-
self.assertEqual(str(Lifetime.SINGLETON), "Lifetime.SINGLETON")
|
|
75
|
-
self.assertEqual(str(Lifetime.SCOPED), "Lifetime.SCOPED")
|
|
76
|
-
|
|
77
|
-
async def testLifetimeComparison(self) -> None:
|
|
78
|
-
"""
|
|
79
|
-
Tests comparison operations between `Lifetime` enum members.
|
|
80
|
-
|
|
81
|
-
This test verifies that each enum member is only equal to itself and not to others.
|
|
82
|
-
|
|
83
|
-
Returns
|
|
84
|
-
-------
|
|
85
|
-
None
|
|
86
|
-
This method does not return any value. It asserts comparison results.
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
# Assert that different enum members are not equal
|
|
90
|
-
self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SINGLETON)
|
|
91
|
-
self.assertNotEqual(Lifetime.SINGLETON, Lifetime.SCOPED)
|
|
92
|
-
self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SCOPED)
|
|
93
|
-
|
|
94
|
-
# Assert that each enum member is equal to itself
|
|
95
|
-
self.assertEqual(Lifetime.TRANSIENT, Lifetime.TRANSIENT)
|
|
96
|
-
self.assertEqual(Lifetime.SINGLETON, Lifetime.SINGLETON)
|
|
97
|
-
self.assertEqual(Lifetime.SCOPED, Lifetime.SCOPED)
|
|
File without changes
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import inspect
|
|
2
|
-
from orionis.container.facades.facade import FacadeMeta, Facade
|
|
3
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
-
|
|
5
|
-
class TestFacadeMethods(AsyncTestCase):
|
|
6
|
-
|
|
7
|
-
async def testFacadeMethodsExist(self):
|
|
8
|
-
"""
|
|
9
|
-
Verify the existence of essential methods in the Facade and FacadeMeta classes.
|
|
10
|
-
|
|
11
|
-
This test checks for the implementation of the following methods:
|
|
12
|
-
- 'getFacadeAccessor' in the Facade class
|
|
13
|
-
- 'resolve' in the Facade class
|
|
14
|
-
- '__getattr__' in the FacadeMeta class
|
|
15
|
-
|
|
16
|
-
The method asserts the presence of these required methods and raises an AssertionError if any are missing.
|
|
17
|
-
|
|
18
|
-
Parameters
|
|
19
|
-
----------
|
|
20
|
-
None
|
|
21
|
-
|
|
22
|
-
Returns
|
|
23
|
-
-------
|
|
24
|
-
None
|
|
25
|
-
Returns None. The method performs assertions to validate method existence.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
# List of expected methods and their corresponding classes
|
|
29
|
-
expected_methods = [
|
|
30
|
-
("getFacadeAccessor", Facade),
|
|
31
|
-
("resolve", Facade),
|
|
32
|
-
("__getattr__", FacadeMeta),
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
# Iterate through each expected method and assert its existence
|
|
36
|
-
for method_name, cls in expected_methods:
|
|
37
|
-
self.assertTrue(
|
|
38
|
-
hasattr(cls, method_name),
|
|
39
|
-
f"Method '{method_name}' does not exist in {cls.__name__}."
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
async def testFacadeMethodSignatures(self):
|
|
43
|
-
"""
|
|
44
|
-
Validate the method signatures of key Facade and FacadeMeta class methods.
|
|
45
|
-
|
|
46
|
-
This test checks that:
|
|
47
|
-
- 'getFacadeAccessor' in Facade accepts no parameters.
|
|
48
|
-
- 'resolve' in Facade accepts variable positional and keyword arguments.
|
|
49
|
-
- '__getattr__' in FacadeMeta accepts 'cls' and 'name' as parameters.
|
|
50
|
-
|
|
51
|
-
The method asserts correct method signatures and raises AssertionError if any signature does not match expectations.
|
|
52
|
-
|
|
53
|
-
Parameters
|
|
54
|
-
----------
|
|
55
|
-
None
|
|
56
|
-
|
|
57
|
-
Returns
|
|
58
|
-
-------
|
|
59
|
-
None
|
|
60
|
-
Returns None. The method performs assertions to validate method signatures.
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
# Check that getFacadeAccessor has no parameters
|
|
64
|
-
sig = inspect.signature(Facade.getFacadeAccessor)
|
|
65
|
-
params = list(sig.parameters.values())
|
|
66
|
-
self.assertEqual(len(params), 0)
|
|
67
|
-
|
|
68
|
-
# Check that resolve has *args and **kwargs as parameters
|
|
69
|
-
sig = inspect.signature(Facade.resolve)
|
|
70
|
-
params = list(sig.parameters.values())
|
|
71
|
-
self.assertEqual(params[0].name, "args")
|
|
72
|
-
self.assertEqual(params[1].kind, inspect.Parameter.VAR_KEYWORD)
|
|
73
|
-
|
|
74
|
-
# Check that __getattr__ has 'cls' and 'name' as parameters
|
|
75
|
-
sig = inspect.signature(FacadeMeta.__getattr__)
|
|
76
|
-
params = list(sig.parameters.values())
|
|
77
|
-
self.assertEqual(params[0].name, "cls")
|
|
78
|
-
self.assertEqual(params[1].name, "name")
|
|
File without changes
|