mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-29 18:16:43 +00:00
fix: localize batched app update notifications
This commit is contained in:
@@ -135,6 +135,31 @@ class AppUpdateNotificationBatchTests(unittest.TestCase):
|
||||
self.assertIn("• Docmost: 0.2 → 0.9", rendered["body"])
|
||||
self.assertIn("• Redis: 7.0 → 8.1", rendered["body"])
|
||||
|
||||
def test_batch_formatter_uses_slovak_runtime_messages(self):
|
||||
data = {
|
||||
"hostname": "HomeLAB_2",
|
||||
"updates": [
|
||||
{"vmid": 115, "app_name": "Redis", "installed": "7.0", "latest": "8.1"},
|
||||
{"vmid": 100, "app_name": "AdGuard Home", "installed": "1.0", "latest": "1.1"},
|
||||
{"vmid": 115, "app_name": "Docmost", "installed": "0.2", "latest": "0.9"},
|
||||
],
|
||||
}
|
||||
|
||||
rendered = notification_templates.render_template(
|
||||
"app_update_available", data, language="sk",
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
rendered["title"],
|
||||
"HomeLAB_2: Dostupné aktualizácie aplikácií: 3",
|
||||
)
|
||||
self.assertIn(
|
||||
"Aplikácie s dostupnou novšou verziou: 3 v 2 kontajneroch LXC:",
|
||||
rendered["body"],
|
||||
)
|
||||
self.assertIn("• AdGuard Home: 1.0 → 1.1", rendered["body"])
|
||||
self.assertNotIn("application updates available", rendered["title"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -289,6 +289,29 @@ class RuntimeCatalogTests(unittest.TestCase):
|
||||
self.assertIn("Vitajte", body)
|
||||
self.assertIn("profilovú fotografiu", caption)
|
||||
|
||||
def test_batch_app_updates_render_from_every_runtime_catalog(self):
|
||||
data = {
|
||||
"hostname": "HOST-ŽILINA",
|
||||
"updates": [
|
||||
{"vmid": 100, "app_name": "AdGuard Home", "installed": "1.0", "latest": "1.1"},
|
||||
{"vmid": 115, "app_name": "Redis", "installed": "7.0", "latest": "8.1"},
|
||||
],
|
||||
}
|
||||
for language in self.RUNTIME_LANGUAGES:
|
||||
rendered = notification_templates.render_template(
|
||||
"app_update_available", data, language=language,
|
||||
)
|
||||
self.assertEqual(
|
||||
rendered["title"],
|
||||
notification_templates.runtime_message(
|
||||
"appUpdates.batchTitle", language,
|
||||
hostname="HOST-ŽILINA", count=2,
|
||||
),
|
||||
language,
|
||||
)
|
||||
self.assertIn("CT 100", rendered["body"], language)
|
||||
self.assertIn("• Redis: 7.0 → 8.1", rendered["body"], language)
|
||||
|
||||
def test_ai_disabled_telegram_receives_deterministic_slovak(self):
|
||||
class RecordingTelegram:
|
||||
def __init__(self):
|
||||
|
||||
Reference in New Issue
Block a user