17 lines
568 B
Python
17 lines
568 B
Python
![]() |
import stix2
|
||
|
|
||
|
from .constants import IDENTITY_ID, IDENTITY_KWARGS, INDICATOR_KWARGS
|
||
|
|
||
|
|
||
|
def test_object_factory_created_by_ref_str():
|
||
|
factory = stix2.ObjectFactory(created_by=IDENTITY_ID)
|
||
|
ind = factory.create(stix2.Indicator, **INDICATOR_KWARGS)
|
||
|
assert ind.created_by_ref == IDENTITY_ID
|
||
|
|
||
|
|
||
|
def test_object_factory_created_by_ref_obj():
|
||
|
id_obj = stix2.Identity(id=IDENTITY_ID, **IDENTITY_KWARGS)
|
||
|
factory = stix2.ObjectFactory(created_by=id_obj)
|
||
|
ind = factory.create(stix2.Indicator, **INDICATOR_KWARGS)
|
||
|
assert ind.created_by_ref == IDENTITY_ID
|