Files
ProxMenux/AppImage/scripts/tests/test_oci_adguard_setup.py
T
MacRimiandClaude Opus 5.5 4437a671d2 ProxMenux 1.2.6.2-beta: OCI containers in the Monitor, docs and fixes
OCI manager Apps
- App tab: containers installed from an OCI image are identified from their
  installation record; the application and image versions are shown and an
  update is detected by image digest; repository link; Refresh data.
- Updates tab for OCI containers: Update and Recreate run the same flow as the
  OCI menu in the Monitor terminal; the pre-update backup can be kept in a
  backup storage; scheduled image updates with an optional minimum age.
- Logs tab: console output of the application, kept on the host
  (lxc.console.logfile + logrotate) and followed live.
- The Proxmox console opens a shell (cmode: shell) when the image has one.
- A damaged image download is fetched again before failing.
- Multi-container applications open at their LAN address; volume mount
  points on block storage report their usage.

Monitor
- Proxmox notifications are delivered to a loopback-only HTTP listener when
  HTTPS is enabled, so they no longer fail certificate verification.
- Log persistence counts recurring patterns only; an ended burst is not
  reported as persistent and its warning clears on its own (#386).
- Proxmox notification config backups are deduplicated and capped at three.
- The update icon on the Apps page opens the container on its Updates tab.
- Version 1.2.6.2-beta and its release notes in every Monitor language.

Docs
- OCI manager Apps and Audit & Report rebuilt as per-page message files,
  with a new page for OCI containers in the Monitor.
- Seven pages fixed where rich-text tags were missing from t.rich.

Translations
- Spanish fixes across the OCI engine, the Monitor and the TUI menus.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:51:12 +02:00

38 lines
1.7 KiB
Python

import sys
from pathlib import Path
import unittest
from unittest.mock import MagicMock, patch
SCRIPTS = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(SCRIPTS))
import lxc_apps
class AdguardSetupTests(unittest.TestCase):
def test_non_adguard_is_not_probed(self):
with patch.object(lxc_apps, '_oci_instance_meta', return_value={'template_id': 'image-frigate'}), \
patch.object(lxc_apps.subprocess, 'run') as run:
self.assertFalse(lxc_apps.oci_adguard_setup_available(190))
run.assert_not_called()
def test_setup_returns_true_only_for_http_response(self):
process = MagicMock(stdout='192.168.0.42\n')
connection = MagicMock()
connection.__enter__.return_value.recv.return_value = b'HTTP/1.1 302 Found\r\n'
with patch.object(lxc_apps, '_oci_instance_meta', return_value={'template_id': 'image-adguard-home'}), \
patch.object(lxc_apps.subprocess, 'run', return_value=process), \
patch.object(lxc_apps.socket, 'create_connection', return_value=connection) as connect:
self.assertTrue(lxc_apps.oci_adguard_setup_available(190))
connect.assert_called_once_with(('192.168.0.42', 3000), timeout=1)
def test_closed_setup_port_is_not_offered(self):
process = MagicMock(stdout='192.168.0.42\n')
with patch.object(lxc_apps, '_oci_instance_meta', return_value={'template_id': 'image-adguard-home'}), \
patch.object(lxc_apps.subprocess, 'run', return_value=process), \
patch.object(lxc_apps.socket, 'create_connection', side_effect=OSError):
self.assertFalse(lxc_apps.oci_adguard_setup_available(190))
if __name__ == '__main__':
unittest.main()