From a37165d7d9c431fa350ebac22e90139dc7c18002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 19 Jul 2018 18:25:16 +0200 Subject: [PATCH] Tracking: Fix unit tests --- tests/plugins/pi_support/test_pi_support.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/plugins/pi_support/test_pi_support.py b/tests/plugins/pi_support/test_pi_support.py index fad261c19..be33f8c71 100644 --- a/tests/plugins/pi_support/test_pi_support.py +++ b/tests/plugins/pi_support/test_pi_support.py @@ -7,6 +7,8 @@ OCTOPI_VERSION = "0.14.0" DT_MODEL = "Raspberry Pi Model F Rev 1.1" +VCGENCMD = "/usr/bin/vcgencmd get_throttled" + class PiSupportTestCase(unittest.TestCase): def test_get_octopi_version(self): @@ -34,9 +36,9 @@ class PiSupportTestCase(unittest.TestCase): with mock.patch("sarge.get_stdout", mock.MagicMock()) as m: m.return_value = "throttled=0x70005" - state = get_vcgencmd_throttled_state() + state = get_vcgencmd_throttled_state(VCGENCMD) - m.assert_called_once_with(["/usr/bin/vcgencmd", "get_throttled"]) + m.assert_called_once_with(VCGENCMD) self.assertTrue(state.current_undervoltage) self.assertFalse(state.current_overheat) self.assertTrue(state.current_issue) @@ -51,7 +53,7 @@ class PiSupportTestCase(unittest.TestCase): m.return_value = "invalid" try: - get_vcgencmd_throttled_state() + get_vcgencmd_throttled_state(VCGENCMD) except ValueError: # expected pass @@ -65,7 +67,7 @@ class PiSupportTestCase(unittest.TestCase): m.return_value = "throttled=0xinvalid" try: - get_vcgencmd_throttled_state() + get_vcgencmd_throttled_state(VCGENCMD) except ValueError: # expected pass