[tests/battery] Mock exists() call for Travis CI

This commit is contained in:
Tobi-wan Kenobi 2016-12-11 08:11:26 +01:00
parent c8fc75a401
commit 7db80b6d3b

View file

@ -41,11 +41,13 @@ class TestBatteryModule(unittest.TestCase):
for widget in self.module.widgets(): for widget in self.module.widgets():
self.assertEquals(len(widget.full_text()), len("100%")) self.assertEquals(len(widget.full_text()), len("100%"))
@mock.patch("os.path.exists")
@mock.patch("{}.open".format("__builtin__" if sys.version_info[0] < 3 else "builtins")) @mock.patch("{}.open".format("__builtin__" if sys.version_info[0] < 3 else "builtins"))
@mock.patch("subprocess.Popen") @mock.patch("subprocess.Popen")
def test_critical(self, mock_output, mock_open): def test_critical(self, mock_output, mock_open, mock_exists):
mock_open.return_value = MockOpen() mock_open.return_value = MockOpen()
mock_open.return_value.returns("19") mock_open.return_value.returns("19")
mock_exists.return_value = True
self.config.set("battery.critical", "20") self.config.set("battery.critical", "20")
self.config.set("battery.warning", "25") self.config.set("battery.warning", "25")
self.module.update(self.module.widgets()) self.module.update(self.module.widgets())