From 2768426a28355943f9223479ae2db8da502d8c46 Mon Sep 17 00:00:00 2001 From: Greg Back Date: Fri, 24 Feb 2017 10:50:43 -0600 Subject: [PATCH] Used fixed property for Bundle spec_version --- stix2/bundle.py | 6 ++---- stix2/properties.py | 2 +- stix2/test/test_stix2.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/stix2/bundle.py b/stix2/bundle.py index 6ee62c6..9ef71be 100644 --- a/stix2/bundle.py +++ b/stix2/bundle.py @@ -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': {}, } diff --git a/stix2/properties.py b/stix2/properties.py index b3f6ca4..08f7c31 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -68,7 +68,7 @@ class Property(object): def validate(self, value): try: value = self.clean(value) - except NotImplemetedError: + except NotImplementedError: pass return value diff --git a/stix2/test/test_stix2.py b/stix2/test/test_stix2.py index bbd030e..bb45554 100644 --- a/stix2/test/test_stix2.py +++ b/stix2/test/test_stix2.py @@ -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):