Fix some TAXII DataStore tests

master
Chris Lenk 3 years ago
parent 9145bdf5e8
commit c7fb79d195
  1. 9
      stix2/test/v20/test_datastore_taxii.py
  2. 10
      stix2/test/v21/test_datastore_taxii.py
  3. 4
      tox.ini

@ -4,7 +4,8 @@ from medallion.filters.basic_filter import BasicFilter
import pytest
from requests.models import Response
import six
from taxii2client import Collection, _filter_kwargs_to_query_params
from taxii2client import Collection
from taxii2client.common import _filter_kwargs_to_query_params
import stix2
from stix2.datastore import DataSourceError
@ -38,7 +39,8 @@ class MockTAXIICollectionEndpoint(Collection):
self.objects,
("id", "type", "version"),
[],
)
None,
)[0]
if objs:
return stix2.v20.Bundle(objects=objs)
else:
@ -59,7 +61,8 @@ class MockTAXIICollectionEndpoint(Collection):
objects,
("version",),
[],
)
None,
)[0]
else:
filtered_objects = []
if filtered_objects:

@ -4,7 +4,8 @@ from medallion.filters.basic_filter import BasicFilter
import pytest
from requests.models import Response
import six
from taxii2client import Collection, _filter_kwargs_to_query_params
from taxii2client import Collection
from taxii2client.common import _filter_kwargs_to_query_params
import stix2
from stix2.datastore import DataSourceError
@ -38,8 +39,10 @@ class MockTAXIICollectionEndpoint(Collection):
self.objects,
("id", "type", "version"),
[],
)
None,
)[0]
if objs:
print(objs)
return stix2.v21.Bundle(objects=objs)
else:
resp = Response()
@ -59,7 +62,8 @@ class MockTAXIICollectionEndpoint(Collection):
objects,
("version",),
[],
)
None,
)[0]
else:
filtered_objects = []
if filtered_objects:

@ -8,11 +8,11 @@ deps =
pytest
pytest-cov
coverage
taxii2-client<1.0.0
taxii2-client
fuzzywuzzy
haversine
python-Levenshtein
medallion<2.0.0
medallion
commands =
python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning

Loading…
Cancel
Save