Fix some testing

master
Chris Lenk 2020-04-02 04:46:11 -04:00
parent c911cff97f
commit 897e884217
4 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
sudo: false
os: linux
language: python
cache: pip
dist: xenial

View File

@ -325,11 +325,8 @@ def _register_observable_extension(
EXT_MAP = STIX2_OBJ_MAPS[v]['observable-extensions']
try:
try:
if ext_type in EXT_MAP[observable_type].keys():
raise DuplicateRegistrationError("Observable Extension", ext_type)
except AttributeError:
pass
if ext_type in EXT_MAP[observable_type].keys():
raise DuplicateRegistrationError("Observable Extension", ext_type)
EXT_MAP[observable_type][ext_type] = new_extension
except KeyError:
if observable_type not in OBJ_MAP_OBSERVABLE:

View File

@ -1080,8 +1080,7 @@ def test_register_duplicate_observable_with_version():
assert "cannot be registered again" in str(excinfo.value)
@pytest.mark.xfail(reason="The default version is no longer 2.0", condition=stix2.DEFAULT_VERSION != "2.0")
def test_register_marking_with_no_version():
def test_register_marking_with_version():
@stix2.v20.CustomMarking(
'x-new-obj-2', [
('property1', stix2.properties.StringProperty(required=True)),

View File

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