mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
- Ensure that each diagnostic test category can be identified by easy prefix matching on the test ID. - Give a different unique IDs each different kind of test. More specific tests of a type get a different kind of ID. - Make comparison of diagnostic test results in test cases more comprehensive. - Simplify code that shows the number if issues identified. - In many languages, there is complex logic to write plural forms. Plurals can't be handled by assuming singular = 1 item and plural is > 1. Translation of messages in Notification does not support plurals properly. Avoid this for now by using sometimes incorrect plural form. - For i18n we should avoid joining phrases/words. Words don't always maintain order after translation. - Notify about the total number of issues in diagnostics and not just the most severe category. This is likely to draw more attention and avoid i18n complexity. - Dismiss the diagnostic notification if the latest run succeeded completely. Tests: - Unit tests pass. - Diagnostics for following apps works: networks (drop-in config), apache (daemon, listen address, internal firewall, external firewall), tor (netcat), torproxy (internal only firewall, torproxy url, torproxy using tor), privoxy (privoxy url, package available, package latest), - Untested: Is release file available method in upgrades app. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
26 lines
560 B
Python
26 lines
560 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""Diagnostic check data type."""
|
|
|
|
from dataclasses import dataclass
|
|
from enum import StrEnum
|
|
|
|
|
|
class Result(StrEnum):
|
|
"""The result of a diagnostic check."""
|
|
NOT_DONE = 'not_done'
|
|
PASSED = 'passed'
|
|
WARNING = 'warning'
|
|
FAILED = 'failed'
|
|
ERROR = 'error'
|
|
|
|
|
|
# TODO: Description should not be translated until we need to display it.
|
|
|
|
|
|
@dataclass
|
|
class DiagnosticCheck:
|
|
"""A diagnostic check and optional result."""
|
|
check_id: str
|
|
description: str
|
|
result: Result = Result.NOT_DONE
|