orionis 0.418.0__py3-none-any.whl → 0.420.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 (136) hide show
  1. orionis/metadata/framework.py +1 -1
  2. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/METADATA +1 -1
  3. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/RECORD +58 -133
  4. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/top_level.txt +0 -1
  5. tests/foundation/config/app/test_foundation_config_app.py +262 -0
  6. {foundation → tests/foundation}/config/cache/test_foundation_config_cache_file.py +8 -8
  7. {foundation → tests/foundation}/config/cache/test_foundation_config_cache_stores.py +11 -3
  8. {foundation → tests/foundation}/config/database/test_foundation_config_database_pgsql.py +5 -5
  9. {foundation → tests/foundation}/config/queue/test_foundation_config_queue.py +0 -20
  10. {foundation → tests/foundation}/config/queue/test_foundation_config_queue_brokers.py +0 -13
  11. tests/foundation/config/root/test_foundation_config_root_paths.py +116 -0
  12. tests/foundation/config/startup/test_foundation_config_startup.py +199 -0
  13. foundation/config/app/test_foundation_config_app.py +0 -150
  14. foundation/config/root/test_foundation_config_root_paths.py +0 -201
  15. foundation/config/startup/test_foundation_config_startup.py +0 -205
  16. foundation/exceptions/__init__.py +0 -0
  17. foundation/exceptions/test_foundation_config_exceptions.py +0 -117
  18. orionis/_contracts/__init__.py +0 -0
  19. orionis/_contracts/application.py +0 -41
  20. orionis/_contracts/config/__init__.py +0 -0
  21. orionis/_contracts/config/config.py +0 -27
  22. orionis/_contracts/console/__init__.py +0 -0
  23. orionis/_contracts/console/base/__init__.py +0 -0
  24. orionis/_contracts/console/base/command.py +0 -437
  25. orionis/_contracts/console/command_filter.py +0 -32
  26. orionis/_contracts/console/kernel.py +0 -32
  27. orionis/_contracts/console/output/__init__.py +0 -0
  28. orionis/_contracts/console/output/console.py +0 -421
  29. orionis/_contracts/console/output/executor.py +0 -51
  30. orionis/_contracts/console/parser.py +0 -75
  31. orionis/_contracts/console/task_manager.py +0 -37
  32. orionis/_contracts/facades/__init__.py +0 -0
  33. orionis/_contracts/facades/commands/__init__.py +0 -0
  34. orionis/_contracts/facades/commands/commands_facade.py +0 -40
  35. orionis/_contracts/facades/commands/scheduler_facade.py +0 -28
  36. orionis/_contracts/facades/config/__init__.py +0 -0
  37. orionis/_contracts/facades/config/config_facade.py +0 -37
  38. orionis/_contracts/facades/environment/__init__.py +0 -0
  39. orionis/_contracts/facades/environment/environment_facade.py +0 -74
  40. orionis/_contracts/facades/facade.py +0 -38
  41. orionis/_contracts/facades/files/__init__.py +0 -0
  42. orionis/_contracts/facades/files/path_facade.py +0 -148
  43. orionis/_contracts/facades/log/__init__.py +0 -0
  44. orionis/_contracts/facades/log/log_facade.py +0 -83
  45. orionis/_contracts/facades/tests/__init__.py +0 -0
  46. orionis/_contracts/facades/tests/tests_facade.py +0 -30
  47. orionis/_contracts/foundation/__init__.py +0 -0
  48. orionis/_contracts/foundation/bootstraper.py +0 -41
  49. orionis/_contracts/foundation/config/__init__.py +0 -0
  50. orionis/_contracts/foundation/config/config_bootstrapper.py +0 -140
  51. orionis/_contracts/foundation/console/__init__.py +0 -0
  52. orionis/_contracts/foundation/console/command_bootstrapper.py +0 -81
  53. orionis/_contracts/foundation/environment/__init__.py +0 -0
  54. orionis/_contracts/foundation/environment/environment_bootstrapper.py +0 -33
  55. orionis/_contracts/foundation/providers/__init__.py +0 -0
  56. orionis/_contracts/foundation/providers/service_providers_bootstrapper.py +0 -47
  57. orionis/_contracts/providers/__init__.py +0 -0
  58. orionis/_contracts/providers/service_provider.py +0 -14
  59. orionis/_contracts/services/__init__.py +0 -0
  60. orionis/_contracts/services/commands/__init__.py +0 -0
  61. orionis/_contracts/services/commands/reactor_commands_service.py +0 -23
  62. orionis/_contracts/services/commands/schedule_service.py +0 -317
  63. orionis/_contracts/services/config/__init__.py +0 -0
  64. orionis/_contracts/services/config/config_service.py +0 -37
  65. orionis/_contracts/services/environment/__init__.py +0 -0
  66. orionis/_contracts/services/environment/environment_service.py +0 -74
  67. orionis/_contracts/services/files/__init__.py +0 -0
  68. orionis/_contracts/services/files/path_resolver_service.py +0 -29
  69. orionis/_contracts/services/log/__init__.py +0 -0
  70. orionis/_contracts/services/log/log_service.py +0 -89
  71. orionis/_contracts/support/exception_parse.py +0 -26
  72. orionis/_contracts/support/reflection.py +0 -352
  73. orionis/_foundation/__init__.py +0 -0
  74. orionis/_foundation/console/__init__.py +0 -0
  75. orionis/_foundation/console/command_bootstrapper.py +0 -175
  76. orionis/_foundation/environment/__init__.py +0 -0
  77. orionis/_foundation/environment/environment_bootstrapper.py +0 -76
  78. orionis/_foundation/exceptions/__init__.py +0 -0
  79. orionis/_foundation/exceptions/exception_bootstrapper.py +0 -54
  80. orionis/_foundation/exceptions/exception_providers.py +0 -54
  81. orionis/_foundation/foundation/config/__init__.py +0 -0
  82. orionis/_foundation/foundation/config/config_bootstrapper.py +0 -209
  83. orionis/_foundation/providers/__init__.py +0 -0
  84. orionis/_foundation/providers/service_providers_bootstrapper.py +0 -107
  85. orionis/_services/__init__.py +0 -0
  86. orionis/_services/commands/__init__.py +0 -0
  87. orionis/_services/commands/reactor_commands_service.py +0 -148
  88. orionis/_services/commands/scheduler_service.py +0 -611
  89. orionis/_services/config/__init__.py +0 -0
  90. orionis/_services/config/config_service.py +0 -72
  91. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/WHEEL +0 -0
  92. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/licenses/LICENCE +0 -0
  93. {orionis-0.418.0.dist-info → orionis-0.420.0.dist-info}/zip-safe +0 -0
  94. {foundation → tests/foundation}/__init__.py +0 -0
  95. {foundation → tests/foundation}/config/__init__.py +0 -0
  96. {foundation → tests/foundation}/config/app/__init__.py +0 -0
  97. {foundation → tests/foundation}/config/auth/__init__.py +0 -0
  98. {foundation → tests/foundation}/config/auth/test_foundation_config_auth.py +0 -0
  99. {foundation → tests/foundation}/config/cache/__init__.py +0 -0
  100. {foundation → tests/foundation}/config/cache/test_foundation_config_cache.py +0 -0
  101. {foundation → tests/foundation}/config/cors/__init__.py +0 -0
  102. {foundation → tests/foundation}/config/cors/test_foundation_config_cors.py +0 -0
  103. {foundation → tests/foundation}/config/database/__init__.py +0 -0
  104. {foundation → tests/foundation}/config/database/test_foundation_config_database.py +0 -0
  105. {foundation → tests/foundation}/config/database/test_foundation_config_database_connections.py +0 -0
  106. {foundation → tests/foundation}/config/database/test_foundation_config_database_mysql.py +0 -0
  107. {foundation → tests/foundation}/config/database/test_foundation_config_database_oracle.py +0 -0
  108. {foundation → tests/foundation}/config/database/test_foundation_config_database_sqlite.py +0 -0
  109. {foundation → tests/foundation}/config/filesystems/__init__.py +0 -0
  110. {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems.py +0 -0
  111. {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_aws.py +0 -0
  112. {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_disks.py +0 -0
  113. {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_local.py +0 -0
  114. {foundation → tests/foundation}/config/filesystems/test_foundation_config_filesystems_public.py +0 -0
  115. {foundation → tests/foundation}/config/logging/__init__.py +0 -0
  116. {foundation → tests/foundation}/config/logging/test_foundation_config_logging.py +0 -0
  117. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_channels.py +0 -0
  118. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_chunked.py +0 -0
  119. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_daily.py +0 -0
  120. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_hourly.py +0 -0
  121. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_monthly.py +0 -0
  122. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_stack.py +0 -0
  123. {foundation → tests/foundation}/config/logging/test_foundation_config_logging_weekly.py +0 -0
  124. {foundation → tests/foundation}/config/mail/__init__.py +0 -0
  125. {foundation → tests/foundation}/config/mail/test_foundation_config_mail.py +0 -0
  126. {foundation → tests/foundation}/config/mail/test_foundation_config_mail_file.py +0 -0
  127. {foundation → tests/foundation}/config/mail/test_foundation_config_mail_mailers.py +0 -0
  128. {foundation → tests/foundation}/config/mail/test_foundation_config_mail_smtp.py +0 -0
  129. {foundation → tests/foundation}/config/queue/__init__.py +0 -0
  130. {foundation → tests/foundation}/config/queue/test_foundation_config_queue_database.py +0 -0
  131. {foundation → tests/foundation}/config/root/__init__.py +0 -0
  132. {foundation → tests/foundation}/config/session/__init__.py +0 -0
  133. {foundation → tests/foundation}/config/session/test_foundation_config_session.py +0 -0
  134. {foundation → tests/foundation}/config/startup/__init__.py +0 -0
  135. {foundation → tests/foundation}/config/testing/__init__.py +0 -0
  136. {foundation → tests/foundation}/config/testing/test_foundation_config_testing.py +0 -0
@@ -1,201 +0,0 @@
1
- from pathlib import Path
2
- from orionis.foundation.exceptions import OrionisIntegrityException
3
- from orionis.foundation.config.roots.paths import Paths
4
- from orionis.test.cases.asynchronous import AsyncTestCase
5
-
6
- class TestFoundationConfigRootPaths(AsyncTestCase):
7
- """
8
- Test suite for the Paths dataclass which defines the project directory structure.
9
-
10
- This class verifies the integrity of path definitions, default values,
11
- and the behavior of accessor methods.
12
-
13
- Attributes
14
- ----------
15
- None
16
-
17
- Methods
18
- -------
19
- testDefaultPathsInstantiation()
20
- Test that a Paths instance can be created with default values.
21
- testRequiredPathsAreSet()
22
- Test that all required paths have non-empty default values.
23
- testOptionalPathsCanBeEmpty()
24
- Test that optional paths can be empty strings.
25
- testPathValidationRejectsNonStringValues()
26
- Test that non-string path values raise OrionisIntegrityException.
27
- testPathValidationRejectsEmptyRequiredPaths()
28
- Test that empty required paths raise OrionisIntegrityException.
29
- testToDictReturnsCompleteDictionary()
30
- Test that toDict() returns a complete dictionary of all paths.
31
- testPathAccessorMethodsReturnPathObjects()
32
- Test that all path accessor methods return Path objects.
33
- testFrozenDataclassBehavior()
34
- Test that the dataclass is truly frozen (immutable).
35
- testPathMetadataIsAccessible()
36
- Test that path metadata is properly defined and accessible.
37
- """
38
-
39
- def testDefaultPathsInstantiation(self):
40
- """
41
- Test that a Paths instance can be created with default values.
42
-
43
- Ensures that all default paths are correctly initialized and
44
- the instance is properly constructed.
45
- """
46
- paths = Paths()
47
- self.assertIsInstance(paths, Paths)
48
-
49
- def testRequiredPathsAreSet(self):
50
- """
51
- Test that all required paths have non-empty default values.
52
-
53
- Checks that paths marked as required in metadata are properly
54
- initialized with valid string values.
55
- """
56
- paths = Paths()
57
- required_fields = [
58
- 'console_scheduler', 'console_commands', 'http_controllers',
59
- 'http_middleware', 'models', 'providers', 'exceptions',
60
- 'views', 'routes_web', 'config', 'migrations',
61
- 'storage_logs', 'storage_framework'
62
- ]
63
- for field in required_fields:
64
- value = getattr(paths, field)
65
- self.assertTrue(isinstance(value, str) and len(value) > 0)
66
-
67
- def testOptionalPathsCanBeEmpty(self):
68
- """
69
- Test that optional paths can be empty strings.
70
-
71
- Verifies that paths not marked as required can be empty strings
72
- without raising exceptions.
73
-
74
- Raises
75
- ------
76
- OrionisIntegrityException
77
- If required validation fails.
78
- """
79
- with self.assertRaises(OrionisIntegrityException):
80
- Paths(
81
- http_requests='',
82
- events='',
83
- listeners='',
84
- notifications='',
85
- jobs='',
86
- policies='',
87
- services='',
88
- lang='',
89
- assets='',
90
- routes_api='',
91
- routes_console='',
92
- routes_channels='',
93
- seeders='',
94
- factories='',
95
- storage_sessions='',
96
- storage_cache='',
97
- storage_views=''
98
- )
99
-
100
- def testPathValidationRejectsNonStringValues(self):
101
- """
102
- Test that non-string path values raise OrionisIntegrityException.
103
-
104
- Verifies that the __post_init__ validation rejects non-string values
105
- for all path fields.
106
-
107
- Raises
108
- ------
109
- OrionisIntegrityException
110
- If a non-string value is provided.
111
- """
112
- with self.assertRaises(OrionisIntegrityException):
113
- Paths(console_scheduler=123)
114
-
115
- def testPathValidationRejectsEmptyRequiredPaths(self):
116
- """
117
- Test that empty required paths raise OrionisIntegrityException.
118
-
119
- Verifies that required paths cannot be empty strings.
120
-
121
- Raises
122
- ------
123
- OrionisIntegrityException
124
- If a required path is empty.
125
- """
126
- with self.assertRaises(OrionisIntegrityException):
127
- Paths(console_scheduler='')
128
-
129
- def testToDictReturnsCompleteDictionary(self):
130
- """
131
- Test that toDict() returns a complete dictionary of all paths.
132
-
133
- Verifies that the returned dictionary contains all path fields
134
- with their current values.
135
-
136
- Returns
137
- -------
138
- None
139
- """
140
- paths = Paths()
141
- path_dict = paths.toDict()
142
- self.assertIsInstance(path_dict, dict)
143
- self.assertEqual(len(path_dict), len(paths.__dataclass_fields__))
144
- for field in paths.__dataclass_fields__:
145
- self.assertIn(field, path_dict)
146
-
147
- def testPathAccessorMethodsReturnPathObjects(self):
148
- """
149
- Test that all path accessor methods return Path objects.
150
-
151
- Verifies that each get* method returns a proper pathlib.Path instance.
152
-
153
- Returns
154
- -------
155
- None
156
- """
157
- paths = Paths()
158
- self.assertIsInstance(paths.getConsoleScheduler(), Path)
159
- self.assertIsInstance(paths.getHttpControllers(), Path)
160
- self.assertIsInstance(paths.getModels(), Path)
161
- self.assertIsInstance(paths.getViews(), Path)
162
- self.assertIsInstance(paths.getRoutesWeb(), Path)
163
- self.assertIsInstance(paths.getConfig(), Path)
164
- self.assertIsInstance(paths.getMigrations(), Path)
165
- self.assertIsInstance(paths.getStorageLogs(), Path)
166
-
167
- def testFrozenDataclassBehavior(self):
168
- """
169
- Test that the dataclass is truly frozen (immutable).
170
-
171
- Verifies that attempts to modify attributes after creation
172
- raise exceptions.
173
-
174
- Raises
175
- ------
176
- Exception
177
- If an attempt is made to modify a frozen dataclass.
178
- """
179
- paths = Paths()
180
- with self.assertRaises(Exception):
181
- paths.console_scheduler = 'new/path' # type: ignore
182
-
183
- def testPathMetadataIsAccessible(self):
184
- """
185
- Test that path metadata is properly defined and accessible.
186
-
187
- Verifies that each path field has the expected metadata structure
188
- with description, type, and required fields.
189
-
190
- Returns
191
- -------
192
- None
193
- """
194
- paths = Paths()
195
- for field in paths.__dataclass_fields__.values():
196
- metadata = field.metadata
197
- self.assertIn('description', metadata)
198
- self.assertIn('type', metadata)
199
- self.assertIn('required', metadata)
200
- self.assertIn(metadata['type'], ['file', 'directory'])
201
- self.assertIsInstance(metadata['required'], bool)
@@ -1,205 +0,0 @@
1
- from dataclasses import is_dataclass
2
- from orionis.foundation.exceptions import OrionisIntegrityException
3
- from orionis.foundation.config.startup import Configuration
4
- from orionis.test.cases.asynchronous import AsyncTestCase
5
- from unittest.mock import Mock
6
-
7
- class TestFoundationConfigStartup(AsyncTestCase):
8
- """
9
- Test suite for the Configuration dataclass.
10
-
11
- This class contains unit tests to verify the correct behavior of the
12
- Configuration dataclass, including initialization, type validation,
13
- dictionary conversion, metadata accessibility, mutability, and equality.
14
-
15
- Attributes
16
- ----------
17
- None
18
-
19
- Methods
20
- -------
21
- testConfigurationIsDataclass()
22
- Test that Configuration is properly defined as a dataclass.
23
- testDefaultInitialization()
24
- Test that Configuration can be initialized with default values.
25
- testAllSectionsHaveDefaultFactories()
26
- Test that all configuration sections have default factories.
27
- testTypeValidationInPostInit()
28
- Test that __post_init__ validates types correctly.
29
- testToDictReturnsCompleteDictionary()
30
- Test that toDict() returns a complete dictionary representation.
31
- testToDictReturnsNestedStructures()
32
- Test that toDict() properly converts nested dataclasses.
33
- testMetadataIsAccessible()
34
- Test that field metadata is properly defined and accessible.
35
- testConfigurationIsMutable()
36
- Test that Configuration is mutable (not frozen).
37
- testConfigurationEquality()
38
- Test that Configuration instances with same values are equal.
39
- """
40
-
41
- def testConfigurationIsDataclass(self):
42
- """
43
- Test that Configuration is properly defined as a dataclass.
44
-
45
- Ensures that the @dataclass decorator was applied correctly.
46
-
47
- Returns
48
- -------
49
- None
50
- """
51
- self.assertTrue(is_dataclass(Configuration))
52
-
53
- def testDefaultInitialization(self):
54
- """
55
- Test that Configuration can be initialized with default values.
56
-
57
- Verifies that all default factories work correctly and the instance
58
- is properly constructed.
59
-
60
- Returns
61
- -------
62
- None
63
- """
64
- config = Configuration()
65
- self.assertIsInstance(config, Configuration)
66
-
67
- def testAllSectionsHaveDefaultFactories(self):
68
- """
69
- Test that all configuration sections have default factories.
70
-
71
- Verifies that each field in the Configuration class has a
72
- default_factory specified.
73
-
74
- Returns
75
- -------
76
- None
77
- """
78
- config = Configuration()
79
- for field in config.__dataclass_fields__.values():
80
- self.assertTrue(hasattr(field, 'default_factory'),
81
- f"Field {field.name} is missing default_factory")
82
-
83
- def testTypeValidationInPostInit(self):
84
- """
85
- Test that __post_init__ validates types correctly.
86
-
87
- Verifies that the type checking for each configuration section
88
- works as expected.
89
-
90
- Returns
91
- -------
92
- None
93
- """
94
- # Test with all correct types (should not raise)
95
- try:
96
- Configuration()
97
- except OrionisIntegrityException:
98
- self.fail("__post_init__ raised exception with valid types")
99
-
100
- # Test each section with wrong type
101
- sections = [
102
- ('paths', Mock()),
103
- ('app', Mock()),
104
- ('auth', Mock()),
105
- ('cache', Mock()),
106
- ('cors', Mock()),
107
- ('database', Mock()),
108
- ('filesystems', Mock()),
109
- ('logging', Mock()),
110
- ('mail', Mock()),
111
- ('queue', Mock()),
112
- ('session', Mock()),
113
- ('testing', Mock())
114
- ]
115
-
116
- for section_name, wrong_value in sections:
117
- with self.subTest(section=section_name):
118
- kwargs = {section_name: wrong_value}
119
- with self.assertRaises(OrionisIntegrityException):
120
- Configuration(**kwargs)
121
-
122
- def testToDictReturnsCompleteDictionary(self):
123
- """
124
- Test that toDict() returns a complete dictionary representation.
125
-
126
- Verifies that the returned dictionary contains all configuration
127
- sections with their current values.
128
-
129
- Returns
130
- -------
131
- None
132
- """
133
- config = Configuration()
134
- config_dict = config.toDict()
135
- self.assertIsInstance(config_dict, dict)
136
- self.assertEqual(len(config_dict), len(config.__dataclass_fields__))
137
- for field in config.__dataclass_fields__:
138
- self.assertIn(field, config_dict)
139
-
140
- def testToDictReturnsNestedStructures(self):
141
- """
142
- Test that toDict() properly converts nested dataclasses.
143
-
144
- Verifies that the dictionary conversion works recursively for
145
- all nested configuration sections.
146
-
147
- Returns
148
- -------
149
- None
150
- """
151
- config = Configuration()
152
- config_dict = config.toDict()
153
- self.assertIsInstance(config_dict['paths'], dict)
154
- self.assertIsInstance(config_dict['app'], dict)
155
- self.assertIsInstance(config_dict['database'], dict)
156
-
157
- def testMetadataIsAccessible(self):
158
- """
159
- Test that field metadata is properly defined and accessible.
160
-
161
- Verifies that each configuration section field has the expected
162
- metadata structure with description.
163
-
164
- Returns
165
- -------
166
- None
167
- """
168
- config = Configuration()
169
- for field in config.__dataclass_fields__.values():
170
- metadata = field.metadata
171
- self.assertIn('description', metadata)
172
- self.assertIsInstance(metadata['description'], str)
173
-
174
- def testConfigurationIsMutable(self):
175
- """
176
- Test that Configuration is mutable (not frozen).
177
-
178
- Verifies that attributes can be modified after creation since
179
- the dataclass isn't marked as frozen.
180
-
181
- Returns
182
- -------
183
- None
184
- """
185
- config = Configuration()
186
- new_paths = config.paths.__class__()
187
-
188
- try:
189
- config.paths = new_paths
190
- except Exception as e:
191
- self.fail(f"Should be able to modify attributes, but got {type(e).__name__}")
192
-
193
- def testConfigurationEquality(self):
194
- """
195
- Test that Configuration instances with same values are equal.
196
-
197
- Verifies that dataclass equality comparison works as expected.
198
-
199
- Returns
200
- -------
201
- None
202
- """
203
- config1 = Configuration()
204
- config2 = Configuration()
205
- self.assertNotEqual(config1, config2)
File without changes
@@ -1,117 +0,0 @@
1
- from orionis.foundation.exceptions import OrionisIntegrityException
2
- from orionis.test.cases.asynchronous import AsyncTestCase
3
-
4
- class TestFoundationConfigExceptions(AsyncTestCase):
5
- """
6
- Test cases for the OrionisIntegrityException class.
7
-
8
- Notes
9
- -----
10
- These tests verify the initialization, inheritance, string representation,
11
- handling of different message types, raising and catching, and exception
12
- chaining behavior of the OrionisIntegrityException.
13
- """
14
-
15
- async def testExceptionInitialization(self):
16
- """
17
- Test initialization of OrionisIntegrityException with a message.
18
-
19
- Verifies
20
- --------
21
- - The exception stores and returns the provided message correctly.
22
- """
23
- test_msg = "Test integrity violation message"
24
- exception = OrionisIntegrityException(test_msg)
25
- self.assertEqual(str(exception), test_msg)
26
- self.assertEqual(exception.args[0], test_msg)
27
-
28
- async def testExceptionInheritance(self):
29
- """
30
- Test inheritance of OrionisIntegrityException.
31
-
32
- Verifies
33
- --------
34
- - OrionisIntegrityException properly inherits from Exception.
35
- - The exception hierarchy is correctly implemented.
36
- """
37
- exception = OrionisIntegrityException("Test")
38
- self.assertIsInstance(exception, Exception)
39
- self.assertTrue(issubclass(OrionisIntegrityException, Exception))
40
-
41
- async def testExceptionStringRepresentation(self):
42
- """
43
- Test string representation of OrionisIntegrityException.
44
-
45
- Verifies
46
- --------
47
- - The __str__ method returns the expected format.
48
- """
49
- test_msg = "Configuration validation failed"
50
- exception = OrionisIntegrityException(test_msg)
51
- self.assertEqual(str(exception), test_msg)
52
-
53
- async def testExceptionWithEmptyMessage(self):
54
- """
55
- Test OrionisIntegrityException with an empty message.
56
-
57
- Verifies
58
- --------
59
- - The exception handles empty messages correctly.
60
- """
61
- exception = OrionisIntegrityException("")
62
- self.assertEqual(str(exception), "")
63
-
64
- async def testExceptionWithNonStringMessage(self):
65
- """
66
- Test OrionisIntegrityException with non-string message types.
67
-
68
- Verifies
69
- --------
70
- - The exception converts non-string messages to strings.
71
-
72
- Tests
73
- -----
74
- - Integer message
75
- - List message
76
- """
77
- # Test with integer
78
- exception = OrionisIntegrityException(123)
79
- self.assertEqual(str(exception), "123")
80
-
81
- # Test with list
82
- exception = OrionisIntegrityException(["error1", "error2"])
83
- self.assertEqual(str(exception), "['error1', 'error2']")
84
-
85
- async def testExceptionRaiseAndCatch(self):
86
- """
87
- Test raising and catching OrionisIntegrityException.
88
-
89
- Verifies
90
- --------
91
- - The exception can be properly raised and caught.
92
- """
93
- test_msg = "Test exception handling"
94
- try:
95
- raise OrionisIntegrityException(test_msg)
96
- except OrionisIntegrityException as e:
97
- self.assertEqual(str(e), test_msg)
98
- except Exception:
99
- self.fail("OrionisIntegrityException should be caught by its specific handler")
100
-
101
- async def testExceptionChaining(self):
102
- """
103
- Test exception chaining with OrionisIntegrityException.
104
-
105
- Verifies
106
- --------
107
- - The exception works correctly in chained exception scenarios.
108
- - The __cause__ attribute is set as expected.
109
- """
110
- try:
111
- try:
112
- raise ValueError("Original error")
113
- except ValueError as ve:
114
- raise OrionisIntegrityException("Wrapper error") from ve
115
- except OrionisIntegrityException as oe:
116
- self.assertIsInstance(oe.__cause__, ValueError)
117
- self.assertEqual(str(oe.__cause__), "Original error")
File without changes
@@ -1,41 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- from typing import List, Type
3
- from orionis._contracts.container.container import IContainer
4
- from orionis._contracts.providers.service_provider import IServiceProvider
5
-
6
- class IApplication(ABC):
7
- """
8
- Abstract base class for the Application.
9
- """
10
-
11
- @abstractmethod
12
- def withProviders(self, providers: List[Type["IServiceProvider"]]) -> None:
13
- """
14
- Sets custom service providers.
15
-
16
- Parameters
17
- ----------
18
- providers : List[Type[ServiceProvider]]
19
- List of service providers.
20
- """
21
- pass
22
-
23
- @abstractmethod
24
- def container(self) -> "IContainer":
25
- """
26
- Returns the service container instance.
27
-
28
- Returns
29
- -------
30
- IContainer
31
- The service container.
32
- """
33
- pass
34
-
35
- @abstractmethod
36
- def create(self) -> None:
37
- """
38
- Initializes and boots the application, including loading commands
39
- and service providers.
40
- """
41
- pass
File without changes
@@ -1,27 +0,0 @@
1
- from abc import ABC
2
- from dataclasses import dataclass
3
-
4
- @dataclass
5
- class EmptyData:
6
- """
7
- A placeholder dataclass that can be used as a default or empty configuration.
8
- This class doesn't have any fields or data, but serves as a default value
9
- for the 'config' attribute in classes implementing IConfig.
10
- """
11
- pass
12
-
13
- class IConfig(ABC):
14
- """
15
- An abstract base class that defines an interface for classes that must have
16
- a `config` attribute.
17
-
18
- The subclass is required to implement the `config` attribute, which should be
19
- a dataclass instance representing the configuration data.
20
-
21
- Attributes
22
- ----------
23
- config : object
24
- A dataclass instance representing the configuration.
25
- """
26
-
27
- config = EmptyData()
File without changes
File without changes