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
@@ -7,12 +7,21 @@ from orionis.unittesting import TestCase
|
|
7
7
|
class TestConfigPGSQL(TestCase):
|
8
8
|
"""
|
9
9
|
Test cases for the PGSQL database configuration class.
|
10
|
+
|
11
|
+
This class contains asynchronous unit tests for validating the behavior,
|
12
|
+
default values, and integrity checks of the PGSQL configuration entity.
|
10
13
|
"""
|
11
14
|
|
12
15
|
async def testDefaultValues(self):
|
13
16
|
"""
|
14
|
-
Test
|
15
|
-
|
17
|
+
Test default values of PGSQL instance.
|
18
|
+
|
19
|
+
Ensures that a PGSQL instance is created with the correct default values
|
20
|
+
as defined in the class.
|
21
|
+
|
22
|
+
Returns
|
23
|
+
-------
|
24
|
+
None
|
16
25
|
"""
|
17
26
|
pgsql = PGSQL()
|
18
27
|
self.assertEqual(pgsql.driver, 'pgsql')
|
@@ -29,8 +38,13 @@ class TestConfigPGSQL(TestCase):
|
|
29
38
|
|
30
39
|
async def testDriverValidation(self):
|
31
40
|
"""
|
32
|
-
Test driver attribute
|
33
|
-
|
41
|
+
Test validation of the driver attribute.
|
42
|
+
|
43
|
+
Checks that empty or non-string driver values raise an exception.
|
44
|
+
|
45
|
+
Returns
|
46
|
+
-------
|
47
|
+
None
|
34
48
|
"""
|
35
49
|
with self.assertRaises(OrionisIntegrityException):
|
36
50
|
PGSQL(driver='')
|
@@ -39,8 +53,13 @@ class TestConfigPGSQL(TestCase):
|
|
39
53
|
|
40
54
|
async def testHostValidation(self):
|
41
55
|
"""
|
42
|
-
Test host attribute
|
43
|
-
|
56
|
+
Test validation of the host attribute.
|
57
|
+
|
58
|
+
Checks that empty or non-string host values raise an exception.
|
59
|
+
|
60
|
+
Returns
|
61
|
+
-------
|
62
|
+
None
|
44
63
|
"""
|
45
64
|
with self.assertRaises(OrionisIntegrityException):
|
46
65
|
PGSQL(host='')
|
@@ -49,8 +68,13 @@ class TestConfigPGSQL(TestCase):
|
|
49
68
|
|
50
69
|
async def testPortValidation(self):
|
51
70
|
"""
|
52
|
-
Test port attribute
|
53
|
-
|
71
|
+
Test validation of the port attribute.
|
72
|
+
|
73
|
+
Checks that non-numeric string ports or non-string ports raise an exception.
|
74
|
+
|
75
|
+
Returns
|
76
|
+
-------
|
77
|
+
None
|
54
78
|
"""
|
55
79
|
with self.assertRaises(OrionisIntegrityException):
|
56
80
|
PGSQL(port='abc')
|
@@ -59,8 +83,13 @@ class TestConfigPGSQL(TestCase):
|
|
59
83
|
|
60
84
|
async def testDatabaseValidation(self):
|
61
85
|
"""
|
62
|
-
Test database attribute
|
63
|
-
|
86
|
+
Test validation of the database attribute.
|
87
|
+
|
88
|
+
Checks that empty or non-string database names raise an exception.
|
89
|
+
|
90
|
+
Returns
|
91
|
+
-------
|
92
|
+
None
|
64
93
|
"""
|
65
94
|
with self.assertRaises(OrionisIntegrityException):
|
66
95
|
PGSQL(database='')
|
@@ -69,8 +98,13 @@ class TestConfigPGSQL(TestCase):
|
|
69
98
|
|
70
99
|
async def testUsernameValidation(self):
|
71
100
|
"""
|
72
|
-
Test username attribute
|
73
|
-
|
101
|
+
Test validation of the username attribute.
|
102
|
+
|
103
|
+
Checks that empty or non-string usernames raise an exception.
|
104
|
+
|
105
|
+
Returns
|
106
|
+
-------
|
107
|
+
None
|
74
108
|
"""
|
75
109
|
with self.assertRaises(OrionisIntegrityException):
|
76
110
|
PGSQL(username='')
|
@@ -79,16 +113,26 @@ class TestConfigPGSQL(TestCase):
|
|
79
113
|
|
80
114
|
async def testPasswordValidation(self):
|
81
115
|
"""
|
82
|
-
Test password attribute
|
83
|
-
|
116
|
+
Test validation of the password attribute.
|
117
|
+
|
118
|
+
Checks that non-string passwords raise an exception.
|
119
|
+
|
120
|
+
Returns
|
121
|
+
-------
|
122
|
+
None
|
84
123
|
"""
|
85
124
|
with self.assertRaises(OrionisIntegrityException):
|
86
125
|
PGSQL(password=123)
|
87
126
|
|
88
127
|
async def testCharsetValidation(self):
|
89
128
|
"""
|
90
|
-
Test charset attribute
|
91
|
-
|
129
|
+
Test validation of the charset attribute.
|
130
|
+
|
131
|
+
Ensures correct enum conversion and handling of invalid values.
|
132
|
+
|
133
|
+
Returns
|
134
|
+
-------
|
135
|
+
None
|
92
136
|
"""
|
93
137
|
# Test string conversion
|
94
138
|
pgsql = PGSQL(charset='UTF8')
|
@@ -104,8 +148,13 @@ class TestConfigPGSQL(TestCase):
|
|
104
148
|
|
105
149
|
async def testPrefixIndexesValidation(self):
|
106
150
|
"""
|
107
|
-
Test prefix_indexes attribute
|
108
|
-
|
151
|
+
Test validation of the prefix_indexes attribute.
|
152
|
+
|
153
|
+
Checks that non-boolean values raise an exception.
|
154
|
+
|
155
|
+
Returns
|
156
|
+
-------
|
157
|
+
None
|
109
158
|
"""
|
110
159
|
with self.assertRaises(OrionisIntegrityException):
|
111
160
|
PGSQL(prefix_indexes='true')
|
@@ -114,8 +163,13 @@ class TestConfigPGSQL(TestCase):
|
|
114
163
|
|
115
164
|
async def testSearchPathValidation(self):
|
116
165
|
"""
|
117
|
-
Test search_path attribute
|
118
|
-
|
166
|
+
Test validation of the search_path attribute.
|
167
|
+
|
168
|
+
Checks that empty or non-string search paths raise an exception.
|
169
|
+
|
170
|
+
Returns
|
171
|
+
-------
|
172
|
+
None
|
119
173
|
"""
|
120
174
|
with self.assertRaises(OrionisIntegrityException):
|
121
175
|
PGSQL(search_path='')
|
@@ -124,8 +178,13 @@ class TestConfigPGSQL(TestCase):
|
|
124
178
|
|
125
179
|
async def testSSLModeValidation(self):
|
126
180
|
"""
|
127
|
-
Test sslmode attribute
|
128
|
-
|
181
|
+
Test validation of the sslmode attribute.
|
182
|
+
|
183
|
+
Ensures correct enum conversion and handling of invalid values.
|
184
|
+
|
185
|
+
Returns
|
186
|
+
-------
|
187
|
+
None
|
129
188
|
"""
|
130
189
|
# Test string conversion
|
131
190
|
pgsql = PGSQL(sslmode='REQUIRE')
|
@@ -141,8 +200,14 @@ class TestConfigPGSQL(TestCase):
|
|
141
200
|
|
142
201
|
async def testToDictMethod(self):
|
143
202
|
"""
|
144
|
-
Test
|
145
|
-
|
203
|
+
Test the toDict method of PGSQL.
|
204
|
+
|
205
|
+
Ensures that the dictionary representation contains all attributes
|
206
|
+
with correct values.
|
207
|
+
|
208
|
+
Returns
|
209
|
+
-------
|
210
|
+
None
|
146
211
|
"""
|
147
212
|
pgsql = PGSQL()
|
148
213
|
pgsql_dict = pgsql.toDict()
|
@@ -160,8 +225,13 @@ class TestConfigPGSQL(TestCase):
|
|
160
225
|
|
161
226
|
async def testCustomValues(self):
|
162
227
|
"""
|
163
|
-
Test
|
164
|
-
|
228
|
+
Test custom configuration values for PGSQL.
|
229
|
+
|
230
|
+
Ensures that custom values are properly stored and validated.
|
231
|
+
|
232
|
+
Returns
|
233
|
+
-------
|
234
|
+
None
|
165
235
|
"""
|
166
236
|
custom_pgsql = PGSQL(
|
167
237
|
host='db.example.com',
|
@@ -8,12 +8,21 @@ from orionis.unittesting import TestCase
|
|
8
8
|
class TestConfigSQLite(TestCase):
|
9
9
|
"""
|
10
10
|
Test cases for the SQLite database configuration class.
|
11
|
+
|
12
|
+
This class contains unit tests to validate the behavior and integrity of the
|
13
|
+
SQLite configuration entity, ensuring correct default values, validation logic,
|
14
|
+
and dictionary representation.
|
11
15
|
"""
|
12
16
|
|
13
17
|
async def testDefaultValues(self):
|
14
18
|
"""
|
15
19
|
Test that SQLite instance is created with correct default values.
|
16
|
-
|
20
|
+
|
21
|
+
Ensures all default values match expected defaults from the class definition.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
None
|
17
26
|
"""
|
18
27
|
sqlite = SQLite()
|
19
28
|
self.assertEqual(sqlite.driver, 'sqlite')
|
@@ -28,7 +37,12 @@ class TestConfigSQLite(TestCase):
|
|
28
37
|
async def testDriverValidation(self):
|
29
38
|
"""
|
30
39
|
Test driver attribute validation.
|
40
|
+
|
31
41
|
Verifies that empty or non-string drivers raise exceptions.
|
42
|
+
|
43
|
+
Returns
|
44
|
+
-------
|
45
|
+
None
|
32
46
|
"""
|
33
47
|
with self.assertRaises(OrionisIntegrityException):
|
34
48
|
SQLite(driver='')
|
@@ -38,7 +52,12 @@ class TestConfigSQLite(TestCase):
|
|
38
52
|
async def testUrlValidation(self):
|
39
53
|
"""
|
40
54
|
Test URL attribute validation.
|
55
|
+
|
41
56
|
Verifies that empty or non-string URLs raise exceptions.
|
57
|
+
|
58
|
+
Returns
|
59
|
+
-------
|
60
|
+
None
|
42
61
|
"""
|
43
62
|
with self.assertRaises(OrionisIntegrityException):
|
44
63
|
SQLite(url='')
|
@@ -48,7 +67,12 @@ class TestConfigSQLite(TestCase):
|
|
48
67
|
async def testDatabaseValidation(self):
|
49
68
|
"""
|
50
69
|
Test database attribute validation.
|
70
|
+
|
51
71
|
Verifies that empty or non-string database paths raise exceptions.
|
72
|
+
|
73
|
+
Returns
|
74
|
+
-------
|
75
|
+
None
|
52
76
|
"""
|
53
77
|
with self.assertRaises(OrionisIntegrityException):
|
54
78
|
SQLite(database='')
|
@@ -58,7 +82,12 @@ class TestConfigSQLite(TestCase):
|
|
58
82
|
async def testForeignKeyConstraintsValidation(self):
|
59
83
|
"""
|
60
84
|
Test foreign_key_constraints attribute validation.
|
85
|
+
|
61
86
|
Verifies enum conversion and invalid value handling.
|
87
|
+
|
88
|
+
Returns
|
89
|
+
-------
|
90
|
+
None
|
62
91
|
"""
|
63
92
|
# Test string conversion
|
64
93
|
sqlite = SQLite(foreign_key_constraints='ON')
|
@@ -75,7 +104,12 @@ class TestConfigSQLite(TestCase):
|
|
75
104
|
async def testBusyTimeoutValidation(self):
|
76
105
|
"""
|
77
106
|
Test busy_timeout attribute validation.
|
107
|
+
|
78
108
|
Verifies non-negative integer requirement.
|
109
|
+
|
110
|
+
Returns
|
111
|
+
-------
|
112
|
+
None
|
79
113
|
"""
|
80
114
|
with self.assertRaises(OrionisIntegrityException):
|
81
115
|
SQLite(busy_timeout=-1)
|
@@ -85,7 +119,12 @@ class TestConfigSQLite(TestCase):
|
|
85
119
|
async def testJournalModeValidation(self):
|
86
120
|
"""
|
87
121
|
Test journal_mode attribute validation.
|
122
|
+
|
88
123
|
Verifies enum conversion and invalid value handling.
|
124
|
+
|
125
|
+
Returns
|
126
|
+
-------
|
127
|
+
None
|
89
128
|
"""
|
90
129
|
# Test string conversion
|
91
130
|
sqlite = SQLite(journal_mode='WAL')
|
@@ -102,7 +141,12 @@ class TestConfigSQLite(TestCase):
|
|
102
141
|
async def testSynchronousValidation(self):
|
103
142
|
"""
|
104
143
|
Test synchronous attribute validation.
|
144
|
+
|
105
145
|
Verifies enum conversion and invalid value handling.
|
146
|
+
|
147
|
+
Returns
|
148
|
+
-------
|
149
|
+
None
|
106
150
|
"""
|
107
151
|
# Test string conversion
|
108
152
|
sqlite = SQLite(synchronous='FULL')
|
@@ -119,7 +163,12 @@ class TestConfigSQLite(TestCase):
|
|
119
163
|
async def testToDictMethod(self):
|
120
164
|
"""
|
121
165
|
Test that toDict returns proper dictionary representation.
|
122
|
-
|
166
|
+
|
167
|
+
Verifies all attributes are correctly included in the dictionary.
|
168
|
+
|
169
|
+
Returns
|
170
|
+
-------
|
171
|
+
None
|
123
172
|
"""
|
124
173
|
sqlite = SQLite()
|
125
174
|
sqlite_dict = sqlite.toDict()
|
@@ -135,7 +184,12 @@ class TestConfigSQLite(TestCase):
|
|
135
184
|
async def testCustomValues(self):
|
136
185
|
"""
|
137
186
|
Test that custom values are properly stored and validated.
|
187
|
+
|
138
188
|
Verifies custom configuration values are correctly handled.
|
189
|
+
|
190
|
+
Returns
|
191
|
+
-------
|
192
|
+
None
|
139
193
|
"""
|
140
194
|
custom_sqlite = SQLite(
|
141
195
|
database='custom.db',
|
@@ -4,12 +4,21 @@ from orionis.unittesting import TestCase
|
|
4
4
|
class TestOrionisIntegrityException(TestCase):
|
5
5
|
"""
|
6
6
|
Test cases for the OrionisIntegrityException class.
|
7
|
+
|
8
|
+
Notes
|
9
|
+
-----
|
10
|
+
These tests verify the initialization, inheritance, string representation,
|
11
|
+
handling of different message types, raising and catching, and exception
|
12
|
+
chaining behavior of the OrionisIntegrityException.
|
7
13
|
"""
|
8
14
|
|
9
15
|
async def testExceptionInitialization(self):
|
10
16
|
"""
|
11
|
-
Test
|
12
|
-
|
17
|
+
Test initialization of OrionisIntegrityException with a message.
|
18
|
+
|
19
|
+
Verifies
|
20
|
+
--------
|
21
|
+
- The exception stores and returns the provided message correctly.
|
13
22
|
"""
|
14
23
|
test_msg = "Test integrity violation message"
|
15
24
|
exception = OrionisIntegrityException(test_msg)
|
@@ -18,8 +27,12 @@ class TestOrionisIntegrityException(TestCase):
|
|
18
27
|
|
19
28
|
async def testExceptionInheritance(self):
|
20
29
|
"""
|
21
|
-
Test
|
22
|
-
|
30
|
+
Test inheritance of OrionisIntegrityException.
|
31
|
+
|
32
|
+
Verifies
|
33
|
+
--------
|
34
|
+
- OrionisIntegrityException properly inherits from Exception.
|
35
|
+
- The exception hierarchy is correctly implemented.
|
23
36
|
"""
|
24
37
|
exception = OrionisIntegrityException("Test")
|
25
38
|
self.assertIsInstance(exception, Exception)
|
@@ -27,8 +40,11 @@ class TestOrionisIntegrityException(TestCase):
|
|
27
40
|
|
28
41
|
async def testExceptionStringRepresentation(self):
|
29
42
|
"""
|
30
|
-
Test
|
31
|
-
|
43
|
+
Test string representation of OrionisIntegrityException.
|
44
|
+
|
45
|
+
Verifies
|
46
|
+
--------
|
47
|
+
- The __str__ method returns the expected format.
|
32
48
|
"""
|
33
49
|
test_msg = "Configuration validation failed"
|
34
50
|
exception = OrionisIntegrityException(test_msg)
|
@@ -37,7 +53,10 @@ class TestOrionisIntegrityException(TestCase):
|
|
37
53
|
async def testExceptionWithEmptyMessage(self):
|
38
54
|
"""
|
39
55
|
Test OrionisIntegrityException with an empty message.
|
40
|
-
|
56
|
+
|
57
|
+
Verifies
|
58
|
+
--------
|
59
|
+
- The exception handles empty messages correctly.
|
41
60
|
"""
|
42
61
|
exception = OrionisIntegrityException("")
|
43
62
|
self.assertEqual(str(exception), "OrionisIntegrityException: ")
|
@@ -45,7 +64,15 @@ class TestOrionisIntegrityException(TestCase):
|
|
45
64
|
async def testExceptionWithNonStringMessage(self):
|
46
65
|
"""
|
47
66
|
Test OrionisIntegrityException with non-string message types.
|
48
|
-
|
67
|
+
|
68
|
+
Verifies
|
69
|
+
--------
|
70
|
+
- The exception converts non-string messages to strings.
|
71
|
+
|
72
|
+
Tests
|
73
|
+
-----
|
74
|
+
- Integer message
|
75
|
+
- List message
|
49
76
|
"""
|
50
77
|
# Test with integer
|
51
78
|
exception = OrionisIntegrityException(123)
|
@@ -58,7 +85,10 @@ class TestOrionisIntegrityException(TestCase):
|
|
58
85
|
async def testExceptionRaiseAndCatch(self):
|
59
86
|
"""
|
60
87
|
Test raising and catching OrionisIntegrityException.
|
61
|
-
|
88
|
+
|
89
|
+
Verifies
|
90
|
+
--------
|
91
|
+
- The exception can be properly raised and caught.
|
62
92
|
"""
|
63
93
|
test_msg = "Test exception handling"
|
64
94
|
try:
|
@@ -71,7 +101,11 @@ class TestOrionisIntegrityException(TestCase):
|
|
71
101
|
async def testExceptionChaining(self):
|
72
102
|
"""
|
73
103
|
Test exception chaining with OrionisIntegrityException.
|
74
|
-
|
104
|
+
|
105
|
+
Verifies
|
106
|
+
--------
|
107
|
+
- The exception works correctly in chained exception scenarios.
|
108
|
+
- The __cause__ attribute is set as expected.
|
75
109
|
"""
|
76
110
|
try:
|
77
111
|
try:
|
@@ -6,12 +6,18 @@ from orionis.unittesting import TestCase
|
|
6
6
|
class TestConfigFilesystems(TestCase):
|
7
7
|
"""
|
8
8
|
Test cases for the Filesystems configuration class.
|
9
|
+
|
10
|
+
This class contains unit tests for the `Filesystems` configuration class,
|
11
|
+
including validation of default values, disk types, dictionary conversion,
|
12
|
+
custom values, hashability, and keyword-only initialization.
|
9
13
|
"""
|
10
14
|
|
11
15
|
async def testDefaultValues(self):
|
12
16
|
"""
|
13
|
-
Test
|
14
|
-
|
17
|
+
Test Filesystems instance creation with default values.
|
18
|
+
|
19
|
+
Ensures that the default disk is set to 'local' and the disks attribute
|
20
|
+
is properly initialized as a Disks instance.
|
15
21
|
"""
|
16
22
|
fs = Filesystems()
|
17
23
|
self.assertEqual(fs.default, "local")
|
@@ -19,8 +25,15 @@ class TestConfigFilesystems(TestCase):
|
|
19
25
|
|
20
26
|
async def testDefaultDiskValidation(self):
|
21
27
|
"""
|
22
|
-
|
23
|
-
|
28
|
+
Validate the default disk attribute.
|
29
|
+
|
30
|
+
Checks that only valid disk types are accepted as default and that
|
31
|
+
invalid types raise an OrionisIntegrityException.
|
32
|
+
|
33
|
+
Raises
|
34
|
+
------
|
35
|
+
OrionisIntegrityException
|
36
|
+
If an invalid disk type is provided as default.
|
24
37
|
"""
|
25
38
|
# Test valid disk types
|
26
39
|
valid_disks = ["local", "public", "aws"]
|
@@ -44,8 +57,15 @@ class TestConfigFilesystems(TestCase):
|
|
44
57
|
|
45
58
|
async def testDisksValidation(self):
|
46
59
|
"""
|
47
|
-
|
48
|
-
|
60
|
+
Validate the disks attribute.
|
61
|
+
|
62
|
+
Ensures that only instances of Disks are accepted for the disks attribute.
|
63
|
+
Invalid types should raise an OrionisIntegrityException.
|
64
|
+
|
65
|
+
Raises
|
66
|
+
------
|
67
|
+
OrionisIntegrityException
|
68
|
+
If disks is not a Disks instance or is None.
|
49
69
|
"""
|
50
70
|
# Test invalid disks type
|
51
71
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -63,8 +83,15 @@ class TestConfigFilesystems(TestCase):
|
|
63
83
|
|
64
84
|
async def testToDictMethod(self):
|
65
85
|
"""
|
66
|
-
Test
|
67
|
-
|
86
|
+
Test the toDict method of Filesystems.
|
87
|
+
|
88
|
+
Ensures that the method returns a dictionary representation of the
|
89
|
+
Filesystems instance with all attributes correctly included.
|
90
|
+
|
91
|
+
Returns
|
92
|
+
-------
|
93
|
+
dict
|
94
|
+
Dictionary representation of the Filesystems instance.
|
68
95
|
"""
|
69
96
|
fs = Filesystems()
|
70
97
|
fs_dict = fs.toDict()
|
@@ -75,8 +102,18 @@ class TestConfigFilesystems(TestCase):
|
|
75
102
|
|
76
103
|
async def testCustomValues(self):
|
77
104
|
"""
|
78
|
-
Test
|
79
|
-
|
105
|
+
Test custom values for Filesystems.
|
106
|
+
|
107
|
+
Ensures that custom configurations are properly stored and validated.
|
108
|
+
|
109
|
+
Parameters
|
110
|
+
----------
|
111
|
+
custom_disks : Disks
|
112
|
+
Custom Disks instance to be used in Filesystems.
|
113
|
+
|
114
|
+
Returns
|
115
|
+
-------
|
116
|
+
None
|
80
117
|
"""
|
81
118
|
custom_disks = Disks()
|
82
119
|
custom_fs = Filesystems(
|
@@ -88,8 +125,14 @@ class TestConfigFilesystems(TestCase):
|
|
88
125
|
|
89
126
|
async def testHashability(self):
|
90
127
|
"""
|
91
|
-
Test
|
92
|
-
|
128
|
+
Test hashability of Filesystems instances.
|
129
|
+
|
130
|
+
Ensures that Filesystems instances are hashable and can be used in sets
|
131
|
+
and as dictionary keys due to `unsafe_hash=True`.
|
132
|
+
|
133
|
+
Returns
|
134
|
+
-------
|
135
|
+
None
|
93
136
|
"""
|
94
137
|
fs1 = Filesystems()
|
95
138
|
fs2 = Filesystems()
|
@@ -103,8 +146,15 @@ class TestConfigFilesystems(TestCase):
|
|
103
146
|
|
104
147
|
async def testKwOnlyInitialization(self):
|
105
148
|
"""
|
106
|
-
Test
|
107
|
-
|
149
|
+
Test keyword-only initialization enforcement.
|
150
|
+
|
151
|
+
Ensures that Filesystems enforces keyword-only arguments and does not
|
152
|
+
allow positional arguments during initialization.
|
153
|
+
|
154
|
+
Raises
|
155
|
+
------
|
156
|
+
TypeError
|
157
|
+
If positional arguments are used for initialization.
|
108
158
|
"""
|
109
159
|
with self.assertRaises(TypeError):
|
110
160
|
Filesystems("local", Disks())
|
@@ -5,11 +5,16 @@ from orionis.unittesting import TestCase
|
|
5
5
|
class TestConfigS3(TestCase):
|
6
6
|
"""
|
7
7
|
Test cases for the S3 storage configuration class.
|
8
|
+
|
9
|
+
This class contains unit tests for the S3 configuration entity, ensuring
|
10
|
+
correct default values, field validation, custom value handling, dictionary
|
11
|
+
conversion, hashability, and keyword-only initialization.
|
8
12
|
"""
|
9
13
|
|
10
14
|
async def testDefaultValues(self):
|
11
15
|
"""
|
12
16
|
Test that S3 instance is created with correct default values.
|
17
|
+
|
13
18
|
Verifies all default values match expected defaults from class definition.
|
14
19
|
"""
|
15
20
|
s3 = S3()
|
@@ -25,7 +30,13 @@ class TestConfigS3(TestCase):
|
|
25
30
|
async def testRequiredFieldValidation(self):
|
26
31
|
"""
|
27
32
|
Test validation of required fields.
|
28
|
-
|
33
|
+
|
34
|
+
Ensures that the 'region' field must be a non-empty string.
|
35
|
+
|
36
|
+
Raises
|
37
|
+
------
|
38
|
+
OrionisIntegrityException
|
39
|
+
If 'region' is empty or not a string.
|
29
40
|
"""
|
30
41
|
# Test empty region
|
31
42
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -38,7 +49,13 @@ class TestConfigS3(TestCase):
|
|
38
49
|
async def testOptionalFieldValidation(self):
|
39
50
|
"""
|
40
51
|
Test validation of optional fields.
|
41
|
-
|
52
|
+
|
53
|
+
Ensures that optional fields accept None or proper types.
|
54
|
+
|
55
|
+
Raises
|
56
|
+
------
|
57
|
+
OrionisIntegrityException
|
58
|
+
If optional fields are not of the correct type.
|
42
59
|
"""
|
43
60
|
# Valid optional configurations
|
44
61
|
try:
|
@@ -56,7 +73,13 @@ class TestConfigS3(TestCase):
|
|
56
73
|
async def testBooleanFieldValidation(self):
|
57
74
|
"""
|
58
75
|
Test validation of boolean fields.
|
59
|
-
|
76
|
+
|
77
|
+
Ensures that boolean fields only accept boolean values.
|
78
|
+
|
79
|
+
Raises
|
80
|
+
------
|
81
|
+
OrionisIntegrityException
|
82
|
+
If boolean fields are not of type bool.
|
60
83
|
"""
|
61
84
|
# Test use_path_style_endpoint
|
62
85
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -69,7 +92,9 @@ class TestConfigS3(TestCase):
|
|
69
92
|
async def testCustomValues(self):
|
70
93
|
"""
|
71
94
|
Test that custom values are properly stored and validated.
|
72
|
-
|
95
|
+
|
96
|
+
Ensures custom configuration values are correctly handled.
|
97
|
+
|
73
98
|
"""
|
74
99
|
custom_s3 = S3(
|
75
100
|
key="AKIAEXAMPLE",
|
@@ -94,7 +119,13 @@ class TestConfigS3(TestCase):
|
|
94
119
|
async def testToDictMethod(self):
|
95
120
|
"""
|
96
121
|
Test that toDict returns proper dictionary representation.
|
97
|
-
|
122
|
+
|
123
|
+
Ensures all attributes are correctly included in the dictionary.
|
124
|
+
|
125
|
+
Returns
|
126
|
+
-------
|
127
|
+
dict
|
128
|
+
Dictionary representation of the S3 instance.
|
98
129
|
"""
|
99
130
|
s3 = S3()
|
100
131
|
s3_dict = s3.toDict()
|
@@ -112,7 +143,8 @@ class TestConfigS3(TestCase):
|
|
112
143
|
async def testHashability(self):
|
113
144
|
"""
|
114
145
|
Test that S3 maintains hashability due to unsafe_hash=True.
|
115
|
-
|
146
|
+
|
147
|
+
Ensures that S3 instances can be used in sets and as dictionary keys.
|
116
148
|
"""
|
117
149
|
s3_1 = S3()
|
118
150
|
s3_2 = S3()
|
@@ -127,7 +159,13 @@ class TestConfigS3(TestCase):
|
|
127
159
|
async def testKwOnlyInitialization(self):
|
128
160
|
"""
|
129
161
|
Test that S3 enforces keyword-only initialization.
|
130
|
-
|
162
|
+
|
163
|
+
Ensures that positional arguments are not allowed for initialization.
|
164
|
+
|
165
|
+
Raises
|
166
|
+
------
|
167
|
+
TypeError
|
168
|
+
If positional arguments are used for initialization.
|
131
169
|
"""
|
132
170
|
with self.assertRaises(TypeError):
|
133
171
|
S3("key", "secret", "region") # Should fail as it requires keyword arguments
|