1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-26 13:37:06 +00:00

Add disk total, used, free to host/info API (#1909)

This commit is contained in:
Joakim Sørensen
2020-08-14 09:24:38 +02:00
committed by GitHub
parent 8307b153e3
commit 3b0d0e9928
6 changed files with 62 additions and 8 deletions

View File

@@ -41,3 +41,21 @@ def test_free_space():
free = system.get_disk_free_space("/data")
assert free == 2.0
def test_total_space():
"""Test total space helper."""
system = Hardware()
with patch("shutil.disk_usage", return_value=(10 * (1024.0 ** 3), 42, 42)):
total = system.get_disk_total_space("/data")
assert total == 10.0
def test_used_space():
"""Test used space helper."""
system = Hardware()
with patch("shutil.disk_usage", return_value=(42, 8 * (1024.0 ** 3), 42)):
used = system.get_disk_used_space("/data")
assert used == 8.0