Drop granular markings from object factory for now
parent
c29acfa3ce
commit
e233a424fb
|
@ -2,8 +2,7 @@
|
||||||
class ObjectFactory(object):
|
class ObjectFactory(object):
|
||||||
|
|
||||||
def __init__(self, created_by_ref=None, created=None,
|
def __init__(self, created_by_ref=None, created=None,
|
||||||
external_references=None, object_marking_refs=None,
|
external_references=None, object_marking_refs=None):
|
||||||
granular_markings=None):
|
|
||||||
|
|
||||||
self._defaults = {}
|
self._defaults = {}
|
||||||
if created_by_ref:
|
if created_by_ref:
|
||||||
|
@ -17,8 +16,6 @@ class ObjectFactory(object):
|
||||||
self._defaults['external_references'] = external_references
|
self._defaults['external_references'] = external_references
|
||||||
if object_marking_refs:
|
if object_marking_refs:
|
||||||
self._defaults['object_marking_refs'] = object_marking_refs
|
self._defaults['object_marking_refs'] = object_marking_refs
|
||||||
if granular_markings:
|
|
||||||
self._defaults['granular_markings'] = granular_markings
|
|
||||||
|
|
||||||
def create(self, cls, **kwargs):
|
def create(self, cls, **kwargs):
|
||||||
# Use self.defaults as the base, but update with any explicit args
|
# Use self.defaults as the base, but update with any explicit args
|
||||||
|
|
|
@ -52,12 +52,3 @@ def test_object_factory_obj_markings():
|
||||||
factory = stix2.ObjectFactory(object_marking_refs=stix2.TLP_RED)
|
factory = stix2.ObjectFactory(object_marking_refs=stix2.TLP_RED)
|
||||||
ind = factory.create(stix2.Indicator, **INDICATOR_KWARGS)
|
ind = factory.create(stix2.Indicator, **INDICATOR_KWARGS)
|
||||||
assert stix2.TLP_RED.id in ind.object_marking_refs
|
assert stix2.TLP_RED.id in ind.object_marking_refs
|
||||||
|
|
||||||
|
|
||||||
def test_object_factory_granular_markings():
|
|
||||||
marking = stix2.GranularMarking(marking_ref=stix2.TLP_AMBER,
|
|
||||||
selectors="created_by_ref")
|
|
||||||
factory = stix2.ObjectFactory(created_by_ref=IDENTITY_ID,
|
|
||||||
granular_markings=marking)
|
|
||||||
ind = factory.create(stix2.Indicator, **INDICATOR_KWARGS)
|
|
||||||
assert "created_by_ref" in ind.granular_markings[0].selectors
|
|
||||||
|
|
Loading…
Reference in New Issue