Moved some test methods here

stix2.0
Emmanuelle Vargas-Gonzalez 2018-04-06 14:24:15 -04:00
parent cd85683f2b
commit 1ff640de3c
1 changed files with 18 additions and 0 deletions

View File

@ -82,3 +82,21 @@ def test_get_dict_invalid(data):
]) ])
def test_get_type_from_id(stix_id, typ): def test_get_type_from_id(stix_id, typ):
assert stix2.utils.get_type_from_id(stix_id) == typ assert stix2.utils.get_type_from_id(stix_id) == typ
def test_deduplicate(stix1_objs):
unique = stix2.utils.deduplicate(stix1_objs)
# Only 3 objects are unique
# 2 id's vary
# 2 modified times vary for a particular id
assert len(unique) == 3
ids = [obj['id'] for obj in unique]
mods = [obj['modified'] for obj in unique]
assert "indicator--d81f86b8-975b-bc0b-775e-810c5ad45a4f" in ids
assert "indicator--d81f86b9-975b-bc0b-775e-810c5ad45a4f" in ids
assert "2017-01-27T13:49:53.935Z" in mods
assert "2017-01-27T13:49:53.936Z" in mods