Beispiel #1
0
    def setUp(self):
        self.time = fake_gpio_for_testing.FakeTime()
        self.fake = fake_gpio_for_testing.FakeGPIO(self.time)
        authbox.gpio_buzzer.time = self.time

        self.q = queue.Queue()
        self.b = authbox.gpio_buzzer.Buzzer(self.q, 'b', '1')
Beispiel #2
0
 def test_compare_log_with_regular_time(self):
     gpio = fake_gpio_for_testing.FakeGPIO()
     gpio.output(1, True)
     time.sleep(0.001)
     gpio.output(1, False)
     # This is a much-truncated version of the above test, because I'm pretty
     # confident in it working right and this makes the tests much faster.
     gpio.compare_log([(0, 1, True), (0.001, 1, False)])
Beispiel #3
0
 def setUp(self):
     self.fake = fake_gpio_for_testing.FakeGPIO()
     self.q = queue.Queue()
     self.b = authbox.gpio_button.Button(self.q,
                                         'b',
                                         '1',
                                         '2',
                                         on_down=self.on_down)
Beispiel #4
0
 def setUp(self):
     self.fake = fake_gpio_for_testing.FakeGPIO()
     self.q = queue.Queue()
     self.b = authbox.badgereader_wiegand_gpio.WiegandGPIOReader(
         self.q,
         "b",
         "0",
         "1",
         on_scan=self.on_scan,
     )
Beispiel #5
0
    def setUp(self):
        authbox.badgereader_hid_keystroking.evdev.list_devices = fake_evdev_device_for_testing.list_devices
        authbox.badgereader_hid_keystroking.evdev.InputDevice = fake_evdev_device_for_testing.InputDevice
        self.gpio = fake_gpio_for_testing.FakeGPIO()

        with tempfile.NamedTemporaryFile() as f:
            f.write(SAMPLE_CONFIG)
            f.flush()
            config = authbox.config.Config(f.name)

        self.dispatcher = two_button.Dispatcher(config)
Beispiel #6
0
 def test_compare_log_simple(self):
     fake_time = fake_gpio_for_testing.FakeTime()
     gpio = fake_gpio_for_testing.FakeGPIO(fake_time)
     gpio.output(1, True)
     fake_time.sleep(1.5)
     gpio.output(1, False)
     gpio.compare_log([(0, 1, True), (1.5, 1, False)])
     # Timestamps are approximate (mainly for use with real time, instead of
     # fake_time)
     gpio.compare_log([(0, 1, True), (1.55, 1, False)])
     # Any of these are reasons for compare_log to fail
     # value
     self.assertRaises(Exception, gpio.compare_log, [(0, 1, True), (1.5, 1, True)])
     # time
     self.assertRaises(Exception, gpio.compare_log, [(0, 1, True), (2.0, 1, False)])
     # pin number
     self.assertRaises(Exception, gpio.compare_log, [(0, 1, True), (1.5, 2, False)])
 def setUp(self):
     self.fake = fake_gpio_for_testing.FakeGPIO()
     self.q = queue.Queue()
     self.t = authbox.timer.Timer(self.q, "t", self.callback)
 def setUp(self):
     self.time = fake_gpio_for_testing.FakeTime()
     self.fake = fake_gpio_for_testing.FakeGPIO(self.time)
     self.q = Queue.Queue()