Files
routeros-suricata-tzsp/tests/test_config.py
T
2026-08-15 23:43:58 +02:00

24 lines
934 B
Python

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()