orionis 0.286.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/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/logs/history.py +3 -5
- {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
- {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/RECORD +56 -54
- 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/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.286.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
- {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
- {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -6,12 +6,26 @@ from orionis.unittesting import TestCase
|
|
6
6
|
class TestConfigStores(TestCase):
|
7
7
|
"""
|
8
8
|
Test cases for the Stores cache configuration entity.
|
9
|
+
|
10
|
+
This class contains asynchronous unit tests for the `Stores` entity,
|
11
|
+
validating its initialization, type enforcement, dictionary conversion,
|
12
|
+
hashability, and keyword-only argument enforcement.
|
13
|
+
|
14
|
+
Attributes
|
15
|
+
----------
|
16
|
+
None
|
9
17
|
"""
|
10
18
|
|
11
19
|
async def testDefaultFileStore(self):
|
12
20
|
"""
|
13
|
-
Test
|
14
|
-
|
21
|
+
Test initialization with default File instance.
|
22
|
+
|
23
|
+
Ensures that `Stores` initializes with a default `File` instance and
|
24
|
+
that the `file` attribute is properly set with the default configuration.
|
25
|
+
|
26
|
+
Returns
|
27
|
+
-------
|
28
|
+
None
|
15
29
|
"""
|
16
30
|
stores = Stores()
|
17
31
|
self.assertIsInstance(stores.file, File)
|
@@ -19,8 +33,14 @@ class TestConfigStores(TestCase):
|
|
19
33
|
|
20
34
|
async def testCustomFileStore(self):
|
21
35
|
"""
|
22
|
-
Test
|
23
|
-
|
36
|
+
Test initialization with a custom File configuration.
|
37
|
+
|
38
|
+
Ensures that a custom `File` instance can be provided during
|
39
|
+
initialization and is correctly assigned to the `file` attribute.
|
40
|
+
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
None
|
24
44
|
"""
|
25
45
|
custom_file = File(path='custom/cache/path')
|
26
46
|
stores = Stores(file=custom_file)
|
@@ -29,8 +49,19 @@ class TestConfigStores(TestCase):
|
|
29
49
|
|
30
50
|
async def testFileTypeValidation(self):
|
31
51
|
"""
|
32
|
-
Test
|
33
|
-
|
52
|
+
Test type validation for the file attribute.
|
53
|
+
|
54
|
+
Ensures that providing a non-`File` instance to the `file` attribute
|
55
|
+
raises an `OrionisIntegrityException`.
|
56
|
+
|
57
|
+
Returns
|
58
|
+
-------
|
59
|
+
None
|
60
|
+
|
61
|
+
Raises
|
62
|
+
------
|
63
|
+
OrionisIntegrityException
|
64
|
+
If the `file` attribute is not a `File` instance.
|
34
65
|
"""
|
35
66
|
with self.assertRaises(OrionisIntegrityException):
|
36
67
|
Stores(file="not_a_file_instance")
|
@@ -43,8 +74,14 @@ class TestConfigStores(TestCase):
|
|
43
74
|
|
44
75
|
async def testToDictMethodWithDefaults(self):
|
45
76
|
"""
|
46
|
-
Test
|
47
|
-
|
77
|
+
Test dictionary representation with default values.
|
78
|
+
|
79
|
+
Ensures that `toDict` returns a dictionary with the correct default
|
80
|
+
file path.
|
81
|
+
|
82
|
+
Returns
|
83
|
+
-------
|
84
|
+
None
|
48
85
|
"""
|
49
86
|
stores = Stores()
|
50
87
|
stores_dict = stores.toDict()
|
@@ -55,8 +92,14 @@ class TestConfigStores(TestCase):
|
|
55
92
|
|
56
93
|
async def testToDictMethodWithCustomFile(self):
|
57
94
|
"""
|
58
|
-
Test
|
59
|
-
|
95
|
+
Test dictionary representation with custom file configuration.
|
96
|
+
|
97
|
+
Ensures that `toDict` reflects custom file paths in its dictionary
|
98
|
+
representation.
|
99
|
+
|
100
|
+
Returns
|
101
|
+
-------
|
102
|
+
None
|
60
103
|
"""
|
61
104
|
custom_file = File(path='alternate/cache/location')
|
62
105
|
stores = Stores(file=custom_file)
|
@@ -66,8 +109,14 @@ class TestConfigStores(TestCase):
|
|
66
109
|
|
67
110
|
async def testHashability(self):
|
68
111
|
"""
|
69
|
-
Test
|
70
|
-
|
112
|
+
Test hashability of Stores instances.
|
113
|
+
|
114
|
+
Ensures that `Stores` instances are hashable and can be used in sets
|
115
|
+
and as dictionary keys.
|
116
|
+
|
117
|
+
Returns
|
118
|
+
-------
|
119
|
+
None
|
71
120
|
"""
|
72
121
|
store1 = Stores()
|
73
122
|
store2 = Stores()
|
@@ -81,8 +130,19 @@ class TestConfigStores(TestCase):
|
|
81
130
|
|
82
131
|
async def testKwOnlyInitialization(self):
|
83
132
|
"""
|
84
|
-
Test
|
85
|
-
|
133
|
+
Test keyword-only initialization enforcement.
|
134
|
+
|
135
|
+
Ensures that `Stores` enforces keyword-only arguments and does not
|
136
|
+
allow positional arguments during initialization.
|
137
|
+
|
138
|
+
Returns
|
139
|
+
-------
|
140
|
+
None
|
141
|
+
|
142
|
+
Raises
|
143
|
+
------
|
144
|
+
TypeError
|
145
|
+
If positional arguments are provided during initialization.
|
86
146
|
"""
|
87
147
|
with self.assertRaises(TypeError):
|
88
148
|
Stores(File())
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
from orionis.foundation.config.cors.entities.cors import Cors
|
3
2
|
from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
|
4
3
|
from orionis.unittesting import TestCase
|
@@ -6,20 +5,35 @@ from orionis.unittesting import TestCase
|
|
6
5
|
class TestCorsConfig(TestCase):
|
7
6
|
"""
|
8
7
|
Unit tests for Cors configuration defaults and validation.
|
8
|
+
|
9
|
+
Notes
|
10
|
+
-----
|
11
|
+
These tests verify the default values, custom value assignment, and type validation
|
12
|
+
for the `Cors` configuration entity.
|
9
13
|
"""
|
10
14
|
|
11
15
|
async def testDefaultValues(self):
|
12
16
|
"""
|
13
17
|
Test the default values of the Cors configuration.
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
Verifies that a newly instantiated Cors object has the expected default settings.
|
20
|
+
|
21
|
+
Expected Defaults
|
22
|
+
-----------------
|
23
|
+
allow_origins : list of str
|
24
|
+
["*"]
|
25
|
+
allow_origin_regex : None or str
|
26
|
+
None
|
27
|
+
allow_methods : list of str
|
28
|
+
["*"]
|
29
|
+
allow_headers : list of str
|
30
|
+
["*"]
|
31
|
+
expose_headers : list of str
|
32
|
+
[]
|
33
|
+
allow_credentials : bool
|
34
|
+
False
|
35
|
+
max_age : int
|
36
|
+
600
|
23
37
|
"""
|
24
38
|
cors = Cors()
|
25
39
|
self.assertEqual(cors.allow_origins, ["*"])
|
@@ -32,18 +46,26 @@ class TestCorsConfig(TestCase):
|
|
32
46
|
|
33
47
|
async def testCustomValues(self):
|
34
48
|
"""
|
35
|
-
Test
|
49
|
+
Test custom value assignment for all Cors configuration parameters.
|
36
50
|
|
37
|
-
|
38
|
-
- `allow_origins` is set to the provided list of origins.
|
39
|
-
- `allow_origin_regex` is set to the provided regex pattern.
|
40
|
-
- `allow_methods` is set to the provided list of HTTP methods.
|
41
|
-
- `allow_headers` is set to the provided list of headers.
|
42
|
-
- `expose_headers` is set to the provided list of exposed headers.
|
43
|
-
- `allow_credentials` is set to True.
|
44
|
-
- `max_age` is set to the provided integer value.
|
51
|
+
Ensures that the Cors object accurately reflects the provided custom configuration values.
|
45
52
|
|
46
|
-
|
53
|
+
Parameters
|
54
|
+
----------
|
55
|
+
allow_origins : list of str
|
56
|
+
Custom list of allowed origins.
|
57
|
+
allow_origin_regex : str
|
58
|
+
Custom regex pattern for allowed origins.
|
59
|
+
allow_methods : list of str
|
60
|
+
Custom list of allowed HTTP methods.
|
61
|
+
allow_headers : list of str
|
62
|
+
Custom list of allowed headers.
|
63
|
+
expose_headers : list of str
|
64
|
+
Custom list of exposed headers.
|
65
|
+
allow_credentials : bool
|
66
|
+
Whether credentials are allowed.
|
67
|
+
max_age : int
|
68
|
+
Custom max age value.
|
47
69
|
"""
|
48
70
|
cors = Cors(
|
49
71
|
allow_origins=["https://example.com"],
|
@@ -64,58 +86,105 @@ class TestCorsConfig(TestCase):
|
|
64
86
|
|
65
87
|
async def testInvalidAllowOriginsType(self):
|
66
88
|
"""
|
67
|
-
Test
|
89
|
+
Test type validation for 'allow_origins' parameter.
|
90
|
+
|
91
|
+
Ensures that passing a string instead of a list to the `allow_origins` parameter
|
68
92
|
raises an OrionisIntegrityException.
|
93
|
+
|
94
|
+
Raises
|
95
|
+
------
|
96
|
+
OrionisIntegrityException
|
97
|
+
If `allow_origins` is not a list.
|
69
98
|
"""
|
70
99
|
with self.assertRaises(OrionisIntegrityException):
|
71
100
|
Cors(allow_origins="*")
|
72
101
|
|
73
102
|
async def testInvalidAllowOriginRegexType(self):
|
74
103
|
"""
|
75
|
-
Test
|
76
|
-
|
104
|
+
Test type validation for 'allow_origin_regex' parameter.
|
105
|
+
|
106
|
+
Ensures that passing a non-string, non-None value (e.g., integer) to the
|
107
|
+
`allow_origin_regex` parameter raises an OrionisIntegrityException.
|
108
|
+
|
109
|
+
Raises
|
110
|
+
------
|
111
|
+
OrionisIntegrityException
|
112
|
+
If `allow_origin_regex` is not a string or None.
|
77
113
|
"""
|
78
114
|
with self.assertRaises(OrionisIntegrityException):
|
79
115
|
Cors(allow_origin_regex=123)
|
80
116
|
|
81
117
|
async def testInvalidAllowMethodsType(self):
|
82
118
|
"""
|
83
|
-
Test
|
119
|
+
Test type validation for 'allow_methods' parameter.
|
120
|
+
|
121
|
+
Ensures that passing a string instead of a list to the `allow_methods` parameter
|
122
|
+
raises an OrionisIntegrityException.
|
84
123
|
|
85
|
-
|
86
|
-
|
124
|
+
Raises
|
125
|
+
------
|
126
|
+
OrionisIntegrityException
|
127
|
+
If `allow_methods` is not a list.
|
87
128
|
"""
|
88
129
|
with self.assertRaises(OrionisIntegrityException):
|
89
130
|
Cors(allow_methods="GET")
|
90
131
|
|
91
132
|
async def testInvalidAllowHeadersType(self):
|
92
133
|
"""
|
93
|
-
Test
|
94
|
-
|
134
|
+
Test type validation for 'allow_headers' parameter.
|
135
|
+
|
136
|
+
Ensures that passing a string instead of a list to the `allow_headers` parameter
|
137
|
+
raises an OrionisIntegrityException.
|
138
|
+
|
139
|
+
Raises
|
140
|
+
------
|
141
|
+
OrionisIntegrityException
|
142
|
+
If `allow_headers` is not a list.
|
95
143
|
"""
|
96
144
|
with self.assertRaises(OrionisIntegrityException):
|
97
145
|
Cors(allow_headers="Authorization")
|
98
146
|
|
99
147
|
async def testInvalidExposeHeadersType(self):
|
100
148
|
"""
|
101
|
-
Test
|
102
|
-
|
149
|
+
Test type validation for 'expose_headers' parameter.
|
150
|
+
|
151
|
+
Ensures that passing a string instead of a list to the `expose_headers` parameter
|
152
|
+
raises an OrionisIntegrityException.
|
153
|
+
|
154
|
+
Raises
|
155
|
+
------
|
156
|
+
OrionisIntegrityException
|
157
|
+
If `expose_headers` is not a list.
|
103
158
|
"""
|
104
159
|
with self.assertRaises(OrionisIntegrityException):
|
105
160
|
Cors(expose_headers="X-Custom-Header")
|
106
161
|
|
107
162
|
async def testInvalidAllowCredentialsType(self):
|
108
163
|
"""
|
109
|
-
Test
|
110
|
-
|
164
|
+
Test type validation for 'allow_credentials' parameter.
|
165
|
+
|
166
|
+
Ensures that passing a non-boolean value to the `allow_credentials` parameter
|
167
|
+
raises an OrionisIntegrityException.
|
168
|
+
|
169
|
+
Raises
|
170
|
+
------
|
171
|
+
OrionisIntegrityException
|
172
|
+
If `allow_credentials` is not a boolean.
|
111
173
|
"""
|
112
174
|
with self.assertRaises(OrionisIntegrityException):
|
113
175
|
Cors(allow_credentials="yes")
|
114
176
|
|
115
177
|
async def testInvalidMaxAgeType(self):
|
116
178
|
"""
|
117
|
-
Test
|
118
|
-
|
179
|
+
Test type validation for 'max_age' parameter.
|
180
|
+
|
181
|
+
Ensures that passing a non-integer value (e.g., string) to the `max_age` parameter
|
182
|
+
raises an OrionisIntegrityException.
|
183
|
+
|
184
|
+
Raises
|
185
|
+
------
|
186
|
+
OrionisIntegrityException
|
187
|
+
If `max_age` is not an integer or None.
|
119
188
|
"""
|
120
189
|
with self.assertRaises(OrionisIntegrityException):
|
121
190
|
Cors(max_age="3600")
|
@@ -6,12 +6,22 @@ from orionis.unittesting import TestCase
|
|
6
6
|
class TestConfigDatabase(TestCase):
|
7
7
|
"""
|
8
8
|
Test cases for the Database configuration class.
|
9
|
+
|
10
|
+
This class contains unit tests for the `Database` configuration class,
|
11
|
+
ensuring correct default values, validation, dictionary representation,
|
12
|
+
custom values, hashability, and keyword-only initialization.
|
13
|
+
|
14
|
+
Attributes
|
15
|
+
----------
|
16
|
+
None
|
9
17
|
"""
|
10
18
|
|
11
19
|
async def testDefaultValues(self):
|
12
20
|
"""
|
13
|
-
Test
|
14
|
-
|
21
|
+
Test creation of Database instance with default values.
|
22
|
+
|
23
|
+
Ensures that the default connection is set to 'sqlite' and the
|
24
|
+
connections attribute is properly initialized as a Connections instance.
|
15
25
|
"""
|
16
26
|
db = Database()
|
17
27
|
self.assertEqual(db.default, 'sqlite')
|
@@ -19,8 +29,11 @@ class TestConfigDatabase(TestCase):
|
|
19
29
|
|
20
30
|
async def testDefaultConnectionValidation(self):
|
21
31
|
"""
|
22
|
-
|
23
|
-
|
32
|
+
Validate the default connection attribute.
|
33
|
+
|
34
|
+
Checks that only valid connection types are accepted as default.
|
35
|
+
Also verifies that invalid, empty, or non-string defaults raise
|
36
|
+
OrionisIntegrityException.
|
24
37
|
"""
|
25
38
|
# Test valid connection types
|
26
39
|
valid_connections = ['sqlite', 'mysql', 'pgsql', 'oracle']
|
@@ -44,8 +57,11 @@ class TestConfigDatabase(TestCase):
|
|
44
57
|
|
45
58
|
async def testConnectionsValidation(self):
|
46
59
|
"""
|
47
|
-
|
48
|
-
|
60
|
+
Validate the connections attribute.
|
61
|
+
|
62
|
+
Ensures that only instances of Connections are accepted for the
|
63
|
+
connections attribute. Invalid types or None should raise
|
64
|
+
OrionisIntegrityException.
|
49
65
|
"""
|
50
66
|
# Test invalid connections type
|
51
67
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -63,8 +79,10 @@ class TestConfigDatabase(TestCase):
|
|
63
79
|
|
64
80
|
async def testToDictMethod(self):
|
65
81
|
"""
|
66
|
-
Test
|
67
|
-
|
82
|
+
Test the toDict method of Database.
|
83
|
+
|
84
|
+
Ensures that the toDict method returns a dictionary representation
|
85
|
+
of the Database instance, including all attributes.
|
68
86
|
"""
|
69
87
|
db = Database()
|
70
88
|
db_dict = db.toDict()
|
@@ -74,8 +92,10 @@ class TestConfigDatabase(TestCase):
|
|
74
92
|
|
75
93
|
async def testCustomValues(self):
|
76
94
|
"""
|
77
|
-
Test
|
78
|
-
|
95
|
+
Test storage and validation of custom values.
|
96
|
+
|
97
|
+
Ensures that custom configurations for default and connections
|
98
|
+
are correctly handled and validated.
|
79
99
|
"""
|
80
100
|
custom_connections = Connections()
|
81
101
|
custom_db = Database(
|
@@ -87,8 +107,10 @@ class TestConfigDatabase(TestCase):
|
|
87
107
|
|
88
108
|
async def testHashability(self):
|
89
109
|
"""
|
90
|
-
Test
|
91
|
-
|
110
|
+
Test hashability of Database instances.
|
111
|
+
|
112
|
+
Ensures that Database instances are hashable (due to unsafe_hash=True)
|
113
|
+
and can be used in sets and as dictionary keys.
|
92
114
|
"""
|
93
115
|
db1 = Database()
|
94
116
|
db2 = Database()
|
@@ -101,8 +123,10 @@ class TestConfigDatabase(TestCase):
|
|
101
123
|
|
102
124
|
async def testKwOnlyInitialization(self):
|
103
125
|
"""
|
104
|
-
Test
|
105
|
-
|
126
|
+
Test keyword-only initialization enforcement.
|
127
|
+
|
128
|
+
Ensures that Database enforces keyword-only initialization and
|
129
|
+
raises TypeError when positional arguments are used.
|
106
130
|
"""
|
107
131
|
with self.assertRaises(TypeError):
|
108
132
|
Database('sqlite', Connections())
|
@@ -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())
|