示例#1
0
def test_send_diagnostic_negative(mock_socket):
    sut = DoIPClient(test_ip, test_logical_address)
    mock_socket.rx_queue.append(diagnostic_negative_response)
    with pytest.raises(
            IOError,
            match=r'Diagnostic request rejected with negative acknowledge code'
    ):
        result = sut.send_diagnostic(bytearray([0, 1, 2]))
    assert mock_socket.tx_queue[-1] == diagnostic_request
示例#2
0
def test_send_diagnostic_postive(mock_socket):
    sut = DoIPClient(test_ip, test_logical_address)
    mock_socket.rx_queue.append(diagnostic_positive_response)
    assert None == sut.send_diagnostic(bytearray([0, 1, 2]))
    assert mock_socket.tx_queue[-1] == diagnostic_request