File: test_issue_43.py

package info (click to toggle)
python-evtx 0.7.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,896 kB
  • sloc: python: 3,181; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import pytest

import Evtx.Evtx as evtx

from fixtures import *


def get_record_by_num(log, record_num):
    for record in log.records():
        if record.record_num() == record_num:
            return record
    raise KeyError(record_num)


def test_issue_43(data_path):
    '''
    regression test demonstrating issue 43.

    Args:
      data_path (str): the file system path of the test directory.
    '''
    with evtx.Evtx(os.path.join(data_path, 'issue_43.evtx')) as log:
        bad_rec = get_record_by_num(log, 508)
        with pytest.raises(UnicodeDecodeError):
            _ = bad_rec.xml()