Files
aza/AzA march 2026/_test_installer_desktop_shortcut_refresh.py
2026-06-17 08:02:39 +02:00

54 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
"""Tests: Installer Desktop-Shortcut-Refresh (Block A)."""
from __future__ import annotations
import unittest
from pathlib import Path
_ISS = Path(__file__).resolve().parent / "installer" / "aza_installer.iss"
class TestInstallerDesktopShortcutRefresh(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.src = _ISS.read_text(encoding="utf-8")
def test_no_optional_desktopicon_task(self) -> None:
self.assertNotIn("desktopicon", self.src)
def test_autodesktop_without_task_binding(self) -> None:
self.assertIn(
'Name: "{autodesktop}\\AzA"; Filename: "{app}\\{#MyStartPanelExe}"',
self.src,
)
self.assertNotIn("Tasks: desktopicon", self.src)
def test_refresh_procedure_present(self) -> None:
self.assertIn("procedure RefreshAzADesktopShortcuts();", self.src)
self.assertIn("RemoveVerifiedLegacyAzAShortcuts", self.src)
self.assertIn("CreateOrRefreshAzADesktopShortcut", self.src)
def test_post_install_calls_refresh(self) -> None:
self.assertIn("RefreshAzADesktopShortcuts();", self.src)
def test_targets_start_panel_not_desktop_exe(self) -> None:
self.assertIn("aza_start_panel.exe", self.src)
for line in self.src.splitlines():
if "{autodesktop}" in line and "AzA" in line:
self.assertIn("MyStartPanelExe", line)
self.assertNotIn("MyAppExeName", line)
return
self.fail("autodesktop AzA icon line missing")
def test_legacy_shortcut_names_listed(self) -> None:
for name in ("AZA Office.lnk", "AzA Chat.lnk", "AzA Empfang Chat.lnk"):
self.assertIn(name, self.src)
def test_verified_target_check(self) -> None:
self.assertIn("IsKnownAzAShortcutTarget", self.src)
self.assertIn("aza_desktop.exe", self.src)
if __name__ == "__main__":
unittest.main()