Used fixed property for Bundle spec_version

stix2.1
Greg Back 2017-02-24 10:50:43 -06:00
parent 2645bf2c71
commit 2768426a28
3 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,7 @@
"""STIX 2 Bundle object"""
from .base import _STIXBase
from .properties import IDProperty, TypeProperty
from .properties import IDProperty, TypeProperty, Property
class Bundle(_STIXBase):
@ -10,9 +10,7 @@ class Bundle(_STIXBase):
_properties = {
'type': TypeProperty(_type),
'id': IDProperty(_type),
'spec_version': {
'fixed': "2.0",
},
'spec_version': Property(fixed="2.0"),
'objects': {},
}

View File

@ -68,7 +68,7 @@ class Property(object):
def validate(self, value):
try:
value = self.clean(value)
except NotImplemetedError:
except NotImplementedError:
pass
return value

View File

@ -471,7 +471,7 @@ def test_bundle_with_wrong_spec_version():
with pytest.raises(ValueError) as excinfo:
bundle = stix2.Bundle(spec_version="1.2")
assert str(excinfo.value) == "Bundle must have spec_version='2.0'."
assert str(excinfo.value) == "Invalid value for Bundle 'spec_version': must equal '2.0'."
def test_create_bundle(indicator, malware, relationship):