orionis 0.546.0__py3-none-any.whl → 0.548.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 (160) hide show
  1. orionis/console/base/scheduler_event_listener.py +0 -17
  2. orionis/console/contracts/schedule_event_listener.py +0 -18
  3. orionis/foundation/config/app/entities/app.py +3 -2
  4. orionis/foundation/config/app/enums/ciphers.py +5 -19
  5. orionis/foundation/config/session/entities/session.py +2 -2
  6. orionis/metadata/framework.py +1 -1
  7. orionis/services/encrypter/encrypter.py +115 -0
  8. orionis/services/environment/dynamic/caster.py +35 -27
  9. orionis/services/environment/key/key_generator.py +32 -11
  10. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/METADATA +1 -1
  11. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/RECORD +14 -159
  12. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/top_level.txt +0 -1
  13. orionis-0.546.0.dist-info/zip-safe +0 -1
  14. tests/container/__init__.py +0 -0
  15. tests/container/context/__init__.py +0 -0
  16. tests/container/context/test_manager.py +0 -38
  17. tests/container/context/test_scope.py +0 -32
  18. tests/container/core/__init__.py +0 -0
  19. tests/container/core/test_advanced_async.py +0 -234
  20. tests/container/core/test_async_optimizations.py +0 -268
  21. tests/container/core/test_container.py +0 -453
  22. tests/container/core/test_singleton.py +0 -122
  23. tests/container/core/test_thread_safety.py +0 -90
  24. tests/container/entities/__init__.py +0 -0
  25. tests/container/entities/test_binding.py +0 -242
  26. tests/container/enums/__init__.py +0 -0
  27. tests/container/enums/test_lifetimes.py +0 -97
  28. tests/container/facades/__init__.py +0 -0
  29. tests/container/facades/test_facade.py +0 -78
  30. tests/container/mocks/__init__.py +0 -0
  31. tests/container/mocks/mock_advanced_async.py +0 -332
  32. tests/container/mocks/mock_async_optimizations.py +0 -407
  33. tests/container/mocks/mock_auto_resolution.py +0 -192
  34. tests/container/mocks/mock_complex_classes.py +0 -792
  35. tests/container/mocks/mock_simple_classes.py +0 -98
  36. tests/container/providers/__init__.py +0 -0
  37. tests/container/providers/test_providers.py +0 -55
  38. tests/container/validators/__init__.py +0 -0
  39. tests/container/validators/test_implements.py +0 -186
  40. tests/container/validators/test_is_abstract_class.py +0 -147
  41. tests/container/validators/test_is_callable.py +0 -102
  42. tests/container/validators/test_is_concrete_class.py +0 -160
  43. tests/container/validators/test_is_instance.py +0 -150
  44. tests/container/validators/test_is_not_subclass.py +0 -49
  45. tests/container/validators/test_is_subclass.py +0 -178
  46. tests/container/validators/test_is_valid_alias.py +0 -147
  47. tests/container/validators/test_lifetime.py +0 -106
  48. tests/example/__init__.py +0 -0
  49. tests/example/test_example.py +0 -725
  50. tests/foundation/__init__.py +0 -0
  51. tests/foundation/config/__init__.py +0 -0
  52. tests/foundation/config/app/__init__.py +0 -0
  53. tests/foundation/config/app/test_foundation_config_app.py +0 -262
  54. tests/foundation/config/auth/__init__.py +0 -0
  55. tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
  56. tests/foundation/config/cache/__init__.py +0 -0
  57. tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
  58. tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
  59. tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
  60. tests/foundation/config/cors/__init__.py +0 -0
  61. tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
  62. tests/foundation/config/database/__init__.py +0 -0
  63. tests/foundation/config/database/test_foundation_config_database.py +0 -158
  64. tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
  65. tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
  66. tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
  67. tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
  68. tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
  69. tests/foundation/config/filesystems/__init__.py +0 -0
  70. tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
  71. tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
  72. tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
  73. tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
  74. tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
  75. tests/foundation/config/logging/__init__.py +0 -0
  76. tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
  77. tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
  78. tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
  79. tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
  80. tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
  81. tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
  82. tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
  83. tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
  84. tests/foundation/config/mail/__init__.py +0 -0
  85. tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
  86. tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
  87. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
  88. tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
  89. tests/foundation/config/queue/__init__.py +0 -0
  90. tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
  91. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
  92. tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
  93. tests/foundation/config/root/__init__.py +0 -0
  94. tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
  95. tests/foundation/config/session/__init__.py +0 -0
  96. tests/foundation/config/session/test_foundation_config_session.py +0 -213
  97. tests/foundation/config/startup/__init__.py +0 -0
  98. tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
  99. tests/foundation/config/testing/__init__.py +0 -0
  100. tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
  101. tests/metadata/__init__.py +0 -0
  102. tests/metadata/test_metadata_framework.py +0 -140
  103. tests/metadata/test_metadata_package.py +0 -139
  104. tests/services/__init__.py +0 -0
  105. tests/services/asynchrony/__init__.py +0 -0
  106. tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
  107. tests/services/environment/__init__.py +0 -0
  108. tests/services/environment/test_services_environment.py +0 -226
  109. tests/services/introspection/__init__.py +0 -0
  110. tests/services/introspection/dependencies/__init__.py +0 -0
  111. tests/services/introspection/dependencies/mocks/__init__.py +0 -0
  112. tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
  113. tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
  114. tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
  115. tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
  116. tests/services/introspection/reflection/__init__.py +0 -0
  117. tests/services/introspection/reflection/mock/__init__.py +0 -0
  118. tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
  119. tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
  120. tests/services/introspection/reflection/test_reflection_callable.py +0 -206
  121. tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
  122. tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
  123. tests/services/introspection/reflection/test_reflection_module.py +0 -567
  124. tests/services/introspection/test_reflection.py +0 -462
  125. tests/services/log/__init__.py +0 -0
  126. tests/services/log/test_log.py +0 -97
  127. tests/services/system/__init__.py +0 -0
  128. tests/services/system/test_services_system_imports.py +0 -204
  129. tests/services/system/test_services_system_workers.py +0 -131
  130. tests/support/__init__.py +0 -0
  131. tests/support/entities/__init__.py +0 -0
  132. tests/support/entities/mock_dataclass.py +0 -40
  133. tests/support/entities/test_base.py +0 -64
  134. tests/support/patterns/__init__.py +0 -0
  135. tests/support/patterns/singleton/__init__.py +0 -0
  136. tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
  137. tests/support/standard/__init__.py +0 -0
  138. tests/support/standard/test_services_std.py +0 -226
  139. tests/support/wrapper/__init__.py +0 -0
  140. tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
  141. tests/testing/__init__.py +0 -0
  142. tests/testing/cases/__init__.py +0 -0
  143. tests/testing/cases/test_testing_asynchronous.py +0 -63
  144. tests/testing/cases/test_testing_synchronous.py +0 -57
  145. tests/testing/entities/__init__.py +0 -0
  146. tests/testing/entities/test_testing_result.py +0 -146
  147. tests/testing/enums/__init__.py +0 -0
  148. tests/testing/enums/test_testing_status.py +0 -63
  149. tests/testing/output/__init__.py +0 -0
  150. tests/testing/output/test_testing_dumper.py +0 -29
  151. tests/testing/output/test_testing_printer.py +0 -42
  152. tests/testing/records/__init__.py +0 -0
  153. tests/testing/records/test_testing_records.py +0 -171
  154. tests/testing/test_testing_unit.py +0 -164
  155. tests/testing/validators/__init__.py +0 -0
  156. tests/testing/validators/test_testing_validators.py +0 -392
  157. tests/testing/view/__init__.py +0 -0
  158. tests/testing/view/test_render.py +0 -30
  159. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/WHEEL +0 -0
  160. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/licenses/LICENCE +0 -0
@@ -1,213 +0,0 @@
1
- from orionis.foundation.config.session.entities.session import Session
2
- from orionis.foundation.config.session.enums.same_site_policy import SameSitePolicy
3
- from orionis.foundation.exceptions import OrionisIntegrityException
4
- from orionis.test.cases.asynchronous import AsyncTestCase
5
-
6
- class TestFoundationConfigSession(AsyncTestCase):
7
-
8
- async def testDefaultInitialization(self):
9
- """
10
- Test default initialization of the Session instance.
11
-
12
- Returns
13
- -------
14
- None
15
-
16
- Notes
17
- -----
18
- Checks that all attributes of the Session instance are set to their correct default values,
19
- including the generation of the secret_key.
20
- """
21
- session = Session()
22
- self.assertIsInstance(session.secret_key, str)
23
- self.assertEqual(session.session_cookie, "orionis_session")
24
- self.assertEqual(session.max_age, 1800)
25
- self.assertEqual(session.same_site, SameSitePolicy.LAX.value)
26
- self.assertEqual(session.path, "/")
27
- self.assertFalse(session.https_only)
28
- self.assertIsNone(session.domain)
29
-
30
- async def testSecretKeyValidation(self):
31
- """
32
- Test validation of the secret_key attribute.
33
-
34
- Returns
35
- -------
36
- None
37
-
38
- Notes
39
- -----
40
- Ensures that providing an invalid secret_key raises an OrionisIntegrityException.
41
- """
42
- with self.assertRaises(OrionisIntegrityException):
43
- Session(secret_key="") # Empty string
44
- with self.assertRaises(OrionisIntegrityException):
45
- Session(secret_key=123) # Non-string value
46
-
47
- async def testSessionCookieValidation(self):
48
- """
49
- Test validation of the session_cookie attribute.
50
-
51
- Returns
52
- -------
53
- None
54
-
55
- Notes
56
- -----
57
- Ensures that invalid session_cookie values raise an OrionisIntegrityException.
58
- """
59
- with self.assertRaises(OrionisIntegrityException):
60
- Session(session_cookie="") # Empty string
61
- with self.assertRaises(OrionisIntegrityException):
62
- Session(session_cookie="my session") # Contains space
63
- with self.assertRaises(OrionisIntegrityException):
64
- Session(session_cookie="session;") # Contains semicolon
65
-
66
- async def testMaxAgeValidation(self):
67
- """
68
- Test validation of the max_age attribute.
69
-
70
- Returns
71
- -------
72
- None
73
-
74
- Notes
75
- -----
76
- Ensures that invalid max_age values raise an OrionisIntegrityException.
77
- Also verifies that None is accepted as a valid value.
78
- """
79
- with self.assertRaises(OrionisIntegrityException):
80
- Session(max_age="3600") # String instead of int
81
- with self.assertRaises(OrionisIntegrityException):
82
- Session(max_age=-1) # Negative value
83
- # Test None is acceptable
84
- session = Session(max_age=None)
85
- self.assertIsNone(session.max_age)
86
-
87
- async def testSameSiteValidation(self):
88
- """
89
- Test validation and normalization of the same_site attribute.
90
-
91
- Returns
92
- -------
93
- None
94
-
95
- Notes
96
- -----
97
- Ensures that both string and enum inputs for same_site are handled correctly.
98
- Also checks that invalid values raise an OrionisIntegrityException.
99
- """
100
- # Test string inputs (case-insensitive)
101
- session1 = Session(same_site="strict")
102
- self.assertEqual(session1.same_site, SameSitePolicy.STRICT.value)
103
- session2 = Session(same_site="NONE")
104
- self.assertEqual(session2.same_site, SameSitePolicy.NONE.value)
105
-
106
- # Test enum inputs
107
- session3 = Session(same_site=SameSitePolicy.LAX)
108
- self.assertEqual(session3.same_site, SameSitePolicy.LAX.value)
109
-
110
- # Test invalid inputs
111
- with self.assertRaises(OrionisIntegrityException):
112
- Session(same_site="invalid")
113
- with self.assertRaises(OrionisIntegrityException):
114
- Session(same_site=123)
115
-
116
- async def testPathValidation(self):
117
- """
118
- Test validation of the path attribute.
119
-
120
- Returns
121
- -------
122
- None
123
-
124
- Notes
125
- -----
126
- Ensures that invalid path values raise an OrionisIntegrityException.
127
- """
128
- with self.assertRaises(OrionisIntegrityException):
129
- Session(path="") # Empty string
130
- with self.assertRaises(OrionisIntegrityException):
131
- Session(path="api") # Doesn't start with /
132
- with self.assertRaises(OrionisIntegrityException):
133
- Session(path=123) # Non-string value
134
-
135
- async def testHttpsOnlyValidation(self):
136
- """
137
- Test validation of the https_only attribute.
138
-
139
- Returns
140
- -------
141
- None
142
-
143
- Notes
144
- -----
145
- Ensures that non-boolean values for https_only raise an OrionisIntegrityException.
146
- """
147
- with self.assertRaises(OrionisIntegrityException):
148
- Session(https_only="true") # String instead of bool
149
- with self.assertRaises(OrionisIntegrityException):
150
- Session(https_only=1) # Integer instead of bool
151
-
152
- async def testDomainValidation(self):
153
- """
154
- Test validation of the domain attribute.
155
-
156
- Returns
157
- -------
158
- None
159
-
160
- Notes
161
- -----
162
- Ensures that invalid domain values raise an OrionisIntegrityException.
163
- Also verifies that None is accepted as a valid value.
164
- """
165
- with self.assertRaises(OrionisIntegrityException):
166
- Session(domain=".example.com") # Starts with dot
167
- with self.assertRaises(OrionisIntegrityException):
168
- Session(domain="example.com.") # Ends with dot
169
- with self.assertRaises(OrionisIntegrityException):
170
- Session(domain="example..com") # Contains consecutive dots
171
-
172
- # Test None is acceptable
173
- session = Session(domain=None)
174
- self.assertIsNone(session.domain)
175
-
176
- async def testToDictMethod(self):
177
- """
178
- Test the toDict method of the Session instance.
179
-
180
- Returns
181
- -------
182
- None
183
-
184
- Notes
185
- -----
186
- Ensures that the toDict method returns a dictionary containing all fields with correct values.
187
- """
188
- session = Session()
189
- result = session.toDict()
190
- self.assertIsInstance(result, dict)
191
- self.assertIn("secret_key", result)
192
- self.assertEqual(result["session_cookie"], "orionis_session")
193
- self.assertEqual(result["max_age"], 1800)
194
- self.assertEqual(result["same_site"], SameSitePolicy.LAX.value)
195
- self.assertEqual(result["path"], "/")
196
- self.assertFalse(result["https_only"])
197
- self.assertIsNone(result["domain"])
198
-
199
- async def testKwOnlyInitialization(self):
200
- """
201
- Test enforcement of keyword-only initialization for Session.
202
-
203
- Returns
204
- -------
205
- None
206
-
207
- Notes
208
- -----
209
- Ensures that the Session class enforces keyword-only arguments during initialization
210
- by raising a TypeError when positional arguments are provided.
211
- """
212
- with self.assertRaises(TypeError):
213
- Session("key", "session")
File without changes
@@ -1,202 +0,0 @@
1
- from dataclasses import is_dataclass
2
- from orionis.foundation.exceptions.integrity import OrionisIntegrityException
3
- from orionis.foundation.config.startup import Configuration
4
- from orionis.foundation.config.app.entities.app import App
5
- from orionis.foundation.config.auth.entities.auth import Auth
6
- from orionis.foundation.config.cache.entities.cache import Cache
7
- from orionis.foundation.config.cors.entities.cors import Cors
8
- from orionis.foundation.config.database.entities.database import Database
9
- from orionis.foundation.config.roots.paths import Paths
10
- from orionis.foundation.config.filesystems.entitites.filesystems import Filesystems
11
- from orionis.foundation.config.logging.entities.logging import Logging
12
- from orionis.foundation.config.mail.entities.mail import Mail
13
- from orionis.foundation.config.queue.entities.queue import Queue
14
- from orionis.foundation.config.session.entities.session import Session
15
- from orionis.foundation.config.testing.entities.testing import Testing
16
- from orionis.test.cases.asynchronous import AsyncTestCase
17
-
18
- class TestFoundationConfigStartup(AsyncTestCase):
19
- """
20
- Test suite for the `Configuration` dataclass, validating its structure, initialization,
21
- type enforcement, mutability, equality, and dictionary conversion.
22
-
23
- Methods
24
- -------
25
- testConfigurationIsDataclass
26
- Verify that `Configuration` is a dataclass.
27
- testDefaultInitialization
28
- Ensure all fields of `Configuration` are initialized with their default factories and correct types.
29
- testAllSectionsHaveDefaultFactories
30
- Check that every field in `Configuration` has a callable default factory.
31
- testTypeValidationInPostInit
32
- Confirm that type validation and dictionary conversion occur in `__post_init__`,
33
- and that invalid types raise `OrionisIntegrityException`.
34
- testToDictReturnsCompleteDictionary
35
- Assert that `toDict()` returns a dictionary containing all configuration sections.
36
- testToDictReturnsNestedStructures
37
- Ensure that nested configuration sections are represented as dictionaries in `toDict()` output.
38
- testMetadataIsAccessible
39
- Validate that field metadata is accessible and contains required keys and types.
40
- testConfigurationIsMutable
41
- Check that attributes of `Configuration` can be modified after initialization.
42
- testConfigurationEquality
43
- Test equality comparison between `Configuration` instances, especially with differing keys.
44
- """
45
-
46
- def testConfigurationIsDataclass(self):
47
- """
48
- Verify that `Configuration` is implemented as a dataclass.
49
-
50
- Returns
51
- -------
52
- None
53
- """
54
- self.assertTrue(is_dataclass(Configuration))
55
-
56
- def testDefaultInitialization(self):
57
- """
58
- Ensure all fields of `Configuration` are initialized with their default factories
59
- and are instances of their respective entity classes.
60
-
61
- Returns
62
- -------
63
- None
64
- """
65
- config = Configuration()
66
- self.assertIsInstance(config, Configuration)
67
- self.assertIsInstance(config.app, App)
68
- self.assertIsInstance(config.auth, Auth)
69
- self.assertIsInstance(config.cache, Cache)
70
- self.assertIsInstance(config.cors, Cors)
71
- self.assertIsInstance(config.database, Database)
72
- self.assertIsInstance(config.filesystems, Filesystems)
73
- self.assertIsInstance(config.logging, Logging)
74
- self.assertIsInstance(config.mail, Mail)
75
- self.assertIsInstance(config.path, Paths)
76
- self.assertIsInstance(config.queue, Queue)
77
- self.assertIsInstance(config.session, Session)
78
- self.assertIsInstance(config.testing, Testing)
79
-
80
- def testAllSectionsHaveDefaultFactories(self):
81
- """
82
- Check that every field in `Configuration` has a callable default factory.
83
-
84
- Returns
85
- -------
86
- None
87
- """
88
- config = Configuration()
89
- for field in config.__dataclass_fields__.values():
90
- self.assertTrue(callable(field.default_factory),
91
- f"Field {field.name} is missing default_factory")
92
-
93
- def testTypeValidationInPostInit(self):
94
- """
95
- Confirm that type validation and dictionary conversion occur in `__post_init__`.
96
- Validates that dictionaries are converted to entity instances and invalid types
97
- raise `OrionisIntegrityException`.
98
-
99
- Returns
100
- -------
101
- None
102
- """
103
- # Valid dict conversion
104
- config = Configuration(app={"name": "TestApp"})
105
- self.assertIsInstance(config.app, App)
106
-
107
- # Invalid types for each section should raise an exception
108
- sections = [
109
- ('app', 123),
110
- ('auth', 123),
111
- ('cache', 123),
112
- ('cors', 123),
113
- ('database', 123),
114
- ('filesystems', 123),
115
- ('logging', 123),
116
- ('mail', 123),
117
- ('path', 123),
118
- ('queue', 123),
119
- ('session', 123),
120
- ('testing', 123)
121
- ]
122
- for section_name, wrong_value in sections:
123
- with self.subTest(section=section_name):
124
- kwargs = {section_name: wrong_value}
125
- with self.assertRaises(OrionisIntegrityException):
126
- Configuration(**kwargs)
127
-
128
- def testToDictReturnsCompleteDictionary(self):
129
- """
130
- Assert that `toDict()` returns a dictionary containing all configuration sections.
131
-
132
- Returns
133
- -------
134
- None
135
- """
136
- config = Configuration()
137
- config_dict = config.toDict()
138
- self.assertIsInstance(config_dict, dict)
139
- self.assertEqual(set(config_dict.keys()), set(config.__dataclass_fields__.keys()))
140
-
141
- def testToDictReturnsNestedStructures(self):
142
- """
143
- Ensure that nested configuration sections are represented as dictionaries
144
- in the output of `toDict()`.
145
-
146
- Returns
147
- -------
148
- None
149
- """
150
- config = Configuration()
151
- config_dict = config.toDict()
152
- self.assertIsInstance(config_dict['app'], dict)
153
- self.assertIsInstance(config_dict['auth'], dict)
154
- self.assertIsInstance(config_dict['database'], dict)
155
- self.assertIsInstance(config_dict['path'], dict)
156
-
157
- def testMetadataIsAccessible(self):
158
- """
159
- Validate that field metadata is accessible and contains the 'description' key
160
- as a string and the 'default' key.
161
-
162
- Returns
163
- -------
164
- None
165
- """
166
- config = Configuration()
167
- for field in config.__dataclass_fields__.values():
168
- metadata = field.metadata
169
- self.assertIn('description', metadata)
170
- self.assertIsInstance(metadata['description'], str)
171
- self.assertIn('default', metadata)
172
-
173
- def testConfigurationIsMutable(self):
174
- """
175
- Check that attributes of `Configuration` can be modified after initialization.
176
-
177
- Returns
178
- -------
179
- None
180
- """
181
- config = Configuration()
182
- new_app = App()
183
- try:
184
- config.app = new_app
185
- except Exception as e:
186
- self.fail(f"Should be able to modify attributes, but got {type(e).__name__}")
187
-
188
- def testConfigurationEquality(self):
189
- """
190
- Test equality comparison between `Configuration` instances, ensuring that
191
- instances with differing keys are not considered equal.
192
-
193
- Returns
194
- -------
195
- None
196
- """
197
- # Ensure both configs have identical App objects, but their keys differ
198
- app_data = {"name": "TestApp"}
199
- config1 = Configuration(app=app_data)
200
- config2 = Configuration(app=app_data)
201
- # The key (e.g., a generated UUID or secret) will be different for each instance
202
- self.assertNotEqual(config1, config2)
File without changes
@@ -1,235 +0,0 @@
1
- from orionis.foundation.config.testing.entities.testing import Testing
2
- from orionis.foundation.config.testing.enums.mode import ExecutionMode
3
- from orionis.foundation.exceptions import OrionisIntegrityException
4
- from orionis.test.cases.asynchronous import AsyncTestCase
5
-
6
- class TestFoundationConfigTesting(AsyncTestCase):
7
- """
8
- Test suite for the Testing configuration entity.
9
-
10
- This class contains asynchronous test cases to validate the default values,
11
- custom values, and integrity constraints of the Testing configuration.
12
- """
13
-
14
- async def testDefaultValues(self):
15
- """
16
- Test the default values of the Testing configuration.
17
-
18
- Notes
19
- -----
20
- Ensures that all default attributes of the Testing configuration are set
21
- as expected.
22
- """
23
- t = Testing()
24
- self.assertEqual(t.verbosity, 2)
25
- self.assertEqual(t.execution_mode, ExecutionMode.SEQUENTIAL.value)
26
- self.assertTrue(isinstance(t.max_workers, int) and t.max_workers >= 1)
27
- self.assertFalse(t.fail_fast)
28
- self.assertTrue(t.print_result)
29
- self.assertFalse(t.throw_exception)
30
- self.assertEqual(t.base_path, "tests")
31
- self.assertEqual(t.folder_path, "*")
32
- self.assertEqual(t.pattern, "test_*.py")
33
- self.assertIsNone(t.test_name_pattern)
34
- self.assertEqual(t.tags, [])
35
-
36
- async def testValidCustomValues(self):
37
- """
38
- Test custom valid values for all fields.
39
-
40
- Notes
41
- -----
42
- Verifies that the Testing configuration accepts and correctly sets
43
- custom valid values for all its fields.
44
- """
45
- t = Testing(
46
- verbosity=1,
47
- execution_mode=ExecutionMode.PARALLEL,
48
- max_workers=4,
49
- fail_fast=True,
50
- print_result=False,
51
- throw_exception=True,
52
- base_path="my_tests",
53
- folder_path=["unit", "integration"],
54
- pattern="*_spec.py",
55
- test_name_pattern="test_login*",
56
- tags=["fast", "critical"]
57
- )
58
- self.assertEqual(t.verbosity, 1)
59
- self.assertEqual(t.execution_mode, ExecutionMode.PARALLEL.value)
60
- self.assertEqual(t.max_workers, 4)
61
- self.assertTrue(t.fail_fast)
62
- self.assertFalse(t.print_result)
63
- self.assertTrue(t.throw_exception)
64
- self.assertEqual(t.base_path, "my_tests")
65
- self.assertEqual(t.folder_path, ["unit", "integration"])
66
- self.assertEqual(t.pattern, "*_spec.py")
67
- self.assertEqual(t.test_name_pattern, "test_login*")
68
- self.assertEqual(t.tags, ["fast", "critical"])
69
-
70
- async def testFolderPathStringAndList(self):
71
- """
72
- Test folder_path accepts both string and list of strings.
73
-
74
- Notes
75
- -----
76
- Checks that the folder_path attribute can be set as a string or a list of strings.
77
- """
78
- t1 = Testing(folder_path="integration")
79
- self.assertEqual(t1.folder_path, "integration")
80
- t2 = Testing(folder_path=["integration", "unit"])
81
- self.assertEqual(t2.folder_path, ["integration", "unit"])
82
-
83
- async def testTagsNoneOrList(self):
84
- """
85
- Test tags accepts None or list of strings.
86
-
87
- Notes
88
- -----
89
- Ensures that the tags attribute can be set to None or a list of strings.
90
- """
91
- t1 = Testing(tags=None)
92
- self.assertIsNone(t1.tags)
93
- t2 = Testing(tags=["a", "b"])
94
- self.assertEqual(t2.tags, ["a", "b"])
95
-
96
- async def testInvalidVerbosity(self):
97
- """
98
- Test invalid verbosity values.
99
-
100
- Notes
101
- -----
102
- Verifies that invalid verbosity values raise OrionisIntegrityException.
103
- """
104
- with self.assertRaises(OrionisIntegrityException):
105
- Testing(verbosity=-1)
106
- with self.assertRaises(OrionisIntegrityException):
107
- Testing(verbosity=3)
108
- with self.assertRaises(OrionisIntegrityException):
109
- Testing(verbosity="high")
110
-
111
- async def testInvalidExecutionMode(self):
112
- """
113
- Test execution_mode cannot be None.
114
-
115
- Notes
116
- -----
117
- Ensures that setting execution_mode to None raises OrionisIntegrityException.
118
- """
119
- with self.assertRaises(OrionisIntegrityException):
120
- Testing(execution_mode=None)
121
-
122
- async def testInvalidMaxWorkers(self):
123
- """
124
- Test invalid max_workers values.
125
-
126
- Notes
127
- -----
128
- Checks that invalid values for max_workers raise OrionisIntegrityException.
129
- """
130
- with self.assertRaises(OrionisIntegrityException):
131
- Testing(max_workers=0)
132
- with self.assertRaises(OrionisIntegrityException):
133
- Testing(max_workers=-5)
134
- with self.assertRaises(OrionisIntegrityException):
135
- Testing(max_workers="many")
136
-
137
- async def testInvalidFailFast(self):
138
- """
139
- Test fail_fast must be boolean.
140
-
141
- Notes
142
- -----
143
- Ensures that non-boolean values for fail_fast raise OrionisIntegrityException.
144
- """
145
- with self.assertRaises(OrionisIntegrityException):
146
- Testing(fail_fast="yes")
147
-
148
- async def testInvalidPrintResult(self):
149
- """
150
- Test print_result must be boolean.
151
-
152
- Notes
153
- -----
154
- Ensures that non-boolean values for print_result raise OrionisIntegrityException.
155
- """
156
- with self.assertRaises(OrionisIntegrityException):
157
- Testing(print_result=1)
158
-
159
- async def testInvalidThrowException(self):
160
- """
161
- Test throw_exception must be boolean.
162
-
163
- Notes
164
- -----
165
- Ensures that non-boolean values for throw_exception raise OrionisIntegrityException.
166
- """
167
- with self.assertRaises(OrionisIntegrityException):
168
- Testing(throw_exception="no")
169
-
170
- async def testInvalidBasePath(self):
171
- """
172
- Test base_path must be string.
173
-
174
- Notes
175
- -----
176
- Ensures that non-string values for base_path raise OrionisIntegrityException.
177
- """
178
- with self.assertRaises(OrionisIntegrityException):
179
- Testing(base_path=123)
180
-
181
- async def testInvalidFolderPath(self):
182
- """
183
- Test folder_path must be string or list of strings.
184
-
185
- Notes
186
- -----
187
- Ensures that invalid types for folder_path raise OrionisIntegrityException.
188
- """
189
- with self.assertRaises(OrionisIntegrityException):
190
- Testing(folder_path=123)
191
- with self.assertRaises(OrionisIntegrityException):
192
- Testing(folder_path=[1, 2])
193
- with self.assertRaises(OrionisIntegrityException):
194
- Testing(folder_path=["ok", 2])
195
-
196
- async def testInvalidPattern(self):
197
- """
198
- Test pattern must be string.
199
-
200
- Notes
201
- -----
202
- Ensures that non-string values for pattern raise OrionisIntegrityException.
203
- """
204
- with self.assertRaises(OrionisIntegrityException):
205
- Testing(pattern=[])
206
- with self.assertRaises(OrionisIntegrityException):
207
- Testing(pattern=123)
208
-
209
- async def testInvalidTestNamePattern(self):
210
- """
211
- Test test_name_pattern must be string or None.
212
-
213
- Notes
214
- -----
215
- Ensures that invalid types for test_name_pattern raise OrionisIntegrityException.
216
- """
217
- with self.assertRaises(OrionisIntegrityException):
218
- Testing(test_name_pattern=[])
219
- with self.assertRaises(OrionisIntegrityException):
220
- Testing(test_name_pattern=123)
221
-
222
- async def testInvalidTags(self):
223
- """
224
- Test tags must be None or list of strings.
225
-
226
- Notes
227
- -----
228
- Ensures that invalid types for tags raise OrionisIntegrityException.
229
- """
230
- with self.assertRaises(OrionisIntegrityException):
231
- Testing(tags="fast")
232
- with self.assertRaises(OrionisIntegrityException):
233
- Testing(tags=[1, 2])
234
- with self.assertRaises(OrionisIntegrityException):
235
- Testing(tags=["ok", 2])
File without changes