def test_legacy_setup(GPIO): """Test init succeeds and GPIO pins are setup.""" from plasma import legacy as plasma plasma.show() GPIO.setmode.assert_called_once_with(GPIO.BCM) GPIO.setup.assert_has_calls( [mock.call(plasma.DAT, GPIO.OUT), mock.call(plasma.CLK, GPIO.OUT)])
def set_light(self, r, g, b): """Set LED. :param r: Red (0-255) :param g: Green (0-255) :param b: Blue (0-255) 8 """ plasma.set_light(0, r, g, b) plasma.show()
def test_setup(): """Test init succeeds and GPIO pins are setup.""" gpio = GPIO() sys.modules['RPi'] = mock.Mock() sys.modules['RPi'].GPIO = gpio sys.modules['RPi.GPIO'] = gpio from plasma import legacy as plasma plasma.show() assert gpio.pin_modes[plasma.DAT] == gpio.OUT assert gpio.pin_modes[plasma.CLK] == gpio.OUT