added tests for get_type_from_id

stix2.0
Sam Cornwell 2017-11-19 22:27:31 -05:00
parent 8930e72cc3
commit 78612530ff
1 changed files with 8 additions and 0 deletions

View File

@ -74,3 +74,11 @@ def test_get_dict(data):
def test_get_dict_invalid(data):
with pytest.raises(ValueError):
stix2.utils.get_dict(data)
@pytest.mark.parametrize('stix_id, typ', [
('malware--d69c8146-ab35-4d50-8382-6fc80e641d43', 'malware'),
('intrusion-set--899ce53f-13a0-479b-a0e4-67d46e241542', 'intrusion-set')
])
def test_get_type_from_id(stix_id, typ):
assert stix2.utils.get_type_from_id(stix_id) == typ