Linted code using isort + autoflake + black, fixed wrong use of Optional[bool]

This commit is contained in:
Nex
2023-06-01 23:40:26 +02:00
parent c2d740ed36
commit e1677639c4
139 changed files with 3751 additions and 2274 deletions
-1
View File
@@ -10,7 +10,6 @@ from mvt.common.indicators import Indicators
class TestIndicators:
def test_parse_stix2(self, indicator_file):
ind = Indicators(log=logging)
ind.load_indicators_files([indicator_file], load_default=False)
+19 -10
View File
@@ -6,11 +6,14 @@
import logging
import os
from mvt.common.utils import (convert_datetime_to_iso, convert_mactime_to_iso,
convert_unix_to_iso,
convert_unix_to_utc_datetime,
generate_hashes_from_path,
get_sha256_from_file_path)
from mvt.common.utils import (
convert_datetime_to_iso,
convert_mactime_to_iso,
convert_unix_to_iso,
convert_unix_to_utc_datetime,
generate_hashes_from_path,
get_sha256_from_file_path,
)
from ..utils import get_artifact_folder
@@ -20,7 +23,6 @@ TEST_DATE_MAC = TEST_DATE_EPOCH - 978307200
class TestDateConversions:
def test_convert_unix_to_iso(self):
assert convert_unix_to_iso(TEST_DATE_EPOCH) == TEST_DATE_ISO
@@ -39,11 +41,12 @@ class TestDateConversions:
class TestHashes:
def test_hash_from_file(self):
path = os.path.join(get_artifact_folder(), "androidqf", "backup.ab")
sha256 = get_sha256_from_file_path(path)
assert sha256 == "f0e32fe8a7fd5ac0e2de19636d123c0072e979396986139ba2bc49ec385dc325"
assert (
sha256 == "f0e32fe8a7fd5ac0e2de19636d123c0072e979396986139ba2bc49ec385dc325"
)
def test_hash_from_folder(self):
path = os.path.join(get_artifact_folder(), "androidqf")
@@ -52,6 +55,12 @@ class TestHashes:
# Sort the files to have reliable order for tests.
hashes = sorted(hashes, key=lambda x: x["file_path"])
assert hashes[0]["file_path"] == os.path.join(path, "backup.ab")
assert hashes[0]["sha256"] == "f0e32fe8a7fd5ac0e2de19636d123c0072e979396986139ba2bc49ec385dc325"
assert (
hashes[0]["sha256"]
== "f0e32fe8a7fd5ac0e2de19636d123c0072e979396986139ba2bc49ec385dc325"
)
assert hashes[1]["file_path"] == os.path.join(path, "dumpsys.txt")
assert hashes[1]["sha256"] == "bac858001784657a43c7cfa771fd1fc4a49428eb6b7c458a1ebf2fdeef78dd86"
assert (
hashes[1]["sha256"]
== "bac858001784657a43c7cfa771fd1fc4a49428eb6b7c458a1ebf2fdeef78dd86"
)