Esempio n. 1
0
def test_OssecQueue_protected_send_ko(mock_send, mock_conn):
    """Tests OssecQueue._send function exceptions works"""

    queue = OssecQueue('test_path')

    with pytest.raises(WazuhException, match=".* 1011 .*"):
        queue._send('msg')

    mock_conn.assert_called_with('test_path')
Esempio n. 2
0
def test_OssecQueue_protected_send(mock_conn, send_response, error):
    """Tests OssecQueue._send function works"""

    queue = OssecQueue('test_path')

    with patch('socket.socket.send', return_value=send_response):
        if error:
            with pytest.raises(WazuhException, match=".* 1011 .*"):
                queue._send('msg')
        else:
            queue._send('msg')

    mock_conn.assert_called_with('test_path')