trying to fix timing bug
parent
52a052d4dd
commit
742d249ee0
|
@ -223,8 +223,8 @@ def test_remove_custom_stix_property():
|
|||
mal_nc = stix2.utils.remove_custom_stix(mal)
|
||||
|
||||
assert "x_custom" not in mal_nc
|
||||
assert stix2.utils.parse_into_datetime(mal["modified"], precision="microsecond") < stix2.utils.parse_into_datetime(mal_nc["modified"],
|
||||
precision="microsecond")
|
||||
assert stix2.utils.parse_into_datetime(mal["modified"], precision="millisecond") < stix2.utils.parse_into_datetime(mal_nc["modified"],
|
||||
precision="millisecond")
|
||||
|
||||
|
||||
def test_remove_custom_stix_object():
|
||||
|
|
|
@ -303,7 +303,14 @@ def remove_custom_stix(stix_obj):
|
|||
# add to set the custom properties we want to get rid of (with their value=None)
|
||||
props.extend(custom_props)
|
||||
|
||||
return new_version(stix_obj, **(dict(props)))
|
||||
new_obj = new_version(stix_obj, **(dict(props)))
|
||||
|
||||
while parse_into_datetime(new_obj["modified"]) == parse_into_datetime(stix_obj["modified"]):
|
||||
# Prevents bug when fast computation allows multiple STIX object
|
||||
# versions to be created in single unit of time
|
||||
new_obj = new_version(stix_obj, **(dict(props)))
|
||||
|
||||
return new_obj
|
||||
|
||||
else:
|
||||
return stix_obj
|
||||
|
|
Loading…
Reference in New Issue