orionis 0.285.0__py3-none-any.whl → 0.287.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/metadata/framework.py +1 -1
- orionis/services/asynchrony/contracts/__init__.py +0 -0
- orionis/services/asynchrony/contracts/coroutines.py +24 -0
- orionis/services/asynchrony/coroutines.py +58 -19
- orionis/services/asynchrony/exceptions/coroutine_exception.py +8 -15
- orionis/services/environment/contracts/env.py +45 -50
- orionis/services/environment/dot_env.py +205 -181
- orionis/services/environment/env.py +68 -85
- orionis/services/environment/exceptions/environment_value_error.py +18 -0
- orionis/services/environment/exceptions/environment_value_exception.py +23 -0
- orionis/services/environment/type_hint.py +559 -0
- orionis/test/exceptions/test_config_exception.py +8 -17
- orionis/test/exceptions/test_failure_exception.py +27 -27
- orionis/test/exceptions/test_persistence_error.py +10 -20
- orionis/test/exceptions/test_runtime_error.py +8 -15
- orionis/test/exceptions/test_value_error.py +8 -15
- orionis/test/logs/history.py +3 -5
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/RECORD +66 -62
- tests/example/test_example.py +5 -2
- tests/foundation/config/app/test_app.py +13 -3
- tests/foundation/config/auth/test_auth.py +9 -4
- tests/foundation/config/cache/test_cache.py +60 -15
- tests/foundation/config/cache/test_cache_file.py +62 -14
- tests/foundation/config/cache/test_cache_stores.py +74 -14
- tests/foundation/config/cors/test_cors.py +102 -33
- tests/foundation/config/database/test_database.py +38 -14
- tests/foundation/config/database/test_database_connections.py +79 -5
- tests/foundation/config/database/test_database_mysql.py +138 -15
- tests/foundation/config/database/test_database_oracle.py +110 -26
- tests/foundation/config/database/test_database_pgsql.py +96 -26
- tests/foundation/config/database/test_database_sqlite.py +56 -2
- tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
- tests/foundation/config/filesystems/test_filesystems.py +64 -14
- tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
- tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
- tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
- tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
- tests/foundation/config/logging/test_logging.py +75 -11
- tests/foundation/config/logging/test_logging_channels.py +79 -2
- tests/foundation/config/logging/test_logging_chunked.py +85 -12
- tests/foundation/config/logging/test_logging_daily.py +79 -12
- tests/foundation/config/logging/test_logging_hourly.py +68 -2
- tests/foundation/config/logging/test_logging_monthly.py +48 -2
- tests/foundation/config/logging/test_logging_stack.py +49 -14
- tests/foundation/config/logging/test_logging_weekly.py +92 -2
- tests/foundation/config/mail/test_mail.py +87 -15
- tests/foundation/config/mail/test_mail_file.py +40 -4
- tests/foundation/config/mail/test_mail_mailers.py +56 -8
- tests/foundation/config/mail/test_mail_smtp.py +58 -14
- tests/foundation/config/queue/test_queue.py +62 -9
- tests/foundation/config/queue/test_queue_brokers.py +27 -10
- tests/foundation/config/queue/test_queue_database.py +53 -15
- tests/foundation/config/root/test_root_paths.py +69 -2
- tests/foundation/config/session/test_session.py +30 -1
- tests/foundation/config/startup/test_config_startup.py +77 -7
- tests/foundation/config/testing/test_testing.py +68 -0
- tests/patterns/singleton/test_singleton.py +10 -1
- tests/services/asynchrony/test_async_io.py +4 -4
- tests/services/environment/test_env.py +3 -4
- tests/testing/test_testing_result.py +56 -19
- tests/testing/test_testing_unit.py +93 -24
- orionis/services/environment/exceptions/value_exception.py +0 -27
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -3,11 +3,23 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
3
3
|
from orionis.unittesting import TestCase
|
4
4
|
|
5
5
|
class TestSmtp(TestCase):
|
6
|
+
"""
|
7
|
+
Unit tests for the Smtp configuration entity.
|
8
|
+
|
9
|
+
This test suite validates the default initialization, type validation,
|
10
|
+
attribute-specific validation, custom initialization, dictionary conversion,
|
11
|
+
and keyword-only enforcement for the Smtp class.
|
12
|
+
"""
|
6
13
|
|
7
14
|
async def testDefaultInitialization(self):
|
8
15
|
"""
|
9
|
-
Test
|
10
|
-
|
16
|
+
Test default initialization of Smtp.
|
17
|
+
|
18
|
+
Ensures that an Smtp instance is initialized with the correct default values.
|
19
|
+
|
20
|
+
Returns
|
21
|
+
-------
|
22
|
+
None
|
11
23
|
"""
|
12
24
|
smtp = Smtp()
|
13
25
|
self.assertEqual(smtp.url, "smtp.mailtrap.io")
|
@@ -20,8 +32,14 @@ class TestSmtp(TestCase):
|
|
20
32
|
|
21
33
|
async def testTypeValidation(self):
|
22
34
|
"""
|
23
|
-
Test type validation for
|
24
|
-
|
35
|
+
Test type validation for Smtp attributes.
|
36
|
+
|
37
|
+
Ensures that providing invalid types for Smtp attributes raises
|
38
|
+
OrionisIntegrityException.
|
39
|
+
|
40
|
+
Returns
|
41
|
+
-------
|
42
|
+
None
|
25
43
|
"""
|
26
44
|
with self.assertRaises(OrionisIntegrityException):
|
27
45
|
Smtp(url=123)
|
@@ -40,16 +58,26 @@ class TestSmtp(TestCase):
|
|
40
58
|
|
41
59
|
async def testPortValidation(self):
|
42
60
|
"""
|
43
|
-
Test
|
44
|
-
|
61
|
+
Test validation for the port attribute.
|
62
|
+
|
63
|
+
Ensures that negative port numbers raise OrionisIntegrityException.
|
64
|
+
|
65
|
+
Returns
|
66
|
+
-------
|
67
|
+
None
|
45
68
|
"""
|
46
69
|
with self.assertRaises(OrionisIntegrityException):
|
47
70
|
Smtp(port=-1)
|
48
71
|
|
49
72
|
async def testTimeoutValidation(self):
|
50
73
|
"""
|
51
|
-
Test
|
52
|
-
|
74
|
+
Test validation for the timeout attribute.
|
75
|
+
|
76
|
+
Ensures that negative timeout values raise OrionisIntegrityException.
|
77
|
+
|
78
|
+
Returns
|
79
|
+
-------
|
80
|
+
None
|
53
81
|
"""
|
54
82
|
with self.assertRaises(OrionisIntegrityException):
|
55
83
|
Smtp(timeout=-1)
|
@@ -57,7 +85,12 @@ class TestSmtp(TestCase):
|
|
57
85
|
async def testValidCustomInitialization(self):
|
58
86
|
"""
|
59
87
|
Test custom initialization with valid parameters.
|
60
|
-
|
88
|
+
|
89
|
+
Ensures that valid custom values are accepted and stored correctly.
|
90
|
+
|
91
|
+
Returns
|
92
|
+
-------
|
93
|
+
None
|
61
94
|
"""
|
62
95
|
custom_config = Smtp(
|
63
96
|
url="smtp.example.com",
|
@@ -78,8 +111,14 @@ class TestSmtp(TestCase):
|
|
78
111
|
|
79
112
|
async def testToDictMethod(self):
|
80
113
|
"""
|
81
|
-
Test the toDict method
|
82
|
-
|
114
|
+
Test the toDict method of Smtp.
|
115
|
+
|
116
|
+
Ensures that the toDict method returns a dictionary containing all fields
|
117
|
+
with correct values.
|
118
|
+
|
119
|
+
Returns
|
120
|
+
-------
|
121
|
+
None
|
83
122
|
"""
|
84
123
|
smtp = Smtp()
|
85
124
|
result = smtp.toDict()
|
@@ -92,11 +131,16 @@ class TestSmtp(TestCase):
|
|
92
131
|
self.assertEqual(result["password"], "")
|
93
132
|
self.assertIsNone(result["timeout"])
|
94
133
|
|
95
|
-
|
96
134
|
async def testKwOnlyInitialization(self):
|
97
135
|
"""
|
98
|
-
Test
|
99
|
-
|
136
|
+
Test keyword-only initialization enforcement.
|
137
|
+
|
138
|
+
Ensures that Smtp requires keyword arguments for initialization and
|
139
|
+
enforces kw_only=True in its dataclass decorator.
|
140
|
+
|
141
|
+
Returns
|
142
|
+
-------
|
143
|
+
None
|
100
144
|
"""
|
101
145
|
with self.assertRaises(TypeError):
|
102
146
|
Smtp("smtp.mailtrap.io", "smtp.mailtrap.io", 587, "TLS", "", "", None)
|
@@ -4,11 +4,24 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
6
|
class TestQueue(TestCase):
|
7
|
+
"""
|
8
|
+
Test suite for the Queue class.
|
9
|
+
"""
|
7
10
|
|
8
11
|
async def testDefaultInitialization(self):
|
9
12
|
"""
|
10
|
-
Test
|
11
|
-
|
13
|
+
Test default initialization of Queue.
|
14
|
+
|
15
|
+
Ensures that a Queue instance is initialized with the correct default values.
|
16
|
+
|
17
|
+
Returns
|
18
|
+
-------
|
19
|
+
None
|
20
|
+
|
21
|
+
Raises
|
22
|
+
------
|
23
|
+
AssertionError
|
24
|
+
If the default value or brokers instance is incorrect.
|
12
25
|
"""
|
13
26
|
queue = Queue()
|
14
27
|
self.assertEqual(queue.default, "sync")
|
@@ -16,8 +29,18 @@ class TestQueue(TestCase):
|
|
16
29
|
|
17
30
|
async def testDefaultValidation(self):
|
18
31
|
"""
|
19
|
-
Test validation
|
20
|
-
|
32
|
+
Test validation of the `default` attribute.
|
33
|
+
|
34
|
+
Checks that invalid values for the `default` attribute raise an OrionisIntegrityException.
|
35
|
+
|
36
|
+
Returns
|
37
|
+
-------
|
38
|
+
None
|
39
|
+
|
40
|
+
Raises
|
41
|
+
------
|
42
|
+
OrionisIntegrityException
|
43
|
+
If an invalid default value is provided.
|
21
44
|
"""
|
22
45
|
invalid_options = ["invalid", "", 123, None]
|
23
46
|
for option in invalid_options:
|
@@ -26,8 +49,18 @@ class TestQueue(TestCase):
|
|
26
49
|
|
27
50
|
async def testBrokersValidation(self):
|
28
51
|
"""
|
29
|
-
Test validation
|
30
|
-
|
52
|
+
Test validation of the `brokers` attribute.
|
53
|
+
|
54
|
+
Ensures that non-Brokers values for the `brokers` attribute raise an OrionisIntegrityException.
|
55
|
+
|
56
|
+
Returns
|
57
|
+
-------
|
58
|
+
None
|
59
|
+
|
60
|
+
Raises
|
61
|
+
------
|
62
|
+
OrionisIntegrityException
|
63
|
+
If a non-Brokers value is provided for brokers.
|
31
64
|
"""
|
32
65
|
with self.assertRaises(OrionisIntegrityException):
|
33
66
|
Queue(brokers="invalid_brokers")
|
@@ -37,7 +70,17 @@ class TestQueue(TestCase):
|
|
37
70
|
async def testValidCustomInitialization(self):
|
38
71
|
"""
|
39
72
|
Test custom initialization with valid parameters.
|
40
|
-
|
73
|
+
|
74
|
+
Verifies that a Queue instance can be initialized with a valid default value and a Brokers instance.
|
75
|
+
|
76
|
+
Returns
|
77
|
+
-------
|
78
|
+
None
|
79
|
+
|
80
|
+
Raises
|
81
|
+
------
|
82
|
+
AssertionError
|
83
|
+
If the custom initialization does not set the attributes correctly.
|
41
84
|
"""
|
42
85
|
custom_brokers = Brokers(sync=False)
|
43
86
|
queue = Queue(default="sync", brokers=custom_brokers)
|
@@ -47,8 +90,18 @@ class TestQueue(TestCase):
|
|
47
90
|
|
48
91
|
async def testToDictMethod(self):
|
49
92
|
"""
|
50
|
-
Test the toDict method
|
51
|
-
|
93
|
+
Test the `toDict` method.
|
94
|
+
|
95
|
+
Ensures that the `toDict` method returns a dictionary representation of the Queue instance with all fields and correct values.
|
96
|
+
|
97
|
+
Returns
|
98
|
+
-------
|
99
|
+
None
|
100
|
+
|
101
|
+
Raises
|
102
|
+
------
|
103
|
+
AssertionError
|
104
|
+
If the dictionary representation is incorrect.
|
52
105
|
"""
|
53
106
|
queue = Queue()
|
54
107
|
result = queue.toDict()
|
@@ -4,11 +4,13 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
6
|
class TestBrokers(TestCase):
|
7
|
-
|
8
7
|
async def testDefaultInitialization(self):
|
9
8
|
"""
|
10
9
|
Test that Brokers instance is initialized with correct default values.
|
11
|
-
|
10
|
+
|
11
|
+
Notes
|
12
|
+
-----
|
13
|
+
Verifies that `sync` is `True` by default and `database` is a `Database` instance.
|
12
14
|
"""
|
13
15
|
brokers = Brokers()
|
14
16
|
self.assertTrue(brokers.sync)
|
@@ -16,8 +18,11 @@ class TestBrokers(TestCase):
|
|
16
18
|
|
17
19
|
async def testSyncValidation(self):
|
18
20
|
"""
|
19
|
-
Test validation for sync attribute.
|
20
|
-
|
21
|
+
Test validation for the `sync` attribute.
|
22
|
+
|
23
|
+
Notes
|
24
|
+
-----
|
25
|
+
Verifies that non-boolean values for `sync` raise `OrionisIntegrityException`.
|
21
26
|
"""
|
22
27
|
with self.assertRaises(OrionisIntegrityException):
|
23
28
|
Brokers(sync="true")
|
@@ -26,8 +31,11 @@ class TestBrokers(TestCase):
|
|
26
31
|
|
27
32
|
async def testDatabaseValidation(self):
|
28
33
|
"""
|
29
|
-
Test validation for database attribute.
|
30
|
-
|
34
|
+
Test validation for the `database` attribute.
|
35
|
+
|
36
|
+
Notes
|
37
|
+
-----
|
38
|
+
Verifies that non-`Database` values for `database` raise `OrionisIntegrityException`.
|
31
39
|
"""
|
32
40
|
with self.assertRaises(OrionisIntegrityException):
|
33
41
|
Brokers(database="invalid_database")
|
@@ -37,7 +45,10 @@ class TestBrokers(TestCase):
|
|
37
45
|
async def testCustomInitialization(self):
|
38
46
|
"""
|
39
47
|
Test custom initialization with valid parameters.
|
40
|
-
|
48
|
+
|
49
|
+
Notes
|
50
|
+
-----
|
51
|
+
Verifies that valid boolean and `Database` instances are accepted for initialization.
|
41
52
|
"""
|
42
53
|
custom_db = Database(table="custom_queue")
|
43
54
|
brokers = Brokers(sync=False, database=custom_db)
|
@@ -47,8 +58,11 @@ class TestBrokers(TestCase):
|
|
47
58
|
|
48
59
|
async def testToDictMethod(self):
|
49
60
|
"""
|
50
|
-
Test the toDict method returns proper dictionary representation.
|
51
|
-
|
61
|
+
Test the `toDict` method returns proper dictionary representation.
|
62
|
+
|
63
|
+
Notes
|
64
|
+
-----
|
65
|
+
Verifies all fields are included with correct values in the returned dictionary.
|
52
66
|
"""
|
53
67
|
brokers = Brokers()
|
54
68
|
result = brokers.toDict()
|
@@ -61,7 +75,10 @@ class TestBrokers(TestCase):
|
|
61
75
|
async def testKwOnlyInitialization(self):
|
62
76
|
"""
|
63
77
|
Test that Brokers requires keyword arguments for initialization.
|
64
|
-
|
78
|
+
|
79
|
+
Notes
|
80
|
+
-----
|
81
|
+
Verifies the class enforces `kw_only=True` in its dataclass decorator.
|
65
82
|
"""
|
66
83
|
with self.assertRaises(TypeError):
|
67
84
|
Brokers(True, Database())
|
@@ -4,11 +4,16 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
6
|
class TestDatabaseQueue(TestCase):
|
7
|
-
|
8
7
|
async def testDefaultInitialization(self):
|
9
8
|
"""
|
10
|
-
Test
|
11
|
-
|
9
|
+
Test default initialization of Database.
|
10
|
+
|
11
|
+
Ensures that a Database instance is initialized with the correct default values for
|
12
|
+
table name, queue name, retry_after, and strategy.
|
13
|
+
|
14
|
+
Returns
|
15
|
+
-------
|
16
|
+
None
|
12
17
|
"""
|
13
18
|
db_queue = Database()
|
14
19
|
self.assertEqual(db_queue.table, "jobs")
|
@@ -18,8 +23,13 @@ class TestDatabaseQueue(TestCase):
|
|
18
23
|
|
19
24
|
async def testTableNameValidation(self):
|
20
25
|
"""
|
21
|
-
Test validation
|
22
|
-
|
26
|
+
Test validation of the table name attribute.
|
27
|
+
|
28
|
+
Checks that invalid table names raise an OrionisIntegrityException.
|
29
|
+
|
30
|
+
Returns
|
31
|
+
-------
|
32
|
+
None
|
23
33
|
"""
|
24
34
|
with self.assertRaises(OrionisIntegrityException):
|
25
35
|
Database(table="1jobs") # Starts with number
|
@@ -32,8 +42,13 @@ class TestDatabaseQueue(TestCase):
|
|
32
42
|
|
33
43
|
async def testQueueNameValidation(self):
|
34
44
|
"""
|
35
|
-
Test validation
|
36
|
-
|
45
|
+
Test validation of the queue name attribute.
|
46
|
+
|
47
|
+
Checks that non-ASCII queue names and non-string values raise an OrionisIntegrityException.
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
None
|
37
52
|
"""
|
38
53
|
with self.assertRaises(OrionisIntegrityException):
|
39
54
|
Database(queue="café") # Non-ASCII character
|
@@ -42,8 +57,13 @@ class TestDatabaseQueue(TestCase):
|
|
42
57
|
|
43
58
|
async def testRetryAfterValidation(self):
|
44
59
|
"""
|
45
|
-
Test validation
|
46
|
-
|
60
|
+
Test validation of the retry_after attribute.
|
61
|
+
|
62
|
+
Ensures that non-positive integers and non-integer values raise an OrionisIntegrityException.
|
63
|
+
|
64
|
+
Returns
|
65
|
+
-------
|
66
|
+
None
|
47
67
|
"""
|
48
68
|
with self.assertRaises(OrionisIntegrityException):
|
49
69
|
Database(retry_after=0)
|
@@ -54,8 +74,14 @@ class TestDatabaseQueue(TestCase):
|
|
54
74
|
|
55
75
|
async def testStrategyValidation(self):
|
56
76
|
"""
|
57
|
-
Test validation and normalization
|
58
|
-
|
77
|
+
Test validation and normalization of the strategy attribute.
|
78
|
+
|
79
|
+
Verifies that both string and Strategy enum inputs are handled properly, and that
|
80
|
+
invalid inputs raise an OrionisIntegrityException.
|
81
|
+
|
82
|
+
Returns
|
83
|
+
-------
|
84
|
+
None
|
59
85
|
"""
|
60
86
|
# Test string inputs (case-insensitive)
|
61
87
|
db1 = Database(strategy="fifo")
|
@@ -75,8 +101,14 @@ class TestDatabaseQueue(TestCase):
|
|
75
101
|
|
76
102
|
async def testToDictMethod(self):
|
77
103
|
"""
|
78
|
-
Test the toDict method
|
79
|
-
|
104
|
+
Test the toDict method.
|
105
|
+
|
106
|
+
Ensures that the toDict method returns a dictionary representation of the Database
|
107
|
+
instance with all fields included and correct values.
|
108
|
+
|
109
|
+
Returns
|
110
|
+
-------
|
111
|
+
None
|
80
112
|
"""
|
81
113
|
db_queue = Database()
|
82
114
|
result = db_queue.toDict()
|
@@ -88,8 +120,14 @@ class TestDatabaseQueue(TestCase):
|
|
88
120
|
|
89
121
|
async def testKwOnlyInitialization(self):
|
90
122
|
"""
|
91
|
-
Test
|
92
|
-
|
123
|
+
Test keyword-only initialization enforcement.
|
124
|
+
|
125
|
+
Ensures that the Database class requires keyword arguments for initialization,
|
126
|
+
enforcing kw_only=True in its dataclass decorator.
|
127
|
+
|
128
|
+
Returns
|
129
|
+
-------
|
130
|
+
None
|
93
131
|
"""
|
94
132
|
with self.assertRaises(TypeError):
|
95
133
|
Database("jobs", "default", 90, Strategy.FIFO)
|
@@ -6,14 +6,41 @@ from orionis.unittesting import TestCase
|
|
6
6
|
class TestPaths(TestCase):
|
7
7
|
"""
|
8
8
|
Test suite for the Paths dataclass which defines the project directory structure.
|
9
|
-
|
9
|
+
|
10
|
+
This class verifies the integrity of path definitions, default values,
|
10
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.
|
11
37
|
"""
|
12
38
|
|
13
39
|
def testDefaultPathsInstantiation(self):
|
14
40
|
"""
|
15
41
|
Test that a Paths instance can be created with default values.
|
16
|
-
|
42
|
+
|
43
|
+
Ensures that all default paths are correctly initialized and
|
17
44
|
the instance is properly constructed.
|
18
45
|
"""
|
19
46
|
paths = Paths()
|
@@ -22,6 +49,7 @@ class TestPaths(TestCase):
|
|
22
49
|
def testRequiredPathsAreSet(self):
|
23
50
|
"""
|
24
51
|
Test that all required paths have non-empty default values.
|
52
|
+
|
25
53
|
Checks that paths marked as required in metadata are properly
|
26
54
|
initialized with valid string values.
|
27
55
|
"""
|
@@ -39,8 +67,14 @@ class TestPaths(TestCase):
|
|
39
67
|
def testOptionalPathsCanBeEmpty(self):
|
40
68
|
"""
|
41
69
|
Test that optional paths can be empty strings.
|
70
|
+
|
42
71
|
Verifies that paths not marked as required can be empty strings
|
43
72
|
without raising exceptions.
|
73
|
+
|
74
|
+
Raises
|
75
|
+
------
|
76
|
+
OrionisIntegrityException
|
77
|
+
If required validation fails.
|
44
78
|
"""
|
45
79
|
with self.assertRaises(OrionisIntegrityException):
|
46
80
|
Paths(
|
@@ -66,8 +100,14 @@ class TestPaths(TestCase):
|
|
66
100
|
def testPathValidationRejectsNonStringValues(self):
|
67
101
|
"""
|
68
102
|
Test that non-string path values raise OrionisIntegrityException.
|
103
|
+
|
69
104
|
Verifies that the __post_init__ validation rejects non-string values
|
70
105
|
for all path fields.
|
106
|
+
|
107
|
+
Raises
|
108
|
+
------
|
109
|
+
OrionisIntegrityException
|
110
|
+
If a non-string value is provided.
|
71
111
|
"""
|
72
112
|
with self.assertRaises(OrionisIntegrityException):
|
73
113
|
Paths(console_scheduler=123)
|
@@ -75,7 +115,13 @@ class TestPaths(TestCase):
|
|
75
115
|
def testPathValidationRejectsEmptyRequiredPaths(self):
|
76
116
|
"""
|
77
117
|
Test that empty required paths raise OrionisIntegrityException.
|
118
|
+
|
78
119
|
Verifies that required paths cannot be empty strings.
|
120
|
+
|
121
|
+
Raises
|
122
|
+
------
|
123
|
+
OrionisIntegrityException
|
124
|
+
If a required path is empty.
|
79
125
|
"""
|
80
126
|
with self.assertRaises(OrionisIntegrityException):
|
81
127
|
Paths(console_scheduler='')
|
@@ -83,8 +129,13 @@ class TestPaths(TestCase):
|
|
83
129
|
def testToDictReturnsCompleteDictionary(self):
|
84
130
|
"""
|
85
131
|
Test that toDict() returns a complete dictionary of all paths.
|
132
|
+
|
86
133
|
Verifies that the returned dictionary contains all path fields
|
87
134
|
with their current values.
|
135
|
+
|
136
|
+
Returns
|
137
|
+
-------
|
138
|
+
None
|
88
139
|
"""
|
89
140
|
paths = Paths()
|
90
141
|
path_dict = paths.toDict()
|
@@ -96,7 +147,12 @@ class TestPaths(TestCase):
|
|
96
147
|
def testPathAccessorMethodsReturnPathObjects(self):
|
97
148
|
"""
|
98
149
|
Test that all path accessor methods return Path objects.
|
150
|
+
|
99
151
|
Verifies that each get* method returns a proper pathlib.Path instance.
|
152
|
+
|
153
|
+
Returns
|
154
|
+
-------
|
155
|
+
None
|
100
156
|
"""
|
101
157
|
paths = Paths()
|
102
158
|
self.assertIsInstance(paths.getConsoleScheduler(), Path)
|
@@ -111,8 +167,14 @@ class TestPaths(TestCase):
|
|
111
167
|
def testFrozenDataclassBehavior(self):
|
112
168
|
"""
|
113
169
|
Test that the dataclass is truly frozen (immutable).
|
170
|
+
|
114
171
|
Verifies that attempts to modify attributes after creation
|
115
172
|
raise exceptions.
|
173
|
+
|
174
|
+
Raises
|
175
|
+
------
|
176
|
+
Exception
|
177
|
+
If an attempt is made to modify a frozen dataclass.
|
116
178
|
"""
|
117
179
|
paths = Paths()
|
118
180
|
with self.assertRaises(Exception):
|
@@ -121,8 +183,13 @@ class TestPaths(TestCase):
|
|
121
183
|
def testPathMetadataIsAccessible(self):
|
122
184
|
"""
|
123
185
|
Test that path metadata is properly defined and accessible.
|
186
|
+
|
124
187
|
Verifies that each path field has the expected metadata structure
|
125
188
|
with description, type, and required fields.
|
189
|
+
|
190
|
+
Returns
|
191
|
+
-------
|
192
|
+
None
|
126
193
|
"""
|
127
194
|
paths = Paths()
|
128
195
|
for field in paths.__dataclass_fields__.values():
|
@@ -4,10 +4,12 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
|
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
6
|
class TestSession(TestCase):
|
7
|
-
|
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):
|