diagnostics: Add DiagnosticCheck dataclass

- Set unique check_id for each diagnostic check.

- Result is a string-based enumeration. The default value (NOT_DONE) can be
  used for diagnostic checks that have not been completed yet.

- Result is StrEnum so that the return value of check_url can still be used
  directly as a diagnostic result.

Closes: #2375

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy committed 2023-10-07 04:52:13 +09:00
1 parent d9491d5762
commit 79f36e6a0c
19 files changed
+284 -183

No files matched your search

+2 -2
View File
@@ -135,7 +135,7 @@ class TorProxyApp(app_module.App):
def _diagnose_url_via_tor(url, kind=None):
"""Diagnose whether a URL is reachable via Tor."""
result = diagnose_url(url, kind=kind, wrapper='torsocks')
result[0] = _('Access URL {url} on tcp{kind} via Tor') \
result.description = _('Access URL {url} on tcp{kind} via Tor') \
.format(url=url, kind=kind)
return result
@@ -146,7 +146,7 @@ def _diagnose_tor_use(url, kind=None):
expected_output = 'Congratulations. This browser is configured to use Tor.'
result = diagnose_url(url, kind=kind, wrapper='torsocks',
expected_output=expected_output)
result[0] = _('Confirm Tor usage at {url} on tcp{kind}') \
result.description = _('Confirm Tor usage at {url} on tcp{kind}') \
.format(url=url, kind=kind)
return result