orionis 0.286.0__py3-none-any.whl → 0.288.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 (86) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/environment/contracts/env.py +45 -50
  3. orionis/services/environment/contracts/types.py +70 -0
  4. orionis/services/environment/dot_env.py +204 -182
  5. orionis/services/environment/env.py +68 -85
  6. orionis/services/{standard/exceptions/path_value_exceptions.py → environment/exceptions/environment_value_error.py} +2 -12
  7. orionis/services/environment/exceptions/environment_value_exception.py +23 -0
  8. orionis/services/environment/types.py +578 -0
  9. orionis/services/paths/exceptions/not_found_exceptions.py +15 -12
  10. orionis/services/paths/exceptions/path_value_exceptions.py +13 -10
  11. orionis/services/standard/contracts/std.py +1 -1
  12. orionis/services/standard/exceptions/std_value_exception.py +23 -0
  13. orionis/services/standard/std.py +2 -2
  14. orionis/services/system/contracts/imports.py +27 -7
  15. orionis/services/system/contracts/workers.py +8 -3
  16. orionis/services/system/imports.py +31 -12
  17. orionis/services/system/runtime_imports.py +33 -23
  18. orionis/services/system/workers.py +6 -8
  19. orionis/services/wrapper/dicts/dot_dict.py +82 -41
  20. orionis/test/logs/history.py +3 -5
  21. orionis/unittesting.py +12 -12
  22. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/METADATA +1 -1
  23. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/RECORD +76 -70
  24. tests/example/test_example.py +5 -2
  25. tests/foundation/config/app/{test_app.py → test_foundation_config_app.py} +14 -4
  26. tests/foundation/config/auth/{test_auth.py → test_foundation_config_auth.py} +10 -5
  27. tests/foundation/config/cache/{test_cache.py → test_foundation_config_cache.py} +61 -16
  28. tests/foundation/config/cache/test_foundation_config_cache_file.py +126 -0
  29. tests/foundation/config/cache/test_foundation_config_cache_stores.py +148 -0
  30. tests/foundation/config/cors/test_foundation_config_cors.py +190 -0
  31. tests/foundation/config/database/{test_database.py → test_foundation_config_database.py} +39 -15
  32. tests/foundation/config/database/{test_database_connections.py → test_foundation_config_database_connections.py} +80 -6
  33. tests/foundation/config/database/{test_database_mysql.py → test_foundation_config_database_mysql.py} +139 -16
  34. tests/foundation/config/database/{test_database_oracle.py → test_foundation_config_database_oracle.py} +111 -27
  35. tests/foundation/config/database/{test_database_pgsql.py → test_foundation_config_database_pgsql.py} +97 -27
  36. tests/foundation/config/database/{test_database_sqlite.py → test_foundation_config_database_sqlite.py} +57 -3
  37. tests/foundation/config/exceptions/{test_exceptions_integrity.py → test_foundation_config_exceptions.py} +45 -11
  38. tests/foundation/config/filesystems/{test_filesystems.py → test_foundation_config_filesystems.py} +65 -15
  39. tests/foundation/config/filesystems/{test_filesystems_aws.py → test_foundation_config_filesystems_aws.py} +46 -8
  40. tests/foundation/config/filesystems/{test_filesystems_disks.py → test_foundation_config_filesystems_disks.py} +79 -9
  41. tests/foundation/config/filesystems/{test_filesystems_local.py → test_foundation_config_filesystems_local.py} +67 -19
  42. tests/foundation/config/filesystems/{test_filesystems_public.py → test_foundation_config_filesystems_public.py} +38 -1
  43. tests/foundation/config/logging/test_foundation_config_logging.py +112 -0
  44. tests/foundation/config/logging/{test_logging_channels.py → test_foundation_config_logging_channels.py} +80 -3
  45. tests/foundation/config/logging/{test_logging_chunked.py → test_foundation_config_logging_chunked.py} +86 -13
  46. tests/foundation/config/logging/{test_logging_daily.py → test_foundation_config_logging_daily.py} +80 -13
  47. tests/foundation/config/logging/{test_logging_hourly.py → test_foundation_config_logging_hourly.py} +69 -3
  48. tests/foundation/config/logging/{test_logging_monthly.py → test_foundation_config_logging_monthly.py} +49 -3
  49. tests/foundation/config/logging/{test_logging_stack.py → test_foundation_config_logging_stack.py} +50 -15
  50. tests/foundation/config/logging/{test_logging_weekly.py → test_foundation_config_logging_weekly.py} +93 -3
  51. tests/foundation/config/mail/test_foundation_config_mail.py +145 -0
  52. tests/foundation/config/mail/{test_mail_file.py → test_foundation_config_mail_file.py} +41 -5
  53. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +106 -0
  54. tests/foundation/config/mail/{test_mail_smtp.py → test_foundation_config_mail_smtp.py} +59 -15
  55. tests/foundation/config/queue/test_foundation_config_queue.py +111 -0
  56. tests/foundation/config/queue/{test_queue_brokers.py → test_foundation_config_queue_brokers.py} +28 -11
  57. tests/foundation/config/queue/{test_queue_database.py → test_foundation_config_queue_database.py} +54 -16
  58. tests/foundation/config/root/{test_root_paths.py → test_foundation_config_root_paths.py} +70 -3
  59. tests/foundation/config/session/{test_session.py → test_foundation_config_session.py} +31 -2
  60. tests/foundation/config/startup/{test_config_startup.py → test_foundation_config_startup.py} +91 -21
  61. tests/foundation/config/testing/{test_testing.py → test_foundation_config_testing.py} +69 -1
  62. tests/patterns/singleton/test_patterns_singleton.py +27 -0
  63. tests/services/asynchrony/{test_async_io.py → test_services_asynchrony_coroutine.py} +1 -1
  64. tests/services/environment/test_services_environment.py +93 -0
  65. tests/services/path/{test_resolver.py → test_services_resolver.py} +51 -12
  66. tests/services/standard/{test_std.py → test_services_std.py} +45 -22
  67. tests/services/system/__init__.py +0 -0
  68. tests/services/system/test_services_system_imports.py +101 -0
  69. tests/services/system/test_services_system_workers.py +89 -0
  70. tests/services/wrapper/{test_wrapper_doc_dict.py → test_services_wrapper_docdict.py} +28 -16
  71. tests/testing/test_testing_result.py +57 -20
  72. tests/testing/test_testing_unit.py +110 -41
  73. orionis/services/environment/exceptions/value_exception.py +0 -27
  74. tests/foundation/config/cache/test_cache_file.py +0 -78
  75. tests/foundation/config/cache/test_cache_stores.py +0 -88
  76. tests/foundation/config/cors/test_cors.py +0 -121
  77. tests/foundation/config/logging/test_logging.py +0 -48
  78. tests/foundation/config/mail/test_mail.py +0 -73
  79. tests/foundation/config/mail/test_mail_mailers.py +0 -58
  80. tests/foundation/config/queue/test_queue.py +0 -58
  81. tests/patterns/singleton/test_singleton.py +0 -18
  82. tests/services/environment/test_env.py +0 -155
  83. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/WHEEL +0 -0
  84. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/licenses/LICENCE +0 -0
  85. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/top_level.txt +0 -0
  86. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/zip-safe +0 -0
@@ -3,15 +3,26 @@ from orionis.foundation.config.logging.enums.levels import Level
3
3
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestConfigMonthly(TestCase):
6
+ class TestFoundationConfigLoggingMonthly(TestCase):
7
7
  """
8
8
  Test cases for the Monthly logging configuration class.
9
+
10
+ Notes
11
+ -----
12
+ This test suite verifies the correct behavior of the `Monthly` logging configuration,
13
+ including default values, attribute validation, dictionary conversion, hashability,
14
+ and keyword-only initialization.
9
15
  """
10
16
 
11
17
  async def testDefaultValues(self):
12
18
  """
13
19
  Test that Monthly instance is created with correct default values.
14
- Verifies default path, level and retention_months match expected values.
20
+
21
+ Verifies
22
+ --------
23
+ - Default path is "storage/log/application.log".
24
+ - Default level is `Level.INFO.value`.
25
+ - Default retention_months is 4.
15
26
  """
16
27
  monthly = Monthly()
17
28
  self.assertEqual(monthly.path, "storage/log/application.log")
@@ -21,7 +32,11 @@ class TestConfigMonthly(TestCase):
21
32
  async def testPathValidation(self):
22
33
  """
23
34
  Test path attribute validation.
24
- Verifies that empty or non-string paths raise exceptions.
35
+
36
+ Verifies
37
+ --------
38
+ - Empty or non-string paths raise `OrionisIntegrityException`.
39
+ - Valid string paths do not raise exceptions.
25
40
  """
26
41
  with self.assertRaises(OrionisIntegrityException):
27
42
  Monthly(path="")
@@ -35,6 +50,11 @@ class TestConfigMonthly(TestCase):
35
50
  async def testLevelValidation(self):
36
51
  """
37
52
  Test level attribute validation with different input types.
53
+
54
+ Verifies
55
+ --------
56
+ - Accepts string, int, and enum values for level.
57
+ - Invalid level values raise `OrionisIntegrityException`.
38
58
  """
39
59
  # Test string level
40
60
  monthly = Monthly(level="debug")
@@ -59,6 +79,11 @@ class TestConfigMonthly(TestCase):
59
79
  async def testRetentionMonthsValidation(self):
60
80
  """
61
81
  Test retention_months attribute validation.
82
+
83
+ Verifies
84
+ --------
85
+ - Accepts valid integer values for retention_months.
86
+ - Invalid values raise `OrionisIntegrityException`.
62
87
  """
63
88
  # Test valid values
64
89
  try:
@@ -81,6 +106,11 @@ class TestConfigMonthly(TestCase):
81
106
  async def testWhitespaceHandling(self):
82
107
  """
83
108
  Test whitespace handling in path and level attributes.
109
+
110
+ Verifies
111
+ --------
112
+ - Whitespace in path is preserved.
113
+ - Whitespace in level is handled correctly.
84
114
  """
85
115
  monthly = Monthly(path=" logs/app.log ", level=" debug ")
86
116
  self.assertEqual(monthly.path, " logs/app.log ")
@@ -89,6 +119,10 @@ class TestConfigMonthly(TestCase):
89
119
  async def testToDictMethod(self):
90
120
  """
91
121
  Test that toDict returns proper dictionary representation.
122
+
123
+ Verifies
124
+ --------
125
+ - Output is a dictionary with correct keys and values.
92
126
  """
93
127
  monthly = Monthly()
94
128
  monthly_dict = monthly.toDict()
@@ -100,6 +134,10 @@ class TestConfigMonthly(TestCase):
100
134
  async def testCustomValuesToDict(self):
101
135
  """
102
136
  Test that custom values are properly included in dictionary.
137
+
138
+ Verifies
139
+ --------
140
+ - Custom path, level, and retention_months are reflected in the output dictionary.
103
141
  """
104
142
  custom_monthly = Monthly(
105
143
  path="custom/logs/app.log",
@@ -114,6 +152,10 @@ class TestConfigMonthly(TestCase):
114
152
  async def testHashability(self):
115
153
  """
116
154
  Test that Monthly maintains hashability due to unsafe_hash=True.
155
+
156
+ Verifies
157
+ --------
158
+ - Monthly instances can be added to a set and compared by value.
117
159
  """
118
160
  monthly1 = Monthly()
119
161
  monthly2 = Monthly()
@@ -128,6 +170,10 @@ class TestConfigMonthly(TestCase):
128
170
  async def testKwOnlyInitialization(self):
129
171
  """
130
172
  Test that Monthly enforces keyword-only initialization.
173
+
174
+ Verifies
175
+ --------
176
+ - Positional arguments raise TypeError.
131
177
  """
132
178
  with self.assertRaises(TypeError):
133
179
  Monthly("path.log", "info", 4)
@@ -3,15 +3,21 @@ from orionis.foundation.config.logging.enums.levels import Level
3
3
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestConfigStack(TestCase):
6
+ class TestFoundationConfigLoggingStack(TestCase):
7
7
  """
8
8
  Test cases for the Stack logging configuration class.
9
+
10
+ This class contains asynchronous unit tests for the Stack class,
11
+ validating default values, attribute validation, dictionary representation,
12
+ hashability, and keyword-only initialization.
9
13
  """
10
14
 
11
15
  async def testDefaultValues(self):
12
16
  """
13
- Test that Stack instance is created with correct default values.
14
- Verifies default path and level match expected values from class definition.
17
+ Test default values of Stack.
18
+
19
+ Ensures that a Stack instance is created with the correct default values.
20
+ Verifies that the default path and level match the expected values from the class definition.
15
21
  """
16
22
  stack = Stack()
17
23
  self.assertEqual(stack.path, "storage/log/application.log")
@@ -19,8 +25,14 @@ class TestConfigStack(TestCase):
19
25
 
20
26
  async def testPathValidation(self):
21
27
  """
22
- Test path attribute validation.
23
- Verifies that empty or non-string paths raise exceptions.
28
+ Test validation of the path attribute.
29
+
30
+ Checks that empty or non-string paths raise exceptions, and that valid paths are accepted.
31
+
32
+ Raises
33
+ ------
34
+ OrionisIntegrityException
35
+ If the path is empty or not a string.
24
36
  """
25
37
  # Test empty path
26
38
  with self.assertRaises(OrionisIntegrityException):
@@ -36,8 +48,14 @@ class TestConfigStack(TestCase):
36
48
 
37
49
  async def testLevelValidation(self):
38
50
  """
39
- Test level attribute validation with different input types.
40
- Verifies string, int and enum level values are properly handled.
51
+ Test validation of the level attribute with different input types.
52
+
53
+ Verifies that string, int, and enum level values are properly handled.
54
+
55
+ Raises
56
+ ------
57
+ OrionisIntegrityException
58
+ If the level is invalid or of an unsupported type.
41
59
  """
42
60
  # Test string level
43
61
  stack = Stack(level="debug")
@@ -65,8 +83,9 @@ class TestConfigStack(TestCase):
65
83
 
66
84
  async def testWhitespaceHandling(self):
67
85
  """
68
- Test whitespace handling in path and level attributes.
69
- Verifies whitespace is preserved in path and trimmed in level strings.
86
+ Test handling of whitespace in path and level attributes.
87
+
88
+ Ensures that whitespace is preserved in the path and trimmed in level strings.
70
89
  """
71
90
  # Test path with whitespace
72
91
  spaced_path = " logs/app.log "
@@ -79,8 +98,14 @@ class TestConfigStack(TestCase):
79
98
 
80
99
  async def testToDictMethod(self):
81
100
  """
82
- Test that toDict returns proper dictionary representation.
83
- Verifies both path and level are correctly included in dictionary.
101
+ Test the toDict method for dictionary representation.
102
+
103
+ Ensures that both path and level are correctly included in the dictionary.
104
+
105
+ Returns
106
+ -------
107
+ dict
108
+ Dictionary representation of the Stack instance.
84
109
  """
85
110
  stack = Stack()
86
111
  stack_dict = stack.toDict()
@@ -91,7 +116,9 @@ class TestConfigStack(TestCase):
91
116
 
92
117
  async def testCustomValuesToDict(self):
93
118
  """
94
- Test that custom values are properly included in dictionary representation.
119
+ Test custom values in dictionary representation.
120
+
121
+ Ensures that custom path and level values are properly included in the dictionary.
95
122
  """
96
123
  custom_stack = Stack(
97
124
  path="custom/logs/app.log",
@@ -103,8 +130,9 @@ class TestConfigStack(TestCase):
103
130
 
104
131
  async def testHashability(self):
105
132
  """
106
- Test that Stack maintains hashability due to unsafe_hash=True.
107
- Verifies Stack instances can be used in sets and as dictionary keys.
133
+ Test hashability of Stack instances.
134
+
135
+ Ensures that Stack instances can be used in sets and as dictionary keys due to unsafe_hash=True.
108
136
  """
109
137
  stack1 = Stack()
110
138
  stack2 = Stack()
@@ -118,7 +146,14 @@ class TestConfigStack(TestCase):
118
146
 
119
147
  async def testKwOnlyInitialization(self):
120
148
  """
121
- Test that Stack enforces keyword-only initialization.
149
+ Test enforcement of keyword-only initialization.
150
+
151
+ Ensures that Stack cannot be initialized with positional arguments.
152
+
153
+ Raises
154
+ ------
155
+ TypeError
156
+ If positional arguments are used for initialization.
122
157
  """
123
158
  with self.assertRaises(TypeError):
124
159
  Stack("path.log", "info")
@@ -3,15 +3,50 @@ from orionis.foundation.config.logging.enums.levels import Level
3
3
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestConfigWeekly(TestCase):
6
+ class TestFoundationConfigLoggingWeekly(TestCase):
7
7
  """
8
8
  Test cases for the Weekly logging configuration class.
9
+
10
+ This class contains unit tests for the `Weekly` logging configuration entity,
11
+ including validation of default values, attribute validation, dictionary conversion,
12
+ hashability, and keyword-only initialization.
13
+
14
+ Attributes
15
+ ----------
16
+ None
17
+
18
+ Methods
19
+ -------
20
+ testDefaultValues()
21
+ Test that Weekly instance is created with correct default values.
22
+ testPathValidation()
23
+ Test path attribute validation.
24
+ testLevelValidation()
25
+ Test level attribute validation with different input types.
26
+ testRetentionWeeksValidation()
27
+ Test retention_weeks attribute validation.
28
+ testWhitespaceHandling()
29
+ Test whitespace handling in path and level attributes.
30
+ testToDictMethod()
31
+ Test that toDict returns proper dictionary representation.
32
+ testCustomValuesToDict()
33
+ Test that custom values are properly included in dictionary.
34
+ testHashability()
35
+ Test that Weekly maintains hashability due to unsafe_hash=True.
36
+ testKwOnlyInitialization()
37
+ Test that Weekly enforces keyword-only initialization.
9
38
  """
10
39
 
11
40
  async def testDefaultValues(self):
12
41
  """
13
42
  Test that Weekly instance is created with correct default values.
14
- Verifies default path, level and retention_weeks match expected values.
43
+
44
+ Verifies that the default `path`, `level`, and `retention_weeks` attributes
45
+ of a `Weekly` instance match the expected values.
46
+
47
+ Returns
48
+ -------
49
+ None
15
50
  """
16
51
  weekly = Weekly()
17
52
  self.assertEqual(weekly.path, "storage/log/application.log")
@@ -21,7 +56,13 @@ class TestConfigWeekly(TestCase):
21
56
  async def testPathValidation(self):
22
57
  """
23
58
  Test path attribute validation.
24
- Verifies that empty or non-string paths raise exceptions.
59
+
60
+ Verifies that empty or non-string `path` values raise exceptions,
61
+ and that a valid path does not raise an exception.
62
+
63
+ Returns
64
+ -------
65
+ None
25
66
  """
26
67
  with self.assertRaises(OrionisIntegrityException):
27
68
  Weekly(path="")
@@ -35,6 +76,13 @@ class TestConfigWeekly(TestCase):
35
76
  async def testLevelValidation(self):
36
77
  """
37
78
  Test level attribute validation with different input types.
79
+
80
+ Checks that the `level` attribute accepts string, integer, and enum values,
81
+ and raises exceptions for invalid types or values.
82
+
83
+ Returns
84
+ -------
85
+ None
38
86
  """
39
87
  # Test string level
40
88
  weekly = Weekly(level="debug")
@@ -59,6 +107,13 @@ class TestConfigWeekly(TestCase):
59
107
  async def testRetentionWeeksValidation(self):
60
108
  """
61
109
  Test retention_weeks attribute validation.
110
+
111
+ Ensures that valid `retention_weeks` values are accepted and invalid
112
+ values raise exceptions.
113
+
114
+ Returns
115
+ -------
116
+ None
62
117
  """
63
118
  # Test valid values
64
119
  try:
@@ -81,6 +136,13 @@ class TestConfigWeekly(TestCase):
81
136
  async def testWhitespaceHandling(self):
82
137
  """
83
138
  Test whitespace handling in path and level attributes.
139
+
140
+ Verifies that leading and trailing whitespace in `path` and `level`
141
+ attributes are handled as expected.
142
+
143
+ Returns
144
+ -------
145
+ None
84
146
  """
85
147
  weekly = Weekly(path=" logs/app.log ", level=" debug ")
86
148
  self.assertEqual(weekly.path, " logs/app.log ")
@@ -89,6 +151,13 @@ class TestConfigWeekly(TestCase):
89
151
  async def testToDictMethod(self):
90
152
  """
91
153
  Test that toDict returns proper dictionary representation.
154
+
155
+ Ensures that the `toDict` method returns a dictionary with the correct
156
+ keys and values for a default `Weekly` instance.
157
+
158
+ Returns
159
+ -------
160
+ None
92
161
  """
93
162
  weekly = Weekly()
94
163
  weekly_dict = weekly.toDict()
@@ -100,6 +169,13 @@ class TestConfigWeekly(TestCase):
100
169
  async def testCustomValuesToDict(self):
101
170
  """
102
171
  Test that custom values are properly included in dictionary.
172
+
173
+ Checks that custom attribute values are correctly represented in the
174
+ dictionary returned by `toDict`.
175
+
176
+ Returns
177
+ -------
178
+ None
103
179
  """
104
180
  custom_weekly = Weekly(
105
181
  path="custom/logs/app.log",
@@ -114,6 +190,13 @@ class TestConfigWeekly(TestCase):
114
190
  async def testHashability(self):
115
191
  """
116
192
  Test that Weekly maintains hashability due to unsafe_hash=True.
193
+
194
+ Verifies that `Weekly` instances are hashable and can be used in sets,
195
+ and that identical instances are considered equal.
196
+
197
+ Returns
198
+ -------
199
+ None
117
200
  """
118
201
  weekly1 = Weekly()
119
202
  weekly2 = Weekly()
@@ -128,6 +211,13 @@ class TestConfigWeekly(TestCase):
128
211
  async def testKwOnlyInitialization(self):
129
212
  """
130
213
  Test that Weekly enforces keyword-only initialization.
214
+
215
+ Ensures that providing positional arguments to the `Weekly` constructor
216
+ raises a TypeError.
217
+
218
+ Returns
219
+ -------
220
+ None
131
221
  """
132
222
  with self.assertRaises(TypeError):
133
223
  Weekly("path.log", "info", 4)
@@ -0,0 +1,145 @@
1
+ from orionis.foundation.config.mail.entities.mail import Mail
2
+ from orionis.foundation.config.mail.entities.mailers import Mailers
3
+ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
+ from orionis.unittesting import TestCase
5
+
6
+ class TestFoundationConfigMail(TestCase):
7
+ """
8
+ Test suite for the Mail class, covering initialization, validation, and utility methods.
9
+ """
10
+
11
+ async def testDefaultInitialization(self):
12
+ """
13
+ Test default initialization of Mail.
14
+
15
+ Tests that a Mail instance is initialized with the correct default values.
16
+
17
+ Returns
18
+ -------
19
+ None
20
+
21
+ Raises
22
+ ------
23
+ AssertionError
24
+ If the default mailer is not 'smtp' or mailers is not an instance of Mailers.
25
+ """
26
+ mail = Mail()
27
+ self.assertEqual(mail.default, "smtp")
28
+ self.assertIsInstance(mail.mailers, Mailers)
29
+
30
+ async def testDefaultValidation(self):
31
+ """
32
+ Test validation of the default mailer.
33
+
34
+ Ensures that providing an invalid default mailer raises an exception.
35
+
36
+ Returns
37
+ -------
38
+ None
39
+
40
+ Raises
41
+ ------
42
+ OrionisIntegrityException
43
+ If the default mailer is invalid or not a string.
44
+ """
45
+ with self.assertRaises(OrionisIntegrityException):
46
+ Mail(default="invalid_mailer")
47
+ with self.assertRaises(OrionisIntegrityException):
48
+ Mail(default=123)
49
+
50
+ async def testMailersTypeValidation(self):
51
+ """
52
+ Test type validation for the mailers attribute.
53
+
54
+ Ensures that assigning a non-Mailers object to mailers raises an exception.
55
+
56
+ Returns
57
+ -------
58
+ None
59
+
60
+ Raises
61
+ ------
62
+ OrionisIntegrityException
63
+ If mailers is not an instance of Mailers.
64
+ """
65
+ with self.assertRaises(OrionisIntegrityException):
66
+ Mail(mailers="invalid_mailers_object")
67
+
68
+ async def testToDictMethod(self):
69
+ """
70
+ Test the toDict method.
71
+
72
+ Checks that the toDict method returns a dictionary representation of the Mail instance.
73
+
74
+ Returns
75
+ -------
76
+ None
77
+
78
+ Raises
79
+ ------
80
+ AssertionError
81
+ If the returned value is not a dict or missing expected fields.
82
+ """
83
+ mail = Mail()
84
+ result = mail.toDict()
85
+ self.assertIsInstance(result, dict)
86
+ self.assertIn("default", result)
87
+ self.assertIn("mailers", result)
88
+ self.assertEqual(result["default"], "smtp")
89
+
90
+ async def testHashability(self):
91
+ """
92
+ Test hashability of Mail instances.
93
+
94
+ Ensures that Mail instances are hashable and can be used in sets or as dictionary keys.
95
+
96
+ Returns
97
+ -------
98
+ None
99
+
100
+ Raises
101
+ ------
102
+ AssertionError
103
+ If Mail instances are not hashable or set behavior is incorrect.
104
+ """
105
+ mail1 = Mail()
106
+ mail2 = Mail(default="smtp")
107
+ test_set = {mail1, mail2}
108
+ self.assertEqual(len(test_set), 1)
109
+
110
+ async def testKwOnlyInitialization(self):
111
+ """
112
+ Test keyword-only initialization enforcement.
113
+
114
+ Ensures that Mail requires keyword arguments for initialization.
115
+
116
+ Returns
117
+ -------
118
+ None
119
+
120
+ Raises
121
+ ------
122
+ TypeError
123
+ If positional arguments are used for initialization.
124
+ """
125
+ with self.assertRaises(TypeError):
126
+ Mail("smtp", Mailers())
127
+
128
+ async def testValidCustomInitialization(self):
129
+ """
130
+ Test valid custom initialization.
131
+
132
+ Checks that a Mail instance can be created with valid, non-default values.
133
+
134
+ Returns
135
+ -------
136
+ None
137
+
138
+ Raises
139
+ ------
140
+ AssertionError
141
+ If the instance is not initialized with the provided values.
142
+ """
143
+ mail = Mail(default="smtp", mailers=Mailers())
144
+ self.assertEqual(mail.default, "smtp")
145
+ self.assertIsInstance(mail.mailers, Mailers)
@@ -2,11 +2,17 @@ from orionis.foundation.config.mail.entities.file import File
2
2
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
3
3
  from orionis.unittesting import TestCase
4
4
 
5
- class TestMailFile(TestCase):
5
+ class TestFoundationConfigMailFile(TestCase):
6
+ """
7
+ Unit tests for the File entity in the mail configuration module.
8
+ """
6
9
 
7
10
  async def testDefaultPathValue(self):
8
11
  """
9
12
  Test that the File instance is initialized with the correct default path.
13
+
14
+ Notes
15
+ -----
10
16
  Verifies that a new File object has 'storage/mail' as the default path.
11
17
  """
12
18
  file = File()
@@ -14,8 +20,16 @@ class TestMailFile(TestCase):
14
20
 
15
21
  async def testPathValidation(self):
16
22
  """
17
- Test the path validation in __post_init__ method.
18
- Verifies that non-string paths raise OrionisIntegrityException.
23
+ Test the path validation in the __post_init__ method.
24
+
25
+ Raises
26
+ ------
27
+ OrionisIntegrityException
28
+ If the path is not a string or is an empty string.
29
+
30
+ Notes
31
+ -----
32
+ Verifies that non-string paths or empty strings raise OrionisIntegrityException.
19
33
  """
20
34
  with self.assertRaises(OrionisIntegrityException):
21
35
  File(path=123)
@@ -25,6 +39,9 @@ class TestMailFile(TestCase):
25
39
  async def testValidPathAssignment(self):
26
40
  """
27
41
  Test that valid path assignments work correctly.
42
+
43
+ Notes
44
+ -----
28
45
  Verifies that string paths are accepted and stored properly.
29
46
  """
30
47
  test_path = "custom/path/to/mail"
@@ -34,8 +51,16 @@ class TestMailFile(TestCase):
34
51
  async def testToDictMethod(self):
35
52
  """
36
53
  Test the toDict method returns a proper dictionary representation.
37
- Checks that the toDict method converts the File instance
38
- into a dictionary with the expected path field.
54
+
55
+ Returns
56
+ -------
57
+ dict
58
+ Dictionary representation of the File instance.
59
+
60
+ Notes
61
+ -----
62
+ Checks that the toDict method converts the File instance into a dictionary
63
+ with the expected path field.
39
64
  """
40
65
  file = File()
41
66
  result = file.toDict()
@@ -45,6 +70,9 @@ class TestMailFile(TestCase):
45
70
  async def testHashability(self):
46
71
  """
47
72
  Test that File instances are hashable due to unsafe_hash=True.
73
+
74
+ Notes
75
+ -----
48
76
  Verifies that instances can be used in sets or as dictionary keys.
49
77
  """
50
78
  file1 = File()
@@ -55,6 +83,14 @@ class TestMailFile(TestCase):
55
83
  async def testKwOnlyInitialization(self):
56
84
  """
57
85
  Test that File requires keyword arguments for initialization.
86
+
87
+ Raises
88
+ ------
89
+ TypeError
90
+ If positional arguments are used for initialization.
91
+
92
+ Notes
93
+ -----
58
94
  Verifies that the class enforces kw_only=True in its dataclass decorator.
59
95
  """
60
96
  with self.assertRaises(TypeError):