68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
||
|
|
"""Tests für Update-Badge statt Startup-Popup."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import unittest
|
||
|
|
|
||
|
|
|
||
|
|
class TestUpdateBadgeLogic(unittest.TestCase):
|
||
|
|
def test_startup_dialog_suppressed_for_optional_only(self):
|
||
|
|
from desktop_update_check import _startup_should_show_dialog
|
||
|
|
|
||
|
|
optional = {"update_level": "optional", "below_min_required": False}
|
||
|
|
required = {"update_level": "required", "below_min_required": False}
|
||
|
|
self.assertFalse(_startup_should_show_dialog(optional))
|
||
|
|
self.assertTrue(_startup_should_show_dialog(required))
|
||
|
|
|
||
|
|
def test_startup_should_show_dialog_optional_false(self):
|
||
|
|
from desktop_update_check import _startup_should_show_dialog
|
||
|
|
|
||
|
|
info = {"update_level": "optional", "below_min_required": False}
|
||
|
|
self.assertFalse(_startup_should_show_dialog(info))
|
||
|
|
|
||
|
|
def test_startup_should_show_dialog_required_true(self):
|
||
|
|
from desktop_update_check import _startup_should_show_dialog
|
||
|
|
|
||
|
|
info = {"update_level": "required", "below_min_required": False}
|
||
|
|
self.assertTrue(_startup_should_show_dialog(info))
|
||
|
|
|
||
|
|
def test_show_update_dialog_from_info_requires_info(self):
|
||
|
|
from desktop_update_check import show_update_dialog_from_info
|
||
|
|
|
||
|
|
# Kein Parent/Dialog ohne info — darf nicht crashen.
|
||
|
|
show_update_dialog_from_info(None, parent=None)
|
||
|
|
|
||
|
|
def test_startup_dialog_does_not_open_ui(self):
|
||
|
|
"""Optionale/recommended Updates: kein Startup-Popup (Badge stattdessen)."""
|
||
|
|
import desktop_update_check as duc
|
||
|
|
|
||
|
|
doc = duc.maybe_show_startup_update_dialog.__doc__ or ""
|
||
|
|
self.assertTrue("kein Popup" in doc or "Badge" in doc or "Pflicht" in doc)
|
||
|
|
|
||
|
|
def test_no_aktuell_label_in_update_hint_logic(self):
|
||
|
|
"""Ohne Update: kein sichtbarer Aktuell-Text, kein Status-Label."""
|
||
|
|
import inspect
|
||
|
|
|
||
|
|
import aza_office_shell_v1 as shell
|
||
|
|
|
||
|
|
src = inspect.getsource(shell._OfficeShellV12._apply_update_hint)
|
||
|
|
self.assertNotIn("Aktuell", src)
|
||
|
|
self.assertNotIn("_sidebar_update_status", src)
|
||
|
|
|
||
|
|
def test_recommended_update_no_startup_dialog(self):
|
||
|
|
from desktop_update_check import _startup_should_show_dialog
|
||
|
|
|
||
|
|
info = {"update_level": "recommended", "below_min_required": False}
|
||
|
|
self.assertFalse(_startup_should_show_dialog(info))
|
||
|
|
|
||
|
|
def test_below_min_required_still_shows_startup_dialog(self):
|
||
|
|
from desktop_update_check import _startup_should_show_dialog
|
||
|
|
|
||
|
|
info = {"update_level": "recommended", "below_min_required": True}
|
||
|
|
self.assertTrue(_startup_should_show_dialog(info))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
unittest.main()
|