orionis 0.545.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.
Files changed (162) hide show
  1. orionis/console/base/scheduler_event_listener.py +0 -17
  2. orionis/console/contracts/schedule_event_listener.py +0 -18
  3. orionis/console/request/cli_request.py +2 -2
  4. orionis/foundation/config/app/entities/app.py +3 -2
  5. orionis/foundation/config/app/enums/ciphers.py +5 -19
  6. orionis/foundation/config/session/entities/session.py +2 -2
  7. orionis/foundation/providers/cli_request_provider.py +44 -0
  8. orionis/metadata/framework.py +1 -1
  9. orionis/services/encrypter/encrypter.py +115 -0
  10. orionis/services/environment/dynamic/caster.py +35 -27
  11. orionis/services/environment/key/key_generator.py +32 -11
  12. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/METADATA +1 -1
  13. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/RECORD +17 -160
  14. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/top_level.txt +0 -1
  15. tests/container/__init__.py +0 -0
  16. tests/container/context/__init__.py +0 -0
  17. tests/container/context/test_manager.py +0 -38
  18. tests/container/context/test_scope.py +0 -32
  19. tests/container/core/__init__.py +0 -0
  20. tests/container/core/test_advanced_async.py +0 -234
  21. tests/container/core/test_async_optimizations.py +0 -268
  22. tests/container/core/test_container.py +0 -453
  23. tests/container/core/test_singleton.py +0 -122
  24. tests/container/core/test_thread_safety.py +0 -90
  25. tests/container/entities/__init__.py +0 -0
  26. tests/container/entities/test_binding.py +0 -242
  27. tests/container/enums/__init__.py +0 -0
  28. tests/container/enums/test_lifetimes.py +0 -97
  29. tests/container/facades/__init__.py +0 -0
  30. tests/container/facades/test_facade.py +0 -78
  31. tests/container/mocks/__init__.py +0 -0
  32. tests/container/mocks/mock_advanced_async.py +0 -332
  33. tests/container/mocks/mock_async_optimizations.py +0 -407
  34. tests/container/mocks/mock_auto_resolution.py +0 -192
  35. tests/container/mocks/mock_complex_classes.py +0 -792
  36. tests/container/mocks/mock_simple_classes.py +0 -98
  37. tests/container/providers/__init__.py +0 -0
  38. tests/container/providers/test_providers.py +0 -55
  39. tests/container/validators/__init__.py +0 -0
  40. tests/container/validators/test_implements.py +0 -186
  41. tests/container/validators/test_is_abstract_class.py +0 -147
  42. tests/container/validators/test_is_callable.py +0 -102
  43. tests/container/validators/test_is_concrete_class.py +0 -160
  44. tests/container/validators/test_is_instance.py +0 -150
  45. tests/container/validators/test_is_not_subclass.py +0 -49
  46. tests/container/validators/test_is_subclass.py +0 -178
  47. tests/container/validators/test_is_valid_alias.py +0 -147
  48. tests/container/validators/test_lifetime.py +0 -106
  49. tests/example/__init__.py +0 -0
  50. tests/example/test_example.py +0 -725
  51. tests/foundation/__init__.py +0 -0
  52. tests/foundation/config/__init__.py +0 -0
  53. tests/foundation/config/app/__init__.py +0 -0
  54. tests/foundation/config/app/test_foundation_config_app.py +0 -262
  55. tests/foundation/config/auth/__init__.py +0 -0
  56. tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
  57. tests/foundation/config/cache/__init__.py +0 -0
  58. tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
  59. tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
  60. tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
  61. tests/foundation/config/cors/__init__.py +0 -0
  62. tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
  63. tests/foundation/config/database/__init__.py +0 -0
  64. tests/foundation/config/database/test_foundation_config_database.py +0 -158
  65. tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
  66. tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
  67. tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
  68. tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
  69. tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
  70. tests/foundation/config/filesystems/__init__.py +0 -0
  71. tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
  72. tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
  73. tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
  74. tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
  75. tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
  76. tests/foundation/config/logging/__init__.py +0 -0
  77. tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
  78. tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
  79. tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
  80. tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
  81. tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
  82. tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
  83. tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
  84. tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
  85. tests/foundation/config/mail/__init__.py +0 -0
  86. tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
  87. tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
  88. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
  89. tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
  90. tests/foundation/config/queue/__init__.py +0 -0
  91. tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
  92. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
  93. tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
  94. tests/foundation/config/root/__init__.py +0 -0
  95. tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
  96. tests/foundation/config/session/__init__.py +0 -0
  97. tests/foundation/config/session/test_foundation_config_session.py +0 -213
  98. tests/foundation/config/startup/__init__.py +0 -0
  99. tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
  100. tests/foundation/config/testing/__init__.py +0 -0
  101. tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
  102. tests/metadata/__init__.py +0 -0
  103. tests/metadata/test_metadata_framework.py +0 -140
  104. tests/metadata/test_metadata_package.py +0 -139
  105. tests/services/__init__.py +0 -0
  106. tests/services/asynchrony/__init__.py +0 -0
  107. tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
  108. tests/services/environment/__init__.py +0 -0
  109. tests/services/environment/test_services_environment.py +0 -226
  110. tests/services/introspection/__init__.py +0 -0
  111. tests/services/introspection/dependencies/__init__.py +0 -0
  112. tests/services/introspection/dependencies/mocks/__init__.py +0 -0
  113. tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
  114. tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
  115. tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
  116. tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
  117. tests/services/introspection/reflection/__init__.py +0 -0
  118. tests/services/introspection/reflection/mock/__init__.py +0 -0
  119. tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
  120. tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
  121. tests/services/introspection/reflection/test_reflection_callable.py +0 -206
  122. tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
  123. tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
  124. tests/services/introspection/reflection/test_reflection_module.py +0 -567
  125. tests/services/introspection/test_reflection.py +0 -462
  126. tests/services/log/__init__.py +0 -0
  127. tests/services/log/test_log.py +0 -97
  128. tests/services/system/__init__.py +0 -0
  129. tests/services/system/test_services_system_imports.py +0 -204
  130. tests/services/system/test_services_system_workers.py +0 -131
  131. tests/support/__init__.py +0 -0
  132. tests/support/entities/__init__.py +0 -0
  133. tests/support/entities/mock_dataclass.py +0 -40
  134. tests/support/entities/test_base.py +0 -64
  135. tests/support/patterns/__init__.py +0 -0
  136. tests/support/patterns/singleton/__init__.py +0 -0
  137. tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
  138. tests/support/standard/__init__.py +0 -0
  139. tests/support/standard/test_services_std.py +0 -226
  140. tests/support/wrapper/__init__.py +0 -0
  141. tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
  142. tests/testing/__init__.py +0 -0
  143. tests/testing/cases/__init__.py +0 -0
  144. tests/testing/cases/test_testing_asynchronous.py +0 -63
  145. tests/testing/cases/test_testing_synchronous.py +0 -57
  146. tests/testing/entities/__init__.py +0 -0
  147. tests/testing/entities/test_testing_result.py +0 -146
  148. tests/testing/enums/__init__.py +0 -0
  149. tests/testing/enums/test_testing_status.py +0 -63
  150. tests/testing/output/__init__.py +0 -0
  151. tests/testing/output/test_testing_dumper.py +0 -29
  152. tests/testing/output/test_testing_printer.py +0 -42
  153. tests/testing/records/__init__.py +0 -0
  154. tests/testing/records/test_testing_records.py +0 -171
  155. tests/testing/test_testing_unit.py +0 -164
  156. tests/testing/validators/__init__.py +0 -0
  157. tests/testing/validators/test_testing_validators.py +0 -392
  158. tests/testing/view/__init__.py +0 -0
  159. tests/testing/view/test_render.py +0 -30
  160. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/WHEEL +0 -0
  161. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/licenses/LICENCE +0 -0
  162. {orionis-0.545.0.dist-info → orionis-0.547.0.dist-info}/zip-safe +0 -0
@@ -1,288 +0,0 @@
1
- from orionis.foundation.config.database.entities.oracle import Oracle
2
- from orionis.foundation.config.database.enums.oracle_encoding import OracleEncoding
3
- from orionis.foundation.config.database.enums.oracle_nencoding import OracleNencoding
4
- from orionis.foundation.exceptions.integrity import OrionisIntegrityException
5
- from orionis.test.cases.asynchronous import AsyncTestCase
6
-
7
- class TestFoundationConfigDatabaseOracle(AsyncTestCase):
8
- """
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.
15
- """
16
-
17
- async def testDefaultValues(self):
18
- """
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.
28
- """
29
- oracle = Oracle()
30
- self.assertEqual(oracle.driver, 'oracle')
31
- self.assertEqual(oracle.username, 'sys')
32
- self.assertEqual(oracle.password, '')
33
- self.assertEqual(oracle.host, 'localhost')
34
- self.assertEqual(oracle.port, 1521)
35
- self.assertEqual(oracle.service_name, 'ORCL')
36
- self.assertIsNone(oracle.sid)
37
- self.assertIsNone(oracle.dsn)
38
- self.assertIsNone(oracle.tns_name)
39
- self.assertEqual(oracle.encoding, OracleEncoding.AL32UTF8.value)
40
- self.assertEqual(oracle.nencoding, OracleNencoding.AL32UTF8.value)
41
-
42
- async def testDriverValidation(self):
43
- """
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.
52
- """
53
- with self.assertRaises(OrionisIntegrityException):
54
- Oracle(driver='')
55
- with self.assertRaises(OrionisIntegrityException):
56
- Oracle(driver='postgres')
57
- with self.assertRaises(OrionisIntegrityException):
58
- Oracle(driver=123)
59
-
60
- async def testUsernameValidation(self):
61
- """
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.
70
- """
71
- with self.assertRaises(OrionisIntegrityException):
72
- Oracle(username='')
73
- with self.assertRaises(OrionisIntegrityException):
74
- Oracle(username=123)
75
-
76
- async def testPasswordValidation(self):
77
- """
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.
86
- """
87
- with self.assertRaises(OrionisIntegrityException):
88
- Oracle(password=123)
89
-
90
- async def testHostValidation(self):
91
- """
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.
100
- """
101
- with self.assertRaises(OrionisIntegrityException):
102
- Oracle(host='', dsn=None, tns_name=None)
103
- with self.assertRaises(OrionisIntegrityException):
104
- Oracle(host=123, dsn=None, tns_name=None)
105
-
106
- async def testPortValidation(self):
107
- """
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.
116
- """
117
- with self.assertRaises(OrionisIntegrityException):
118
- Oracle(port=0, dsn=None, tns_name=None)
119
- with self.assertRaises(OrionisIntegrityException):
120
- Oracle(port=65536, dsn=None, tns_name=None)
121
- with self.assertRaises(OrionisIntegrityException):
122
- Oracle(port='1521', dsn=None, tns_name=None)
123
-
124
- async def testServiceNameAndSidValidation(self):
125
- """
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.
134
- """
135
- # Test with neither service_name nor sid
136
- with self.assertRaises(OrionisIntegrityException):
137
- Oracle(service_name=None, sid=None, dsn=None, tns_name=None)
138
-
139
- # Test valid with service_name only
140
- try:
141
- Oracle(service_name='ORCL', sid=None, dsn=None, tns_name=None)
142
- except OrionisIntegrityException:
143
- self.fail("Valid service_name should not raise exception")
144
-
145
- # Test valid with sid only
146
- try:
147
- Oracle(service_name=None, sid='XE', dsn=None, tns_name=None)
148
- except OrionisIntegrityException:
149
- self.fail("Valid sid should not raise exception")
150
-
151
- async def testDsnValidation(self):
152
- """
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.
161
- """
162
- with self.assertRaises(OrionisIntegrityException):
163
- Oracle(dsn='')
164
- try:
165
- Oracle(dsn='valid_dsn_string')
166
- except OrionisIntegrityException:
167
- self.fail("Valid dsn should not raise exception")
168
-
169
- async def testTnsNameValidation(self):
170
- """
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.
179
- """
180
- with self.assertRaises(OrionisIntegrityException):
181
- Oracle(tns_name='')
182
- try:
183
- Oracle(tns_name='valid_tns_name')
184
- except OrionisIntegrityException:
185
- self.fail("Valid tns_name should not raise exception")
186
-
187
- async def testEncodingValidation(self):
188
- """
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.
197
- """
198
- # Test enum assignment
199
- oracle = Oracle(encoding=OracleEncoding.WE8ISO8859P1)
200
- self.assertEqual(oracle.encoding, OracleEncoding.WE8ISO8859P1.value)
201
-
202
- # Test invalid value
203
- with self.assertRaises(OrionisIntegrityException):
204
- Oracle(encoding='INVALID')
205
-
206
- async def testNencodingValidation(self):
207
- """
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.
216
- """
217
- # Test string conversion
218
- oracle = Oracle(nencoding='EE8MSWIN1250')
219
- self.assertEqual(oracle.nencoding, OracleNencoding.EE8MSWIN1250.value)
220
-
221
- # Test enum assignment
222
- oracle = Oracle(nencoding=OracleNencoding.ZHS16GBK)
223
- self.assertEqual(oracle.nencoding, OracleNencoding.ZHS16GBK.value)
224
-
225
- # Test invalid value
226
- with self.assertRaises(OrionisIntegrityException):
227
- Oracle(nencoding='INVALID')
228
-
229
- async def testToDictMethod(self):
230
- """
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.
239
- """
240
- oracle = Oracle()
241
- oracle_dict = oracle.toDict()
242
-
243
- self.assertEqual(oracle_dict['driver'], 'oracle')
244
- self.assertEqual(oracle_dict['username'], 'sys')
245
- self.assertEqual(oracle_dict['password'], '')
246
- self.assertEqual(oracle_dict['host'], 'localhost')
247
- self.assertEqual(oracle_dict['port'], 1521)
248
- self.assertEqual(oracle_dict['service_name'], 'ORCL')
249
- self.assertIsNone(oracle_dict['sid'])
250
- self.assertIsNone(oracle_dict['dsn'])
251
- self.assertIsNone(oracle_dict['tns_name'])
252
- self.assertEqual(oracle_dict['encoding'], OracleEncoding.AL32UTF8.value)
253
- self.assertEqual(oracle_dict['nencoding'], OracleNencoding.AL32UTF8.value)
254
-
255
- async def testConnectionMethods(self):
256
- """
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.
265
- """
266
- # Test DSN connection
267
- try:
268
- Oracle(dsn='valid_dsn', host=None, port=None, service_name=None, sid=None)
269
- except OrionisIntegrityException:
270
- self.fail("Valid DSN connection should not raise exception")
271
-
272
- # Test TNS connection
273
- try:
274
- Oracle(tns_name='valid_tns', host=None, port=None, service_name=None, sid=None)
275
- except OrionisIntegrityException:
276
- self.fail("Valid TNS connection should not raise exception")
277
-
278
- # Test host/port/service connection
279
- try:
280
- Oracle(dsn=None, tns_name=None, host='localhost', port=1521, service_name='ORCL')
281
- except OrionisIntegrityException:
282
- self.fail("Valid host/port/service connection should not raise exception")
283
-
284
- # Test host/port/sid connection
285
- try:
286
- Oracle(dsn=None, tns_name=None, host='localhost', port=1521, sid='XE')
287
- except OrionisIntegrityException:
288
- self.fail("Valid host/port/sid connection should not raise exception")
@@ -1,257 +0,0 @@
1
- from orionis.foundation.config.database.entities.pgsql import PGSQL
2
- from orionis.foundation.config.database.enums.pgsql_charsets import PGSQLCharset
3
- from orionis.foundation.config.database.enums.pgsql_mode import PGSQLSSLMode
4
- from orionis.foundation.exceptions.integrity import OrionisIntegrityException
5
- from orionis.test.cases.asynchronous import AsyncTestCase
6
-
7
- class TestFoundationConfigDatabasePgsql(AsyncTestCase):
8
- """
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.
13
- """
14
-
15
- async def testDefaultValues(self):
16
- """
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
25
- """
26
- pgsql = PGSQL()
27
- self.assertEqual(pgsql.driver, 'pgsql')
28
- self.assertEqual(pgsql.host, '127.0.0.1')
29
- self.assertEqual(pgsql.port, 5432)
30
- self.assertEqual(pgsql.database, 'orionis')
31
- self.assertEqual(pgsql.username, 'postgres')
32
- self.assertEqual(pgsql.password, '')
33
- self.assertEqual(pgsql.charset, PGSQLCharset.UTF8.value)
34
- self.assertEqual(pgsql.prefix, '')
35
- self.assertTrue(pgsql.prefix_indexes)
36
- self.assertEqual(pgsql.search_path, 'public')
37
- self.assertEqual(pgsql.sslmode, PGSQLSSLMode.PREFER.value)
38
-
39
- async def testDriverValidation(self):
40
- """
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
48
- """
49
- with self.assertRaises(OrionisIntegrityException):
50
- PGSQL(driver='')
51
- with self.assertRaises(OrionisIntegrityException):
52
- PGSQL(driver=123)
53
-
54
- async def testHostValidation(self):
55
- """
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
63
- """
64
- with self.assertRaises(OrionisIntegrityException):
65
- PGSQL(host='')
66
- with self.assertRaises(OrionisIntegrityException):
67
- PGSQL(host=123)
68
-
69
- async def testPortValidation(self):
70
- """
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
78
- """
79
- with self.assertRaises(OrionisIntegrityException):
80
- PGSQL(port='abc')
81
- with self.assertRaises(OrionisIntegrityException):
82
- PGSQL(port='string')
83
-
84
- async def testDatabaseValidation(self):
85
- """
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
93
- """
94
- with self.assertRaises(OrionisIntegrityException):
95
- PGSQL(database='')
96
- with self.assertRaises(OrionisIntegrityException):
97
- PGSQL(database=123)
98
-
99
- async def testUsernameValidation(self):
100
- """
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
108
- """
109
- with self.assertRaises(OrionisIntegrityException):
110
- PGSQL(username='')
111
- with self.assertRaises(OrionisIntegrityException):
112
- PGSQL(username=123)
113
-
114
- async def testPasswordValidation(self):
115
- """
116
- Test validation of the password attribute.
117
-
118
- Checks that non-string passwords raise an exception.
119
-
120
- Returns
121
- -------
122
- None
123
- """
124
- with self.assertRaises(OrionisIntegrityException):
125
- PGSQL(password=123)
126
-
127
- async def testCharsetValidation(self):
128
- """
129
- Test validation of the charset attribute.
130
-
131
- Ensures correct enum conversion and handling of invalid values.
132
-
133
- Returns
134
- -------
135
- None
136
- """
137
- # Test string conversion
138
- pgsql = PGSQL(charset='UTF8')
139
- self.assertEqual(pgsql.charset, PGSQLCharset.UTF8.value)
140
-
141
- # Test enum assignment
142
- pgsql = PGSQL(charset=PGSQLCharset.LATIN1)
143
- self.assertEqual(pgsql.charset, PGSQLCharset.LATIN1.value)
144
-
145
- # Test invalid value
146
- with self.assertRaises(OrionisIntegrityException):
147
- PGSQL(charset='INVALID')
148
-
149
- async def testPrefixIndexesValidation(self):
150
- """
151
- Test validation of the prefix_indexes attribute.
152
-
153
- Checks that non-boolean values raise an exception.
154
-
155
- Returns
156
- -------
157
- None
158
- """
159
- with self.assertRaises(OrionisIntegrityException):
160
- PGSQL(prefix_indexes='true')
161
- with self.assertRaises(OrionisIntegrityException):
162
- PGSQL(prefix_indexes=1)
163
-
164
- async def testSearchPathValidation(self):
165
- """
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
173
- """
174
- with self.assertRaises(OrionisIntegrityException):
175
- PGSQL(search_path='')
176
- with self.assertRaises(OrionisIntegrityException):
177
- PGSQL(search_path=123)
178
-
179
- async def testSSLModeValidation(self):
180
- """
181
- Test validation of the sslmode attribute.
182
-
183
- Ensures correct enum conversion and handling of invalid values.
184
-
185
- Returns
186
- -------
187
- None
188
- """
189
- # Test string conversion
190
- pgsql = PGSQL(sslmode='REQUIRE')
191
- self.assertEqual(pgsql.sslmode, PGSQLSSLMode.REQUIRE.value)
192
-
193
- # Test enum assignment
194
- pgsql = PGSQL(sslmode=PGSQLSSLMode.DISABLE)
195
- self.assertEqual(pgsql.sslmode, PGSQLSSLMode.DISABLE.value)
196
-
197
- # Test invalid value
198
- with self.assertRaises(OrionisIntegrityException):
199
- PGSQL(sslmode='INVALID')
200
-
201
- async def testToDictMethod(self):
202
- """
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
211
- """
212
- pgsql = PGSQL()
213
- pgsql_dict = pgsql.toDict()
214
- self.assertEqual(pgsql_dict['driver'], 'pgsql')
215
- self.assertEqual(pgsql_dict['host'], '127.0.0.1')
216
- self.assertEqual(pgsql_dict['port'], 5432)
217
- self.assertEqual(pgsql_dict['database'], 'orionis')
218
- self.assertEqual(pgsql_dict['username'], 'postgres')
219
- self.assertEqual(pgsql_dict['password'], '')
220
- self.assertEqual(pgsql_dict['charset'], PGSQLCharset.UTF8.value)
221
- self.assertEqual(pgsql_dict['prefix'], '')
222
- self.assertTrue(pgsql_dict['prefix_indexes'])
223
- self.assertEqual(pgsql_dict['search_path'], 'public')
224
- self.assertEqual(pgsql_dict['sslmode'], PGSQLSSLMode.PREFER.value)
225
-
226
- async def testCustomValues(self):
227
- """
228
- Test custom configuration values for PGSQL.
229
-
230
- Ensures that custom values are properly stored and validated.
231
-
232
- Returns
233
- -------
234
- None
235
- """
236
- custom_pgsql = PGSQL(
237
- host='db.example.com',
238
- port='6432',
239
- database='custom_db',
240
- username='admin',
241
- password='secure123',
242
- charset='LATIN1',
243
- prefix='app_',
244
- prefix_indexes=False,
245
- search_path='app_schema',
246
- sslmode='VERIFY_FULL'
247
- )
248
- self.assertEqual(custom_pgsql.host, 'db.example.com')
249
- self.assertEqual(custom_pgsql.port, '6432')
250
- self.assertEqual(custom_pgsql.database, 'custom_db')
251
- self.assertEqual(custom_pgsql.username, 'admin')
252
- self.assertEqual(custom_pgsql.password, 'secure123')
253
- self.assertEqual(custom_pgsql.charset, PGSQLCharset.LATIN1.value)
254
- self.assertEqual(custom_pgsql.prefix, 'app_')
255
- self.assertFalse(custom_pgsql.prefix_indexes)
256
- self.assertEqual(custom_pgsql.search_path, 'app_schema')
257
- self.assertEqual(custom_pgsql.sslmode, PGSQLSSLMode.VERIFY_FULL.value)