Skip to content

Commit b4f6586

Browse files
add test demonstrating issue 37
1 parent c823fb9 commit b4f6586

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

tests/data/dns_log_malformed.evtx

68 KB
Binary file not shown.

tests/data/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ The source for system.evtx with md5 182de19fe6a25b928a34ad59af0bbf1e
33

44
The source for security.evtx with md5 8fa20a376cb6745453bc51f906e0fcd0
55
was Carlos Dias, via email, on May 4, 2017.
6+
7+
The source for ae831beda7dfda43f4de0e18a1035f64/dns_log_malformed.evtx
8+
was @stephensheridan, via Github issue #37 (https://github.com/williballenthin/python-evtx/issues/37).
9+

tests/fixtures.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,17 @@ def security():
6666
with contextlib.closing(mmap.mmap(f.fileno(), 0,
6767
access=mmap.ACCESS_READ)) as buf:
6868
yield buf
69+
70+
71+
@pytest.fixture
72+
def data_path():
73+
'''
74+
fetch the file system path of the directory containing test files.
75+
76+
Returns:
77+
str: the file system path of the test directory.
78+
'''
79+
cd = os.path.dirname(__file__)
80+
datadir = os.path.join(cd, 'data')
81+
return datadir
82+

tests/test_issue_37.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Evtx.Evtx as evtx
2+
3+
from fixtures import *
4+
5+
6+
def test_render_records(data_path):
7+
'''
8+
regression test demonstrating issue 37.
9+
10+
Args:
11+
data_path (str): the file system path of the test directory.
12+
'''
13+
with evtx.Evtx(os.path.join(data_path, 'dns_log_malformed.evtx')) as log:
14+
for chunk in log.chunks():
15+
for record in chunk.records():
16+
assert record.xml() is not None

0 commit comments

Comments
 (0)