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.
Files changed (57) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/environment/contracts/env.py +45 -50
  3. orionis/services/environment/dot_env.py +205 -181
  4. orionis/services/environment/env.py +68 -85
  5. orionis/services/environment/exceptions/environment_value_error.py +18 -0
  6. orionis/services/environment/exceptions/environment_value_exception.py +23 -0
  7. orionis/services/environment/type_hint.py +559 -0
  8. orionis/test/logs/history.py +3 -5
  9. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
  10. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/RECORD +56 -54
  11. tests/example/test_example.py +5 -2
  12. tests/foundation/config/app/test_app.py +13 -3
  13. tests/foundation/config/auth/test_auth.py +9 -4
  14. tests/foundation/config/cache/test_cache.py +60 -15
  15. tests/foundation/config/cache/test_cache_file.py +62 -14
  16. tests/foundation/config/cache/test_cache_stores.py +74 -14
  17. tests/foundation/config/cors/test_cors.py +102 -33
  18. tests/foundation/config/database/test_database.py +38 -14
  19. tests/foundation/config/database/test_database_connections.py +79 -5
  20. tests/foundation/config/database/test_database_mysql.py +138 -15
  21. tests/foundation/config/database/test_database_oracle.py +110 -26
  22. tests/foundation/config/database/test_database_pgsql.py +96 -26
  23. tests/foundation/config/database/test_database_sqlite.py +56 -2
  24. tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
  25. tests/foundation/config/filesystems/test_filesystems.py +64 -14
  26. tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
  27. tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
  28. tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
  29. tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
  30. tests/foundation/config/logging/test_logging.py +75 -11
  31. tests/foundation/config/logging/test_logging_channels.py +79 -2
  32. tests/foundation/config/logging/test_logging_chunked.py +85 -12
  33. tests/foundation/config/logging/test_logging_daily.py +79 -12
  34. tests/foundation/config/logging/test_logging_hourly.py +68 -2
  35. tests/foundation/config/logging/test_logging_monthly.py +48 -2
  36. tests/foundation/config/logging/test_logging_stack.py +49 -14
  37. tests/foundation/config/logging/test_logging_weekly.py +92 -2
  38. tests/foundation/config/mail/test_mail.py +87 -15
  39. tests/foundation/config/mail/test_mail_file.py +40 -4
  40. tests/foundation/config/mail/test_mail_mailers.py +56 -8
  41. tests/foundation/config/mail/test_mail_smtp.py +58 -14
  42. tests/foundation/config/queue/test_queue.py +62 -9
  43. tests/foundation/config/queue/test_queue_brokers.py +27 -10
  44. tests/foundation/config/queue/test_queue_database.py +53 -15
  45. tests/foundation/config/root/test_root_paths.py +69 -2
  46. tests/foundation/config/session/test_session.py +30 -1
  47. tests/foundation/config/startup/test_config_startup.py +77 -7
  48. tests/foundation/config/testing/test_testing.py +68 -0
  49. tests/patterns/singleton/test_singleton.py +10 -1
  50. tests/services/environment/test_env.py +3 -4
  51. tests/testing/test_testing_result.py +56 -19
  52. tests/testing/test_testing_unit.py +93 -24
  53. orionis/services/environment/exceptions/value_exception.py +0 -27
  54. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
  55. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
  56. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
  57. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -5,20 +5,33 @@ from orionis.unittesting import TestCase
5
5
  class TestConfigLocal(TestCase):
6
6
  """
7
7
  Test cases for the Local storage configuration class.
8
+
9
+ This class contains asynchronous unit tests for the `Local` storage configuration,
10
+ validating path handling, dictionary conversion, hashability, and initialization constraints.
8
11
  """
9
12
 
10
13
  async def testDefaultPath(self):
11
14
  """
12
- Test that Local instance is created with correct default path.
13
- Verifies the default path matches the expected value from class definition.
15
+ Test Local instance creation with default path.
16
+
17
+ Ensures that the default path of a Local instance matches the expected value.
18
+
19
+ Returns
20
+ -------
21
+ None
14
22
  """
15
23
  local = Local()
16
24
  self.assertEqual(local.path, "storage/app/private")
17
25
 
18
26
  async def testCustomPath(self):
19
27
  """
20
- Test that custom path can be set during initialization.
21
- Verifies the path attribute accepts and stores valid custom paths.
28
+ Test setting a custom path during initialization.
29
+
30
+ Ensures that the path attribute accepts and stores valid custom paths.
31
+
32
+ Returns
33
+ -------
34
+ None
22
35
  """
23
36
  custom_path = "custom/storage/path"
24
37
  local = Local(path=custom_path)
@@ -26,16 +39,26 @@ class TestConfigLocal(TestCase):
26
39
 
27
40
  async def testEmptyPathValidation(self):
28
41
  """
29
- Test that empty paths are rejected.
30
- Verifies that an empty path raises OrionisIntegrityException.
42
+ Test rejection of empty paths.
43
+
44
+ Ensures that initializing Local with an empty path raises OrionisIntegrityException.
45
+
46
+ Returns
47
+ -------
48
+ None
31
49
  """
32
50
  with self.assertRaises(OrionisIntegrityException):
33
51
  Local(path="")
34
52
 
35
53
  async def testPathTypeValidation(self):
36
54
  """
37
- Test that non-string paths are rejected.
38
- Verifies that non-string path values raise OrionisIntegrityException.
55
+ Test rejection of non-string paths.
56
+
57
+ Ensures that non-string path values raise OrionisIntegrityException.
58
+
59
+ Returns
60
+ -------
61
+ None
39
62
  """
40
63
  with self.assertRaises(OrionisIntegrityException):
41
64
  Local(path=123)
@@ -46,8 +69,13 @@ class TestConfigLocal(TestCase):
46
69
 
47
70
  async def testToDictMethod(self):
48
71
  """
49
- Test that toDict returns proper dictionary representation.
50
- Verifies the returned dictionary contains the expected path value.
72
+ Test dictionary representation of Local.
73
+
74
+ Ensures that toDict returns a dictionary containing the expected path value.
75
+
76
+ Returns
77
+ -------
78
+ None
51
79
  """
52
80
  local = Local()
53
81
  config_dict = local.toDict()
@@ -56,8 +84,13 @@ class TestConfigLocal(TestCase):
56
84
 
57
85
  async def testCustomPathToDict(self):
58
86
  """
59
- Test that custom paths are properly included in dictionary representation.
60
- Verifies toDict() includes custom path values when specified.
87
+ Test dictionary representation with custom path.
88
+
89
+ Ensures that toDict includes custom path values when specified.
90
+
91
+ Returns
92
+ -------
93
+ None
61
94
  """
62
95
  custom_path = "another/storage/location"
63
96
  local = Local(path=custom_path)
@@ -66,8 +99,13 @@ class TestConfigLocal(TestCase):
66
99
 
67
100
  async def testWhitespacePathHandling(self):
68
101
  """
69
- Test that paths with whitespace are accepted but not automatically trimmed.
70
- Verifies the validation allows paths containing whitespace characters.
102
+ Test handling of paths with whitespace.
103
+
104
+ Ensures that paths containing whitespace are accepted and not automatically trimmed.
105
+
106
+ Returns
107
+ -------
108
+ None
71
109
  """
72
110
  spaced_path = " storage/with/space "
73
111
  local = Local(path=spaced_path)
@@ -75,8 +113,13 @@ class TestConfigLocal(TestCase):
75
113
 
76
114
  async def testHashability(self):
77
115
  """
78
- Test that Local maintains hashability due to unsafe_hash=True.
79
- Verifies that Local instances can be used in sets and as dictionary keys.
116
+ Test hashability of Local instances.
117
+
118
+ Ensures that Local instances can be used in sets and as dictionary keys.
119
+
120
+ Returns
121
+ -------
122
+ None
80
123
  """
81
124
  local1 = Local()
82
125
  local2 = Local()
@@ -88,8 +131,13 @@ class TestConfigLocal(TestCase):
88
131
 
89
132
  async def testKwOnlyInitialization(self):
90
133
  """
91
- Test that Local enforces keyword-only initialization.
92
- Verifies that positional arguments are not allowed for initialization.
134
+ Test enforcement of keyword-only initialization.
135
+
136
+ Ensures that positional arguments are not allowed for Local initialization.
137
+
138
+ Returns
139
+ -------
140
+ None
93
141
  """
94
142
  with self.assertRaises(TypeError):
95
143
  Local("storage/path")
@@ -5,11 +5,39 @@ from orionis.unittesting import TestCase
5
5
  class TestConfigPublic(TestCase):
6
6
  """
7
7
  Test cases for the Public storage configuration class.
8
+
9
+ This class contains asynchronous unit tests for the `Public` storage configuration,
10
+ validating default values, custom values, input validation, dictionary conversion,
11
+ whitespace handling, hashability, and keyword-only initialization.
12
+
13
+ Methods
14
+ -------
15
+ testDefaultValues()
16
+ Test that Public instance is created with correct default values.
17
+ testCustomValues()
18
+ Test that custom path and url can be set during initialization.
19
+ testEmptyPathValidation()
20
+ Test that empty paths are rejected.
21
+ testEmptyUrlValidation()
22
+ Test that empty URLs are rejected.
23
+ testTypeValidation()
24
+ Test that non-string values are rejected for both attributes.
25
+ testToDictMethod()
26
+ Test that toDict returns proper dictionary representation.
27
+ testCustomValuesToDict()
28
+ Test that custom values are properly included in dictionary representation.
29
+ testWhitespaceHandling()
30
+ Test that values with whitespace are accepted but not automatically trimmed.
31
+ testHashability()
32
+ Test that Public maintains hashability due to unsafe_hash=True.
33
+ testKwOnlyInitialization()
34
+ Test that Public enforces keyword-only initialization.
8
35
  """
9
36
 
10
37
  async def testDefaultValues(self):
11
38
  """
12
39
  Test that Public instance is created with correct default values.
40
+
13
41
  Verifies both default path and url match expected values from class definition.
14
42
  """
15
43
  public = Public()
@@ -19,6 +47,7 @@ class TestConfigPublic(TestCase):
19
47
  async def testCustomValues(self):
20
48
  """
21
49
  Test that custom path and url can be set during initialization.
50
+
22
51
  Verifies both attributes accept and store valid custom values.
23
52
  """
24
53
  custom_path = "custom/public/path"
@@ -30,6 +59,7 @@ class TestConfigPublic(TestCase):
30
59
  async def testEmptyPathValidation(self):
31
60
  """
32
61
  Test that empty paths are rejected.
62
+
33
63
  Verifies that an empty path raises OrionisIntegrityException.
34
64
  """
35
65
  with self.assertRaises(OrionisIntegrityException):
@@ -38,6 +68,7 @@ class TestConfigPublic(TestCase):
38
68
  async def testEmptyUrlValidation(self):
39
69
  """
40
70
  Test that empty URLs are rejected.
71
+
41
72
  Verifies that an empty url raises OrionisIntegrityException.
42
73
  """
43
74
  with self.assertRaises(OrionisIntegrityException):
@@ -46,6 +77,7 @@ class TestConfigPublic(TestCase):
46
77
  async def testTypeValidation(self):
47
78
  """
48
79
  Test that non-string values are rejected for both attributes.
80
+
49
81
  Verifies that non-string values raise OrionisIntegrityException.
50
82
  """
51
83
  # Test path validation
@@ -63,6 +95,7 @@ class TestConfigPublic(TestCase):
63
95
  async def testToDictMethod(self):
64
96
  """
65
97
  Test that toDict returns proper dictionary representation.
98
+
66
99
  Verifies the returned dictionary contains both default values.
67
100
  """
68
101
  public = Public()
@@ -75,6 +108,7 @@ class TestConfigPublic(TestCase):
75
108
  async def testCustomValuesToDict(self):
76
109
  """
77
110
  Test that custom values are properly included in dictionary representation.
111
+
78
112
  Verifies toDict() includes custom values when specified.
79
113
  """
80
114
  custom_path = "public/assets"
@@ -88,6 +122,7 @@ class TestConfigPublic(TestCase):
88
122
  async def testWhitespaceHandling(self):
89
123
  """
90
124
  Test that values with whitespace are accepted but not automatically trimmed.
125
+
91
126
  Verifies the validation allows values containing whitespace characters.
92
127
  """
93
128
  spaced_path = " public/storage "
@@ -99,6 +134,7 @@ class TestConfigPublic(TestCase):
99
134
  async def testHashability(self):
100
135
  """
101
136
  Test that Public maintains hashability due to unsafe_hash=True.
137
+
102
138
  Verifies that Public instances can be used in sets and as dictionary keys.
103
139
  """
104
140
  public1 = Public()
@@ -114,6 +150,7 @@ class TestConfigPublic(TestCase):
114
150
  async def testKwOnlyInitialization(self):
115
151
  """
116
152
  Test that Public enforces keyword-only initialization.
153
+
117
154
  Verifies that positional arguments are not allowed for initialization.
118
155
  """
119
156
  with self.assertRaises(TypeError):
@@ -4,12 +4,33 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
4
4
  from orionis.unittesting import TestCase
5
5
 
6
6
  class TestLogging(TestCase):
7
+ """
8
+ Unit tests for the Logging class.
9
+
10
+ This test suite verifies the correct initialization, dictionary conversion,
11
+ post-initialization validation, and keyword-only argument enforcement of the
12
+ Logging class.
13
+ """
7
14
 
8
15
  async def testDefaultValues(self):
9
16
  """
10
- Test that the Logging instance is initialized with correct default values.
11
- Verifies that a new Logging object has 'stack' as default channel
12
- and an instance of Channels as channels attribute.
17
+ Test default values of Logging.
18
+
19
+ Ensures that a new Logging instance is initialized with the correct default values.
20
+
21
+ Parameters
22
+ ----------
23
+ self : TestLogging
24
+ The test case instance.
25
+
26
+ Returns
27
+ -------
28
+ None
29
+
30
+ Raises
31
+ ------
32
+ AssertionError
33
+ If the default values are not as expected.
13
34
  """
14
35
  logging = Logging()
15
36
  self.assertEqual(logging.default, "stack")
@@ -17,9 +38,23 @@ class TestLogging(TestCase):
17
38
 
18
39
  async def testToDictMethod(self):
19
40
  """
20
- Test the toDict method returns a proper dictionary representation.
21
- Checks that the toDict method converts the Logging instance
22
- into a dictionary with all expected fields.
41
+ Test the toDict method of Logging.
42
+
43
+ Checks that the toDict method returns a dictionary representation with all expected fields.
44
+
45
+ Parameters
46
+ ----------
47
+ self : TestLogging
48
+ The test case instance.
49
+
50
+ Returns
51
+ -------
52
+ None
53
+
54
+ Raises
55
+ ------
56
+ AssertionError
57
+ If the dictionary representation is not as expected.
23
58
  """
24
59
  logging = Logging()
25
60
  result = logging.toDict()
@@ -29,9 +64,23 @@ class TestLogging(TestCase):
29
64
 
30
65
  async def testPostInitValidation(self):
31
66
  """
32
- Test the __post_init__ validation works correctly.
33
- Verifies that invalid default channel or channels type
34
- raises OrionisIntegrityException.
67
+ Test post-initialization validation of Logging.
68
+
69
+ Verifies that providing an invalid default channel or channels type raises an exception.
70
+
71
+ Parameters
72
+ ----------
73
+ self : TestLogging
74
+ The test case instance.
75
+
76
+ Returns
77
+ -------
78
+ None
79
+
80
+ Raises
81
+ ------
82
+ AssertionError
83
+ If the expected exception is not raised.
35
84
  """
36
85
  with self.assertRaises(OrionisIntegrityException):
37
86
  Logging(default="invalid_channel")
@@ -41,8 +90,23 @@ class TestLogging(TestCase):
41
90
 
42
91
  async def testKwOnlyInitialization(self):
43
92
  """
44
- Test that Logging requires keyword arguments for initialization.
45
- Verifies that the class enforces kw_only=True in its dataclass decorator.
93
+ Test keyword-only initialization enforcement.
94
+
95
+ Ensures that Logging requires keyword arguments for initialization.
96
+
97
+ Parameters
98
+ ----------
99
+ self : TestLogging
100
+ The test case instance.
101
+
102
+ Returns
103
+ -------
104
+ None
105
+
106
+ Raises
107
+ ------
108
+ AssertionError
109
+ If TypeError is not raised when using positional arguments.
46
110
  """
47
111
  with self.assertRaises(TypeError):
48
112
  Logging("stack", Channels())
@@ -11,12 +11,46 @@ from orionis.unittesting import TestCase
11
11
  class TestConfigChannels(TestCase):
12
12
  """
13
13
  Test cases for the Channels logging configuration class.
14
+
15
+ This class contains unit tests for the `Channels` class, ensuring correct
16
+ initialization, type validation, custom configuration, dictionary conversion,
17
+ hashability, and keyword-only initialization.
18
+
19
+ Attributes
20
+ ----------
21
+ None
22
+
23
+ Methods
24
+ -------
25
+ testDefaultValues()
26
+ Test that Channels instance is created with correct default values.
27
+ testStackValidation()
28
+ Test stack attribute type validation.
29
+ testHourlyValidation()
30
+ Test hourly attribute type validation.
31
+ testDailyValidation()
32
+ Test daily attribute type validation.
33
+ testWeeklyValidation()
34
+ Test weekly attribute type validation.
35
+ testMonthlyValidation()
36
+ Test monthly attribute type validation.
37
+ testChunkedValidation()
38
+ Test chunked attribute type validation.
39
+ testCustomConfigurations()
40
+ Test that custom channel configurations are properly stored and validated.
41
+ testToDictMethod()
42
+ Test that toDict returns proper dictionary representation.
43
+ testHashability()
44
+ Test that Channels maintains hashability due to unsafe_hash=True.
45
+ testKwOnlyInitialization()
46
+ Test that Channels enforces keyword-only initialization.
14
47
  """
15
48
 
16
49
  async def testDefaultValues(self):
17
50
  """
18
51
  Test that Channels instance is created with correct default values.
19
- Verifies all channel configurations are properly initialized with their default values.
52
+
53
+ Ensures all channel configurations are properly initialized with their default values.
20
54
  """
21
55
  channels = Channels()
22
56
  self.assertIsInstance(channels.stack, Stack)
@@ -29,7 +63,13 @@ class TestConfigChannels(TestCase):
29
63
  async def testStackValidation(self):
30
64
  """
31
65
  Test stack attribute type validation.
32
- Verifies that only Stack instances are accepted for stack attribute.
66
+
67
+ Verifies that only Stack instances are accepted for the stack attribute.
68
+
69
+ Raises
70
+ ------
71
+ OrionisIntegrityException
72
+ If the stack attribute is not a Stack instance.
33
73
  """
34
74
  with self.assertRaises(OrionisIntegrityException):
35
75
  Channels(stack="not_a_stack_instance")
@@ -43,6 +83,11 @@ class TestConfigChannels(TestCase):
43
83
  async def testHourlyValidation(self):
44
84
  """
45
85
  Test hourly attribute type validation.
86
+
87
+ Raises
88
+ ------
89
+ OrionisIntegrityException
90
+ If the hourly attribute is not an Hourly instance.
46
91
  """
47
92
  with self.assertRaises(OrionisIntegrityException):
48
93
  Channels(hourly="not_an_hourly_instance")
@@ -54,6 +99,11 @@ class TestConfigChannels(TestCase):
54
99
  async def testDailyValidation(self):
55
100
  """
56
101
  Test daily attribute type validation.
102
+
103
+ Raises
104
+ ------
105
+ OrionisIntegrityException
106
+ If the daily attribute is not a Daily instance.
57
107
  """
58
108
  with self.assertRaises(OrionisIntegrityException):
59
109
  Channels(daily="not_a_daily_instance")
@@ -65,6 +115,11 @@ class TestConfigChannels(TestCase):
65
115
  async def testWeeklyValidation(self):
66
116
  """
67
117
  Test weekly attribute type validation.
118
+
119
+ Raises
120
+ ------
121
+ OrionisIntegrityException
122
+ If the weekly attribute is not a Weekly instance.
68
123
  """
69
124
  with self.assertRaises(OrionisIntegrityException):
70
125
  Channels(weekly="not_a_weekly_instance")
@@ -76,6 +131,11 @@ class TestConfigChannels(TestCase):
76
131
  async def testMonthlyValidation(self):
77
132
  """
78
133
  Test monthly attribute type validation.
134
+
135
+ Raises
136
+ ------
137
+ OrionisIntegrityException
138
+ If the monthly attribute is not a Monthly instance.
79
139
  """
80
140
  with self.assertRaises(OrionisIntegrityException):
81
141
  Channels(monthly="not_a_monthly_instance")
@@ -87,6 +147,11 @@ class TestConfigChannels(TestCase):
87
147
  async def testChunkedValidation(self):
88
148
  """
89
149
  Test chunked attribute type validation.
150
+
151
+ Raises
152
+ ------
153
+ OrionisIntegrityException
154
+ If the chunked attribute is not a Chunked instance.
90
155
  """
91
156
  with self.assertRaises(OrionisIntegrityException):
92
157
  Channels(chunked="not_a_chunked_instance")
@@ -98,6 +163,9 @@ class TestConfigChannels(TestCase):
98
163
  async def testCustomConfigurations(self):
99
164
  """
100
165
  Test that custom channel configurations are properly stored and validated.
166
+
167
+ Ensures that custom channel instances are correctly assigned and their
168
+ properties are properly set.
101
169
  """
102
170
  custom_stack = Stack(path="custom/stack.log")
103
171
  custom_hourly = Hourly(path="custom/hourly.log")
@@ -124,6 +192,8 @@ class TestConfigChannels(TestCase):
124
192
  async def testToDictMethod(self):
125
193
  """
126
194
  Test that toDict returns proper dictionary representation.
195
+
196
+ Ensures that the `toDict` method returns a dictionary with the correct structure.
127
197
  """
128
198
  channels = Channels()
129
199
  channels_dict = channels.toDict()
@@ -138,6 +208,8 @@ class TestConfigChannels(TestCase):
138
208
  async def testHashability(self):
139
209
  """
140
210
  Test that Channels maintains hashability due to unsafe_hash=True.
211
+
212
+ Ensures that Channels instances can be used in sets and as dictionary keys.
141
213
  """
142
214
  channels1 = Channels()
143
215
  channels2 = Channels()
@@ -152,6 +224,11 @@ class TestConfigChannels(TestCase):
152
224
  async def testKwOnlyInitialization(self):
153
225
  """
154
226
  Test that Channels enforces keyword-only initialization.
227
+
228
+ Raises
229
+ ------
230
+ TypeError
231
+ If positional arguments are used instead of keyword arguments.
155
232
  """
156
233
  with self.assertRaises(TypeError):
157
234
  Channels(Stack(), Hourly(), Daily(), Weekly(), Monthly(), Chunked())