|
1 | 1 | """Test evaluation base.""" |
2 | 2 |
|
3 | 3 | # pylint: disable=import-error,protected-access |
4 | | -import errno |
5 | | -import os |
6 | | -from pathlib import Path |
7 | | -from unittest.mock import AsyncMock, patch |
| 4 | +from unittest.mock import patch |
8 | 5 |
|
9 | 6 | from supervisor.const import CoreState |
10 | 7 | from supervisor.coresys import CoreSys |
11 | | -from supervisor.exceptions import CodeNotaryError, CodeNotaryUntrusted |
12 | | -from supervisor.resolution.const import ContextType, IssueType |
13 | | -from supervisor.resolution.data import Issue |
14 | 8 | from supervisor.resolution.evaluations.source_mods import EvaluateSourceMods |
15 | 9 |
|
16 | 10 |
|
17 | 11 | async def test_evaluation(coresys: CoreSys): |
18 | | - """Test evaluation.""" |
19 | | - with patch( |
20 | | - "supervisor.resolution.evaluations.source_mods._SUPERVISOR_SOURCE", |
21 | | - Path(f"{os.getcwd()}/supervisor"), |
22 | | - ): |
23 | | - sourcemods = EvaluateSourceMods(coresys) |
24 | | - await coresys.core.set_state(CoreState.RUNNING) |
25 | | - |
26 | | - assert sourcemods.reason not in coresys.resolution.unsupported |
27 | | - coresys.security.verify_own_content = AsyncMock(side_effect=CodeNotaryUntrusted) |
28 | | - await sourcemods() |
29 | | - assert sourcemods.reason in coresys.resolution.unsupported |
30 | | - |
31 | | - coresys.security.verify_own_content = AsyncMock(side_effect=CodeNotaryError) |
32 | | - await sourcemods() |
33 | | - assert sourcemods.reason not in coresys.resolution.unsupported |
| 12 | + """Test evaluation - CodeNotary removed.""" |
| 13 | + sourcemods = EvaluateSourceMods(coresys) |
| 14 | + await coresys.core.set_state(CoreState.RUNNING) |
34 | 15 |
|
35 | | - coresys.security.verify_own_content = AsyncMock() |
36 | | - await sourcemods() |
37 | | - assert sourcemods.reason not in coresys.resolution.unsupported |
| 16 | + # CodeNotary checking removed, evaluation always returns False now |
| 17 | + assert sourcemods.reason not in coresys.resolution.unsupported |
| 18 | + await sourcemods() |
| 19 | + assert sourcemods.reason not in coresys.resolution.unsupported |
38 | 20 |
|
39 | 21 |
|
40 | 22 | async def test_did_run(coresys: CoreSys): |
@@ -63,27 +45,11 @@ async def test_did_run(coresys: CoreSys): |
63 | 45 |
|
64 | 46 |
|
65 | 47 | async def test_evaluation_error(coresys: CoreSys): |
66 | | - """Test error reading file during evaluation.""" |
| 48 | + """Test error reading file during evaluation - CodeNotary removed.""" |
67 | 49 | sourcemods = EvaluateSourceMods(coresys) |
68 | 50 | await coresys.core.set_state(CoreState.RUNNING) |
69 | | - corrupt_fs = Issue(IssueType.CORRUPT_FILESYSTEM, ContextType.SYSTEM) |
70 | 51 |
|
| 52 | + # CodeNotary checking removed, evaluation always returns False now |
| 53 | + assert sourcemods.reason not in coresys.resolution.unsupported |
| 54 | + await sourcemods() |
71 | 55 | assert sourcemods.reason not in coresys.resolution.unsupported |
72 | | - assert corrupt_fs not in coresys.resolution.issues |
73 | | - |
74 | | - with patch( |
75 | | - "supervisor.utils.codenotary.dirhash", |
76 | | - side_effect=(err := OSError()), |
77 | | - ): |
78 | | - err.errno = errno.EBUSY |
79 | | - await sourcemods() |
80 | | - assert sourcemods.reason not in coresys.resolution.unsupported |
81 | | - assert corrupt_fs in coresys.resolution.issues |
82 | | - assert coresys.core.healthy is True |
83 | | - |
84 | | - coresys.resolution.dismiss_issue(corrupt_fs) |
85 | | - err.errno = errno.EBADMSG |
86 | | - await sourcemods() |
87 | | - assert sourcemods.reason not in coresys.resolution.unsupported |
88 | | - assert corrupt_fs in coresys.resolution.issues |
89 | | - assert coresys.core.healthy is False |
0 commit comments