-
Notifications
You must be signed in to change notification settings - Fork 16
/
tests.py
35 lines (23 loc) · 933 Bytes
/
tests.py
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
28
29
30
31
32
33
34
"""Copyright 2022 Cado Security Ltd. All rights reserved
Tests for rip_raw
python3 -m unittest tests.DetectExtractMemoryTests
"""
import logging
import os
from typing import Any
import unittest
import zipfile
import rip_raw
class DetectExtractMemoryTests(unittest.TestCase):
def setUp(self) -> None:
logging.info('Called detect setUp')
self.data_dir = './tests/data/'
def test_detect_extract_memory(self):
test_file = os.path.join(self.data_dir, 'tiny.mem')
logging.info(f"Calling test file with {test_file}")
zip_output = rip_raw.convert_memory_to_zip(test_file)
zip = zipfile.ZipFile(zip_output)
expected_zip_contents = ['carved_memory_module_1.bin', 'carved_memory_module_2_37.log', 'carved_memory_module_2.bin']
zip_contents = zip.namelist()
for content in expected_zip_contents:
self.assertIn(content, zip_contents)