Skip to content

Commit

Permalink
Key fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden3c committed Sep 11, 2024
1 parent 343c96d commit d1f38e8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@pytest.mark.asyncio
async def test__ensure_smart_enabled__smart_error():
with patch("middlewared.etc_files.smartd.smartctl") as run:
run.return_value = Mock(stdout='{"smart_support": {"available": false}}')
run.return_value = Mock(stdout='{"smart_support": {"enabled": false, "available": false}}')

assert await ensure_smart_enabled(["/dev/ada0"]) is False

Expand All @@ -22,7 +22,7 @@ async def test__ensure_smart_enabled__smart_error():
@pytest.mark.asyncio
async def test__ensure_smart_enabled__smart_enabled():
with patch("middlewared.etc_files.smartd.smartctl") as run:
run.return_value = Mock(stdout='{"smart_support": {"available": true}}')
run.return_value = Mock(stdout='{"smart_support": {"enabled": true, "available": true}}')

assert await ensure_smart_enabled(["/dev/ada0"])

Expand All @@ -37,7 +37,7 @@ async def test__ensure_smart_enabled__smart_was_disabled():
assert await ensure_smart_enabled(["/dev/ada0"])

assert run.call_args_list == [
call(["/dev/ada0", "-i"], check=False, stderr=subprocess.STDOUT,
call(["/dev/ada0", "-i", "--json=c"], check=False, stderr=subprocess.STDOUT,
encoding="utf8", errors="ignore"),
call(["/dev/ada0", "-s", "on"], check=False, stderr=subprocess.STDOUT),
]
Expand Down

0 comments on commit d1f38e8

Please sign in to comment.