Debian Codegraph @

testing/tests/test_lzma.py

raw symbols SCIP
1
2 import os
3 import binwalk
4
5 def test_lzma():
6 '''
7 Test: Open foobar.lzma, scan for signatures.
8 Verify that only one LZMA signature was detected.
9 '''
10 expected_result = "LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: -1 bytes"
11
12 input_vector_file = os.path.join(os.path.dirname(__file__),
13 "input-vectors",
14 "foobar.lzma")
15
16 scan_result = binwalk.scan(input_vector_file,
17 signature=True,
18 quiet=True)
19
20 # Test number of modules used
21 assert len(scan_result) == 1
22
23 # There should be only one result
24 assert len(scan_result[0].results) == 1
25
26 # That result should be at offset 0
27 assert scan_result[0].results[0].offset == 0
28
29 # That result should be an LZMA file
30 assert scan_result[0].results[0].description == expected_result