def test_input(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     bbio_gpio.input = Mock(return_value=True)
     val = adapter.input(1)
     self.assertTrue(val)
     bbio_gpio.input.assert_called_with(1)
 def test_output(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.output(1, True)
     bbio_gpio.output.assert_called_with(1, True)
     adapter.output(1, False)
     bbio_gpio.output.assert_called_with(1, False)
 def test_setup(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.setup(1, GPIO.OUT)
     bbio_gpio.setup.assert_called_with(1, bbio_gpio.OUT, pull_up_down=bbio_gpio.PUD_OFF)
     adapter.setup(1, GPIO.IN)
     bbio_gpio.setup.assert_called_with(1, bbio_gpio.IN, pull_up_down=bbio_gpio.PUD_OFF)
     adapter.setup(1, GPIO.IN, GPIO.PUD_DOWN)
     bbio_gpio.setup.assert_called_with(1, bbio_gpio.IN, pull_up_down=bbio_gpio.PUD_DOWN)
     adapter.setup(1, GPIO.IN, GPIO.PUD_UP)
     bbio_gpio.setup.assert_called_with(1, bbio_gpio.IN, pull_up_down=bbio_gpio.PUD_UP)
 def test_cleanup_pin(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.cleanup(1)
     bbio_gpio.cleanup.assert_called_with(1)
 def test_wait_for_edge(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.wait_for_edge(1, GPIO.FALLING)
     bbio_gpio.wait_for_edge.assert_called_with(1, bbio_gpio.FALLING)
 def test_event_detected(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.event_detected(1)
     bbio_gpio.event_detected.assert_called_with(1)
 def test_add_event_callback(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.add_event_callback(1, callback=self.test_add_event_callback)
     bbio_gpio.add_event_callback.assert_called_with(
         1, self.test_add_event_callback)
 def test_remove_event_detect(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.remove_event_detect(1)
     bbio_gpio.remove_event_detect.assert_called_with(1)
 def test_add_event_detect(self):
     bbio_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(bbio_gpio)
     adapter.add_event_detect(1, GPIO.RISING)
     bbio_gpio.add_event_detect.assert_called_with(1, bbio_gpio.RISING)
 def test_cleanup(self):
     rpi_gpio = Mock()
     adapter = GPIO.AdafruitBBIOAdapter(rpi_gpio)
     adapter.cleanup()
     rpi_gpio.cleanup.assert_called()