mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
- Notification settings show the last 20 notifications with the result of each send, the error when one failed and every daily digest run, also on days with nothing to send; the history is read without the flag the API never returned, and the page does not offer to erase it, as Audit & Report reads it. - The Ctrl menu of the three web terminals sends Ctrl+D, which ends a text pasted in the terminal, also from a phone or a tablet. - The repository check lists every Proxmox VE or Enterprise Ceph repository whose suite does not match the installed version, with its channel and file, and says where to disable it; repository addresses are never shown. - Adding an NVIDIA GPU to a VM writes its VFIO udev rule again when it is missing or was edited, and the pre-check counts a missing rule as a pending host change. - New texts in English and Spanish, modelled in the translation steady-state test, and the notifications docs page describes the history section. - Corrected the automatic translations of the new LXC update and power control texts, and the start, shutdown, reboot and stop buttons of VMs and LXCs in German, French, Portuguese and Swedish. - Tests for the history panel, the terminal Ctrl+D, the repository message and the VFIO rule.
50 lines
2.1 KiB
Python
50 lines
2.1 KiB
Python
"""The notification settings show the delivery history the Monitor records,
|
|
the daily digest runs included, and never offer to erase it: Audit & Report
|
|
reads the same history to tell whether each channel delivers."""
|
|
import json
|
|
from pathlib import Path
|
|
import re
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
PAGE = ROOT / 'AppImage/components/notification-settings.tsx'
|
|
KEYS = ('title', 'description', 'empty', 'loadFailed', 'sent', 'notSent',
|
|
'severityInfo', 'severityWarning', 'severityCritical')
|
|
|
|
|
|
class NotificationHistoryPanelTests(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.page = PAGE.read_text(encoding='utf-8')
|
|
|
|
def test_the_panel_opens_and_lists_the_history(self):
|
|
self.assertIn('setShowHistory(open => !open)', self.page)
|
|
self.assertIn('history.map(entry =>', self.page)
|
|
self.assertIn('t("settings.notifications.history.title")', self.page)
|
|
|
|
def test_the_history_is_read_without_a_success_flag(self):
|
|
loader = re.search(r'const loadHistory = useCallback\(async \(\) => \{(.*?)\n \}, \[\]\)', self.page, re.S)
|
|
self.assertIsNotNone(loader)
|
|
self.assertIn('Array.isArray(data.history)', loader.group(1))
|
|
self.assertNotIn('data.success', loader.group(1))
|
|
|
|
def test_a_digest_run_and_a_failed_delivery_show_their_message(self):
|
|
self.assertIn('entry.event_type === "digest" ? entry.message', self.page)
|
|
self.assertIn('!sent ? entry.error_message', self.page)
|
|
|
|
def test_the_page_never_erases_the_history(self):
|
|
self.assertNotIn('handleClearHistory', self.page)
|
|
self.assertIsNone(re.search(r'notifications/history["\'`][^)]*method:\s*["\']DELETE', self.page))
|
|
|
|
def test_the_texts_exist_in_english_and_spanish(self):
|
|
for language in ('en', 'es'):
|
|
catalog = json.loads((ROOT / f'AppImage/messages/{language}/common.json').read_text(encoding='utf-8'))
|
|
history = catalog['settings']['notifications']['history']
|
|
for key in KEYS:
|
|
with self.subTest(language=language, key=key):
|
|
self.assertTrue(history.get(key))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|