def test(self): keepalive.initialise() delta = datetime.timedelta(seconds=61) keepalive.LAST_RUN = datetime.datetime.now() - delta result = keepalive.check_keepalive() self.assertEqual(result, "%s" % keepalive.format_datetime(datetime.datetime.now())) result_2 = keepalive.check_keepalive() self.assertEqual(result_2, None)
def test(self): keepalive.initialise() delta = datetime.timedelta(seconds=59) keepalive.LAST_RUN = datetime.datetime.now() - delta result = keepalive.check_keepalive() self.assertEqual(result, None)
def scan_loop(sock): while True: returned_list = blescan.parse_events(sock, 10) if len(returned_list) > 0: keepalive.set_last_run() for beacon in returned_list: queue.queue_beacon(beacon) keepalive_message = keepalive.check_keepalive() if keepalive_message is not None: send.send(1, "KA:%s", keepalive_message)