Beispiel #1
0
def test__forward_close_returns_true_if_response():
    driver = CIPDriver(CONNECT_PATH)
    driver._session = 1
    response = (
        b"o\x00\x1e\x00\x02\x16\x02\x0b\x00\x00\x00\x00_pycomm_"
        b"\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x00\x00\x00"
        b"\x00\x00\xb2\x00\x0e\x00\xce\x00\x00\x00'\x04\t\x10\xd6\x9c\x06=\x00\x00"
    )
    driver._sock = Mocket(response)
    assert driver._forward_close()
Beispiel #2
0
def test__forward_close_raises_commerror_if_session_zero():
    driver = CIPDriver(CONNECT_PATH)
    with pytest.raises(CommError):
        driver._forward_close()
Beispiel #3
0
def test__forward_close_returns_false_if_no_response():
    driver = CIPDriver(CONNECT_PATH)
    driver._sock = Mocket()
    driver._session = 1
    assert not driver._forward_close()