mirror of
https://github.com/mvt-project/mvt.git
synced 2026-08-14 23:20:22 +02:00
Update test PR to work with latest code, fix flake8
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import pytest
|
||||
import logging
|
||||
import os
|
||||
|
||||
from mvt.common.indicators import Indicators
|
||||
|
||||
from ..utils import get_artifact, init_setup
|
||||
from mvt.common.indicators import Indicators, IndicatorsFileBadFormat
|
||||
|
||||
|
||||
class TestIndicators:
|
||||
@@ -13,7 +15,7 @@ class TestIndicators:
|
||||
def test_parse_stix2(self):
|
||||
stix_path = get_artifact("test.stix2")
|
||||
ind = Indicators(log=logging)
|
||||
ind.parse_stix2(stix_path)
|
||||
ind.load_indicators_files([stix_path], load_default=False)
|
||||
assert ind.ioc_count == 4
|
||||
assert len(ind.ioc_domains) == 1
|
||||
assert len(ind.ioc_emails) == 1
|
||||
@@ -23,12 +25,13 @@ class TestIndicators:
|
||||
def test_check_domain(self):
|
||||
ind = Indicators(log=logging)
|
||||
stix_path = get_artifact("test.stix2")
|
||||
ind.parse_stix2(stix_path)
|
||||
assert ind.check_domain("https://www.example.org/foobar") == True
|
||||
assert ind.check_domain("http://example.org:8080/toto") == True
|
||||
ind.load_indicators_files([stix_path], 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
|
||||
ind = Indicators(log=logging)
|
||||
ind.load_indicators_files([stix_path], load_default=False)
|
||||
assert ind.ioc_count == 4
|
||||
|
||||
Reference in New Issue
Block a user