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
@@ -2,14 +2,19 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
2
2
  from orionis.foundation.config.filesystems.entitites.aws import S3
3
3
  from orionis.unittesting import TestCase
4
4
 
5
- class TestConfigS3(TestCase):
5
+ class TestFoundationConfigFilesystemsAws(TestCase):
6
6
  """
7
7
  Test cases for the S3 storage configuration class.
8
+
9
+ This class contains unit tests for the S3 configuration entity, ensuring
10
+ correct default values, field validation, custom value handling, dictionary
11
+ conversion, hashability, and keyword-only initialization.
8
12
  """
9
13
 
10
14
  async def testDefaultValues(self):
11
15
  """
12
16
  Test that S3 instance is created with correct default values.
17
+
13
18
  Verifies all default values match expected defaults from class definition.
14
19
  """
15
20
  s3 = S3()
@@ -25,7 +30,13 @@ class TestConfigS3(TestCase):
25
30
  async def testRequiredFieldValidation(self):
26
31
  """
27
32
  Test validation of required fields.
28
- Verifies that region must be a non-empty string.
33
+
34
+ Ensures that the 'region' field must be a non-empty string.
35
+
36
+ Raises
37
+ ------
38
+ OrionisIntegrityException
39
+ If 'region' is empty or not a string.
29
40
  """
30
41
  # Test empty region
31
42
  with self.assertRaises(OrionisIntegrityException):
@@ -38,7 +49,13 @@ class TestConfigS3(TestCase):
38
49
  async def testOptionalFieldValidation(self):
39
50
  """
40
51
  Test validation of optional fields.
41
- Verifies that optional fields accept None or proper types.
52
+
53
+ Ensures that optional fields accept None or proper types.
54
+
55
+ Raises
56
+ ------
57
+ OrionisIntegrityException
58
+ If optional fields are not of the correct type.
42
59
  """
43
60
  # Valid optional configurations
44
61
  try:
@@ -56,7 +73,13 @@ class TestConfigS3(TestCase):
56
73
  async def testBooleanFieldValidation(self):
57
74
  """
58
75
  Test validation of boolean fields.
59
- Verifies that boolean fields only accept boolean values.
76
+
77
+ Ensures that boolean fields only accept boolean values.
78
+
79
+ Raises
80
+ ------
81
+ OrionisIntegrityException
82
+ If boolean fields are not of type bool.
60
83
  """
61
84
  # Test use_path_style_endpoint
62
85
  with self.assertRaises(OrionisIntegrityException):
@@ -69,7 +92,9 @@ class TestConfigS3(TestCase):
69
92
  async def testCustomValues(self):
70
93
  """
71
94
  Test that custom values are properly stored and validated.
72
- Verifies custom configuration values are correctly handled.
95
+
96
+ Ensures custom configuration values are correctly handled.
97
+
73
98
  """
74
99
  custom_s3 = S3(
75
100
  key="AKIAEXAMPLE",
@@ -94,7 +119,13 @@ class TestConfigS3(TestCase):
94
119
  async def testToDictMethod(self):
95
120
  """
96
121
  Test that toDict returns proper dictionary representation.
97
- Verifies all attributes are correctly included in dictionary.
122
+
123
+ Ensures all attributes are correctly included in the dictionary.
124
+
125
+ Returns
126
+ -------
127
+ dict
128
+ Dictionary representation of the S3 instance.
98
129
  """
99
130
  s3 = S3()
100
131
  s3_dict = s3.toDict()
@@ -112,7 +143,8 @@ class TestConfigS3(TestCase):
112
143
  async def testHashability(self):
113
144
  """
114
145
  Test that S3 maintains hashability due to unsafe_hash=True.
115
- Verifies that S3 instances can be used in sets and as dictionary keys.
146
+
147
+ Ensures that S3 instances can be used in sets and as dictionary keys.
116
148
  """
117
149
  s3_1 = S3()
118
150
  s3_2 = S3()
@@ -127,7 +159,13 @@ class TestConfigS3(TestCase):
127
159
  async def testKwOnlyInitialization(self):
128
160
  """
129
161
  Test that S3 enforces keyword-only initialization.
130
- Verifies that positional arguments are not allowed for initialization.
162
+
163
+ Ensures that positional arguments are not allowed for initialization.
164
+
165
+ Raises
166
+ ------
167
+ TypeError
168
+ If positional arguments are used for initialization.
131
169
  """
132
170
  with self.assertRaises(TypeError):
133
171
  S3("key", "secret", "region") # Should fail as it requires keyword arguments
@@ -5,15 +5,44 @@ from orionis.foundation.config.filesystems.entitites.public import Public
5
5
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
6
6
  from orionis.unittesting import TestCase
7
7
 
8
- class TestConfigDisks(TestCase):
8
+ class TestFoundationConfigFilesystemsDisks(TestCase):
9
9
  """
10
10
  Test cases for the Disks filesystem configuration class.
11
+
12
+ This class contains unit tests to validate the behavior and integrity of the
13
+ `Disks` configuration class, ensuring correct type validation, default values,
14
+ custom configuration handling, dictionary conversion, hashability, and
15
+ keyword-only initialization.
16
+
17
+ Methods
18
+ -------
19
+ testDefaultValues()
20
+ Test that Disks instance is created with correct default values.
21
+ testLocalTypeValidation()
22
+ Test local attribute type validation.
23
+ testPublicTypeValidation()
24
+ Test public attribute type validation.
25
+ testAwsTypeValidation()
26
+ Test aws attribute type validation.
27
+ testCustomDiskConfigurations()
28
+ Test that custom disk configurations are properly stored and validated.
29
+ testToDictMethod()
30
+ Test that toDict returns proper dictionary representation.
31
+ testHashability()
32
+ Test that Disks maintains hashability due to unsafe_hash=True.
33
+ testKwOnlyInitialization()
34
+ Test that Disks enforces keyword-only initialization.
11
35
  """
12
36
 
13
37
  async def testDefaultValues(self):
14
38
  """
15
39
  Test that Disks instance is created with correct default values.
16
- Verifies all default disk configurations are properly initialized.
40
+
41
+ Ensures that all default disk configurations are properly initialized.
42
+
43
+ Returns
44
+ -------
45
+ None
17
46
  """
18
47
  disks = Disks()
19
48
  self.assertIsInstance(disks.local, Local)
@@ -23,7 +52,13 @@ class TestConfigDisks(TestCase):
23
52
  async def testLocalTypeValidation(self):
24
53
  """
25
54
  Test local attribute type validation.
26
- Verifies that only Local instances are accepted for local attribute.
55
+
56
+ Ensures that only `Local` instances are accepted for the `local` attribute.
57
+
58
+ Raises
59
+ ------
60
+ OrionisIntegrityException
61
+ If the `local` attribute is not a `Local` instance.
27
62
  """
28
63
  with self.assertRaises(OrionisIntegrityException):
29
64
  Disks(local="not_a_local_instance")
@@ -35,7 +70,13 @@ class TestConfigDisks(TestCase):
35
70
  async def testPublicTypeValidation(self):
36
71
  """
37
72
  Test public attribute type validation.
38
- Verifies that only Public instances are accepted for public attribute.
73
+
74
+ Ensures that only `Public` instances are accepted for the `public` attribute.
75
+
76
+ Raises
77
+ ------
78
+ OrionisIntegrityException
79
+ If the `public` attribute is not a `Public` instance.
39
80
  """
40
81
  with self.assertRaises(OrionisIntegrityException):
41
82
  Disks(public="not_a_public_instance")
@@ -47,7 +88,13 @@ class TestConfigDisks(TestCase):
47
88
  async def testAwsTypeValidation(self):
48
89
  """
49
90
  Test aws attribute type validation.
50
- Verifies that only S3 instances are accepted for aws attribute.
91
+
92
+ Ensures that only `S3` instances are accepted for the `aws` attribute.
93
+
94
+ Raises
95
+ ------
96
+ OrionisIntegrityException
97
+ If the `aws` attribute is not an `S3` instance.
51
98
  """
52
99
  with self.assertRaises(OrionisIntegrityException):
53
100
  Disks(aws="not_an_s3_instance")
@@ -59,7 +106,13 @@ class TestConfigDisks(TestCase):
59
106
  async def testCustomDiskConfigurations(self):
60
107
  """
61
108
  Test that custom disk configurations are properly stored and validated.
62
- Verifies custom disk configurations are correctly handled.
109
+
110
+ Ensures that custom disk configurations are correctly handled and their
111
+ attributes are properly set.
112
+
113
+ Returns
114
+ -------
115
+ None
63
116
  """
64
117
  custom_local = Local(path="custom/local/path")
65
118
  custom_public = Public(path="custom/public/path", url="assets")
@@ -80,7 +133,13 @@ class TestConfigDisks(TestCase):
80
133
  async def testToDictMethod(self):
81
134
  """
82
135
  Test that toDict returns proper dictionary representation.
83
- Verifies all disk configurations are correctly included in dictionary.
136
+
137
+ Ensures that all disk configurations are correctly included in the
138
+ dictionary representation.
139
+
140
+ Returns
141
+ -------
142
+ None
84
143
  """
85
144
  disks = Disks()
86
145
  disks_dict = disks.toDict()
@@ -93,7 +152,12 @@ class TestConfigDisks(TestCase):
93
152
  async def testHashability(self):
94
153
  """
95
154
  Test that Disks maintains hashability due to unsafe_hash=True.
96
- Verifies that Disks instances can be used in sets and as dictionary keys.
155
+
156
+ Ensures that `Disks` instances can be used in sets and as dictionary keys.
157
+
158
+ Returns
159
+ -------
160
+ None
97
161
  """
98
162
  disks1 = Disks()
99
163
  disks2 = Disks()
@@ -108,7 +172,13 @@ class TestConfigDisks(TestCase):
108
172
  async def testKwOnlyInitialization(self):
109
173
  """
110
174
  Test that Disks enforces keyword-only initialization.
111
- Verifies that positional arguments are not allowed for initialization.
175
+
176
+ Ensures that positional arguments are not allowed for initialization.
177
+
178
+ Raises
179
+ ------
180
+ TypeError
181
+ If positional arguments are used for initialization.
112
182
  """
113
183
  with self.assertRaises(TypeError):
114
184
  Disks(Local(), Public(), S3())
@@ -2,23 +2,36 @@ from orionis.foundation.config.filesystems.entitites.local import Local
2
2
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
3
3
  from orionis.unittesting import TestCase
4
4
 
5
- class TestConfigLocal(TestCase):
5
+ class TestFoundationConfigFilesystemsLocal(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")
@@ -2,14 +2,42 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
2
2
  from orionis.foundation.config.filesystems.entitites.public import Public
3
3
  from orionis.unittesting import TestCase
4
4
 
5
- class TestConfigPublic(TestCase):
5
+ class TestFoundationConfigFilesystemsPublic(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):
@@ -0,0 +1,112 @@
1
+ from orionis.foundation.config.logging.entities.logging import Logging
2
+ from orionis.foundation.config.logging.entities.channels import Channels
3
+ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
+ from orionis.unittesting import TestCase
5
+
6
+ class TestFoundationConfigLogging(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
+ """
14
+
15
+ async def testDefaultValues(self):
16
+ """
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.
34
+ """
35
+ logging = Logging()
36
+ self.assertEqual(logging.default, "stack")
37
+ self.assertIsInstance(logging.channels, Channels)
38
+
39
+ async def testToDictMethod(self):
40
+ """
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.
58
+ """
59
+ logging = Logging()
60
+ result = logging.toDict()
61
+ self.assertIsInstance(result, dict)
62
+ self.assertIn("default", result)
63
+ self.assertIn("channels", result)
64
+
65
+ async def testPostInitValidation(self):
66
+ """
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.
84
+ """
85
+ with self.assertRaises(OrionisIntegrityException):
86
+ Logging(default="invalid_channel")
87
+
88
+ with self.assertRaises(OrionisIntegrityException):
89
+ Logging(channels="invalid_channels")
90
+
91
+ async def testKwOnlyInitialization(self):
92
+ """
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.
110
+ """
111
+ with self.assertRaises(TypeError):
112
+ Logging("stack", Channels())