Ejemplo n.º 1
0
    def door_state(self, msg):
        """
        Doorman get current state of door (output from get_door_state function).

        RPi.Doorman is using adafruit magnetic contact switch (door sensor), and
        monitor door state.

        More info: https://github.com/ricco386/rpi-doorman

        Usage: door-state
        """
        d = Doorman()
        return d.get_door_state()
Ejemplo n.º 2
0
class DoormanObjectTestCase(unittest.TestCase):
    def setUp(self):
        self.d = Doorman()

    def tearDown(self):
        self.d = None

    def test_constants(self):
        self.assertEqual(self.d.door_open, 1)
        self.assertEqual(self.d.door_closed, 0)

    def test_get_door_state(self):
        self.d.door_state = 1
        self.assertEqual(self.d.get_door_state(), 'Door is open')
        self.d.door_state = 0
        self.assertEqual(self.d.get_door_state(), 'Door is closed')
Ejemplo n.º 3
0
 def setUp(self):
     self.d = Doorman()