orionis 0.286.0__py3-none-any.whl → 0.288.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/environment/contracts/env.py +45 -50
  3. orionis/services/environment/contracts/types.py +70 -0
  4. orionis/services/environment/dot_env.py +204 -182
  5. orionis/services/environment/env.py +68 -85
  6. orionis/services/{standard/exceptions/path_value_exceptions.py → environment/exceptions/environment_value_error.py} +2 -12
  7. orionis/services/environment/exceptions/environment_value_exception.py +23 -0
  8. orionis/services/environment/types.py +578 -0
  9. orionis/services/paths/exceptions/not_found_exceptions.py +15 -12
  10. orionis/services/paths/exceptions/path_value_exceptions.py +13 -10
  11. orionis/services/standard/contracts/std.py +1 -1
  12. orionis/services/standard/exceptions/std_value_exception.py +23 -0
  13. orionis/services/standard/std.py +2 -2
  14. orionis/services/system/contracts/imports.py +27 -7
  15. orionis/services/system/contracts/workers.py +8 -3
  16. orionis/services/system/imports.py +31 -12
  17. orionis/services/system/runtime_imports.py +33 -23
  18. orionis/services/system/workers.py +6 -8
  19. orionis/services/wrapper/dicts/dot_dict.py +82 -41
  20. orionis/test/logs/history.py +3 -5
  21. orionis/unittesting.py +12 -12
  22. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/METADATA +1 -1
  23. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/RECORD +76 -70
  24. tests/example/test_example.py +5 -2
  25. tests/foundation/config/app/{test_app.py → test_foundation_config_app.py} +14 -4
  26. tests/foundation/config/auth/{test_auth.py → test_foundation_config_auth.py} +10 -5
  27. tests/foundation/config/cache/{test_cache.py → test_foundation_config_cache.py} +61 -16
  28. tests/foundation/config/cache/test_foundation_config_cache_file.py +126 -0
  29. tests/foundation/config/cache/test_foundation_config_cache_stores.py +148 -0
  30. tests/foundation/config/cors/test_foundation_config_cors.py +190 -0
  31. tests/foundation/config/database/{test_database.py → test_foundation_config_database.py} +39 -15
  32. tests/foundation/config/database/{test_database_connections.py → test_foundation_config_database_connections.py} +80 -6
  33. tests/foundation/config/database/{test_database_mysql.py → test_foundation_config_database_mysql.py} +139 -16
  34. tests/foundation/config/database/{test_database_oracle.py → test_foundation_config_database_oracle.py} +111 -27
  35. tests/foundation/config/database/{test_database_pgsql.py → test_foundation_config_database_pgsql.py} +97 -27
  36. tests/foundation/config/database/{test_database_sqlite.py → test_foundation_config_database_sqlite.py} +57 -3
  37. tests/foundation/config/exceptions/{test_exceptions_integrity.py → test_foundation_config_exceptions.py} +45 -11
  38. tests/foundation/config/filesystems/{test_filesystems.py → test_foundation_config_filesystems.py} +65 -15
  39. tests/foundation/config/filesystems/{test_filesystems_aws.py → test_foundation_config_filesystems_aws.py} +46 -8
  40. tests/foundation/config/filesystems/{test_filesystems_disks.py → test_foundation_config_filesystems_disks.py} +79 -9
  41. tests/foundation/config/filesystems/{test_filesystems_local.py → test_foundation_config_filesystems_local.py} +67 -19
  42. tests/foundation/config/filesystems/{test_filesystems_public.py → test_foundation_config_filesystems_public.py} +38 -1
  43. tests/foundation/config/logging/test_foundation_config_logging.py +112 -0
  44. tests/foundation/config/logging/{test_logging_channels.py → test_foundation_config_logging_channels.py} +80 -3
  45. tests/foundation/config/logging/{test_logging_chunked.py → test_foundation_config_logging_chunked.py} +86 -13
  46. tests/foundation/config/logging/{test_logging_daily.py → test_foundation_config_logging_daily.py} +80 -13
  47. tests/foundation/config/logging/{test_logging_hourly.py → test_foundation_config_logging_hourly.py} +69 -3
  48. tests/foundation/config/logging/{test_logging_monthly.py → test_foundation_config_logging_monthly.py} +49 -3
  49. tests/foundation/config/logging/{test_logging_stack.py → test_foundation_config_logging_stack.py} +50 -15
  50. tests/foundation/config/logging/{test_logging_weekly.py → test_foundation_config_logging_weekly.py} +93 -3
  51. tests/foundation/config/mail/test_foundation_config_mail.py +145 -0
  52. tests/foundation/config/mail/{test_mail_file.py → test_foundation_config_mail_file.py} +41 -5
  53. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +106 -0
  54. tests/foundation/config/mail/{test_mail_smtp.py → test_foundation_config_mail_smtp.py} +59 -15
  55. tests/foundation/config/queue/test_foundation_config_queue.py +111 -0
  56. tests/foundation/config/queue/{test_queue_brokers.py → test_foundation_config_queue_brokers.py} +28 -11
  57. tests/foundation/config/queue/{test_queue_database.py → test_foundation_config_queue_database.py} +54 -16
  58. tests/foundation/config/root/{test_root_paths.py → test_foundation_config_root_paths.py} +70 -3
  59. tests/foundation/config/session/{test_session.py → test_foundation_config_session.py} +31 -2
  60. tests/foundation/config/startup/{test_config_startup.py → test_foundation_config_startup.py} +91 -21
  61. tests/foundation/config/testing/{test_testing.py → test_foundation_config_testing.py} +69 -1
  62. tests/patterns/singleton/test_patterns_singleton.py +27 -0
  63. tests/services/asynchrony/{test_async_io.py → test_services_asynchrony_coroutine.py} +1 -1
  64. tests/services/environment/test_services_environment.py +93 -0
  65. tests/services/path/{test_resolver.py → test_services_resolver.py} +51 -12
  66. tests/services/standard/{test_std.py → test_services_std.py} +45 -22
  67. tests/services/system/__init__.py +0 -0
  68. tests/services/system/test_services_system_imports.py +101 -0
  69. tests/services/system/test_services_system_workers.py +89 -0
  70. tests/services/wrapper/{test_wrapper_doc_dict.py → test_services_wrapper_docdict.py} +28 -16
  71. tests/testing/test_testing_result.py +57 -20
  72. tests/testing/test_testing_unit.py +110 -41
  73. orionis/services/environment/exceptions/value_exception.py +0 -27
  74. tests/foundation/config/cache/test_cache_file.py +0 -78
  75. tests/foundation/config/cache/test_cache_stores.py +0 -88
  76. tests/foundation/config/cors/test_cors.py +0 -121
  77. tests/foundation/config/logging/test_logging.py +0 -48
  78. tests/foundation/config/mail/test_mail.py +0 -73
  79. tests/foundation/config/mail/test_mail_mailers.py +0 -58
  80. tests/foundation/config/queue/test_queue.py +0 -58
  81. tests/patterns/singleton/test_singleton.py +0 -18
  82. tests/services/environment/test_env.py +0 -155
  83. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/WHEEL +0 -0
  84. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/licenses/LICENCE +0 -0
  85. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/top_level.txt +0 -0
  86. {orionis-0.286.0.dist-info → orionis-0.288.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,106 @@
1
+ from orionis.foundation.config.mail.entities.mailers import Mailers
2
+ from orionis.foundation.config.mail.entities.smtp import Smtp
3
+ from orionis.foundation.config.mail.entities.file import File
4
+ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
5
+ from orionis.unittesting import TestCase
6
+
7
+ class TestFoundationConfigMailMailers(TestCase):
8
+ """
9
+ Unit tests for the Mailers class.
10
+
11
+ This test suite verifies the correct initialization, type validation,
12
+ custom initialization, dictionary conversion, and keyword-only enforcement
13
+ of the Mailers class.
14
+ """
15
+
16
+ async def testDefaultInitialization(self):
17
+ """
18
+ Test default initialization of Mailers.
19
+
20
+ Ensures that a Mailers instance is initialized with default factories
21
+ and that the `smtp` and `file` attributes are instances of their
22
+ respective types.
23
+
24
+ Returns
25
+ -------
26
+ None
27
+ """
28
+ mailers = Mailers()
29
+ self.assertIsInstance(mailers.smtp, Smtp)
30
+ self.assertIsInstance(mailers.file, File)
31
+
32
+ async def testTypeValidation(self):
33
+ """
34
+ Test type validation for smtp and file attributes.
35
+
36
+ Ensures that providing invalid types for `smtp` or `file` raises
37
+ an OrionisIntegrityException.
38
+
39
+ Returns
40
+ -------
41
+ None
42
+
43
+ Raises
44
+ ------
45
+ OrionisIntegrityException
46
+ If an invalid type is provided for `smtp` or `file`.
47
+ """
48
+ with self.assertRaises(OrionisIntegrityException):
49
+ Mailers(smtp="invalid_smtp")
50
+ with self.assertRaises(OrionisIntegrityException):
51
+ Mailers(file="invalid_file")
52
+
53
+ async def testCustomInitialization(self):
54
+ """
55
+ Test custom initialization with valid parameters.
56
+
57
+ Ensures that valid Smtp and File instances can be provided to the
58
+ Mailers constructor and are correctly assigned.
59
+
60
+ Returns
61
+ -------
62
+ None
63
+ """
64
+ custom_smtp = Smtp()
65
+ custom_file = File()
66
+ mailers = Mailers(smtp=custom_smtp, file=custom_file)
67
+ self.assertIs(mailers.smtp, custom_smtp)
68
+ self.assertIs(mailers.file, custom_file)
69
+
70
+ async def testToDictMethod(self):
71
+ """
72
+ Test the toDict method of Mailers.
73
+
74
+ Ensures that the `toDict` method returns a dictionary representation
75
+ containing all fields with correct values and types.
76
+
77
+ Returns
78
+ -------
79
+ None
80
+ """
81
+ mailers = Mailers()
82
+ result = mailers.toDict()
83
+ self.assertIsInstance(result, dict)
84
+ self.assertIn("smtp", result)
85
+ self.assertIn("file", result)
86
+ self.assertIsInstance(result["smtp"], dict)
87
+ self.assertIsInstance(result["file"], dict)
88
+
89
+ async def testKwOnlyInitialization(self):
90
+ """
91
+ Test keyword-only initialization enforcement.
92
+
93
+ Ensures that the Mailers class enforces keyword-only arguments
94
+ during initialization (i.e., `kw_only=True` in its dataclass decorator).
95
+
96
+ Returns
97
+ -------
98
+ None
99
+
100
+ Raises
101
+ ------
102
+ TypeError
103
+ If positional arguments are provided to the constructor.
104
+ """
105
+ with self.assertRaises(TypeError):
106
+ Mailers(Smtp(), File())
@@ -2,12 +2,24 @@ from orionis.foundation.config.mail.entities.smtp import Smtp
2
2
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
3
3
  from orionis.unittesting import TestCase
4
4
 
5
- class TestSmtp(TestCase):
5
+ class TestFoundationConfigMailSmtp(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 that Smtp instance is initialized with correct default values.
10
- Verifies all default values match the expected configuration.
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 all Smtp attributes.
24
- Verifies that invalid types raise OrionisIntegrityException.
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 specific validation for port attribute.
44
- Verifies that negative port numbers raise OrionisIntegrityException.
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 specific validation for timeout attribute.
52
- Verifies that negative timeout values raise OrionisIntegrityException.
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
- Verifies that valid custom values are accepted and stored correctly.
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 returns proper dictionary representation.
82
- Verifies the method returns a dict containing all fields with correct values.
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 that Smtp requires keyword arguments for initialization.
99
- Verifies the class enforces kw_only=True in its dataclass decorator.
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)
@@ -0,0 +1,111 @@
1
+ from orionis.foundation.config.queue.entities.queue import Queue
2
+ from orionis.foundation.config.queue.entities.brokers import Brokers
3
+ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
+ from orionis.unittesting import TestCase
5
+
6
+ class TestFoundationConfigQueue(TestCase):
7
+ """
8
+ Test suite for the Queue class.
9
+ """
10
+
11
+ async def testDefaultInitialization(self):
12
+ """
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.
25
+ """
26
+ queue = Queue()
27
+ self.assertEqual(queue.default, "sync")
28
+ self.assertIsInstance(queue.brokers, Brokers)
29
+
30
+ async def testDefaultValidation(self):
31
+ """
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.
44
+ """
45
+ invalid_options = ["invalid", "", 123, None]
46
+ for option in invalid_options:
47
+ with self.assertRaises(OrionisIntegrityException):
48
+ Queue(default=option)
49
+
50
+ async def testBrokersValidation(self):
51
+ """
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.
64
+ """
65
+ with self.assertRaises(OrionisIntegrityException):
66
+ Queue(brokers="invalid_brokers")
67
+ with self.assertRaises(OrionisIntegrityException):
68
+ Queue(brokers={})
69
+
70
+ async def testValidCustomInitialization(self):
71
+ """
72
+ Test custom initialization with valid parameters.
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.
84
+ """
85
+ custom_brokers = Brokers(sync=False)
86
+ queue = Queue(default="sync", brokers=custom_brokers)
87
+ self.assertEqual(queue.default, "sync")
88
+ self.assertIs(queue.brokers, custom_brokers)
89
+ self.assertFalse(queue.brokers.sync)
90
+
91
+ async def testToDictMethod(self):
92
+ """
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.
105
+ """
106
+ queue = Queue()
107
+ result = queue.toDict()
108
+ self.assertIsInstance(result, dict)
109
+ self.assertEqual(result["default"], "sync")
110
+ self.assertIsInstance(result["brokers"], dict)
111
+ self.assertTrue(result["brokers"]["sync"])
@@ -3,12 +3,14 @@ from orionis.foundation.config.queue.entities.database import Database
3
3
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestBrokers(TestCase):
7
-
6
+ class TestFoundationConfigQueueBrokers(TestCase):
8
7
  async def testDefaultInitialization(self):
9
8
  """
10
9
  Test that Brokers instance is initialized with correct default values.
11
- Verifies that sync is True by default and database is a Database instance.
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
- Verifies that non-boolean values raise OrionisIntegrityException.
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
- Verifies that non-Database values raise OrionisIntegrityException.
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
- Verifies that valid boolean and Database instances are accepted.
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
- Verifies all fields are included with correct values.
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
- Verifies the class enforces kw_only=True in its dataclass decorator.
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())
@@ -3,12 +3,17 @@ from orionis.foundation.config.queue.enums.strategy import Strategy
3
3
  from orionis.foundation.config.exceptions.integrity import OrionisIntegrityException
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestDatabaseQueue(TestCase):
7
-
6
+ class TestFoundationConfigQueueDatabase(TestCase):
8
7
  async def testDefaultInitialization(self):
9
8
  """
10
- Test that Database instance is initialized with correct default values.
11
- Verifies that default table name, queue name, retry_after, and strategy are set properly.
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 for table name attribute.
22
- Verifies that invalid table names raise OrionisIntegrityException.
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 for queue name attribute.
36
- Verifies that non-ASCII queue names raise OrionisIntegrityException.
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 for retry_after attribute.
46
- Verifies that non-positive integers raise OrionisIntegrityException.
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 for strategy attribute.
58
- Verifies both string and Strategy enum inputs are properly handled.
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 returns proper dictionary representation.
79
- Verifies all fields are included with correct values.
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 that Database requires keyword arguments for initialization.
92
- Verifies the class enforces kw_only=True in its dataclass decorator.
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)
@@ -3,17 +3,44 @@ from orionis.foundation.config.exceptions.integrity import OrionisIntegrityExcep
3
3
  from orionis.foundation.config.roots.paths import Paths
4
4
  from orionis.unittesting import TestCase
5
5
 
6
- class TestPaths(TestCase):
6
+ class TestFoundationConfigRootPaths(TestCase):
7
7
  """
8
8
  Test suite for the Paths dataclass which defines the project directory structure.
9
- This test class verifies the integrity of path definitions, default values,
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
- Verifies that all default paths are correctly initialized and
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():