mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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:
19 files changed
+284
-183
No files matched your search
@@ -243,11 +243,13 @@ def test_diagnose_url(get_addresses, check):
|
||||
}
|
||||
check.return_value = 'passed'
|
||||
result = diagnose_url(**args)
|
||||
assert result == ['Access URL https://localhost/test on tcp4', 'passed']
|
||||
assert result.description == 'Access URL https://localhost/test on tcp4'
|
||||
assert result.result == 'passed'
|
||||
|
||||
check.return_value = 'failed'
|
||||
result = diagnose_url(**args)
|
||||
assert result == ['Access URL https://localhost/test on tcp4', 'failed']
|
||||
assert result.description == 'Access URL https://localhost/test on tcp4'
|
||||
assert result.result == 'failed'
|
||||
|
||||
del args['kind']
|
||||
args['url'] = 'https://{host}/test'
|
||||
@@ -264,10 +266,12 @@ def test_diagnose_url(get_addresses, check):
|
||||
'url_address': 'test-host-2'
|
||||
}]
|
||||
result = diagnose_url_on_all(**args)
|
||||
assert result == [
|
||||
['Access URL https://test-host-1/test on tcp4', 'passed'],
|
||||
['Access URL https://test-host-2/test on tcp6', 'passed'],
|
||||
]
|
||||
assert result[
|
||||
0].description == 'Access URL https://test-host-1/test on tcp4'
|
||||
assert result[0].result == 'passed'
|
||||
assert result[
|
||||
1].description == 'Access URL https://test-host-2/test on tcp6'
|
||||
assert result[1].result == 'passed'
|
||||
|
||||
|
||||
@patch('subprocess.run')
|
||||
|
||||
Reference in new issue
Block a user