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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user