poc3
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from app.config import Config
|
||||
|
||||
|
||||
class ConfigTests(unittest.TestCase):
|
||||
def test_rule_update_interval_defaults_to_24_hours(self):
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
self.assertEqual(Config.from_env().rule_update_interval_hours, 24)
|
||||
|
||||
def test_rule_update_interval_can_be_changed_or_disabled(self):
|
||||
with patch.dict(os.environ, {"RULE_UPDATE_INTERVAL_HOURS": "6"}, clear=True):
|
||||
self.assertEqual(Config.from_env().rule_update_interval_hours, 6)
|
||||
with patch.dict(os.environ, {"RULE_UPDATE_INTERVAL_HOURS": "0"}, clear=True):
|
||||
self.assertEqual(Config.from_env().rule_update_interval_hours, 0)
|
||||
with patch.dict(os.environ, {"RULE_UPDATE_INTERVAL_HOURS": "-5"}, clear=True):
|
||||
self.assertEqual(Config.from_env().rule_update_interval_hours, 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user