コード例 #1
0
    def test_get_vcgencmd_throttle_state_unparseable2(self):
        from octoprint.plugins.pi_support import get_vcgencmd_throttled_state

        with mock.patch("sarge.get_stdout", mock.MagicMock()) as m:
            m.return_value = "throttled=0xinvalid"

            try:
                get_vcgencmd_throttled_state(VCGENCMD)
            except ValueError:
                # expected
                pass
            else:
                self.fail("Expected ValueError")
コード例 #2
0
	def test_get_vcgencmd_throttle_state_unparseable2(self):
		from octoprint.plugins.pi_support import get_vcgencmd_throttled_state

		with mock.patch("sarge.get_stdout", mock.MagicMock()) as m:
			m.return_value = "throttled=0xinvalid"

			try:
				get_vcgencmd_throttled_state(VCGENCMD)
			except ValueError:
				# expected
				pass
			else:
				self.fail("Expected ValueError")
コード例 #3
0
    def test_get_vcgencmd_throttle_state(self):
        from octoprint.plugins.pi_support import get_vcgencmd_throttled_state

        with mock.patch("sarge.get_stdout", mock.MagicMock()) as m:
            m.return_value = "throttled=0x70005"
            state = get_vcgencmd_throttled_state(VCGENCMD)

        m.assert_called_once_with(VCGENCMD, close_fds=CLOSE_FDS)
        self.assertTrue(state.current_undervoltage)
        self.assertFalse(state.current_overheat)
        self.assertTrue(state.current_issue)
        self.assertTrue(state.past_undervoltage)
        self.assertTrue(state.past_overheat)
        self.assertTrue(state.past_issue)
コード例 #4
0
	def test_get_vcgencmd_throttle_state(self):
		from octoprint.plugins.pi_support import get_vcgencmd_throttled_state

		with mock.patch("sarge.get_stdout", mock.MagicMock()) as m:
			m.return_value = "throttled=0x70005"
			state = get_vcgencmd_throttled_state(VCGENCMD)

		m.assert_called_once_with(VCGENCMD)
		self.assertTrue(state.current_undervoltage)
		self.assertFalse(state.current_overheat)
		self.assertTrue(state.current_issue)
		self.assertTrue(state.past_undervoltage)
		self.assertTrue(state.past_overheat)
		self.assertTrue(state.past_issue)