2018-06-06 21:30:45 +02:00
|
|
|
import pickle
|
|
|
|
|
|
|
|
import stix2
|
|
|
|
|
2019-01-29 16:52:59 +01:00
|
|
|
from .constants import IDENTITY_ID
|
|
|
|
|
2018-06-06 21:30:45 +02:00
|
|
|
|
|
|
|
def test_pickling():
|
|
|
|
"""
|
|
|
|
Ensure a pickle/unpickle cycle works okay.
|
|
|
|
"""
|
2018-07-05 21:23:25 +02:00
|
|
|
identity = stix2.v20.Identity(
|
2019-01-29 16:52:59 +01:00
|
|
|
id=IDENTITY_ID,
|
2018-06-06 21:30:45 +02:00
|
|
|
name="alice",
|
|
|
|
description="this is a pickle test",
|
2018-07-13 17:10:05 +02:00
|
|
|
identity_class="some_class",
|
2018-06-06 21:30:45 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
pickle.loads(pickle.dumps(identity))
|