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,203 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.database.entities.connections import Connections
|
|
2
|
-
from orionis.foundation.config.database.entities.mysql import MySQL
|
|
3
|
-
from orionis.foundation.config.database.entities.oracle import Oracle
|
|
4
|
-
from orionis.foundation.config.database.entities.pgsql import PGSQL
|
|
5
|
-
from orionis.foundation.config.database.entities.sqlite import SQLite
|
|
6
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
7
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
8
|
-
|
|
9
|
-
class TestFoundationConfigDatabaseConnections(AsyncTestCase):
|
|
10
|
-
"""
|
|
11
|
-
Test cases for the Connections configuration class.
|
|
12
|
-
|
|
13
|
-
This class contains unit tests to validate the behavior and integrity of the
|
|
14
|
-
Connections class, ensuring correct type validation, default values, dictionary
|
|
15
|
-
representation, custom connection handling, hashability, and keyword-only initialization.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
async def testDefaultValues(self):
|
|
19
|
-
"""
|
|
20
|
-
Test that Connections instance is created with correct default values.
|
|
21
|
-
|
|
22
|
-
Verifies all default connections are properly initialized with their respective types.
|
|
23
|
-
|
|
24
|
-
Returns
|
|
25
|
-
-------
|
|
26
|
-
None
|
|
27
|
-
"""
|
|
28
|
-
connections = Connections()
|
|
29
|
-
self.assertIsInstance(connections.sqlite, SQLite)
|
|
30
|
-
self.assertIsInstance(connections.mysql, MySQL)
|
|
31
|
-
self.assertIsInstance(connections.pgsql, PGSQL)
|
|
32
|
-
self.assertIsInstance(connections.oracle, Oracle)
|
|
33
|
-
|
|
34
|
-
async def testSqliteTypeValidation(self):
|
|
35
|
-
"""
|
|
36
|
-
Test sqlite attribute type validation.
|
|
37
|
-
|
|
38
|
-
Verifies that only SQLite instances are accepted for the sqlite attribute.
|
|
39
|
-
|
|
40
|
-
Returns
|
|
41
|
-
-------
|
|
42
|
-
None
|
|
43
|
-
|
|
44
|
-
Raises
|
|
45
|
-
------
|
|
46
|
-
OrionisIntegrityException
|
|
47
|
-
If the sqlite attribute is not a valid SQLite instance.
|
|
48
|
-
"""
|
|
49
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
50
|
-
Connections(sqlite="not_a_sqlite_instance")
|
|
51
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
52
|
-
Connections(sqlite=123)
|
|
53
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
54
|
-
Connections(sqlite=None)
|
|
55
|
-
|
|
56
|
-
async def testMysqlTypeValidation(self):
|
|
57
|
-
"""
|
|
58
|
-
Test mysql attribute type validation.
|
|
59
|
-
|
|
60
|
-
Verifies that only MySQL instances are accepted for the mysql attribute.
|
|
61
|
-
|
|
62
|
-
Returns
|
|
63
|
-
-------
|
|
64
|
-
None
|
|
65
|
-
|
|
66
|
-
Raises
|
|
67
|
-
------
|
|
68
|
-
OrionisIntegrityException
|
|
69
|
-
If the mysql attribute is not a valid MySQL instance.
|
|
70
|
-
"""
|
|
71
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
72
|
-
Connections(mysql="not_a_mysql_instance")
|
|
73
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
74
|
-
Connections(mysql=123)
|
|
75
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
76
|
-
Connections(mysql=None)
|
|
77
|
-
|
|
78
|
-
async def testPgsqlTypeValidation(self):
|
|
79
|
-
"""
|
|
80
|
-
Test pgsql attribute type validation.
|
|
81
|
-
|
|
82
|
-
Verifies that only PGSQL instances are accepted for the pgsql attribute.
|
|
83
|
-
|
|
84
|
-
Returns
|
|
85
|
-
-------
|
|
86
|
-
None
|
|
87
|
-
|
|
88
|
-
Raises
|
|
89
|
-
------
|
|
90
|
-
OrionisIntegrityException
|
|
91
|
-
If the pgsql attribute is not a valid PGSQL instance.
|
|
92
|
-
"""
|
|
93
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
94
|
-
Connections(pgsql="not_a_pgsql_instance")
|
|
95
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
96
|
-
Connections(pgsql=123)
|
|
97
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
98
|
-
Connections(pgsql=None)
|
|
99
|
-
|
|
100
|
-
async def testOracleTypeValidation(self):
|
|
101
|
-
"""
|
|
102
|
-
Test oracle attribute type validation.
|
|
103
|
-
|
|
104
|
-
Verifies that only Oracle instances are accepted for the oracle attribute.
|
|
105
|
-
|
|
106
|
-
Returns
|
|
107
|
-
-------
|
|
108
|
-
None
|
|
109
|
-
|
|
110
|
-
Raises
|
|
111
|
-
------
|
|
112
|
-
OrionisIntegrityException
|
|
113
|
-
If the oracle attribute is not a valid Oracle instance.
|
|
114
|
-
"""
|
|
115
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
116
|
-
Connections(oracle="not_an_oracle_instance")
|
|
117
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
118
|
-
Connections(oracle=123)
|
|
119
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
120
|
-
Connections(oracle=None)
|
|
121
|
-
|
|
122
|
-
async def testToDictMethod(self):
|
|
123
|
-
"""
|
|
124
|
-
Test that toDict returns proper dictionary representation.
|
|
125
|
-
|
|
126
|
-
Verifies all connections are correctly included in the dictionary.
|
|
127
|
-
|
|
128
|
-
Returns
|
|
129
|
-
-------
|
|
130
|
-
None
|
|
131
|
-
"""
|
|
132
|
-
connections = Connections()
|
|
133
|
-
connections_dict = connections.toDict()
|
|
134
|
-
self.assertIsInstance(connections_dict, dict)
|
|
135
|
-
self.assertIsInstance(connections_dict['sqlite'], dict)
|
|
136
|
-
self.assertIsInstance(connections_dict['mysql'], dict)
|
|
137
|
-
self.assertIsInstance(connections_dict['pgsql'], dict)
|
|
138
|
-
self.assertIsInstance(connections_dict['oracle'], dict)
|
|
139
|
-
|
|
140
|
-
async def testCustomConnections(self):
|
|
141
|
-
"""
|
|
142
|
-
Test that custom connections are properly stored and validated.
|
|
143
|
-
|
|
144
|
-
Verifies custom connection configurations are correctly handled.
|
|
145
|
-
|
|
146
|
-
Returns
|
|
147
|
-
-------
|
|
148
|
-
None
|
|
149
|
-
"""
|
|
150
|
-
custom_sqlite = SQLite(database='custom.db')
|
|
151
|
-
custom_mysql = MySQL(database='custom_db')
|
|
152
|
-
custom_pgsql = PGSQL(database='custom_db')
|
|
153
|
-
custom_oracle = Oracle(service_name='CUSTOM_SID')
|
|
154
|
-
|
|
155
|
-
connections = Connections(
|
|
156
|
-
sqlite=custom_sqlite,
|
|
157
|
-
mysql=custom_mysql,
|
|
158
|
-
pgsql=custom_pgsql,
|
|
159
|
-
oracle=custom_oracle
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
self.assertEqual(connections.sqlite.database, 'custom.db')
|
|
163
|
-
self.assertEqual(connections.mysql.database, 'custom_db')
|
|
164
|
-
self.assertEqual(connections.pgsql.database, 'custom_db')
|
|
165
|
-
self.assertEqual(connections.oracle.service_name, 'CUSTOM_SID')
|
|
166
|
-
|
|
167
|
-
async def testHashability(self):
|
|
168
|
-
"""
|
|
169
|
-
Test that Connections maintains hashability due to unsafe_hash=True.
|
|
170
|
-
|
|
171
|
-
Verifies that Connections instances can be used in sets and as dictionary keys.
|
|
172
|
-
|
|
173
|
-
Returns
|
|
174
|
-
-------
|
|
175
|
-
None
|
|
176
|
-
"""
|
|
177
|
-
conn1 = Connections()
|
|
178
|
-
conn2 = Connections()
|
|
179
|
-
conn_set = {conn1, conn2}
|
|
180
|
-
|
|
181
|
-
self.assertEqual(len(conn_set), 1)
|
|
182
|
-
|
|
183
|
-
custom_conn = Connections(sqlite=SQLite(database='custom.db'))
|
|
184
|
-
conn_set.add(custom_conn)
|
|
185
|
-
self.assertEqual(len(conn_set), 2)
|
|
186
|
-
|
|
187
|
-
async def testKwOnlyInitialization(self):
|
|
188
|
-
"""
|
|
189
|
-
Test that Connections enforces keyword-only initialization.
|
|
190
|
-
|
|
191
|
-
Verifies that positional arguments are not allowed for initialization.
|
|
192
|
-
|
|
193
|
-
Returns
|
|
194
|
-
-------
|
|
195
|
-
None
|
|
196
|
-
|
|
197
|
-
Raises
|
|
198
|
-
------
|
|
199
|
-
TypeError
|
|
200
|
-
If positional arguments are used for initialization.
|
|
201
|
-
"""
|
|
202
|
-
with self.assertRaises(TypeError):
|
|
203
|
-
Connections(SQLite(), MySQL(), PGSQL(), Oracle())
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
from orionis.foundation.config.database.entities.mysql import MySQL
|
|
2
|
-
from orionis.foundation.config.database.enums.mysql_charsets import MySQLCharset
|
|
3
|
-
from orionis.foundation.config.database.enums.mysql_collations import MySQLCollation
|
|
4
|
-
from orionis.foundation.config.database.enums.mysql_engine import MySQLEngine
|
|
5
|
-
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
6
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
7
|
-
|
|
8
|
-
class TestFoundationConfigDatabaseMysql(AsyncTestCase):
|
|
9
|
-
"""
|
|
10
|
-
Test cases for the MySQL database configuration class.
|
|
11
|
-
|
|
12
|
-
This class contains asynchronous unit tests for validating the behavior,
|
|
13
|
-
default values, and input validation of the `MySQL` configuration entity.
|
|
14
|
-
|
|
15
|
-
Attributes
|
|
16
|
-
----------
|
|
17
|
-
None
|
|
18
|
-
|
|
19
|
-
Methods
|
|
20
|
-
-------
|
|
21
|
-
testDefaultValues()
|
|
22
|
-
Test that MySQL instance is created with correct default values.
|
|
23
|
-
testDriverValidation()
|
|
24
|
-
Test driver attribute validation.
|
|
25
|
-
testHostValidation()
|
|
26
|
-
Test host attribute validation.
|
|
27
|
-
testPortValidation()
|
|
28
|
-
Test port attribute validation.
|
|
29
|
-
testDatabaseValidation()
|
|
30
|
-
Test database attribute validation.
|
|
31
|
-
testUsernameValidation()
|
|
32
|
-
Test username attribute validation.
|
|
33
|
-
testPasswordValidation()
|
|
34
|
-
Test password attribute validation.
|
|
35
|
-
testUnixSocketValidation()
|
|
36
|
-
Test unix_socket attribute validation.
|
|
37
|
-
testCharsetValidation()
|
|
38
|
-
Test charset attribute validation.
|
|
39
|
-
testCollationValidation()
|
|
40
|
-
Test collation attribute validation.
|
|
41
|
-
testPrefixValidation()
|
|
42
|
-
Test prefix attribute validation.
|
|
43
|
-
testPrefixIndexesValidation()
|
|
44
|
-
Test prefix_indexes attribute validation.
|
|
45
|
-
testStrictValidation()
|
|
46
|
-
Test strict attribute validation.
|
|
47
|
-
testEngineValidation()
|
|
48
|
-
Test engine attribute validation.
|
|
49
|
-
testToDictMethod()
|
|
50
|
-
Test that toDict returns proper dictionary representation.
|
|
51
|
-
testCustomValues()
|
|
52
|
-
Test that custom values are properly stored and validated.
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
async def testDefaultValues(self):
|
|
56
|
-
"""
|
|
57
|
-
Test that MySQL instance is created with correct default values.
|
|
58
|
-
|
|
59
|
-
Verifies all default values match expected defaults from class definition.
|
|
60
|
-
"""
|
|
61
|
-
mysql = MySQL()
|
|
62
|
-
self.assertEqual(mysql.driver, 'mysql')
|
|
63
|
-
self.assertEqual(mysql.host, '127.0.0.1')
|
|
64
|
-
self.assertEqual(mysql.port, 3306)
|
|
65
|
-
self.assertEqual(mysql.database, 'orionis')
|
|
66
|
-
self.assertEqual(mysql.username, 'root')
|
|
67
|
-
self.assertEqual(mysql.password, '')
|
|
68
|
-
self.assertEqual(mysql.unix_socket, '')
|
|
69
|
-
self.assertEqual(mysql.charset, MySQLCharset.UTF8MB4.value)
|
|
70
|
-
self.assertEqual(mysql.collation, MySQLCollation.UTF8MB4_UNICODE_CI.value)
|
|
71
|
-
self.assertEqual(mysql.prefix, '')
|
|
72
|
-
self.assertTrue(mysql.prefix_indexes)
|
|
73
|
-
self.assertTrue(mysql.strict)
|
|
74
|
-
self.assertEqual(mysql.engine, MySQLEngine.INNODB.value)
|
|
75
|
-
|
|
76
|
-
async def testDriverValidation(self):
|
|
77
|
-
"""
|
|
78
|
-
Test driver attribute validation.
|
|
79
|
-
|
|
80
|
-
Ensures that only 'mysql' value is accepted for driver.
|
|
81
|
-
|
|
82
|
-
Raises
|
|
83
|
-
------
|
|
84
|
-
OrionisIntegrityException
|
|
85
|
-
If the driver value is invalid.
|
|
86
|
-
"""
|
|
87
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
88
|
-
MySQL(driver='')
|
|
89
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
90
|
-
MySQL(driver='postgres')
|
|
91
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
92
|
-
MySQL(driver=123)
|
|
93
|
-
|
|
94
|
-
async def testHostValidation(self):
|
|
95
|
-
"""
|
|
96
|
-
Test host attribute validation.
|
|
97
|
-
|
|
98
|
-
Ensures that empty or non-string hosts raise exceptions.
|
|
99
|
-
|
|
100
|
-
Raises
|
|
101
|
-
------
|
|
102
|
-
OrionisIntegrityException
|
|
103
|
-
If the host value is invalid.
|
|
104
|
-
"""
|
|
105
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
106
|
-
MySQL(host='')
|
|
107
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
108
|
-
MySQL(host=123)
|
|
109
|
-
|
|
110
|
-
async def testPortValidation(self):
|
|
111
|
-
"""
|
|
112
|
-
Test port attribute validation.
|
|
113
|
-
|
|
114
|
-
Ensures invalid port numbers raise exceptions.
|
|
115
|
-
|
|
116
|
-
Raises
|
|
117
|
-
------
|
|
118
|
-
OrionisIntegrityException
|
|
119
|
-
If the port value is invalid.
|
|
120
|
-
"""
|
|
121
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
122
|
-
MySQL(port=0)
|
|
123
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
124
|
-
MySQL(port=65536)
|
|
125
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
126
|
-
MySQL(port='3306')
|
|
127
|
-
|
|
128
|
-
async def testDatabaseValidation(self):
|
|
129
|
-
"""
|
|
130
|
-
Test database attribute validation.
|
|
131
|
-
|
|
132
|
-
Ensures that empty or non-string database names raise exceptions.
|
|
133
|
-
|
|
134
|
-
Raises
|
|
135
|
-
------
|
|
136
|
-
OrionisIntegrityException
|
|
137
|
-
If the database value is invalid.
|
|
138
|
-
"""
|
|
139
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
140
|
-
MySQL(database='')
|
|
141
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
142
|
-
MySQL(database=123)
|
|
143
|
-
|
|
144
|
-
async def testUsernameValidation(self):
|
|
145
|
-
"""
|
|
146
|
-
Test username attribute validation.
|
|
147
|
-
|
|
148
|
-
Ensures that empty or non-string usernames raise exceptions.
|
|
149
|
-
|
|
150
|
-
Raises
|
|
151
|
-
------
|
|
152
|
-
OrionisIntegrityException
|
|
153
|
-
If the username value is invalid.
|
|
154
|
-
"""
|
|
155
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
156
|
-
MySQL(username='')
|
|
157
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
158
|
-
MySQL(username=123)
|
|
159
|
-
|
|
160
|
-
async def testPasswordValidation(self):
|
|
161
|
-
"""
|
|
162
|
-
Test password attribute validation.
|
|
163
|
-
|
|
164
|
-
Ensures that non-string passwords raise exceptions.
|
|
165
|
-
|
|
166
|
-
Raises
|
|
167
|
-
------
|
|
168
|
-
OrionisIntegrityException
|
|
169
|
-
If the password value is invalid.
|
|
170
|
-
"""
|
|
171
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
172
|
-
MySQL(password=123)
|
|
173
|
-
|
|
174
|
-
async def testUnixSocketValidation(self):
|
|
175
|
-
"""
|
|
176
|
-
Test unix_socket attribute validation.
|
|
177
|
-
|
|
178
|
-
Ensures that non-string socket paths raise exceptions.
|
|
179
|
-
|
|
180
|
-
Raises
|
|
181
|
-
------
|
|
182
|
-
OrionisIntegrityException
|
|
183
|
-
If the unix_socket value is invalid.
|
|
184
|
-
"""
|
|
185
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
186
|
-
MySQL(unix_socket=123)
|
|
187
|
-
|
|
188
|
-
async def testCharsetValidation(self):
|
|
189
|
-
"""
|
|
190
|
-
Test charset attribute validation.
|
|
191
|
-
|
|
192
|
-
Ensures enum conversion and invalid value handling.
|
|
193
|
-
|
|
194
|
-
Raises
|
|
195
|
-
------
|
|
196
|
-
OrionisIntegrityException
|
|
197
|
-
If the charset value is invalid.
|
|
198
|
-
"""
|
|
199
|
-
# Test string conversion
|
|
200
|
-
mysql = MySQL(charset='UTF8')
|
|
201
|
-
self.assertEqual(mysql.charset, MySQLCharset.UTF8.value)
|
|
202
|
-
# Test enum assignment
|
|
203
|
-
mysql = MySQL(charset=MySQLCharset.LATIN1)
|
|
204
|
-
self.assertEqual(mysql.charset, MySQLCharset.LATIN1.value)
|
|
205
|
-
|
|
206
|
-
# Test invalid value
|
|
207
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
208
|
-
MySQL(charset='INVALID')
|
|
209
|
-
|
|
210
|
-
async def testCollationValidation(self):
|
|
211
|
-
"""
|
|
212
|
-
Test collation attribute validation.
|
|
213
|
-
|
|
214
|
-
Ensures enum conversion and invalid value handling.
|
|
215
|
-
|
|
216
|
-
Raises
|
|
217
|
-
------
|
|
218
|
-
OrionisIntegrityException
|
|
219
|
-
If the collation value is invalid.
|
|
220
|
-
"""
|
|
221
|
-
# Test string conversion
|
|
222
|
-
mysql = MySQL(collation='UTF8_GENERAL_CI')
|
|
223
|
-
self.assertEqual(mysql.collation, MySQLCollation.UTF8_GENERAL_CI.value)
|
|
224
|
-
# Test enum assignment
|
|
225
|
-
mysql = MySQL(collation=MySQLCollation.UTF8MB4_BIN)
|
|
226
|
-
self.assertEqual(mysql.collation, MySQLCollation.UTF8MB4_BIN.value)
|
|
227
|
-
|
|
228
|
-
# Test invalid value
|
|
229
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
230
|
-
MySQL(collation='INVALID')
|
|
231
|
-
|
|
232
|
-
async def testPrefixValidation(self):
|
|
233
|
-
"""
|
|
234
|
-
Test prefix attribute validation.
|
|
235
|
-
|
|
236
|
-
Ensures that non-string prefixes raise exceptions.
|
|
237
|
-
|
|
238
|
-
Raises
|
|
239
|
-
------
|
|
240
|
-
OrionisIntegrityException
|
|
241
|
-
If the prefix value is invalid.
|
|
242
|
-
"""
|
|
243
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
244
|
-
MySQL(prefix=123)
|
|
245
|
-
|
|
246
|
-
async def testPrefixIndexesValidation(self):
|
|
247
|
-
"""
|
|
248
|
-
Test prefix_indexes attribute validation.
|
|
249
|
-
|
|
250
|
-
Ensures that non-boolean values raise exceptions.
|
|
251
|
-
|
|
252
|
-
Raises
|
|
253
|
-
------
|
|
254
|
-
OrionisIntegrityException
|
|
255
|
-
If the prefix_indexes value is invalid.
|
|
256
|
-
"""
|
|
257
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
258
|
-
MySQL(prefix_indexes='true')
|
|
259
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
260
|
-
MySQL(prefix_indexes=1)
|
|
261
|
-
|
|
262
|
-
async def testStrictValidation(self):
|
|
263
|
-
"""
|
|
264
|
-
Test strict attribute validation.
|
|
265
|
-
|
|
266
|
-
Ensures that non-boolean values raise exceptions.
|
|
267
|
-
|
|
268
|
-
Raises
|
|
269
|
-
------
|
|
270
|
-
OrionisIntegrityException
|
|
271
|
-
If the strict value is invalid.
|
|
272
|
-
"""
|
|
273
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
274
|
-
MySQL(strict='true')
|
|
275
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
276
|
-
MySQL(strict=1)
|
|
277
|
-
|
|
278
|
-
async def testEngineValidation(self):
|
|
279
|
-
"""
|
|
280
|
-
Test engine attribute validation.
|
|
281
|
-
|
|
282
|
-
Ensures enum conversion and invalid value handling.
|
|
283
|
-
|
|
284
|
-
Raises
|
|
285
|
-
------
|
|
286
|
-
OrionisIntegrityException
|
|
287
|
-
If the engine value is invalid.
|
|
288
|
-
"""
|
|
289
|
-
# Test string conversion
|
|
290
|
-
mysql = MySQL(engine='MYISAM')
|
|
291
|
-
self.assertEqual(mysql.engine, MySQLEngine.MYISAM.value)
|
|
292
|
-
|
|
293
|
-
# Test enum assignment
|
|
294
|
-
mysql = MySQL(engine=MySQLEngine.MEMORY)
|
|
295
|
-
self.assertEqual(mysql.engine, MySQLEngine.MEMORY.value)
|
|
296
|
-
|
|
297
|
-
# Test invalid value
|
|
298
|
-
with self.assertRaises(OrionisIntegrityException):
|
|
299
|
-
MySQL(engine='INVALID')
|
|
300
|
-
|
|
301
|
-
async def testToDictMethod(self):
|
|
302
|
-
"""
|
|
303
|
-
Test that toDict returns proper dictionary representation.
|
|
304
|
-
|
|
305
|
-
Ensures all attributes are correctly included in dictionary.
|
|
306
|
-
"""
|
|
307
|
-
mysql = MySQL()
|
|
308
|
-
mysql_dict = mysql.toDict()
|
|
309
|
-
self.assertEqual(mysql_dict['driver'], 'mysql')
|
|
310
|
-
self.assertEqual(mysql_dict['host'], '127.0.0.1')
|
|
311
|
-
self.assertEqual(mysql_dict['port'], 3306)
|
|
312
|
-
self.assertEqual(mysql_dict['database'], 'orionis')
|
|
313
|
-
self.assertEqual(mysql_dict['username'], 'root')
|
|
314
|
-
self.assertEqual(mysql_dict['password'], '')
|
|
315
|
-
self.assertEqual(mysql_dict['unix_socket'], '')
|
|
316
|
-
self.assertEqual(mysql_dict['charset'], MySQLCharset.UTF8MB4.value)
|
|
317
|
-
self.assertEqual(mysql_dict['collation'], MySQLCollation.UTF8MB4_UNICODE_CI.value)
|
|
318
|
-
self.assertEqual(mysql_dict['prefix'], '')
|
|
319
|
-
self.assertTrue(mysql_dict['prefix_indexes'])
|
|
320
|
-
self.assertTrue(mysql_dict['strict'])
|
|
321
|
-
self.assertEqual(mysql_dict['engine'], MySQLEngine.INNODB.value)
|
|
322
|
-
|
|
323
|
-
async def testCustomValues(self):
|
|
324
|
-
"""
|
|
325
|
-
Test that custom values are properly stored and validated.
|
|
326
|
-
|
|
327
|
-
Ensures custom configuration values are correctly handled.
|
|
328
|
-
"""
|
|
329
|
-
custom_mysql = MySQL(
|
|
330
|
-
host='db.example.com',
|
|
331
|
-
port=3307,
|
|
332
|
-
database='custom_db',
|
|
333
|
-
username='admin',
|
|
334
|
-
password='secure123',
|
|
335
|
-
unix_socket='/var/run/mysqld/mysqld.sock',
|
|
336
|
-
charset='LATIN1',
|
|
337
|
-
collation='LATIN1_GENERAL_CI',
|
|
338
|
-
prefix='app_',
|
|
339
|
-
prefix_indexes=False,
|
|
340
|
-
strict=False,
|
|
341
|
-
engine='MEMORY'
|
|
342
|
-
)
|
|
343
|
-
self.assertEqual(custom_mysql.host, 'db.example.com')
|
|
344
|
-
self.assertEqual(custom_mysql.port, 3307)
|
|
345
|
-
self.assertEqual(custom_mysql.database, 'custom_db')
|
|
346
|
-
self.assertEqual(custom_mysql.username, 'admin')
|
|
347
|
-
self.assertEqual(custom_mysql.password, 'secure123')
|
|
348
|
-
self.assertEqual(custom_mysql.unix_socket, '/var/run/mysqld/mysqld.sock')
|
|
349
|
-
self.assertEqual(custom_mysql.charset, MySQLCharset.LATIN1.value)
|
|
350
|
-
self.assertEqual(custom_mysql.collation, MySQLCollation.LATIN1_GENERAL_CI.value)
|
|
351
|
-
self.assertEqual(custom_mysql.prefix, 'app_')
|
|
352
|
-
self.assertFalse(custom_mysql.prefix_indexes)
|
|
353
|
-
self.assertFalse(custom_mysql.strict)
|
|
354
|
-
self.assertEqual(custom_mysql.engine, MySQLEngine.MEMORY.value)
|