mirror of
https://github.com/mvt-project/mvt.git
synced 2026-08-15 07:30:35 +02:00
Linted code using isort + autoflake + black, fixed wrong use of Optional[bool]
This commit is contained in:
@@ -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
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user