コード例 #1
0
ファイル: run_test.py プロジェクト: evdodima/my_leosac
def test_8bits():
    leosac = LeosacRunner("this_test/config-8bits.xml")
    wiegand = WiegandClient("/tmp/leosac-ipc", "wiegand_data_high", "wiegand_data_low")
    time.sleep(3)

    wiegand.send_8bits_pin("31337")
    leosac.run_at_most(7)
    test_assert(leosac.returncode == 0,
                "Process returned with non-zero exit code ({0})".format(leosac.returncode))
    ret = re.search("^.* 31337$", leosac.out, re.MULTILINE)
    test_assert(ret, "8bits Pin code wasn't read")
コード例 #2
0
ファイル: run_test.py プロジェクト: EvdoDima/my_leosac
def main():
    leosac = LeosacRunner("this_test/test-module-list.xml")

    rc = RemoteController("127.0.0.1:12345", "TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT")
    cmd = ModuleListCommand()

    rc.execute_command(cmd)
    test_assert(cmd.status is True
                and ("MONITOR" in cmd.modules)
                and ("WIEGAND_READER" in cmd.modules)
                and ("NOT_A_MODULE" not in cmd.modules),
                "Failed to retrieve config from valid module.")

    leosac.run_at_most(10)
コード例 #3
0
ファイル: run_test.py プロジェクト: evdodima/my_leosac
def main():
    leosac = LeosacRunner("this_test/test-module-list.xml")

    rc = RemoteController("127.0.0.1:12345",
                          "TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT")
    cmd = ModuleListCommand()

    rc.execute_command(cmd)
    test_assert(
        cmd.status is True and ("MONITOR" in cmd.modules)
        and ("WIEGAND_READER" in cmd.modules)
        and ("NOT_A_MODULE" not in cmd.modules),
        "Failed to retrieve config from valid module.")

    leosac.run_at_most(10)
コード例 #4
0
ファイル: run_test.py プロジェクト: EvdoDima/my_leosac
def receive_card_number():
    tcp_server = subprocess.Popen(["this_test/tcp_server.py"])
    leosac = LeosacRunner("this_test/config.xml")

    time.sleep(3)
    wiegand = WiegandClient("/tmp/leosac-ipc", "wiegand_data_high", "wiegand_data_low")

    wiegand.send_card("ff:ff:ff:ff")
    wiegand.send_card("00:00:00:10")

    tcp_server.wait()
    leosac.run_at_most(5)
    test_assert(tcp_server.returncode == 0,
                "TCPServer returned with non zero code")
    test_assert(leosac.returncode == 0,
                "Process returned with non-zero exit code ({0})".format(leosac.returncode))
コード例 #5
0
ファイル: run_test.py プロジェクト: evdodima/my_leosac
def receive_card_number():
    tcp_server = subprocess.Popen(["this_test/tcp_server.py"])
    leosac = LeosacRunner("this_test/config.xml")

    time.sleep(3)
    wiegand = WiegandClient("/tmp/leosac-ipc", "wiegand_data_high",
                            "wiegand_data_low")

    wiegand.send_card("ff:ff:ff:ff")
    wiegand.send_card("00:00:00:10")

    tcp_server.wait()
    leosac.run_at_most(5)
    test_assert(tcp_server.returncode == 0,
                "TCPServer returned with non zero code")
    test_assert(
        leosac.returncode == 0,
        "Process returned with non-zero exit code ({0})".format(
            leosac.returncode))