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.
Files changed (160) hide show
  1. orionis/console/base/scheduler_event_listener.py +0 -17
  2. orionis/console/contracts/schedule_event_listener.py +0 -18
  3. orionis/foundation/config/app/entities/app.py +3 -2
  4. orionis/foundation/config/app/enums/ciphers.py +5 -19
  5. orionis/foundation/config/session/entities/session.py +2 -2
  6. orionis/metadata/framework.py +1 -1
  7. orionis/services/encrypter/encrypter.py +115 -0
  8. orionis/services/environment/dynamic/caster.py +35 -27
  9. orionis/services/environment/key/key_generator.py +32 -11
  10. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/METADATA +1 -1
  11. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/RECORD +15 -159
  12. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/top_level.txt +0 -1
  13. tests/container/__init__.py +0 -0
  14. tests/container/context/__init__.py +0 -0
  15. tests/container/context/test_manager.py +0 -38
  16. tests/container/context/test_scope.py +0 -32
  17. tests/container/core/__init__.py +0 -0
  18. tests/container/core/test_advanced_async.py +0 -234
  19. tests/container/core/test_async_optimizations.py +0 -268
  20. tests/container/core/test_container.py +0 -453
  21. tests/container/core/test_singleton.py +0 -122
  22. tests/container/core/test_thread_safety.py +0 -90
  23. tests/container/entities/__init__.py +0 -0
  24. tests/container/entities/test_binding.py +0 -242
  25. tests/container/enums/__init__.py +0 -0
  26. tests/container/enums/test_lifetimes.py +0 -97
  27. tests/container/facades/__init__.py +0 -0
  28. tests/container/facades/test_facade.py +0 -78
  29. tests/container/mocks/__init__.py +0 -0
  30. tests/container/mocks/mock_advanced_async.py +0 -332
  31. tests/container/mocks/mock_async_optimizations.py +0 -407
  32. tests/container/mocks/mock_auto_resolution.py +0 -192
  33. tests/container/mocks/mock_complex_classes.py +0 -792
  34. tests/container/mocks/mock_simple_classes.py +0 -98
  35. tests/container/providers/__init__.py +0 -0
  36. tests/container/providers/test_providers.py +0 -55
  37. tests/container/validators/__init__.py +0 -0
  38. tests/container/validators/test_implements.py +0 -186
  39. tests/container/validators/test_is_abstract_class.py +0 -147
  40. tests/container/validators/test_is_callable.py +0 -102
  41. tests/container/validators/test_is_concrete_class.py +0 -160
  42. tests/container/validators/test_is_instance.py +0 -150
  43. tests/container/validators/test_is_not_subclass.py +0 -49
  44. tests/container/validators/test_is_subclass.py +0 -178
  45. tests/container/validators/test_is_valid_alias.py +0 -147
  46. tests/container/validators/test_lifetime.py +0 -106
  47. tests/example/__init__.py +0 -0
  48. tests/example/test_example.py +0 -725
  49. tests/foundation/__init__.py +0 -0
  50. tests/foundation/config/__init__.py +0 -0
  51. tests/foundation/config/app/__init__.py +0 -0
  52. tests/foundation/config/app/test_foundation_config_app.py +0 -262
  53. tests/foundation/config/auth/__init__.py +0 -0
  54. tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
  55. tests/foundation/config/cache/__init__.py +0 -0
  56. tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
  57. tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
  58. tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
  59. tests/foundation/config/cors/__init__.py +0 -0
  60. tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
  61. tests/foundation/config/database/__init__.py +0 -0
  62. tests/foundation/config/database/test_foundation_config_database.py +0 -158
  63. tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
  64. tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
  65. tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
  66. tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
  67. tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
  68. tests/foundation/config/filesystems/__init__.py +0 -0
  69. tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
  70. tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
  71. tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
  72. tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
  73. tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
  74. tests/foundation/config/logging/__init__.py +0 -0
  75. tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
  76. tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
  77. tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
  78. tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
  79. tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
  80. tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
  81. tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
  82. tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
  83. tests/foundation/config/mail/__init__.py +0 -0
  84. tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
  85. tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
  86. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
  87. tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
  88. tests/foundation/config/queue/__init__.py +0 -0
  89. tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
  90. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
  91. tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
  92. tests/foundation/config/root/__init__.py +0 -0
  93. tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
  94. tests/foundation/config/session/__init__.py +0 -0
  95. tests/foundation/config/session/test_foundation_config_session.py +0 -213
  96. tests/foundation/config/startup/__init__.py +0 -0
  97. tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
  98. tests/foundation/config/testing/__init__.py +0 -0
  99. tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
  100. tests/metadata/__init__.py +0 -0
  101. tests/metadata/test_metadata_framework.py +0 -140
  102. tests/metadata/test_metadata_package.py +0 -139
  103. tests/services/__init__.py +0 -0
  104. tests/services/asynchrony/__init__.py +0 -0
  105. tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
  106. tests/services/environment/__init__.py +0 -0
  107. tests/services/environment/test_services_environment.py +0 -226
  108. tests/services/introspection/__init__.py +0 -0
  109. tests/services/introspection/dependencies/__init__.py +0 -0
  110. tests/services/introspection/dependencies/mocks/__init__.py +0 -0
  111. tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
  112. tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
  113. tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
  114. tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
  115. tests/services/introspection/reflection/__init__.py +0 -0
  116. tests/services/introspection/reflection/mock/__init__.py +0 -0
  117. tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
  118. tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
  119. tests/services/introspection/reflection/test_reflection_callable.py +0 -206
  120. tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
  121. tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
  122. tests/services/introspection/reflection/test_reflection_module.py +0 -567
  123. tests/services/introspection/test_reflection.py +0 -462
  124. tests/services/log/__init__.py +0 -0
  125. tests/services/log/test_log.py +0 -97
  126. tests/services/system/__init__.py +0 -0
  127. tests/services/system/test_services_system_imports.py +0 -204
  128. tests/services/system/test_services_system_workers.py +0 -131
  129. tests/support/__init__.py +0 -0
  130. tests/support/entities/__init__.py +0 -0
  131. tests/support/entities/mock_dataclass.py +0 -40
  132. tests/support/entities/test_base.py +0 -64
  133. tests/support/patterns/__init__.py +0 -0
  134. tests/support/patterns/singleton/__init__.py +0 -0
  135. tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
  136. tests/support/standard/__init__.py +0 -0
  137. tests/support/standard/test_services_std.py +0 -226
  138. tests/support/wrapper/__init__.py +0 -0
  139. tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
  140. tests/testing/__init__.py +0 -0
  141. tests/testing/cases/__init__.py +0 -0
  142. tests/testing/cases/test_testing_asynchronous.py +0 -63
  143. tests/testing/cases/test_testing_synchronous.py +0 -57
  144. tests/testing/entities/__init__.py +0 -0
  145. tests/testing/entities/test_testing_result.py +0 -146
  146. tests/testing/enums/__init__.py +0 -0
  147. tests/testing/enums/test_testing_status.py +0 -63
  148. tests/testing/output/__init__.py +0 -0
  149. tests/testing/output/test_testing_dumper.py +0 -29
  150. tests/testing/output/test_testing_printer.py +0 -42
  151. tests/testing/records/__init__.py +0 -0
  152. tests/testing/records/test_testing_records.py +0 -171
  153. tests/testing/test_testing_unit.py +0 -164
  154. tests/testing/validators/__init__.py +0 -0
  155. tests/testing/validators/test_testing_validators.py +0 -392
  156. tests/testing/view/__init__.py +0 -0
  157. tests/testing/view/test_render.py +0 -30
  158. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/WHEEL +0 -0
  159. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/licenses/LICENCE +0 -0
  160. {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/zip-safe +0 -0
@@ -1,268 +0,0 @@
1
- from orionis.container.container import Container
2
- from orionis.test.cases.asynchronous import AsyncTestCase
3
- from tests.container.mocks.mock_async_optimizations import AsyncTestService, AsyncTestServiceWithDependency, IAsyncTestService, IAsyncTestServiceWithDependency, ITestService, ITestServiceWithDependency, MixedService, TestService, TestServiceWithDependency, async_callable, async_callable_with_dependency, sync_callable, sync_callable_with_dependency
4
-
5
- class TestContainer(AsyncTestCase):
6
-
7
- async def testSyncServices(self):
8
- """
9
- Tests the registration and resolution of synchronous services in the container.
10
-
11
- This method verifies that singleton and transient services can be registered and resolved correctly.
12
- It checks that the singleton service returns the same instance on multiple resolutions, and that
13
- the service with a dependency is properly constructed.
14
-
15
- Returns
16
- -------
17
- None
18
- This method does not return a value. Assertions are used to validate behavior.
19
- """
20
-
21
- # Create a new container instance
22
- container = Container()
23
-
24
- # Register a singleton service and a transient service with dependency
25
- container.singleton(ITestService, TestService)
26
- container.transient(ITestServiceWithDependency, TestServiceWithDependency)
27
-
28
- # Resolve the singleton service and verify its method output
29
- service: ITestService = container.make(ITestService)
30
- self.assertEqual(service.get_message(), "Hello from sync service")
31
-
32
- # Resolve the transient service with dependency and check its output
33
- service_with_dep: ITestServiceWithDependency = container.make(ITestServiceWithDependency)
34
- self.assertTrue(service_with_dep.get_combined_message().startswith("Combined: "))
35
-
36
- # Ensure that singleton returns the same instance on multiple resolutions
37
- service2: ITestService = container.make(ITestService)
38
- self.assertIs(service, service2, "Singleton service should return the same instance")
39
-
40
- async def testAsyncServices(self):
41
- """
42
- Tests the registration and resolution of asynchronous services in the dependency injection container.
43
-
44
- This method ensures that asynchronous services can be registered as singletons or transients and resolved correctly.
45
- It verifies that the resolved service instance matches the expected implementation type.
46
-
47
- Parameters
48
- ----------
49
- self : TestContainer
50
- The test case instance.
51
-
52
- Returns
53
- -------
54
- None
55
- This method does not return a value. Assertions are used to validate correct behavior.
56
- """
57
-
58
- # Create a new container instance
59
- container = Container()
60
-
61
- # Register an asynchronous singleton service
62
- container.singleton(IAsyncTestService, AsyncTestService)
63
-
64
- # Register an asynchronous transient service with dependency
65
- container.transient(IAsyncTestServiceWithDependency, AsyncTestServiceWithDependency)
66
-
67
- # Resolve the asynchronous singleton service and check its type
68
- async_service = container.make(IAsyncTestService)
69
- self.assertIsInstance(async_service, AsyncTestService)
70
-
71
- async def testAsyncCalls(self):
72
- """
73
- Tests asynchronous service resolution and asynchronous method invocation in the dependency injection container.
74
-
75
- This method verifies that asynchronous services can be registered, resolved, and their asynchronous methods invoked correctly.
76
- It checks both singleton and transient registrations, and asserts that the returned values are as expected.
77
-
78
- Parameters
79
- ----------
80
- self : TestContainer
81
- The test case instance.
82
-
83
- Returns
84
- -------
85
- None
86
- This method does not return a value. Assertions are used to validate correct behavior.
87
- """
88
-
89
- # Create a new container instance
90
- container = Container()
91
-
92
- # Register an asynchronous singleton service
93
- container.singleton(IAsyncTestService, AsyncTestService)
94
-
95
- # Register an asynchronous transient service with dependency
96
- container.transient(IAsyncTestServiceWithDependency, AsyncTestServiceWithDependency)
97
-
98
- # Resolve the asynchronous singleton service
99
- async_service: IAsyncTestService = container.make(IAsyncTestService)
100
-
101
- # Call an asynchronous method on the resolved service and check the result
102
- result = await container.callAsync(async_service, 'get_async_message')
103
- self.assertEqual(result, "Hello from async service")
104
-
105
- # Resolve the asynchronous transient service with dependency
106
- service_with_dep: IAsyncTestServiceWithDependency = container.make(IAsyncTestServiceWithDependency)
107
-
108
- # Call an asynchronous method that combines results from dependencies and check the result
109
- result2: str = await container.callAsync(service_with_dep, 'get_combined_async_message')
110
- self.assertTrue(result2.startswith("Combined: "))
111
-
112
- async def testCallableRegistration(self):
113
- """
114
- Tests the registration and resolution of synchronous and asynchronous callables in the dependency injection container.
115
-
116
- This method verifies that:
117
- - Synchronous services can be registered as singletons.
118
- - Synchronous callables can be registered and resolved by name.
119
- - Callables with dependencies are correctly resolved and invoked.
120
- - The resolved callables return the expected results.
121
-
122
- Parameters
123
- ----------
124
- self : TestContainer
125
- The test case instance.
126
-
127
- Returns
128
- -------
129
- None
130
- This method does not return a value. Assertions are used to validate correct behavior.
131
- """
132
-
133
- # Create a new container instance
134
- container = Container()
135
-
136
- # Register base services as singletons
137
- container.singleton(ITestService, TestService)
138
- container.singleton(IAsyncTestService, AsyncTestService)
139
-
140
- # Register synchronous callables, including one with a dependency
141
- container.callable("sync_func", sync_callable)
142
- container.callable("sync_func_with_dep", sync_callable_with_dependency)
143
-
144
- # Resolve and invoke the synchronous callable, then check its result
145
- result1: str = container.make("sync_func")
146
- self.assertEqual(result1, "Sync callable result")
147
-
148
- # Resolve and invoke the callable with dependency, then check its result
149
- result2: str = container.make("sync_func_with_dep")
150
- self.assertTrue(result2.startswith("Callable with dependency: "))
151
-
152
- async def testAsyncCallables(self):
153
- """
154
- Tests registration, resolution, and invocation of asynchronous callables in the dependency injection container.
155
-
156
- This method ensures that:
157
- - Asynchronous callables can be registered using the `callable` method.
158
- - Registered asynchronous callables are resolved correctly from the container.
159
- - Dependencies for asynchronous callables are properly injected by the container.
160
- - The results returned by the asynchronous callables match the expected output.
161
-
162
- Parameters
163
- ----------
164
- self : TestContainer
165
- The test case instance.
166
-
167
- Returns
168
- -------
169
- None
170
- This method does not return a value. Assertions are used to validate correct behavior.
171
- """
172
-
173
- # Create a new container instance
174
- container = Container()
175
-
176
- # Register base services as singletons for dependency injection
177
- container.singleton(ITestService, TestService)
178
- container.singleton(IAsyncTestService, AsyncTestService)
179
-
180
- # Register asynchronous callables, including one with a dependency
181
- container.callable("async_func", async_callable)
182
- container.callable("async_func_with_dep", async_callable_with_dependency)
183
-
184
- # Resolve and invoke the asynchronous callable, then check its result
185
- result1: str = container.make("async_func")
186
- self.assertEqual(result1, "Async callable result")
187
-
188
- # Resolve and invoke the asynchronous callable with dependency, then check its result
189
- result2: str = container.make("async_func_with_dep")
190
- self.assertTrue(result2.startswith("Async callable with dependency: "))
191
-
192
- async def testMixedSyncAsync(self):
193
- """
194
- Tests the container's ability to integrate synchronous and asynchronous services and dependencies.
195
-
196
- This method registers both a synchronous service (`TestService`) and an asynchronous service (`AsyncTestService`)
197
- as singletons in the container. It then resolves a `MixedService` instance, which depends on both types of services,
198
- and invokes its synchronous method `get_sync_message` using the container's `call` method. The test asserts that
199
- the returned message from the synchronous method starts with "Mixed sync: ", verifying that the container can
200
- correctly handle and inject both synchronous and asynchronous dependencies into a mixed service.
201
-
202
- Parameters
203
- ----------
204
- self : TestContainer
205
- The test case instance.
206
-
207
- Returns
208
- -------
209
- None
210
- This method does not return a value. Assertions are used to validate correct behavior.
211
- """
212
-
213
- # Create a new container instance
214
- container = Container()
215
-
216
- # Register synchronous and asynchronous services as singletons
217
- container.singleton(ITestService, TestService)
218
- container.singleton(IAsyncTestService, AsyncTestService)
219
-
220
- # Resolve the mixed service, which depends on both sync and async services
221
- mixed_service = container.make(MixedService)
222
-
223
- # Invoke the synchronous method and check the result
224
- sync_result: str = container.call(mixed_service, 'get_sync_message')
225
- self.assertTrue(sync_result.startswith("Mixed sync: "))
226
-
227
- async def testMixedAsync(self):
228
- """
229
- Tests the container's ability to integrate synchronous and asynchronous services and dependencies,
230
- focusing on asynchronous method invocation.
231
-
232
- This method performs the following verifications:
233
- - Registers both a synchronous service (`TestService`) and an asynchronous service (`AsyncTestService`)
234
- as singletons in the container.
235
- - Resolves a `MixedService` instance, which depends on both types of services.
236
- - Invokes the asynchronous method `get_async_message` on the mixed service using `callAsync` and asserts
237
- that the returned message starts with "Mixed async: ".
238
- - Invokes the asynchronous method `get_both_messages` on the mixed service using `callAsync` and asserts
239
- that the returned message starts with "Both: ".
240
-
241
- Parameters
242
- ----------
243
- self : TestContainer
244
- The test case instance.
245
-
246
- Returns
247
- -------
248
- None
249
- This method does not return a value. Assertions are used to validate correct behavior.
250
- """
251
-
252
- # Create a new container instance
253
- container = Container()
254
-
255
- # Register synchronous and asynchronous services as singletons
256
- container.singleton(ITestService, TestService)
257
- container.singleton(IAsyncTestService, AsyncTestService)
258
-
259
- # Resolve the mixed service, which depends on both sync and async services
260
- mixed_service = container.make(MixedService)
261
-
262
- # Invoke the asynchronous method and check the result
263
- async_result: str = await container.callAsync(mixed_service, 'get_async_message')
264
- self.assertTrue(async_result.startswith("Mixed async: "))
265
-
266
- # Invoke the asynchronous method that combines both sync and async dependencies and check the result
267
- both_result = await container.callAsync(mixed_service, 'get_both_messages')
268
- self.assertTrue(both_result.startswith("Both: "))