Commit 07140b34 authored by juga's avatar juga Committed by Matt Traudt
Browse files

Add unit tests for disk space functions

parent 2f39df44
"""Unit tests for fs module"""
from unittest.mock import patch
from sbws.util import fs
def mock_df_zero(path):
return 0
def mock_df_enough(path):
return 32
@patch('sbws.util.fs.df', mock_df_zero)
def test_is_low_space_true(caplog, conf):
assert fs.is_low_space(conf) is True
assert ' is less than ' in caplog.records[-1].getMessage()
@patch('sbws.util.fs.df', mock_df_enough)
def test_is_low_space_false(conf):
assert fs.is_low_space(conf) is False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment