Update test PR to work with latest code, fix flake8

This commit is contained in:
Donncha Ó Cearbhaill
2022-01-07 17:03:53 +01:00
parent 513e2cc704
commit 54963b0b59
8 changed files with 29 additions and 27 deletions
+8 -5
View File
@@ -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