Used fixed property for Bundle spec_version
parent
2645bf2c71
commit
2768426a28
|
@ -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': {},
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class Property(object):
|
|||
def validate(self, value):
|
||||
try:
|
||||
value = self.clean(value)
|
||||
except NotImplemetedError:
|
||||
except NotImplementedError:
|
||||
pass
|
||||
return value
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue