orionis 0.285.0__py3-none-any.whl → 0.287.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/metadata/framework.py +1 -1
- orionis/services/asynchrony/contracts/__init__.py +0 -0
- orionis/services/asynchrony/contracts/coroutines.py +24 -0
- orionis/services/asynchrony/coroutines.py +58 -19
- orionis/services/asynchrony/exceptions/coroutine_exception.py +8 -15
- orionis/services/environment/contracts/env.py +45 -50
- orionis/services/environment/dot_env.py +205 -181
- orionis/services/environment/env.py +68 -85
- orionis/services/environment/exceptions/environment_value_error.py +18 -0
- orionis/services/environment/exceptions/environment_value_exception.py +23 -0
- orionis/services/environment/type_hint.py +559 -0
- orionis/test/exceptions/test_config_exception.py +8 -17
- orionis/test/exceptions/test_failure_exception.py +27 -27
- orionis/test/exceptions/test_persistence_error.py +10 -20
- orionis/test/exceptions/test_runtime_error.py +8 -15
- orionis/test/exceptions/test_value_error.py +8 -15
- orionis/test/logs/history.py +3 -5
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/RECORD +66 -62
- tests/example/test_example.py +5 -2
- tests/foundation/config/app/test_app.py +13 -3
- tests/foundation/config/auth/test_auth.py +9 -4
- tests/foundation/config/cache/test_cache.py +60 -15
- tests/foundation/config/cache/test_cache_file.py +62 -14
- tests/foundation/config/cache/test_cache_stores.py +74 -14
- tests/foundation/config/cors/test_cors.py +102 -33
- tests/foundation/config/database/test_database.py +38 -14
- tests/foundation/config/database/test_database_connections.py +79 -5
- tests/foundation/config/database/test_database_mysql.py +138 -15
- tests/foundation/config/database/test_database_oracle.py +110 -26
- tests/foundation/config/database/test_database_pgsql.py +96 -26
- tests/foundation/config/database/test_database_sqlite.py +56 -2
- tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
- tests/foundation/config/filesystems/test_filesystems.py +64 -14
- tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
- tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
- tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
- tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
- tests/foundation/config/logging/test_logging.py +75 -11
- tests/foundation/config/logging/test_logging_channels.py +79 -2
- tests/foundation/config/logging/test_logging_chunked.py +85 -12
- tests/foundation/config/logging/test_logging_daily.py +79 -12
- tests/foundation/config/logging/test_logging_hourly.py +68 -2
- tests/foundation/config/logging/test_logging_monthly.py +48 -2
- tests/foundation/config/logging/test_logging_stack.py +49 -14
- tests/foundation/config/logging/test_logging_weekly.py +92 -2
- tests/foundation/config/mail/test_mail.py +87 -15
- tests/foundation/config/mail/test_mail_file.py +40 -4
- tests/foundation/config/mail/test_mail_mailers.py +56 -8
- tests/foundation/config/mail/test_mail_smtp.py +58 -14
- tests/foundation/config/queue/test_queue.py +62 -9
- tests/foundation/config/queue/test_queue_brokers.py +27 -10
- tests/foundation/config/queue/test_queue_database.py +53 -15
- tests/foundation/config/root/test_root_paths.py +69 -2
- tests/foundation/config/session/test_session.py +30 -1
- tests/foundation/config/startup/test_config_startup.py +77 -7
- tests/foundation/config/testing/test_testing.py +68 -0
- tests/patterns/singleton/test_singleton.py +10 -1
- tests/services/asynchrony/test_async_io.py +4 -4
- tests/services/environment/test_env.py +3 -4
- tests/testing/test_testing_result.py +56 -19
- tests/testing/test_testing_unit.py +93 -24
- orionis/services/environment/exceptions/value_exception.py +0 -27
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -9,12 +9,21 @@ from orionis.unittesting import TestCase
|
|
9
9
|
class TestConfigConnections(TestCase):
|
10
10
|
"""
|
11
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.
|
12
16
|
"""
|
13
17
|
|
14
18
|
async def testDefaultValues(self):
|
15
19
|
"""
|
16
20
|
Test that Connections instance is created with correct default values.
|
21
|
+
|
17
22
|
Verifies all default connections are properly initialized with their respective types.
|
23
|
+
|
24
|
+
Returns
|
25
|
+
-------
|
26
|
+
None
|
18
27
|
"""
|
19
28
|
connections = Connections()
|
20
29
|
self.assertIsInstance(connections.sqlite, SQLite)
|
@@ -25,7 +34,17 @@ class TestConfigConnections(TestCase):
|
|
25
34
|
async def testSqliteTypeValidation(self):
|
26
35
|
"""
|
27
36
|
Test sqlite attribute type validation.
|
28
|
-
|
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.
|
29
48
|
"""
|
30
49
|
with self.assertRaises(OrionisIntegrityException):
|
31
50
|
Connections(sqlite="not_a_sqlite_instance")
|
@@ -37,7 +56,17 @@ class TestConfigConnections(TestCase):
|
|
37
56
|
async def testMysqlTypeValidation(self):
|
38
57
|
"""
|
39
58
|
Test mysql attribute type validation.
|
40
|
-
|
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.
|
41
70
|
"""
|
42
71
|
with self.assertRaises(OrionisIntegrityException):
|
43
72
|
Connections(mysql="not_a_mysql_instance")
|
@@ -49,7 +78,17 @@ class TestConfigConnections(TestCase):
|
|
49
78
|
async def testPgsqlTypeValidation(self):
|
50
79
|
"""
|
51
80
|
Test pgsql attribute type validation.
|
52
|
-
|
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.
|
53
92
|
"""
|
54
93
|
with self.assertRaises(OrionisIntegrityException):
|
55
94
|
Connections(pgsql="not_a_pgsql_instance")
|
@@ -61,7 +100,17 @@ class TestConfigConnections(TestCase):
|
|
61
100
|
async def testOracleTypeValidation(self):
|
62
101
|
"""
|
63
102
|
Test oracle attribute type validation.
|
64
|
-
|
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.
|
65
114
|
"""
|
66
115
|
with self.assertRaises(OrionisIntegrityException):
|
67
116
|
Connections(oracle="not_an_oracle_instance")
|
@@ -73,7 +122,12 @@ class TestConfigConnections(TestCase):
|
|
73
122
|
async def testToDictMethod(self):
|
74
123
|
"""
|
75
124
|
Test that toDict returns proper dictionary representation.
|
76
|
-
|
125
|
+
|
126
|
+
Verifies all connections are correctly included in the dictionary.
|
127
|
+
|
128
|
+
Returns
|
129
|
+
-------
|
130
|
+
None
|
77
131
|
"""
|
78
132
|
connections = Connections()
|
79
133
|
connections_dict = connections.toDict()
|
@@ -86,7 +140,12 @@ class TestConfigConnections(TestCase):
|
|
86
140
|
async def testCustomConnections(self):
|
87
141
|
"""
|
88
142
|
Test that custom connections are properly stored and validated.
|
143
|
+
|
89
144
|
Verifies custom connection configurations are correctly handled.
|
145
|
+
|
146
|
+
Returns
|
147
|
+
-------
|
148
|
+
None
|
90
149
|
"""
|
91
150
|
custom_sqlite = SQLite(database='custom.db')
|
92
151
|
custom_mysql = MySQL(database='custom_db')
|
@@ -108,7 +167,12 @@ class TestConfigConnections(TestCase):
|
|
108
167
|
async def testHashability(self):
|
109
168
|
"""
|
110
169
|
Test that Connections maintains hashability due to unsafe_hash=True.
|
170
|
+
|
111
171
|
Verifies that Connections instances can be used in sets and as dictionary keys.
|
172
|
+
|
173
|
+
Returns
|
174
|
+
-------
|
175
|
+
None
|
112
176
|
"""
|
113
177
|
conn1 = Connections()
|
114
178
|
conn2 = Connections()
|
@@ -123,7 +187,17 @@ class TestConfigConnections(TestCase):
|
|
123
187
|
async def testKwOnlyInitialization(self):
|
124
188
|
"""
|
125
189
|
Test that Connections enforces keyword-only initialization.
|
190
|
+
|
126
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.
|
127
201
|
"""
|
128
202
|
with self.assertRaises(TypeError):
|
129
203
|
Connections(SQLite(), MySQL(), PGSQL(), Oracle())
|
@@ -8,11 +8,54 @@ from orionis.unittesting import TestCase
|
|
8
8
|
class TestConfigMySQL(TestCase):
|
9
9
|
"""
|
10
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.
|
11
53
|
"""
|
12
54
|
|
13
55
|
async def testDefaultValues(self):
|
14
56
|
"""
|
15
57
|
Test that MySQL instance is created with correct default values.
|
58
|
+
|
16
59
|
Verifies all default values match expected defaults from class definition.
|
17
60
|
"""
|
18
61
|
mysql = MySQL()
|
@@ -33,7 +76,13 @@ class TestConfigMySQL(TestCase):
|
|
33
76
|
async def testDriverValidation(self):
|
34
77
|
"""
|
35
78
|
Test driver attribute validation.
|
36
|
-
|
79
|
+
|
80
|
+
Ensures that only 'mysql' value is accepted for driver.
|
81
|
+
|
82
|
+
Raises
|
83
|
+
------
|
84
|
+
OrionisIntegrityException
|
85
|
+
If the driver value is invalid.
|
37
86
|
"""
|
38
87
|
with self.assertRaises(OrionisIntegrityException):
|
39
88
|
MySQL(driver='')
|
@@ -45,7 +94,13 @@ class TestConfigMySQL(TestCase):
|
|
45
94
|
async def testHostValidation(self):
|
46
95
|
"""
|
47
96
|
Test host attribute validation.
|
48
|
-
|
97
|
+
|
98
|
+
Ensures that empty or non-string hosts raise exceptions.
|
99
|
+
|
100
|
+
Raises
|
101
|
+
------
|
102
|
+
OrionisIntegrityException
|
103
|
+
If the host value is invalid.
|
49
104
|
"""
|
50
105
|
with self.assertRaises(OrionisIntegrityException):
|
51
106
|
MySQL(host='')
|
@@ -55,7 +110,13 @@ class TestConfigMySQL(TestCase):
|
|
55
110
|
async def testPortValidation(self):
|
56
111
|
"""
|
57
112
|
Test port attribute validation.
|
58
|
-
|
113
|
+
|
114
|
+
Ensures invalid port numbers raise exceptions.
|
115
|
+
|
116
|
+
Raises
|
117
|
+
------
|
118
|
+
OrionisIntegrityException
|
119
|
+
If the port value is invalid.
|
59
120
|
"""
|
60
121
|
with self.assertRaises(OrionisIntegrityException):
|
61
122
|
MySQL(port=0)
|
@@ -67,7 +128,13 @@ class TestConfigMySQL(TestCase):
|
|
67
128
|
async def testDatabaseValidation(self):
|
68
129
|
"""
|
69
130
|
Test database attribute validation.
|
70
|
-
|
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.
|
71
138
|
"""
|
72
139
|
with self.assertRaises(OrionisIntegrityException):
|
73
140
|
MySQL(database='')
|
@@ -77,7 +144,13 @@ class TestConfigMySQL(TestCase):
|
|
77
144
|
async def testUsernameValidation(self):
|
78
145
|
"""
|
79
146
|
Test username attribute validation.
|
80
|
-
|
147
|
+
|
148
|
+
Ensures that empty or non-string usernames raise exceptions.
|
149
|
+
|
150
|
+
Raises
|
151
|
+
------
|
152
|
+
OrionisIntegrityException
|
153
|
+
If the username value is invalid.
|
81
154
|
"""
|
82
155
|
with self.assertRaises(OrionisIntegrityException):
|
83
156
|
MySQL(username='')
|
@@ -87,7 +160,13 @@ class TestConfigMySQL(TestCase):
|
|
87
160
|
async def testPasswordValidation(self):
|
88
161
|
"""
|
89
162
|
Test password attribute validation.
|
90
|
-
|
163
|
+
|
164
|
+
Ensures that non-string passwords raise exceptions.
|
165
|
+
|
166
|
+
Raises
|
167
|
+
------
|
168
|
+
OrionisIntegrityException
|
169
|
+
If the password value is invalid.
|
91
170
|
"""
|
92
171
|
with self.assertRaises(OrionisIntegrityException):
|
93
172
|
MySQL(password=123)
|
@@ -95,7 +174,13 @@ class TestConfigMySQL(TestCase):
|
|
95
174
|
async def testUnixSocketValidation(self):
|
96
175
|
"""
|
97
176
|
Test unix_socket attribute validation.
|
98
|
-
|
177
|
+
|
178
|
+
Ensures that non-string socket paths raise exceptions.
|
179
|
+
|
180
|
+
Raises
|
181
|
+
------
|
182
|
+
OrionisIntegrityException
|
183
|
+
If the unix_socket value is invalid.
|
99
184
|
"""
|
100
185
|
with self.assertRaises(OrionisIntegrityException):
|
101
186
|
MySQL(unix_socket=123)
|
@@ -103,7 +188,13 @@ class TestConfigMySQL(TestCase):
|
|
103
188
|
async def testCharsetValidation(self):
|
104
189
|
"""
|
105
190
|
Test charset attribute validation.
|
106
|
-
|
191
|
+
|
192
|
+
Ensures enum conversion and invalid value handling.
|
193
|
+
|
194
|
+
Raises
|
195
|
+
------
|
196
|
+
OrionisIntegrityException
|
197
|
+
If the charset value is invalid.
|
107
198
|
"""
|
108
199
|
# Test string conversion
|
109
200
|
mysql = MySQL(charset='UTF8')
|
@@ -119,7 +210,13 @@ class TestConfigMySQL(TestCase):
|
|
119
210
|
async def testCollationValidation(self):
|
120
211
|
"""
|
121
212
|
Test collation attribute validation.
|
122
|
-
|
213
|
+
|
214
|
+
Ensures enum conversion and invalid value handling.
|
215
|
+
|
216
|
+
Raises
|
217
|
+
------
|
218
|
+
OrionisIntegrityException
|
219
|
+
If the collation value is invalid.
|
123
220
|
"""
|
124
221
|
# Test string conversion
|
125
222
|
mysql = MySQL(collation='UTF8_GENERAL_CI')
|
@@ -135,7 +232,13 @@ class TestConfigMySQL(TestCase):
|
|
135
232
|
async def testPrefixValidation(self):
|
136
233
|
"""
|
137
234
|
Test prefix attribute validation.
|
138
|
-
|
235
|
+
|
236
|
+
Ensures that non-string prefixes raise exceptions.
|
237
|
+
|
238
|
+
Raises
|
239
|
+
------
|
240
|
+
OrionisIntegrityException
|
241
|
+
If the prefix value is invalid.
|
139
242
|
"""
|
140
243
|
with self.assertRaises(OrionisIntegrityException):
|
141
244
|
MySQL(prefix=123)
|
@@ -143,7 +246,13 @@ class TestConfigMySQL(TestCase):
|
|
143
246
|
async def testPrefixIndexesValidation(self):
|
144
247
|
"""
|
145
248
|
Test prefix_indexes attribute validation.
|
146
|
-
|
249
|
+
|
250
|
+
Ensures that non-boolean values raise exceptions.
|
251
|
+
|
252
|
+
Raises
|
253
|
+
------
|
254
|
+
OrionisIntegrityException
|
255
|
+
If the prefix_indexes value is invalid.
|
147
256
|
"""
|
148
257
|
with self.assertRaises(OrionisIntegrityException):
|
149
258
|
MySQL(prefix_indexes='true')
|
@@ -153,7 +262,13 @@ class TestConfigMySQL(TestCase):
|
|
153
262
|
async def testStrictValidation(self):
|
154
263
|
"""
|
155
264
|
Test strict attribute validation.
|
156
|
-
|
265
|
+
|
266
|
+
Ensures that non-boolean values raise exceptions.
|
267
|
+
|
268
|
+
Raises
|
269
|
+
------
|
270
|
+
OrionisIntegrityException
|
271
|
+
If the strict value is invalid.
|
157
272
|
"""
|
158
273
|
with self.assertRaises(OrionisIntegrityException):
|
159
274
|
MySQL(strict='true')
|
@@ -163,7 +278,13 @@ class TestConfigMySQL(TestCase):
|
|
163
278
|
async def testEngineValidation(self):
|
164
279
|
"""
|
165
280
|
Test engine attribute validation.
|
166
|
-
|
281
|
+
|
282
|
+
Ensures enum conversion and invalid value handling.
|
283
|
+
|
284
|
+
Raises
|
285
|
+
------
|
286
|
+
OrionisIntegrityException
|
287
|
+
If the engine value is invalid.
|
167
288
|
"""
|
168
289
|
# Test string conversion
|
169
290
|
mysql = MySQL(engine='MYISAM')
|
@@ -180,7 +301,8 @@ class TestConfigMySQL(TestCase):
|
|
180
301
|
async def testToDictMethod(self):
|
181
302
|
"""
|
182
303
|
Test that toDict returns proper dictionary representation.
|
183
|
-
|
304
|
+
|
305
|
+
Ensures all attributes are correctly included in dictionary.
|
184
306
|
"""
|
185
307
|
mysql = MySQL()
|
186
308
|
mysql_dict = mysql.toDict()
|
@@ -201,7 +323,8 @@ class TestConfigMySQL(TestCase):
|
|
201
323
|
async def testCustomValues(self):
|
202
324
|
"""
|
203
325
|
Test that custom values are properly stored and validated.
|
204
|
-
|
326
|
+
|
327
|
+
Ensures custom configuration values are correctly handled.
|
205
328
|
"""
|
206
329
|
custom_mysql = MySQL(
|
207
330
|
host='db.example.com',
|
@@ -7,12 +7,24 @@ from orionis.unittesting import TestCase
|
|
7
7
|
class TestConfigOracle(TestCase):
|
8
8
|
"""
|
9
9
|
Test cases for the Oracle database configuration class.
|
10
|
+
|
11
|
+
Notes
|
12
|
+
-----
|
13
|
+
This class contains asynchronous unit tests for the `Oracle` configuration entity,
|
14
|
+
validating its attributes, value constraints, and dictionary serialization.
|
10
15
|
"""
|
11
16
|
|
12
17
|
async def testDefaultValues(self):
|
13
18
|
"""
|
14
|
-
Test
|
15
|
-
|
19
|
+
Test Oracle instance creation with default values.
|
20
|
+
|
21
|
+
Ensures that all default attribute values match the expected defaults
|
22
|
+
as defined in the class.
|
23
|
+
|
24
|
+
Raises
|
25
|
+
------
|
26
|
+
AssertionError
|
27
|
+
If any default value does not match the expected value.
|
16
28
|
"""
|
17
29
|
oracle = Oracle()
|
18
30
|
self.assertEqual(oracle.driver, 'oracle')
|
@@ -29,8 +41,14 @@ class TestConfigOracle(TestCase):
|
|
29
41
|
|
30
42
|
async def testDriverValidation(self):
|
31
43
|
"""
|
32
|
-
Test driver attribute
|
33
|
-
|
44
|
+
Test validation of the `driver` attribute.
|
45
|
+
|
46
|
+
Ensures that only the value 'oracle' is accepted for the driver.
|
47
|
+
|
48
|
+
Raises
|
49
|
+
------
|
50
|
+
OrionisIntegrityException
|
51
|
+
If the driver value is invalid.
|
34
52
|
"""
|
35
53
|
with self.assertRaises(OrionisIntegrityException):
|
36
54
|
Oracle(driver='')
|
@@ -41,8 +59,14 @@ class TestConfigOracle(TestCase):
|
|
41
59
|
|
42
60
|
async def testUsernameValidation(self):
|
43
61
|
"""
|
44
|
-
Test username attribute
|
45
|
-
|
62
|
+
Test validation of the `username` attribute.
|
63
|
+
|
64
|
+
Ensures that empty or non-string usernames raise exceptions.
|
65
|
+
|
66
|
+
Raises
|
67
|
+
------
|
68
|
+
OrionisIntegrityException
|
69
|
+
If the username is invalid.
|
46
70
|
"""
|
47
71
|
with self.assertRaises(OrionisIntegrityException):
|
48
72
|
Oracle(username='')
|
@@ -51,16 +75,28 @@ class TestConfigOracle(TestCase):
|
|
51
75
|
|
52
76
|
async def testPasswordValidation(self):
|
53
77
|
"""
|
54
|
-
Test password attribute
|
55
|
-
|
78
|
+
Test validation of the `password` attribute.
|
79
|
+
|
80
|
+
Ensures that non-string passwords raise exceptions.
|
81
|
+
|
82
|
+
Raises
|
83
|
+
------
|
84
|
+
OrionisIntegrityException
|
85
|
+
If the password is invalid.
|
56
86
|
"""
|
57
87
|
with self.assertRaises(OrionisIntegrityException):
|
58
88
|
Oracle(password=123)
|
59
89
|
|
60
90
|
async def testHostValidation(self):
|
61
91
|
"""
|
62
|
-
Test host attribute
|
63
|
-
|
92
|
+
Test validation of the `host` attribute when not using DSN/TNS.
|
93
|
+
|
94
|
+
Ensures that empty or non-string hosts raise exceptions.
|
95
|
+
|
96
|
+
Raises
|
97
|
+
------
|
98
|
+
OrionisIntegrityException
|
99
|
+
If the host is invalid.
|
64
100
|
"""
|
65
101
|
with self.assertRaises(OrionisIntegrityException):
|
66
102
|
Oracle(host='', dsn=None, tns_name=None)
|
@@ -69,8 +105,14 @@ class TestConfigOracle(TestCase):
|
|
69
105
|
|
70
106
|
async def testPortValidation(self):
|
71
107
|
"""
|
72
|
-
Test port attribute
|
73
|
-
|
108
|
+
Test validation of the `port` attribute when not using DSN/TNS.
|
109
|
+
|
110
|
+
Ensures that invalid port numbers raise exceptions.
|
111
|
+
|
112
|
+
Raises
|
113
|
+
------
|
114
|
+
OrionisIntegrityException
|
115
|
+
If the port is invalid.
|
74
116
|
"""
|
75
117
|
with self.assertRaises(OrionisIntegrityException):
|
76
118
|
Oracle(port=0, dsn=None, tns_name=None)
|
@@ -81,8 +123,14 @@ class TestConfigOracle(TestCase):
|
|
81
123
|
|
82
124
|
async def testServiceNameAndSidValidation(self):
|
83
125
|
"""
|
84
|
-
Test service_name and sid
|
85
|
-
|
126
|
+
Test validation of `service_name` and `sid` attributes when not using DSN/TNS.
|
127
|
+
|
128
|
+
Ensures that at least one of `service_name` or `sid` is required.
|
129
|
+
|
130
|
+
Raises
|
131
|
+
------
|
132
|
+
OrionisIntegrityException
|
133
|
+
If both `service_name` and `sid` are missing.
|
86
134
|
"""
|
87
135
|
# Test with neither service_name nor sid
|
88
136
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -102,8 +150,14 @@ class TestConfigOracle(TestCase):
|
|
102
150
|
|
103
151
|
async def testDsnValidation(self):
|
104
152
|
"""
|
105
|
-
Test dsn attribute
|
106
|
-
|
153
|
+
Test validation of the `dsn` attribute.
|
154
|
+
|
155
|
+
Ensures that `dsn` must be a non-empty string or None.
|
156
|
+
|
157
|
+
Raises
|
158
|
+
------
|
159
|
+
OrionisIntegrityException
|
160
|
+
If the dsn is invalid.
|
107
161
|
"""
|
108
162
|
with self.assertRaises(OrionisIntegrityException):
|
109
163
|
Oracle(dsn='')
|
@@ -114,8 +168,14 @@ class TestConfigOracle(TestCase):
|
|
114
168
|
|
115
169
|
async def testTnsNameValidation(self):
|
116
170
|
"""
|
117
|
-
Test tns_name attribute
|
118
|
-
|
171
|
+
Test validation of the `tns_name` attribute.
|
172
|
+
|
173
|
+
Ensures that `tns_name` must be a non-empty string or None.
|
174
|
+
|
175
|
+
Raises
|
176
|
+
------
|
177
|
+
OrionisIntegrityException
|
178
|
+
If the tns_name is invalid.
|
119
179
|
"""
|
120
180
|
with self.assertRaises(OrionisIntegrityException):
|
121
181
|
Oracle(tns_name='')
|
@@ -126,8 +186,14 @@ class TestConfigOracle(TestCase):
|
|
126
186
|
|
127
187
|
async def testEncodingValidation(self):
|
128
188
|
"""
|
129
|
-
Test encoding attribute
|
130
|
-
|
189
|
+
Test validation of the `encoding` attribute.
|
190
|
+
|
191
|
+
Ensures correct enum conversion and invalid value handling.
|
192
|
+
|
193
|
+
Raises
|
194
|
+
------
|
195
|
+
OrionisIntegrityException
|
196
|
+
If the encoding value is invalid.
|
131
197
|
"""
|
132
198
|
# Test enum assignment
|
133
199
|
oracle = Oracle(encoding=OracleEncoding.WE8ISO8859P1)
|
@@ -139,8 +205,14 @@ class TestConfigOracle(TestCase):
|
|
139
205
|
|
140
206
|
async def testNencodingValidation(self):
|
141
207
|
"""
|
142
|
-
Test nencoding attribute
|
143
|
-
|
208
|
+
Test validation of the `nencoding` attribute.
|
209
|
+
|
210
|
+
Ensures correct enum conversion and invalid value handling.
|
211
|
+
|
212
|
+
Raises
|
213
|
+
------
|
214
|
+
OrionisIntegrityException
|
215
|
+
If the nencoding value is invalid.
|
144
216
|
"""
|
145
217
|
# Test string conversion
|
146
218
|
oracle = Oracle(nencoding='EE8MSWIN1250')
|
@@ -156,8 +228,14 @@ class TestConfigOracle(TestCase):
|
|
156
228
|
|
157
229
|
async def testToDictMethod(self):
|
158
230
|
"""
|
159
|
-
Test
|
160
|
-
|
231
|
+
Test the `toDict` method for dictionary representation.
|
232
|
+
|
233
|
+
Ensures that all attributes are correctly included in the dictionary.
|
234
|
+
|
235
|
+
Raises
|
236
|
+
------
|
237
|
+
AssertionError
|
238
|
+
If any attribute is missing or incorrect in the dictionary.
|
161
239
|
"""
|
162
240
|
oracle = Oracle()
|
163
241
|
oracle_dict = oracle.toDict()
|
@@ -176,8 +254,14 @@ class TestConfigOracle(TestCase):
|
|
176
254
|
|
177
255
|
async def testConnectionMethods(self):
|
178
256
|
"""
|
179
|
-
Test
|
180
|
-
|
257
|
+
Test handling of different Oracle connection methods.
|
258
|
+
|
259
|
+
Ensures that DSN, TNS, or host/port/service/sid combinations are valid.
|
260
|
+
|
261
|
+
Raises
|
262
|
+
------
|
263
|
+
OrionisIntegrityException
|
264
|
+
If a valid connection method raises an exception.
|
181
265
|
"""
|
182
266
|
# Test DSN connection
|
183
267
|
try:
|