Skip to content

Commit 3ae4744

Browse files
committed
Add test for unsupported evalation
1 parent 42069a3 commit 3ae4744

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Test evaluation supported system architectures."""
2+
3+
from unittest.mock import PropertyMock, patch
4+
5+
import pytest
6+
7+
from supervisor.const import CoreState
8+
from supervisor.coresys import CoreSys
9+
from supervisor.resolution.evaluations.system_architecture import (
10+
EvaluateSystemArchitecture,
11+
)
12+
13+
14+
@pytest.mark.parametrize("arch", ["i386", "armhf"])
15+
async def test_evaluation_unsupported_architectures(
16+
coresys: CoreSys,
17+
arch: str,
18+
):
19+
"""Test evaluation of unsupported system architectures."""
20+
system_architecture = EvaluateSystemArchitecture(coresys)
21+
coresys.core.state = CoreState.INITIALIZE
22+
23+
with patch.object(
24+
type(coresys.supervisor), "arch", PropertyMock(return_value=arch)
25+
):
26+
await system_architecture()
27+
assert system_architecture.reason in coresys.resolution.unsupported
28+
29+
30+
@pytest.mark.parametrize("arch", ["amd64", "aarch64", "armv7"])
31+
async def test_evaluation_supported_architectures(
32+
coresys: CoreSys,
33+
arch: str,
34+
):
35+
"""Test evaluation of supported system architectures."""
36+
system_architecture = EvaluateSystemArchitecture(coresys)
37+
coresys.core.state = CoreState.INITIALIZE
38+
39+
with patch.object(
40+
type(coresys.supervisor), "arch", PropertyMock(return_value=arch)
41+
):
42+
await system_architecture()
43+
assert system_architecture.reason not in coresys.resolution.unsupported
44+

0 commit comments

Comments
 (0)