def setgpiostate(id, state): pins().setpin(id, state) return str(pins().getpin(id))
def getgpiostate(id): return str(pins().getpin(id))
def test_hwcontrol_pins_setpin_WhenCalledWithAnyPinNmberAndFalse_WillCallRPi_GPIO_OuputWithFalse( self): with mock.patch('RPi.GPIO.output') as mock_method: ret = pins().setpin(22, 'on') mock_method.assert_called_with(22, True)
def test_hwcontrol_pins_setpin_WhenCalledWithAnyPinNmberAndTrue_WillCallRPi_GPIO_OuputWithTrue( self): with mock.patch('hwcontrol.pins.setpin') as mock_method: ret = pins().setpin(22, False) mock_method.assert_called_with(22, False)
def test_hwcontrol_pins_getpin_WhenCalledWithAnyPinNumberAndMockedLow_ReturnsFalse( self): with mock.patch('RPi.GPIO.input', return_value=False): ret = pins().getpin(22) self.assertEqual(False, ret)