mirror of
https://github.com/mvt-project/mvt.git
synced 2026-10-01 05:29:45 +02:00
Generate stix2 for each test run
This commit is contained in:
1 parent
3f8dade610
commit
e85c70c603
10 files changed
+47
-171
No files matched your search
@@ -1,37 +1,26 @@
|
||||
import pytest
|
||||
import logging
|
||||
import os
|
||||
|
||||
from mvt.common.indicators import Indicators
|
||||
|
||||
from ..utils import get_artifact, init_setup
|
||||
|
||||
|
||||
class TestIndicators:
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def set(self):
|
||||
init_setup()
|
||||
|
||||
def test_parse_stix2(self):
|
||||
stix_path = get_artifact("test.stix2")
|
||||
def test_parse_stix2(self, indicator_file):
|
||||
ind = Indicators(log=logging)
|
||||
ind.load_indicators_files([stix_path], load_default=False)
|
||||
ind.load_indicators_files([indicator_file], load_default=False)
|
||||
assert ind.ioc_count == 4
|
||||
assert len(ind.ioc_domains) == 1
|
||||
assert len(ind.ioc_emails) == 1
|
||||
assert len(ind.ioc_files) == 1
|
||||
assert len(ind.ioc_processes) == 1
|
||||
|
||||
def test_check_domain(self):
|
||||
def test_check_domain(self, indicator_file):
|
||||
ind = Indicators(log=logging)
|
||||
stix_path = get_artifact("test.stix2")
|
||||
ind.load_indicators_files([stix_path], load_default=False)
|
||||
ind.load_indicators_files([indicator_file], load_default=False)
|
||||
assert ind.check_domain("https://www.example.org/foobar")
|
||||
assert ind.check_domain("http://example.org:8080/toto")
|
||||
|
||||
def test_env_stix(self):
|
||||
stix_path = get_artifact("test.stix2")
|
||||
os.environ["MVT_STIX2"] = stix_path
|
||||
def test_env_stix(self, indicator_file):
|
||||
os.environ["MVT_STIX2"] = indicator_file
|
||||
ind = Indicators(log=logging)
|
||||
ind.load_indicators_files([stix_path], load_default=False)
|
||||
ind.load_indicators_files([indicator_file], load_default=False)
|
||||
assert ind.ioc_count == 4
|
||||
Reference in new issue
Block a user