orionis 0.546.0__py3-none-any.whl → 0.548.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.548.0.dist-info}/METADATA +1 -1
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/RECORD +14 -159
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/top_level.txt +0 -1
- orionis-0.546.0.dist-info/zip-safe +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.548.0.dist-info}/WHEEL +0 -0
- {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/licenses/LICENCE +0 -0
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.filesystems.entitites.aws import S3
|
|
2
|
-
from orionis.foundation.config.filesystems.entitites.disks import Disks
|
|
3
|
-
from orionis.foundation.config.filesystems.entitites.local import Local
|
|
4
|
-
from orionis.foundation.config.filesystems.entitites.public import Public
|
|
5
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
6
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
7
|
-
|
|
8
|
-
class TestFoundationConfigFilesystemsDisks(AsyncTestCase):
|
|
9
|
-
"""
|
|
10
|
-
Test cases for the Disks filesystem configuration class.
|
|
11
|
-
|
|
12
|
-
This class contains unit tests to validate the behavior and integrity of the
|
|
13
|
-
`Disks` configuration class, ensuring correct type validation, default values,
|
|
14
|
-
custom configuration handling, dictionary conversion, hashability, and
|
|
15
|
-
keyword-only initialization.
|
|
16
|
-
|
|
17
|
-
Methods
|
|
18
|
-
-------
|
|
19
|
-
testDefaultValues()
|
|
20
|
-
Test that Disks instance is created with correct default values.
|
|
21
|
-
testLocalTypeValidation()
|
|
22
|
-
Test local attribute type validation.
|
|
23
|
-
testPublicTypeValidation()
|
|
24
|
-
Test public attribute type validation.
|
|
25
|
-
testAwsTypeValidation()
|
|
26
|
-
Test aws attribute type validation.
|
|
27
|
-
testCustomDiskConfigurations()
|
|
28
|
-
Test that custom disk configurations are properly stored and validated.
|
|
29
|
-
testToDictMethod()
|
|
30
|
-
Test that toDict returns proper dictionary representation.
|
|
31
|
-
testHashability()
|
|
32
|
-
Test that Disks maintains hashability due to unsafe_hash=True.
|
|
33
|
-
testKwOnlyInitialization()
|
|
34
|
-
Test that Disks enforces keyword-only initialization.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
async def testDefaultValues(self):
|
|
38
|
-
"""
|
|
39
|
-
Test that Disks instance is created with correct default values.
|
|
40
|
-
|
|
41
|
-
Ensures that all default disk configurations are properly initialized.
|
|
42
|
-
|
|
43
|
-
Returns
|
|
44
|
-
-------
|
|
45
|
-
None
|
|
46
|
-
"""
|
|
47
|
-
disks = Disks()
|
|
48
|
-
self.assertIsInstance(disks.local, Local)
|
|
49
|
-
self.assertIsInstance(disks.public, Public)
|
|
50
|
-
self.assertIsInstance(disks.aws, S3)
|
|
51
|
-
|
|
52
|
-
async def testLocalTypeValidation(self):
|
|
53
|
-
"""
|
|
54
|
-
Test local attribute type validation.
|
|
55
|
-
|
|
56
|
-
Ensures that only `Local` instances are accepted for the `local` attribute.
|
|
57
|
-
|
|
58
|
-
Raises
|
|
59
|
-
------
|
|
60
|
-
OrionisIntegrityException
|
|
61
|
-
If the `local` attribute is not a `Local` instance.
|
|
62
|
-
"""
|
|
63
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
64
|
-
Disks(local="not_a_local_instance")
|
|
65
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
66
|
-
Disks(local=123)
|
|
67
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
68
|
-
Disks(local=None)
|
|
69
|
-
|
|
70
|
-
async def testPublicTypeValidation(self):
|
|
71
|
-
"""
|
|
72
|
-
Test public attribute type validation.
|
|
73
|
-
|
|
74
|
-
Ensures that only `Public` instances are accepted for the `public` attribute.
|
|
75
|
-
|
|
76
|
-
Raises
|
|
77
|
-
------
|
|
78
|
-
OrionisIntegrityException
|
|
79
|
-
If the `public` attribute is not a `Public` instance.
|
|
80
|
-
"""
|
|
81
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
82
|
-
Disks(public="not_a_public_instance")
|
|
83
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
84
|
-
Disks(public=123)
|
|
85
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
86
|
-
Disks(public=None)
|
|
87
|
-
|
|
88
|
-
async def testAwsTypeValidation(self):
|
|
89
|
-
"""
|
|
90
|
-
Test aws attribute type validation.
|
|
91
|
-
|
|
92
|
-
Ensures that only `S3` instances are accepted for the `aws` attribute.
|
|
93
|
-
|
|
94
|
-
Raises
|
|
95
|
-
------
|
|
96
|
-
OrionisIntegrityException
|
|
97
|
-
If the `aws` attribute is not an `S3` instance.
|
|
98
|
-
"""
|
|
99
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
100
|
-
Disks(aws="not_an_s3_instance")
|
|
101
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
102
|
-
Disks(aws=123)
|
|
103
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
104
|
-
Disks(aws=None)
|
|
105
|
-
|
|
106
|
-
async def testCustomDiskConfigurations(self):
|
|
107
|
-
"""
|
|
108
|
-
Test that custom disk configurations are properly stored and validated.
|
|
109
|
-
|
|
110
|
-
Ensures that custom disk configurations are correctly handled and their
|
|
111
|
-
attributes are properly set.
|
|
112
|
-
|
|
113
|
-
Returns
|
|
114
|
-
-------
|
|
115
|
-
None
|
|
116
|
-
"""
|
|
117
|
-
custom_local = Local(path="custom/local/path")
|
|
118
|
-
custom_public = Public(path="custom/public/path", url="assets")
|
|
119
|
-
custom_aws = S3(bucket="custom-bucket", region="eu-west-1")
|
|
120
|
-
|
|
121
|
-
disks = Disks(
|
|
122
|
-
local=custom_local,
|
|
123
|
-
public=custom_public,
|
|
124
|
-
aws=custom_aws
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
self.assertEqual(disks.local.path, "custom/local/path")
|
|
128
|
-
self.assertEqual(disks.public.path, "custom/public/path")
|
|
129
|
-
self.assertEqual(disks.public.url, "assets")
|
|
130
|
-
self.assertEqual(disks.aws.bucket, "custom-bucket")
|
|
131
|
-
self.assertEqual(disks.aws.region, "eu-west-1")
|
|
132
|
-
|
|
133
|
-
async def testToDictMethod(self):
|
|
134
|
-
"""
|
|
135
|
-
Test that toDict returns proper dictionary representation.
|
|
136
|
-
|
|
137
|
-
Ensures that all disk configurations are correctly included in the
|
|
138
|
-
dictionary representation.
|
|
139
|
-
|
|
140
|
-
Returns
|
|
141
|
-
-------
|
|
142
|
-
None
|
|
143
|
-
"""
|
|
144
|
-
disks = Disks()
|
|
145
|
-
disks_dict = disks.toDict()
|
|
146
|
-
|
|
147
|
-
self.assertIsInstance(disks_dict, dict)
|
|
148
|
-
self.assertIsInstance(disks_dict['local'], dict)
|
|
149
|
-
self.assertIsInstance(disks_dict['public'], dict)
|
|
150
|
-
self.assertIsInstance(disks_dict['aws'], dict)
|
|
151
|
-
|
|
152
|
-
async def testHashability(self):
|
|
153
|
-
"""
|
|
154
|
-
Test that Disks maintains hashability due to unsafe_hash=True.
|
|
155
|
-
|
|
156
|
-
Ensures that `Disks` instances can be used in sets and as dictionary keys.
|
|
157
|
-
|
|
158
|
-
Returns
|
|
159
|
-
-------
|
|
160
|
-
None
|
|
161
|
-
"""
|
|
162
|
-
disks1 = Disks()
|
|
163
|
-
disks2 = Disks()
|
|
164
|
-
disks_set = {disks1, disks2}
|
|
165
|
-
|
|
166
|
-
self.assertEqual(len(disks_set), 1)
|
|
167
|
-
|
|
168
|
-
custom_disks = Disks(local=Local(path="custom/path"))
|
|
169
|
-
disks_set.add(custom_disks)
|
|
170
|
-
self.assertEqual(len(disks_set), 2)
|
|
171
|
-
|
|
172
|
-
async def testKwOnlyInitialization(self):
|
|
173
|
-
"""
|
|
174
|
-
Test that Disks enforces keyword-only initialization.
|
|
175
|
-
|
|
176
|
-
Ensures that positional arguments are not allowed for initialization.
|
|
177
|
-
|
|
178
|
-
Raises
|
|
179
|
-
------
|
|
180
|
-
TypeError
|
|
181
|
-
If positional arguments are used for initialization.
|
|
182
|
-
"""
|
|
183
|
-
with self.assertRaises(TypeError):
|
|
184
|
-
Disks(Local(), Public(), S3())
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.filesystems.entitites.local import Local
|
|
2
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
3
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
-
|
|
5
|
-
class TestFoundationConfigFilesystemsLocal(AsyncTestCase):
|
|
6
|
-
"""
|
|
7
|
-
Test cases for the Local storage configuration class.
|
|
8
|
-
|
|
9
|
-
This class contains asynchronous unit tests for the `Local` storage configuration,
|
|
10
|
-
validating path handling, dictionary conversion, hashability, and initialization constraints.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
async def testDefaultPath(self):
|
|
14
|
-
"""
|
|
15
|
-
Test Local instance creation with default path.
|
|
16
|
-
|
|
17
|
-
Ensures that the default path of a Local instance matches the expected value.
|
|
18
|
-
|
|
19
|
-
Returns
|
|
20
|
-
-------
|
|
21
|
-
None
|
|
22
|
-
"""
|
|
23
|
-
local = Local()
|
|
24
|
-
self.assertEqual(local.path, "storage/app/private")
|
|
25
|
-
|
|
26
|
-
async def testCustomPath(self):
|
|
27
|
-
"""
|
|
28
|
-
Test setting a custom path during initialization.
|
|
29
|
-
|
|
30
|
-
Ensures that the path attribute accepts and stores valid custom paths.
|
|
31
|
-
|
|
32
|
-
Returns
|
|
33
|
-
-------
|
|
34
|
-
None
|
|
35
|
-
"""
|
|
36
|
-
custom_path = "custom/storage/path"
|
|
37
|
-
local = Local(path=custom_path)
|
|
38
|
-
self.assertEqual(local.path, custom_path)
|
|
39
|
-
|
|
40
|
-
async def testEmptyPathValidation(self):
|
|
41
|
-
"""
|
|
42
|
-
Test rejection of empty paths.
|
|
43
|
-
|
|
44
|
-
Ensures that initializing Local with an empty path raises OrionisIntegrityException.
|
|
45
|
-
|
|
46
|
-
Returns
|
|
47
|
-
-------
|
|
48
|
-
None
|
|
49
|
-
"""
|
|
50
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
51
|
-
Local(path="")
|
|
52
|
-
|
|
53
|
-
async def testPathTypeValidation(self):
|
|
54
|
-
"""
|
|
55
|
-
Test rejection of non-string paths.
|
|
56
|
-
|
|
57
|
-
Ensures that non-string path values raise OrionisIntegrityException.
|
|
58
|
-
|
|
59
|
-
Returns
|
|
60
|
-
-------
|
|
61
|
-
None
|
|
62
|
-
"""
|
|
63
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
64
|
-
Local(path=123)
|
|
65
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
66
|
-
Local(path=None)
|
|
67
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
68
|
-
Local(path=[])
|
|
69
|
-
|
|
70
|
-
async def testToDictMethod(self):
|
|
71
|
-
"""
|
|
72
|
-
Test dictionary representation of Local.
|
|
73
|
-
|
|
74
|
-
Ensures that toDict returns a dictionary containing the expected path value.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
None
|
|
79
|
-
"""
|
|
80
|
-
local = Local()
|
|
81
|
-
config_dict = local.toDict()
|
|
82
|
-
self.assertIsInstance(config_dict, dict)
|
|
83
|
-
self.assertEqual(config_dict['path'], "storage/app/private")
|
|
84
|
-
|
|
85
|
-
async def testCustomPathToDict(self):
|
|
86
|
-
"""
|
|
87
|
-
Test dictionary representation with custom path.
|
|
88
|
-
|
|
89
|
-
Ensures that toDict includes custom path values when specified.
|
|
90
|
-
|
|
91
|
-
Returns
|
|
92
|
-
-------
|
|
93
|
-
None
|
|
94
|
-
"""
|
|
95
|
-
custom_path = "another/storage/location"
|
|
96
|
-
local = Local(path=custom_path)
|
|
97
|
-
config_dict = local.toDict()
|
|
98
|
-
self.assertEqual(config_dict['path'], custom_path)
|
|
99
|
-
|
|
100
|
-
async def testWhitespacePathHandling(self):
|
|
101
|
-
"""
|
|
102
|
-
Test handling of paths with whitespace.
|
|
103
|
-
|
|
104
|
-
Ensures that paths containing whitespace are accepted and not automatically trimmed.
|
|
105
|
-
|
|
106
|
-
Returns
|
|
107
|
-
-------
|
|
108
|
-
None
|
|
109
|
-
"""
|
|
110
|
-
spaced_path = " storage/with/space "
|
|
111
|
-
local = Local(path=spaced_path)
|
|
112
|
-
self.assertEqual(local.path, spaced_path)
|
|
113
|
-
|
|
114
|
-
async def testHashability(self):
|
|
115
|
-
"""
|
|
116
|
-
Test hashability of Local instances.
|
|
117
|
-
|
|
118
|
-
Ensures that Local instances can be used in sets and as dictionary keys.
|
|
119
|
-
|
|
120
|
-
Returns
|
|
121
|
-
-------
|
|
122
|
-
None
|
|
123
|
-
"""
|
|
124
|
-
local1 = Local()
|
|
125
|
-
local2 = Local()
|
|
126
|
-
local_set = {local1, local2}
|
|
127
|
-
self.assertEqual(len(local_set), 1)
|
|
128
|
-
custom_local = Local(path="custom/path")
|
|
129
|
-
local_set.add(custom_local)
|
|
130
|
-
self.assertEqual(len(local_set), 2)
|
|
131
|
-
|
|
132
|
-
async def testKwOnlyInitialization(self):
|
|
133
|
-
"""
|
|
134
|
-
Test enforcement of keyword-only initialization.
|
|
135
|
-
|
|
136
|
-
Ensures that positional arguments are not allowed for Local initialization.
|
|
137
|
-
|
|
138
|
-
Returns
|
|
139
|
-
-------
|
|
140
|
-
None
|
|
141
|
-
"""
|
|
142
|
-
with self.assertRaises(TypeError):
|
|
143
|
-
Local("storage/path")
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
2
|
-
from orionis.foundation.config.filesystems.entitites.public import Public
|
|
3
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
-
|
|
5
|
-
class TestFoundationConfigFilesystemsPublic(AsyncTestCase):
|
|
6
|
-
"""
|
|
7
|
-
Asynchronous unit tests for the `Public` storage configuration class.
|
|
8
|
-
|
|
9
|
-
This class validates the behavior of the `Public` storage configuration, including
|
|
10
|
-
default and custom value assignment, input validation, dictionary conversion,
|
|
11
|
-
whitespace handling, hashability, and enforcement of keyword-only initialization.
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
async def testDefaultValues(self):
|
|
15
|
-
"""
|
|
16
|
-
Test creation of a Public instance with default values.
|
|
17
|
-
|
|
18
|
-
Ensures that the default `path` and `url` attributes are set as defined
|
|
19
|
-
in the class.
|
|
20
|
-
|
|
21
|
-
Returns
|
|
22
|
-
-------
|
|
23
|
-
None
|
|
24
|
-
"""
|
|
25
|
-
public = Public()
|
|
26
|
-
self.assertEqual(public.path, "storage/app/public")
|
|
27
|
-
self.assertEqual(public.url, "static")
|
|
28
|
-
|
|
29
|
-
async def testCustomValues(self):
|
|
30
|
-
"""
|
|
31
|
-
Test assignment of custom values to path and url.
|
|
32
|
-
|
|
33
|
-
Checks that custom `path` and `url` values are accepted and stored
|
|
34
|
-
correctly during initialization.
|
|
35
|
-
|
|
36
|
-
Returns
|
|
37
|
-
-------
|
|
38
|
-
None
|
|
39
|
-
"""
|
|
40
|
-
custom_path = "custom/public/path"
|
|
41
|
-
custom_url = "assets"
|
|
42
|
-
public = Public(path=custom_path, url=custom_url)
|
|
43
|
-
self.assertEqual(public.path, custom_path)
|
|
44
|
-
self.assertEqual(public.url, custom_url)
|
|
45
|
-
|
|
46
|
-
async def testEmptyPathValidation(self):
|
|
47
|
-
"""
|
|
48
|
-
Test validation for empty path values.
|
|
49
|
-
|
|
50
|
-
Verifies that providing an empty string for `path` raises
|
|
51
|
-
OrionisIntegrityException.
|
|
52
|
-
|
|
53
|
-
Returns
|
|
54
|
-
-------
|
|
55
|
-
None
|
|
56
|
-
"""
|
|
57
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
58
|
-
Public(path="")
|
|
59
|
-
|
|
60
|
-
async def testEmptyUrlValidation(self):
|
|
61
|
-
"""
|
|
62
|
-
Test validation for empty url values.
|
|
63
|
-
|
|
64
|
-
Verifies that providing an empty string for `url` raises
|
|
65
|
-
OrionisIntegrityException.
|
|
66
|
-
|
|
67
|
-
Returns
|
|
68
|
-
-------
|
|
69
|
-
None
|
|
70
|
-
"""
|
|
71
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
72
|
-
Public(url="")
|
|
73
|
-
|
|
74
|
-
async def testTypeValidation(self):
|
|
75
|
-
"""
|
|
76
|
-
Test type validation for path and url attributes.
|
|
77
|
-
|
|
78
|
-
Ensures that non-string values for `path` and `url` raise
|
|
79
|
-
OrionisIntegrityException.
|
|
80
|
-
|
|
81
|
-
Returns
|
|
82
|
-
-------
|
|
83
|
-
None
|
|
84
|
-
"""
|
|
85
|
-
# Test path validation
|
|
86
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
87
|
-
Public(path=123)
|
|
88
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
89
|
-
Public(path=None)
|
|
90
|
-
|
|
91
|
-
# Test url validation
|
|
92
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
93
|
-
Public(url=123)
|
|
94
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
95
|
-
Public(url=None)
|
|
96
|
-
|
|
97
|
-
async def testToDictMethod(self):
|
|
98
|
-
"""
|
|
99
|
-
Test the toDict method for correct dictionary output.
|
|
100
|
-
|
|
101
|
-
Ensures that the dictionary representation contains the correct
|
|
102
|
-
default values for `path` and `url`.
|
|
103
|
-
|
|
104
|
-
Returns
|
|
105
|
-
-------
|
|
106
|
-
None
|
|
107
|
-
"""
|
|
108
|
-
public = Public()
|
|
109
|
-
config_dict = public.toDict()
|
|
110
|
-
|
|
111
|
-
self.assertIsInstance(config_dict, dict)
|
|
112
|
-
self.assertEqual(config_dict['path'], "storage/app/public")
|
|
113
|
-
self.assertEqual(config_dict['url'], "static")
|
|
114
|
-
|
|
115
|
-
async def testCustomValuesToDict(self):
|
|
116
|
-
"""
|
|
117
|
-
Test dictionary output with custom values.
|
|
118
|
-
|
|
119
|
-
Ensures that the dictionary representation includes custom
|
|
120
|
-
`path` and `url` values when specified.
|
|
121
|
-
|
|
122
|
-
Returns
|
|
123
|
-
-------
|
|
124
|
-
None
|
|
125
|
-
"""
|
|
126
|
-
custom_path = "public/assets"
|
|
127
|
-
custom_url = "cdn"
|
|
128
|
-
public = Public(path=custom_path, url=custom_url)
|
|
129
|
-
config_dict = public.toDict()
|
|
130
|
-
|
|
131
|
-
self.assertEqual(config_dict['path'], custom_path)
|
|
132
|
-
self.assertEqual(config_dict['url'], custom_url)
|
|
133
|
-
|
|
134
|
-
async def testWhitespaceHandling(self):
|
|
135
|
-
"""
|
|
136
|
-
Test handling of whitespace in attribute values.
|
|
137
|
-
|
|
138
|
-
Verifies that values containing whitespace are accepted and
|
|
139
|
-
not automatically trimmed.
|
|
140
|
-
|
|
141
|
-
Returns
|
|
142
|
-
-------
|
|
143
|
-
None
|
|
144
|
-
"""
|
|
145
|
-
spaced_path = " public/storage "
|
|
146
|
-
spaced_url = " static/files "
|
|
147
|
-
public = Public(path=spaced_path, url=spaced_url)
|
|
148
|
-
self.assertEqual(public.path, spaced_path)
|
|
149
|
-
self.assertEqual(public.url, spaced_url)
|
|
150
|
-
|
|
151
|
-
async def testHashability(self):
|
|
152
|
-
"""
|
|
153
|
-
Test hashability of Public instances.
|
|
154
|
-
|
|
155
|
-
Ensures that Public instances are hashable and can be used in sets
|
|
156
|
-
and as dictionary keys due to `unsafe_hash=True`.
|
|
157
|
-
|
|
158
|
-
Returns
|
|
159
|
-
-------
|
|
160
|
-
None
|
|
161
|
-
"""
|
|
162
|
-
public1 = Public()
|
|
163
|
-
public2 = Public()
|
|
164
|
-
public_set = {public1, public2}
|
|
165
|
-
|
|
166
|
-
self.assertEqual(len(public_set), 1)
|
|
167
|
-
|
|
168
|
-
custom_public = Public(path="custom/public", url="custom-url")
|
|
169
|
-
public_set.add(custom_public)
|
|
170
|
-
self.assertEqual(len(public_set), 2)
|
|
171
|
-
|
|
172
|
-
async def testKwOnlyInitialization(self):
|
|
173
|
-
"""
|
|
174
|
-
Test enforcement of keyword-only initialization.
|
|
175
|
-
|
|
176
|
-
Verifies that positional arguments are not allowed when initializing
|
|
177
|
-
a Public instance.
|
|
178
|
-
|
|
179
|
-
Returns
|
|
180
|
-
-------
|
|
181
|
-
None
|
|
182
|
-
"""
|
|
183
|
-
with self.assertRaises(TypeError):
|
|
184
|
-
Public("storage/path", "static")
|
|
File without changes
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.logging.entities.logging import Logging
|
|
2
|
-
from orionis.foundation.config.logging.entities.channels import Channels
|
|
3
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
|
|
6
|
-
class TestFoundationConfigLogging(AsyncTestCase):
|
|
7
|
-
"""
|
|
8
|
-
Unit tests for the Logging class.
|
|
9
|
-
|
|
10
|
-
This test suite verifies the correct initialization, dictionary conversion,
|
|
11
|
-
post-initialization validation, and keyword-only argument enforcement of the
|
|
12
|
-
Logging class.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
async def testDefaultValues(self):
|
|
16
|
-
"""
|
|
17
|
-
Test default values of Logging.
|
|
18
|
-
|
|
19
|
-
Ensures that a new Logging instance is initialized with the correct default values.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
self : TestLogging
|
|
24
|
-
The test case instance.
|
|
25
|
-
|
|
26
|
-
Returns
|
|
27
|
-
-------
|
|
28
|
-
None
|
|
29
|
-
|
|
30
|
-
Raises
|
|
31
|
-
------
|
|
32
|
-
AssertionError
|
|
33
|
-
If the default values are not as expected.
|
|
34
|
-
"""
|
|
35
|
-
logging = Logging()
|
|
36
|
-
self.assertEqual(logging.default, "stack")
|
|
37
|
-
self.assertIsInstance(logging.channels, Channels)
|
|
38
|
-
|
|
39
|
-
async def testToDictMethod(self):
|
|
40
|
-
"""
|
|
41
|
-
Test the toDict method of Logging.
|
|
42
|
-
|
|
43
|
-
Checks that the toDict method returns a dictionary representation with all expected fields.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
self : TestLogging
|
|
48
|
-
The test case instance.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
None
|
|
53
|
-
|
|
54
|
-
Raises
|
|
55
|
-
------
|
|
56
|
-
AssertionError
|
|
57
|
-
If the dictionary representation is not as expected.
|
|
58
|
-
"""
|
|
59
|
-
logging = Logging()
|
|
60
|
-
result = logging.toDict()
|
|
61
|
-
self.assertIsInstance(result, dict)
|
|
62
|
-
self.assertIn("default", result)
|
|
63
|
-
self.assertIn("channels", result)
|
|
64
|
-
|
|
65
|
-
async def testPostInitValidation(self):
|
|
66
|
-
"""
|
|
67
|
-
Test post-initialization validation of Logging.
|
|
68
|
-
|
|
69
|
-
Verifies that providing an invalid default channel or channels type raises an exception.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
self : TestLogging
|
|
74
|
-
The test case instance.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
None
|
|
79
|
-
|
|
80
|
-
Raises
|
|
81
|
-
------
|
|
82
|
-
AssertionError
|
|
83
|
-
If the expected exception is not raised.
|
|
84
|
-
"""
|
|
85
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
86
|
-
Logging(default="invalid_channel")
|
|
87
|
-
|
|
88
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
89
|
-
Logging(channels="invalid_channels")
|
|
90
|
-
|
|
91
|
-
async def testKwOnlyInitialization(self):
|
|
92
|
-
"""
|
|
93
|
-
Test keyword-only initialization enforcement.
|
|
94
|
-
|
|
95
|
-
Ensures that Logging requires keyword arguments for initialization.
|
|
96
|
-
|
|
97
|
-
Parameters
|
|
98
|
-
----------
|
|
99
|
-
self : TestLogging
|
|
100
|
-
The test case instance.
|
|
101
|
-
|
|
102
|
-
Returns
|
|
103
|
-
-------
|
|
104
|
-
None
|
|
105
|
-
|
|
106
|
-
Raises
|
|
107
|
-
------
|
|
108
|
-
AssertionError
|
|
109
|
-
If TypeError is not raised when using positional arguments.
|
|
110
|
-
"""
|
|
111
|
-
with self.assertRaises(TypeError):
|
|
112
|
-
Logging("stack", Channels())
|