feat(UI): fix lint issues

This commit is contained in:
Alejandro Roman committed 2026-09-01 13:15:33 +04:00
1 parent accc9e4c7c
commit e1bf6d775e
5 files changed
+29 -7

No files matched your search

@@ -14,6 +14,7 @@ from __future__ import annotations
import re
import unittest
from typing import Any, ClassVar
from jinja2 import Environment, StrictUndefined
@@ -131,7 +132,9 @@ class TestMsmtprcOnionProxy(unittest.TestCase):
Connection refused" and the hlth-msmtp unit takes the deploy down with it.
"""
ONION_EMAIL = dict(EMAIL, host="mail.abc123.onion", tls=False, port=25)
ONION_EMAIL: ClassVar[dict[str, Any]] = dict(
EMAIL, host="mail.abc123.onion", tls=False, port=25
)
def _proxy(self, rendered: str) -> dict[str, str]:
found = {}
@@ -23,10 +23,16 @@ from utils.cache.files import read_text
from . import PROJECT_ROOT
TEMPLATE = (
PROJECT_ROOT / "roles" / "web-app-stalwart" / "templates" / "roundcube-oauth.inc.php.j2"
PROJECT_ROOT
/ "roles"
/ "web-app-stalwart"
/ "templates"
/ "roundcube-oauth.inc.php.j2"
)
FORCE_HTTPS = "$_SERVER['HTTPS'] = 'on';"
ONION_BASE = "http://webmail.4dl6yijmuksgh5bfaf3csqoelji7zptyuo6wy5g5prjpnk6vdbzfwnad.onion"
ONION_BASE = (
"http://webmail.4dl6yijmuksgh5bfaf3csqoelji7zptyuo6wy5g5prjpnk6vdbzfwnad.onion"
)
CLEARNET_BASE = "https://webmail.infinito.example"
@@ -67,7 +73,9 @@ class TestRoundcubeOauthScheme(unittest.TestCase):
self.assertIn(FORCE_HTTPS, _render("https://webmail.example.onion"))
def test_an_onion_issuer_routes_the_back_channel_through_tor(self):
rendered = _render(ONION_BASE, socks_proxy="socks5h://host.docker.internal:9050")
rendered = _render(
ONION_BASE, socks_proxy="socks5h://host.docker.internal:9050"
)
self.assertIn(
"$config['http_client'] = ['proxy' => 'socks5h://host.docker.internal:9050'];",
rendered,
@@ -75,14 +83,18 @@ class TestRoundcubeOauthScheme(unittest.TestCase):
def test_the_proxy_must_hand_the_name_to_tor_to_resolve(self):
"""socks5:// resolves locally, which is what cURL refuses to do for .onion."""
rendered = _render(ONION_BASE, socks_proxy="socks5h://host.docker.internal:9050")
rendered = _render(
ONION_BASE, socks_proxy="socks5h://host.docker.internal:9050"
)
self.assertNotIn("'proxy' => 'socks5://", rendered)
def test_a_clearnet_issuer_gets_no_proxy_at_all(self):
self.assertNotIn("http_client", _render(CLEARNET_BASE))
def test_nothing_is_emitted_without_sso(self):
rendered = _render(CLEARNET_BASE, sso_enabled=False, socks_proxy="socks5h://tor:9050")
rendered = _render(
CLEARNET_BASE, sso_enabled=False, socks_proxy="socks5h://tor:9050"
)
self.assertNotIn(FORCE_HTTPS, rendered)
self.assertNotIn("oauth_client_id", rendered)
self.assertNotIn("http_client", rendered)