Initial Awawawa

This commit is contained in:
mueller_minki
2026-10-04 09:08:27 +02:00
commit 8e83a98ef4
76 changed files with 8225 additions and 0 deletions

27
web/tests/test_conf.py Normal file
View File

@@ -0,0 +1,27 @@
import os
import tempfile
import unittest
from patchbay_web.conf import Config
class ConfTest(unittest.TestCase):
def test_update_preserves_layout(self):
with tempfile.TemporaryDirectory() as d:
p = os.path.join(d, "patchbay.conf")
with open(p, "w") as f:
f.write("# head\nRole = target\nmailhost = old\nMailHost = dup\n")
os.chmod(p, 0o600)
c = Config(p)
self.assertEqual(c.get("MailHost"), "dup")
c.update({"MailHost": "smtp.example.org", "MailPort": 465})
with open(p) as f:
text = f.read()
self.assertEqual(text, "# head\nRole = target\nmailhost = smtp.example.org\nMailPort = 465\n")
self.assertEqual(os.stat(p).st_mode & 0o777, 0o600)
with self.assertRaises(ValueError):
c.update({"MailHost": "a\nRole = client"})
if __name__ == "__main__":
unittest.main()