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.
- orionis/metadata/framework.py +1 -1
- orionis/services/environment/contracts/env.py +45 -50
- orionis/services/environment/contracts/types.py +70 -0
- orionis/services/environment/dot_env.py +204 -182
- orionis/services/environment/env.py +68 -85
- orionis/services/{standard/exceptions/path_value_exceptions.py → environment/exceptions/environment_value_error.py} +2 -12
- orionis/services/environment/exceptions/environment_value_exception.py +23 -0
- orionis/services/environment/types.py +578 -0
- orionis/services/paths/exceptions/not_found_exceptions.py +15 -12
- orionis/services/paths/exceptions/path_value_exceptions.py +13 -10
- orionis/services/standard/contracts/std.py +1 -1
- orionis/services/standard/exceptions/std_value_exception.py +23 -0
- orionis/services/standard/std.py +2 -2
- orionis/services/system/contracts/imports.py +27 -7
- orionis/services/system/contracts/workers.py +8 -3
- orionis/services/system/imports.py +31 -12
- orionis/services/system/runtime_imports.py +33 -23
- orionis/services/system/workers.py +6 -8
- orionis/services/wrapper/dicts/dot_dict.py +82 -41
- orionis/test/logs/history.py +3 -5
- orionis/unittesting.py +12 -12
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/METADATA +1 -1
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/RECORD +76 -70
- tests/example/test_example.py +5 -2
- tests/foundation/config/app/{test_app.py → test_foundation_config_app.py} +14 -4
- tests/foundation/config/auth/{test_auth.py → test_foundation_config_auth.py} +10 -5
- tests/foundation/config/cache/{test_cache.py → test_foundation_config_cache.py} +61 -16
- tests/foundation/config/cache/test_foundation_config_cache_file.py +126 -0
- tests/foundation/config/cache/test_foundation_config_cache_stores.py +148 -0
- tests/foundation/config/cors/test_foundation_config_cors.py +190 -0
- tests/foundation/config/database/{test_database.py → test_foundation_config_database.py} +39 -15
- tests/foundation/config/database/{test_database_connections.py → test_foundation_config_database_connections.py} +80 -6
- tests/foundation/config/database/{test_database_mysql.py → test_foundation_config_database_mysql.py} +139 -16
- tests/foundation/config/database/{test_database_oracle.py → test_foundation_config_database_oracle.py} +111 -27
- tests/foundation/config/database/{test_database_pgsql.py → test_foundation_config_database_pgsql.py} +97 -27
- tests/foundation/config/database/{test_database_sqlite.py → test_foundation_config_database_sqlite.py} +57 -3
- tests/foundation/config/exceptions/{test_exceptions_integrity.py → test_foundation_config_exceptions.py} +45 -11
- tests/foundation/config/filesystems/{test_filesystems.py → test_foundation_config_filesystems.py} +65 -15
- tests/foundation/config/filesystems/{test_filesystems_aws.py → test_foundation_config_filesystems_aws.py} +46 -8
- tests/foundation/config/filesystems/{test_filesystems_disks.py → test_foundation_config_filesystems_disks.py} +79 -9
- tests/foundation/config/filesystems/{test_filesystems_local.py → test_foundation_config_filesystems_local.py} +67 -19
- tests/foundation/config/filesystems/{test_filesystems_public.py → test_foundation_config_filesystems_public.py} +38 -1
- tests/foundation/config/logging/test_foundation_config_logging.py +112 -0
- tests/foundation/config/logging/{test_logging_channels.py → test_foundation_config_logging_channels.py} +80 -3
- tests/foundation/config/logging/{test_logging_chunked.py → test_foundation_config_logging_chunked.py} +86 -13
- tests/foundation/config/logging/{test_logging_daily.py → test_foundation_config_logging_daily.py} +80 -13
- tests/foundation/config/logging/{test_logging_hourly.py → test_foundation_config_logging_hourly.py} +69 -3
- tests/foundation/config/logging/{test_logging_monthly.py → test_foundation_config_logging_monthly.py} +49 -3
- tests/foundation/config/logging/{test_logging_stack.py → test_foundation_config_logging_stack.py} +50 -15
- tests/foundation/config/logging/{test_logging_weekly.py → test_foundation_config_logging_weekly.py} +93 -3
- tests/foundation/config/mail/test_foundation_config_mail.py +145 -0
- tests/foundation/config/mail/{test_mail_file.py → test_foundation_config_mail_file.py} +41 -5
- tests/foundation/config/mail/test_foundation_config_mail_mailers.py +106 -0
- tests/foundation/config/mail/{test_mail_smtp.py → test_foundation_config_mail_smtp.py} +59 -15
- tests/foundation/config/queue/test_foundation_config_queue.py +111 -0
- tests/foundation/config/queue/{test_queue_brokers.py → test_foundation_config_queue_brokers.py} +28 -11
- tests/foundation/config/queue/{test_queue_database.py → test_foundation_config_queue_database.py} +54 -16
- tests/foundation/config/root/{test_root_paths.py → test_foundation_config_root_paths.py} +70 -3
- tests/foundation/config/session/{test_session.py → test_foundation_config_session.py} +31 -2
- tests/foundation/config/startup/{test_config_startup.py → test_foundation_config_startup.py} +91 -21
- tests/foundation/config/testing/{test_testing.py → test_foundation_config_testing.py} +69 -1
- tests/patterns/singleton/test_patterns_singleton.py +27 -0
- tests/services/asynchrony/{test_async_io.py → test_services_asynchrony_coroutine.py} +1 -1
- tests/services/environment/test_services_environment.py +93 -0
- tests/services/path/{test_resolver.py → test_services_resolver.py} +51 -12
- tests/services/standard/{test_std.py → test_services_std.py} +45 -22
- tests/services/system/__init__.py +0 -0
- tests/services/system/test_services_system_imports.py +101 -0
- tests/services/system/test_services_system_workers.py +89 -0
- tests/services/wrapper/{test_wrapper_doc_dict.py → test_services_wrapper_docdict.py} +28 -16
- tests/testing/test_testing_result.py +57 -20
- tests/testing/test_testing_unit.py +110 -41
- orionis/services/environment/exceptions/value_exception.py +0 -27
- tests/foundation/config/cache/test_cache_file.py +0 -78
- tests/foundation/config/cache/test_cache_stores.py +0 -88
- tests/foundation/config/cors/test_cors.py +0 -121
- tests/foundation/config/logging/test_logging.py +0 -48
- tests/foundation/config/mail/test_mail.py +0 -73
- tests/foundation/config/mail/test_mail_mailers.py +0 -58
- tests/foundation/config/queue/test_queue.py +0 -58
- tests/patterns/singleton/test_singleton.py +0 -18
- tests/services/environment/test_env.py +0 -155
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/WHEEL +0 -0
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/top_level.txt +0 -0
- {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/zip-safe +0 -0
@@ -3,11 +3,13 @@ from orionis.foundation.config.session.enums.same_site_policy import SameSitePol
|
|
3
3
|
from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
|
-
class
|
7
|
-
|
6
|
+
class TestFoundationConfigSession(TestCase):
|
8
7
|
async def testDefaultInitialization(self):
|
9
8
|
"""
|
10
9
|
Test that Session instance is initialized with correct default values.
|
10
|
+
|
11
|
+
Notes
|
12
|
+
-----
|
11
13
|
Verifies default values for all attributes including secret_key generation.
|
12
14
|
"""
|
13
15
|
session = Session()
|
@@ -22,6 +24,9 @@ class TestSession(TestCase):
|
|
22
24
|
async def testSecretKeyValidation(self):
|
23
25
|
"""
|
24
26
|
Test validation for secret_key attribute.
|
27
|
+
|
28
|
+
Notes
|
29
|
+
-----
|
25
30
|
Verifies that invalid secret keys raise OrionisIntegrityException.
|
26
31
|
"""
|
27
32
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -32,6 +37,9 @@ class TestSession(TestCase):
|
|
32
37
|
async def testSessionCookieValidation(self):
|
33
38
|
"""
|
34
39
|
Test validation for session_cookie attribute.
|
40
|
+
|
41
|
+
Notes
|
42
|
+
-----
|
35
43
|
Verifies invalid cookie names raise OrionisIntegrityException.
|
36
44
|
"""
|
37
45
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -44,6 +52,9 @@ class TestSession(TestCase):
|
|
44
52
|
async def testMaxAgeValidation(self):
|
45
53
|
"""
|
46
54
|
Test validation for max_age attribute.
|
55
|
+
|
56
|
+
Notes
|
57
|
+
-----
|
47
58
|
Verifies invalid max_age values raise OrionisIntegrityException.
|
48
59
|
"""
|
49
60
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -57,6 +68,9 @@ class TestSession(TestCase):
|
|
57
68
|
async def testSameSiteValidation(self):
|
58
69
|
"""
|
59
70
|
Test validation and normalization for same_site attribute.
|
71
|
+
|
72
|
+
Notes
|
73
|
+
-----
|
60
74
|
Verifies both string and enum inputs are properly handled.
|
61
75
|
"""
|
62
76
|
# Test string inputs (case-insensitive)
|
@@ -78,6 +92,9 @@ class TestSession(TestCase):
|
|
78
92
|
async def testPathValidation(self):
|
79
93
|
"""
|
80
94
|
Test validation for path attribute.
|
95
|
+
|
96
|
+
Notes
|
97
|
+
-----
|
81
98
|
Verifies invalid paths raise OrionisIntegrityException.
|
82
99
|
"""
|
83
100
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -90,6 +107,9 @@ class TestSession(TestCase):
|
|
90
107
|
async def testHttpsOnlyValidation(self):
|
91
108
|
"""
|
92
109
|
Test validation for https_only attribute.
|
110
|
+
|
111
|
+
Notes
|
112
|
+
-----
|
93
113
|
Verifies non-boolean values raise OrionisIntegrityException.
|
94
114
|
"""
|
95
115
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -100,6 +120,9 @@ class TestSession(TestCase):
|
|
100
120
|
async def testDomainValidation(self):
|
101
121
|
"""
|
102
122
|
Test validation for domain attribute.
|
123
|
+
|
124
|
+
Notes
|
125
|
+
-----
|
103
126
|
Verifies invalid domains raise OrionisIntegrityException.
|
104
127
|
"""
|
105
128
|
with self.assertRaises(OrionisIntegrityException):
|
@@ -116,6 +139,9 @@ class TestSession(TestCase):
|
|
116
139
|
async def testToDictMethod(self):
|
117
140
|
"""
|
118
141
|
Test the toDict method returns proper dictionary representation.
|
142
|
+
|
143
|
+
Notes
|
144
|
+
-----
|
119
145
|
Verifies all fields are included with correct values.
|
120
146
|
"""
|
121
147
|
session = Session()
|
@@ -132,6 +158,9 @@ class TestSession(TestCase):
|
|
132
158
|
async def testKwOnlyInitialization(self):
|
133
159
|
"""
|
134
160
|
Test that Session requires keyword arguments for initialization.
|
161
|
+
|
162
|
+
Notes
|
163
|
+
-----
|
135
164
|
Verifies the class enforces kw_only=True in its dataclass decorator.
|
136
165
|
"""
|
137
166
|
with self.assertRaises(TypeError):
|
tests/foundation/config/startup/{test_config_startup.py → test_foundation_config_startup.py}
RENAMED
@@ -1,29 +1,64 @@
|
|
1
1
|
from dataclasses import is_dataclass
|
2
2
|
from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
|
3
3
|
from orionis.foundation.config.startup import Configuration
|
4
|
-
from orionis.unittesting import TestCase,
|
4
|
+
from orionis.unittesting import TestCase, Mock
|
5
5
|
|
6
|
-
class
|
6
|
+
class TestFoundationConfigStartup(TestCase):
|
7
7
|
"""
|
8
|
-
Test suite for the Configuration dataclass
|
9
|
-
configuration sections for the application.
|
8
|
+
Test suite for the Configuration dataclass.
|
10
9
|
|
11
|
-
This
|
12
|
-
|
10
|
+
This class contains unit tests to verify the correct behavior of the
|
11
|
+
Configuration dataclass, including initialization, type validation,
|
12
|
+
dictionary conversion, metadata accessibility, mutability, and equality.
|
13
|
+
|
14
|
+
Attributes
|
15
|
+
----------
|
16
|
+
None
|
17
|
+
|
18
|
+
Methods
|
19
|
+
-------
|
20
|
+
testConfigurationIsDataclass()
|
21
|
+
Test that Configuration is properly defined as a dataclass.
|
22
|
+
testDefaultInitialization()
|
23
|
+
Test that Configuration can be initialized with default values.
|
24
|
+
testAllSectionsHaveDefaultFactories()
|
25
|
+
Test that all configuration sections have default factories.
|
26
|
+
testTypeValidationInPostInit()
|
27
|
+
Test that __post_init__ validates types correctly.
|
28
|
+
testToDictReturnsCompleteDictionary()
|
29
|
+
Test that toDict() returns a complete dictionary representation.
|
30
|
+
testToDictReturnsNestedStructures()
|
31
|
+
Test that toDict() properly converts nested dataclasses.
|
32
|
+
testMetadataIsAccessible()
|
33
|
+
Test that field metadata is properly defined and accessible.
|
34
|
+
testConfigurationIsMutable()
|
35
|
+
Test that Configuration is mutable (not frozen).
|
36
|
+
testConfigurationEquality()
|
37
|
+
Test that Configuration instances with same values are equal.
|
13
38
|
"""
|
14
39
|
|
15
40
|
def testConfigurationIsDataclass(self):
|
16
41
|
"""
|
17
42
|
Test that Configuration is properly defined as a dataclass.
|
18
|
-
|
43
|
+
|
44
|
+
Ensures that the @dataclass decorator was applied correctly.
|
45
|
+
|
46
|
+
Returns
|
47
|
+
-------
|
48
|
+
None
|
19
49
|
"""
|
20
50
|
self.assertTrue(is_dataclass(Configuration))
|
21
51
|
|
22
52
|
def testDefaultInitialization(self):
|
23
53
|
"""
|
24
54
|
Test that Configuration can be initialized with default values.
|
25
|
-
|
26
|
-
|
55
|
+
|
56
|
+
Verifies that all default factories work correctly and the instance
|
57
|
+
is properly constructed.
|
58
|
+
|
59
|
+
Returns
|
60
|
+
-------
|
61
|
+
None
|
27
62
|
"""
|
28
63
|
config = Configuration()
|
29
64
|
self.assertIsInstance(config, Configuration)
|
@@ -31,8 +66,13 @@ class TestConfiguration(TestCase):
|
|
31
66
|
def testAllSectionsHaveDefaultFactories(self):
|
32
67
|
"""
|
33
68
|
Test that all configuration sections have default factories.
|
69
|
+
|
34
70
|
Verifies that each field in the Configuration class has a
|
35
71
|
default_factory specified.
|
72
|
+
|
73
|
+
Returns
|
74
|
+
-------
|
75
|
+
None
|
36
76
|
"""
|
37
77
|
config = Configuration()
|
38
78
|
for field in config.__dataclass_fields__.values():
|
@@ -42,8 +82,13 @@ class TestConfiguration(TestCase):
|
|
42
82
|
def testTypeValidationInPostInit(self):
|
43
83
|
"""
|
44
84
|
Test that __post_init__ validates types correctly.
|
85
|
+
|
45
86
|
Verifies that the type checking for each configuration section
|
46
87
|
works as expected.
|
88
|
+
|
89
|
+
Returns
|
90
|
+
-------
|
91
|
+
None
|
47
92
|
"""
|
48
93
|
# Test with all correct types (should not raise)
|
49
94
|
try:
|
@@ -53,18 +98,18 @@ class TestConfiguration(TestCase):
|
|
53
98
|
|
54
99
|
# Test each section with wrong type
|
55
100
|
sections = [
|
56
|
-
('paths',
|
57
|
-
('app',
|
58
|
-
('auth',
|
59
|
-
('cache',
|
60
|
-
('cors',
|
61
|
-
('database',
|
62
|
-
('filesystems',
|
63
|
-
('logging',
|
64
|
-
('mail',
|
65
|
-
('queue',
|
66
|
-
('session',
|
67
|
-
('testing',
|
101
|
+
('paths', Mock()),
|
102
|
+
('app', Mock()),
|
103
|
+
('auth', Mock()),
|
104
|
+
('cache', Mock()),
|
105
|
+
('cors', Mock()),
|
106
|
+
('database', Mock()),
|
107
|
+
('filesystems', Mock()),
|
108
|
+
('logging', Mock()),
|
109
|
+
('mail', Mock()),
|
110
|
+
('queue', Mock()),
|
111
|
+
('session', Mock()),
|
112
|
+
('testing', Mock())
|
68
113
|
]
|
69
114
|
|
70
115
|
for section_name, wrong_value in sections:
|
@@ -76,8 +121,13 @@ class TestConfiguration(TestCase):
|
|
76
121
|
def testToDictReturnsCompleteDictionary(self):
|
77
122
|
"""
|
78
123
|
Test that toDict() returns a complete dictionary representation.
|
124
|
+
|
79
125
|
Verifies that the returned dictionary contains all configuration
|
80
126
|
sections with their current values.
|
127
|
+
|
128
|
+
Returns
|
129
|
+
-------
|
130
|
+
None
|
81
131
|
"""
|
82
132
|
config = Configuration()
|
83
133
|
config_dict = config.toDict()
|
@@ -89,8 +139,13 @@ class TestConfiguration(TestCase):
|
|
89
139
|
def testToDictReturnsNestedStructures(self):
|
90
140
|
"""
|
91
141
|
Test that toDict() properly converts nested dataclasses.
|
142
|
+
|
92
143
|
Verifies that the dictionary conversion works recursively for
|
93
144
|
all nested configuration sections.
|
145
|
+
|
146
|
+
Returns
|
147
|
+
-------
|
148
|
+
None
|
94
149
|
"""
|
95
150
|
config = Configuration()
|
96
151
|
config_dict = config.toDict()
|
@@ -101,8 +156,13 @@ class TestConfiguration(TestCase):
|
|
101
156
|
def testMetadataIsAccessible(self):
|
102
157
|
"""
|
103
158
|
Test that field metadata is properly defined and accessible.
|
159
|
+
|
104
160
|
Verifies that each configuration section field has the expected
|
105
161
|
metadata structure with description.
|
162
|
+
|
163
|
+
Returns
|
164
|
+
-------
|
165
|
+
None
|
106
166
|
"""
|
107
167
|
config = Configuration()
|
108
168
|
for field in config.__dataclass_fields__.values():
|
@@ -113,8 +173,13 @@ class TestConfiguration(TestCase):
|
|
113
173
|
def testConfigurationIsMutable(self):
|
114
174
|
"""
|
115
175
|
Test that Configuration is mutable (not frozen).
|
176
|
+
|
116
177
|
Verifies that attributes can be modified after creation since
|
117
178
|
the dataclass isn't marked as frozen.
|
179
|
+
|
180
|
+
Returns
|
181
|
+
-------
|
182
|
+
None
|
118
183
|
"""
|
119
184
|
config = Configuration()
|
120
185
|
new_paths = config.paths.__class__()
|
@@ -127,7 +192,12 @@ class TestConfiguration(TestCase):
|
|
127
192
|
def testConfigurationEquality(self):
|
128
193
|
"""
|
129
194
|
Test that Configuration instances with same values are equal.
|
195
|
+
|
130
196
|
Verifies that dataclass equality comparison works as expected.
|
197
|
+
|
198
|
+
Returns
|
199
|
+
-------
|
200
|
+
None
|
131
201
|
"""
|
132
202
|
config1 = Configuration()
|
133
203
|
config2 = Configuration()
|
@@ -3,11 +3,22 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
3
3
|
from orionis.test.enums.test_mode import ExecutionMode
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
|
-
class
|
6
|
+
class TestFoundationConfigTesting(TestCase):
|
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
|
+
"""
|
7
13
|
|
8
14
|
async def testDefaultValues(self):
|
9
15
|
"""
|
10
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.
|
11
22
|
"""
|
12
23
|
t = Testing()
|
13
24
|
self.assertEqual(t.verbosity, 2)
|
@@ -25,6 +36,11 @@ class TestTestingConfig(TestCase):
|
|
25
36
|
async def testValidCustomValues(self):
|
26
37
|
"""
|
27
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.
|
28
44
|
"""
|
29
45
|
t = Testing(
|
30
46
|
verbosity=1,
|
@@ -54,6 +70,10 @@ class TestTestingConfig(TestCase):
|
|
54
70
|
async def testFolderPathStringAndList(self):
|
55
71
|
"""
|
56
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.
|
57
77
|
"""
|
58
78
|
t1 = Testing(folder_path="integration")
|
59
79
|
self.assertEqual(t1.folder_path, "integration")
|
@@ -63,6 +83,10 @@ class TestTestingConfig(TestCase):
|
|
63
83
|
async def testTagsNoneOrList(self):
|
64
84
|
"""
|
65
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.
|
66
90
|
"""
|
67
91
|
t1 = Testing(tags=None)
|
68
92
|
self.assertIsNone(t1.tags)
|
@@ -72,6 +96,10 @@ class TestTestingConfig(TestCase):
|
|
72
96
|
async def testInvalidVerbosity(self):
|
73
97
|
"""
|
74
98
|
Test invalid verbosity values.
|
99
|
+
|
100
|
+
Notes
|
101
|
+
-----
|
102
|
+
Verifies that invalid verbosity values raise OrionisIntegrityException.
|
75
103
|
"""
|
76
104
|
with self.assertRaises(OrionisIntegrityException):
|
77
105
|
Testing(verbosity=-1)
|
@@ -83,6 +111,10 @@ class TestTestingConfig(TestCase):
|
|
83
111
|
async def testInvalidExecutionMode(self):
|
84
112
|
"""
|
85
113
|
Test execution_mode cannot be None.
|
114
|
+
|
115
|
+
Notes
|
116
|
+
-----
|
117
|
+
Ensures that setting execution_mode to None raises OrionisIntegrityException.
|
86
118
|
"""
|
87
119
|
with self.assertRaises(OrionisIntegrityException):
|
88
120
|
Testing(execution_mode=None)
|
@@ -90,6 +122,10 @@ class TestTestingConfig(TestCase):
|
|
90
122
|
async def testInvalidMaxWorkers(self):
|
91
123
|
"""
|
92
124
|
Test invalid max_workers values.
|
125
|
+
|
126
|
+
Notes
|
127
|
+
-----
|
128
|
+
Checks that invalid values for max_workers raise OrionisIntegrityException.
|
93
129
|
"""
|
94
130
|
with self.assertRaises(OrionisIntegrityException):
|
95
131
|
Testing(max_workers=0)
|
@@ -101,6 +137,10 @@ class TestTestingConfig(TestCase):
|
|
101
137
|
async def testInvalidFailFast(self):
|
102
138
|
"""
|
103
139
|
Test fail_fast must be boolean.
|
140
|
+
|
141
|
+
Notes
|
142
|
+
-----
|
143
|
+
Ensures that non-boolean values for fail_fast raise OrionisIntegrityException.
|
104
144
|
"""
|
105
145
|
with self.assertRaises(OrionisIntegrityException):
|
106
146
|
Testing(fail_fast="yes")
|
@@ -108,6 +148,10 @@ class TestTestingConfig(TestCase):
|
|
108
148
|
async def testInvalidPrintResult(self):
|
109
149
|
"""
|
110
150
|
Test print_result must be boolean.
|
151
|
+
|
152
|
+
Notes
|
153
|
+
-----
|
154
|
+
Ensures that non-boolean values for print_result raise OrionisIntegrityException.
|
111
155
|
"""
|
112
156
|
with self.assertRaises(OrionisIntegrityException):
|
113
157
|
Testing(print_result=1)
|
@@ -115,6 +159,10 @@ class TestTestingConfig(TestCase):
|
|
115
159
|
async def testInvalidThrowException(self):
|
116
160
|
"""
|
117
161
|
Test throw_exception must be boolean.
|
162
|
+
|
163
|
+
Notes
|
164
|
+
-----
|
165
|
+
Ensures that non-boolean values for throw_exception raise OrionisIntegrityException.
|
118
166
|
"""
|
119
167
|
with self.assertRaises(OrionisIntegrityException):
|
120
168
|
Testing(throw_exception="no")
|
@@ -122,6 +170,10 @@ class TestTestingConfig(TestCase):
|
|
122
170
|
async def testInvalidBasePath(self):
|
123
171
|
"""
|
124
172
|
Test base_path must be string.
|
173
|
+
|
174
|
+
Notes
|
175
|
+
-----
|
176
|
+
Ensures that non-string values for base_path raise OrionisIntegrityException.
|
125
177
|
"""
|
126
178
|
with self.assertRaises(OrionisIntegrityException):
|
127
179
|
Testing(base_path=123)
|
@@ -129,6 +181,10 @@ class TestTestingConfig(TestCase):
|
|
129
181
|
async def testInvalidFolderPath(self):
|
130
182
|
"""
|
131
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.
|
132
188
|
"""
|
133
189
|
with self.assertRaises(OrionisIntegrityException):
|
134
190
|
Testing(folder_path=123)
|
@@ -140,6 +196,10 @@ class TestTestingConfig(TestCase):
|
|
140
196
|
async def testInvalidPattern(self):
|
141
197
|
"""
|
142
198
|
Test pattern must be string.
|
199
|
+
|
200
|
+
Notes
|
201
|
+
-----
|
202
|
+
Ensures that non-string values for pattern raise OrionisIntegrityException.
|
143
203
|
"""
|
144
204
|
with self.assertRaises(OrionisIntegrityException):
|
145
205
|
Testing(pattern=[])
|
@@ -149,6 +209,10 @@ class TestTestingConfig(TestCase):
|
|
149
209
|
async def testInvalidTestNamePattern(self):
|
150
210
|
"""
|
151
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.
|
152
216
|
"""
|
153
217
|
with self.assertRaises(OrionisIntegrityException):
|
154
218
|
Testing(test_name_pattern=[])
|
@@ -158,6 +222,10 @@ class TestTestingConfig(TestCase):
|
|
158
222
|
async def testInvalidTags(self):
|
159
223
|
"""
|
160
224
|
Test tags must be None or list of strings.
|
225
|
+
|
226
|
+
Notes
|
227
|
+
-----
|
228
|
+
Ensures that invalid types for tags raise OrionisIntegrityException.
|
161
229
|
"""
|
162
230
|
with self.assertRaises(OrionisIntegrityException):
|
163
231
|
Testing(tags="fast")
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from orionis.patterns.singleton.meta_class import Singleton
|
2
|
+
from orionis.test.cases.test_case import TestCase
|
3
|
+
|
4
|
+
class TestPatternsSingleton(TestCase):
|
5
|
+
"""
|
6
|
+
Test cases for the Singleton metaclass.
|
7
|
+
|
8
|
+
This class contains asynchronous test methods to verify the correct behavior
|
9
|
+
of the Singleton metaclass, ensuring that only one instance of a class is created.
|
10
|
+
"""
|
11
|
+
|
12
|
+
async def testSingleton(self):
|
13
|
+
"""
|
14
|
+
Test the Singleton metaclass.
|
15
|
+
|
16
|
+
Ensures that only one instance of a class using the Singleton metaclass is created,
|
17
|
+
regardless of how many times the class is instantiated.
|
18
|
+
"""
|
19
|
+
class SingletonClass(metaclass=Singleton):
|
20
|
+
def __init__(self, value):
|
21
|
+
self.value = value
|
22
|
+
|
23
|
+
instance1 = SingletonClass(1)
|
24
|
+
instance2 = SingletonClass(2)
|
25
|
+
|
26
|
+
self.assertIs(instance1, instance2)
|
27
|
+
self.assertEqual(instance1.value, 1)
|
@@ -3,7 +3,7 @@ from orionis.services.asynchrony.coroutines import Coroutine
|
|
3
3
|
from orionis.services.asynchrony.exceptions.coroutine_exception import OrionisCoroutineException
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
|
-
class
|
6
|
+
class TestServicesAsynchronyCoroutine(TestCase):
|
7
7
|
|
8
8
|
async def testExecuteWithActiveEventLoop(self):
|
9
9
|
"""
|
@@ -0,0 +1,93 @@
|
|
1
|
+
from orionis.services.environment.env import Env
|
2
|
+
from orionis.unittesting import TestCase
|
3
|
+
|
4
|
+
class TestServicesEnvironment(TestCase):
|
5
|
+
|
6
|
+
async def testSetAndGetConstants(self):
|
7
|
+
"""
|
8
|
+
Test storing and retrieving framework metadata constants using Env.set and Env.get.
|
9
|
+
|
10
|
+
Imports several metadata constants from the `orionis.metadata.framework` module, sets each constant
|
11
|
+
in the Env storage using `Env.set`, and verifies that the operation succeeds. Then retrieves each
|
12
|
+
constant using `Env.get` and asserts that the retrieved value matches the original constant.
|
13
|
+
|
14
|
+
Ensures
|
15
|
+
-------
|
16
|
+
- `Env.set` returns True for each constant.
|
17
|
+
- `Env.get` returns the correct value for each constant.
|
18
|
+
"""
|
19
|
+
from orionis.metadata.framework import (
|
20
|
+
NAME, VERSION, AUTHOR, AUTHOR_EMAIL, DESCRIPTION,
|
21
|
+
SKELETON, FRAMEWORK, DOCS, API, PYTHON_REQUIRES
|
22
|
+
)
|
23
|
+
constants = {
|
24
|
+
"NAME": NAME,
|
25
|
+
"VERSION": VERSION,
|
26
|
+
"AUTHOR": AUTHOR,
|
27
|
+
"AUTHOR_EMAIL": AUTHOR_EMAIL,
|
28
|
+
"DESCRIPTION": DESCRIPTION,
|
29
|
+
"SKELETON": SKELETON,
|
30
|
+
"FRAMEWORK": FRAMEWORK,
|
31
|
+
"DOCS": DOCS,
|
32
|
+
"API": API,
|
33
|
+
"PYTHON_REQUIRES": PYTHON_REQUIRES
|
34
|
+
}
|
35
|
+
for key, value in constants.items():
|
36
|
+
result = Env.set(key, value)
|
37
|
+
self.assertTrue(result)
|
38
|
+
for key, value in constants.items():
|
39
|
+
retrieved = Env.get(key)
|
40
|
+
self.assertEqual(retrieved, value)
|
41
|
+
|
42
|
+
async def testGetNonExistentKey(self):
|
43
|
+
"""
|
44
|
+
Test that Env.get returns None for a non-existent environment key.
|
45
|
+
|
46
|
+
Ensures
|
47
|
+
-------
|
48
|
+
- `Env.get` returns None when the key does not exist.
|
49
|
+
"""
|
50
|
+
self.assertIsNone(Env.get("NON_EXISTENT_KEY"))
|
51
|
+
|
52
|
+
async def testTypeHints(self):
|
53
|
+
"""
|
54
|
+
Test that Env.set and Env.get correctly handle and preserve Python type hints.
|
55
|
+
|
56
|
+
Sets environment variables with various data types (int, float, bool, str, list, dict, tuple, set)
|
57
|
+
using the `Env.set` method, specifying the type as a string. Then retrieves each variable using
|
58
|
+
`Env.get` and asserts that the returned value is of the expected Python type.
|
59
|
+
|
60
|
+
Ensures
|
61
|
+
-------
|
62
|
+
- The returned value from `Env.get` matches the expected Python type for each variable.
|
63
|
+
"""
|
64
|
+
|
65
|
+
# Set environment variables with type hints
|
66
|
+
Env.set("TEST_INT", 42, 'int')
|
67
|
+
Env.set("TEST_FLOAT", 3.14, 'float')
|
68
|
+
Env.set("TEST_BOOL", True, 'bool')
|
69
|
+
Env.set("TEST_STR", "Hello, World!", 'str')
|
70
|
+
Env.set("TEST_LIST", [1, 2, 3], 'list')
|
71
|
+
Env.set("TEST_DICT", {"key": "value"}, 'dict')
|
72
|
+
Env.set("TEST_TUPLE", (1,2,3), 'tuple')
|
73
|
+
Env.set("TEST_SET", {1, 2, 3}, 'set')
|
74
|
+
|
75
|
+
# Retrieve and check types
|
76
|
+
self.assertIsInstance(Env.get("TEST_INT"), int)
|
77
|
+
self.assertIsInstance(Env.get("TEST_FLOAT"), float)
|
78
|
+
self.assertIsInstance(Env.get("TEST_BOOL"), bool)
|
79
|
+
self.assertIsInstance(Env.get("TEST_STR"), str)
|
80
|
+
self.assertIsInstance(Env.get("TEST_LIST"), list)
|
81
|
+
self.assertIsInstance(Env.get("TEST_DICT"), dict)
|
82
|
+
self.assertIsInstance(Env.get("TEST_TUPLE"), tuple)
|
83
|
+
self.assertIsInstance(Env.get("TEST_SET"), set)
|
84
|
+
|
85
|
+
# Clean up environment variables after test
|
86
|
+
Env.unset("TEST_INT")
|
87
|
+
Env.unset("TEST_FLOAT")
|
88
|
+
Env.unset("TEST_BOOL")
|
89
|
+
Env.unset("TEST_STR")
|
90
|
+
Env.unset("TEST_LIST")
|
91
|
+
Env.unset("TEST_DICT")
|
92
|
+
Env.unset("TEST_TUPLE")
|
93
|
+
Env.unset("TEST_SET")
|