update to test cases

removing invalid test cases per new changes. updating some to reflect new changes to the Extensions Property, other minor ones
pull/1/head
Emmanuelle Vargas-Gonzalez 2020-11-09 20:35:22 -05:00
parent 5cb52844dc
commit 1180da7cc7
6 changed files with 64 additions and 194 deletions

View File

@ -696,7 +696,7 @@ def test_observed_data_with_custom_observable_object():
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.DomainName, 'x-new-ext', [ 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),
], ],
@ -758,7 +758,7 @@ def test_custom_extension_wrong_observable_type():
) )
def test_custom_extension_with_list_and_dict_properties_observable_type(data): def test_custom_extension_with_list_and_dict_properties_observable_type(data):
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.UserAccount, 'some-extension', [ 'some-extension', [
('keys', stix2.properties.ListProperty(stix2.properties.DictionaryProperty, required=True)), ('keys', stix2.properties.ListProperty(stix2.properties.DictionaryProperty, required=True)),
], ],
) )
@ -769,52 +769,10 @@ def test_custom_extension_with_list_and_dict_properties_observable_type(data):
assert data == str(example) assert data == str(example)
def test_custom_extension_invalid_observable():
# These extensions are being applied to improperly-created Observables.
# The Observable classes should have been created with the CustomObservable decorator.
class Foo(object):
pass
with pytest.raises(ValueError) as excinfo:
@stix2.v20.CustomExtension(
Foo, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class FooExtension():
pass # pragma: no cover
assert str(excinfo.value) == "'observable' must be a valid Observable class!"
class Bar(stix2.v20.observables._Observable):
pass
with pytest.raises(ValueError) as excinfo:
@stix2.v20.CustomExtension(
Bar, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class BarExtension():
pass
assert "Unknown observable type" in str(excinfo.value)
assert "Custom observables must be created with the @CustomObservable decorator." in str(excinfo.value)
class Baz(stix2.v20.observables._Observable):
_type = 'Baz'
with pytest.raises(ValueError) as excinfo:
@stix2.v20.CustomExtension(
Baz, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class BazExtension():
pass
assert "Unknown observable type" in str(excinfo.value)
assert "Custom observables must be created with the @CustomObservable decorator." in str(excinfo.value)
def test_custom_extension_invalid_type_name(): def test_custom_extension_invalid_type_name():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.File, 'x', { 'x', {
'property1': stix2.properties.StringProperty(required=True), 'property1': stix2.properties.StringProperty(required=True),
}, },
) )
@ -824,7 +782,7 @@ def test_custom_extension_invalid_type_name():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.File, 'x_new_ext', { 'x_new_ext', {
'property1': stix2.properties.StringProperty(required=True), 'property1': stix2.properties.StringProperty(required=True),
}, },
) )
@ -835,28 +793,28 @@ def test_custom_extension_invalid_type_name():
def test_custom_extension_no_properties(): def test_custom_extension_no_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v20.CustomExtension(stix2.v20.DomainName, 'x-new-ext2', None) @stix2.v20.CustomExtension('x-new-ext2', None)
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_empty_properties(): def test_custom_extension_empty_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v20.CustomExtension(stix2.v20.DomainName, 'x-new-ext2', []) @stix2.v20.CustomExtension('x-new-ext2', [])
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_dict_properties(): def test_custom_extension_dict_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v20.CustomExtension(stix2.v20.DomainName, 'x-new-ext2', {}) @stix2.v20.CustomExtension('x-new-ext2', {})
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_no_init_1(): def test_custom_extension_no_init_1():
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.DomainName, 'x-new-extension', [ 'x-new-extension', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -869,7 +827,7 @@ def test_custom_extension_no_init_1():
def test_custom_extension_no_init_2(): def test_custom_extension_no_init_2():
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.DomainName, 'x-new-ext2', [ 'x-new-ext2', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -986,7 +944,7 @@ def test_register_custom_object():
def test_extension_property_location(): def test_extension_property_location():
assert 'extensions' in stix2.v20.OBJ_MAP_OBSERVABLE['x-new-observable']._properties assert 'extensions' in stix2.v20.OBJ_MAP_OBSERVABLE['x-new-observable']._properties
assert 'extensions' not in stix2.v20.EXT_MAP['domain-name']['x-new-ext']._properties assert 'extensions' not in stix2.v20.EXT_MAP['x-new-ext']._properties
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -1107,7 +1065,7 @@ def test_register_marking_with_version():
def test_register_observable_extension_with_version(): def test_register_observable_extension_with_version():
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.UserAccount, 'some-extension-2', [ 'some-extension-2', [
('keys', stix2.properties.StringProperty(required=True)), ('keys', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -1117,13 +1075,13 @@ def test_register_observable_extension_with_version():
v = 'v20' v = 'v20'
example = SomeCustomExtension2(keys='test123') example = SomeCustomExtension2(keys='test123')
assert example._type in parsing.STIX2_OBJ_MAPS[v]['observable-extensions']['user-account'] assert example._type in parsing.STIX2_OBJ_MAPS[v]['extensions']
def test_register_duplicate_observable_extension(): def test_register_duplicate_observable_extension():
with pytest.raises(DuplicateRegistrationError) as excinfo: with pytest.raises(DuplicateRegistrationError) as excinfo:
@stix2.v20.CustomExtension( @stix2.v20.CustomExtension(
stix2.v20.UserAccount, 'some-extension-2', [ 'some-extension-2', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),
], ],

View File

@ -213,7 +213,7 @@ def test_embedded_property():
def test_extension_property_valid(): def test_extension_property_valid():
ext_prop = ExtensionsProperty(spec_version="2.0", enclosing_type='file') ext_prop = ExtensionsProperty(spec_version="2.0")
assert ext_prop({ assert ext_prop({
'windows-pebinary-ext': { 'windows-pebinary-ext': {
'pe_type': 'exe', 'pe_type': 'exe',
@ -222,13 +222,13 @@ def test_extension_property_valid():
def test_extension_property_invalid1(): def test_extension_property_invalid1():
ext_prop = ExtensionsProperty(spec_version="2.0", enclosing_type='file') ext_prop = ExtensionsProperty(spec_version="2.0")
with pytest.raises(ValueError): with pytest.raises(ValueError):
ext_prop.clean(1) ext_prop.clean(1)
def test_extension_property_invalid2(): def test_extension_property_invalid2():
ext_prop = ExtensionsProperty(spec_version="2.0", enclosing_type='file') ext_prop = ExtensionsProperty(spec_version="2.0")
with pytest.raises(CustomContentError): with pytest.raises(CustomContentError):
ext_prop.clean( ext_prop.clean(
{ {
@ -239,19 +239,6 @@ def test_extension_property_invalid2():
) )
def test_extension_property_invalid_type():
ext_prop = ExtensionsProperty(spec_version="2.0", enclosing_type='indicator')
with pytest.raises(CustomContentError) as excinfo:
ext_prop.clean(
{
'windows-pebinary-ext': {
'pe_type': 'exe',
},
},
)
assert "Can't parse unknown extension" in str(excinfo.value)
def test_extension_at_least_one_property_constraint(): def test_extension_at_least_one_property_constraint():
with pytest.raises(AtLeastOnePropertyError): with pytest.raises(AtLeastOnePropertyError):
stix2.v20.TCPExt() stix2.v20.TCPExt()

View File

@ -893,7 +893,7 @@ def test_custom_observable_object_no_id_contrib_props():
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new-ext', [ 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),
], ],
@ -955,7 +955,7 @@ def test_custom_extension_wrong_observable_type():
) )
def test_custom_extension_with_list_and_dict_properties_observable_type(data): def test_custom_extension_with_list_and_dict_properties_observable_type(data):
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.UserAccount, 'x-some-extension-ext', [ 'x-some-extension-ext', [
('keys', stix2.properties.ListProperty(stix2.properties.DictionaryProperty, required=True)), ('keys', stix2.properties.ListProperty(stix2.properties.DictionaryProperty, required=True)),
], ],
) )
@ -966,52 +966,10 @@ def test_custom_extension_with_list_and_dict_properties_observable_type(data):
assert data == str(example) assert data == str(example)
def test_custom_extension_invalid_observable():
# These extensions are being applied to improperly-created Observables.
# The Observable classes should have been created with the CustomObservable decorator.
class Foo(object):
pass
with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension(
Foo, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class FooExtension():
pass # pragma: no cover
assert str(excinfo.value) == "'observable' must be a valid Observable class!"
class Bar(stix2.v21.observables._Observable):
pass
with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension(
Bar, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class BarExtension():
pass
assert "Unknown observable type" in str(excinfo.value)
assert "Custom observables must be created with the @CustomObservable decorator." in str(excinfo.value)
class Baz(stix2.v21.observables._Observable):
_type = 'Baz'
with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension(
Baz, 'x-new-ext', [
('property1', stix2.properties.StringProperty(required=True)),
],
)
class BazExtension():
pass
assert "Unknown observable type" in str(excinfo.value)
assert "Custom observables must be created with the @CustomObservable decorator." in str(excinfo.value)
def test_custom_extension_invalid_type_name(): def test_custom_extension_invalid_type_name():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.File, 'x', { 'x', {
'property1': stix2.properties.StringProperty(required=True), 'property1': stix2.properties.StringProperty(required=True),
}, },
) )
@ -1021,7 +979,7 @@ def test_custom_extension_invalid_type_name():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.File, 'x_new_ext', { 'x_new_ext', {
'property1': stix2.properties.StringProperty(required=True), 'property1': stix2.properties.StringProperty(required=True),
}, },
) )
@ -1031,7 +989,7 @@ def test_custom_extension_invalid_type_name():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.File, '7x-new-ext', { '7x-new-ext', {
'property1': stix2.properties.StringProperty(required=True), 'property1': stix2.properties.StringProperty(required=True),
}, },
) )
@ -1042,28 +1000,28 @@ def test_custom_extension_invalid_type_name():
def test_custom_extension_no_properties(): def test_custom_extension_no_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v21.CustomExtension(stix2.v21.DomainName, 'x-new2-ext', None) @stix2.v21.CustomExtension('x-new2-ext', None)
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_empty_properties(): def test_custom_extension_empty_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v21.CustomExtension(stix2.v21.DomainName, 'x-new2-ext', []) @stix2.v21.CustomExtension('x-new2-ext', [])
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_dict_properties(): def test_custom_extension_dict_properties():
with pytest.raises(ValueError): with pytest.raises(ValueError):
@stix2.v21.CustomExtension(stix2.v21.DomainName, 'x-new2-ext', {}) @stix2.v21.CustomExtension('x-new2-ext', {})
class BarExtension(): class BarExtension():
pass pass
def test_custom_extension_no_init_1(): def test_custom_extension_no_init_1():
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new-extension-ext', [ 'x-new-extension-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -1076,7 +1034,7 @@ def test_custom_extension_no_init_1():
def test_custom_extension_no_init_2(): def test_custom_extension_no_init_2():
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new2-ext', [ 'x-new2-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -1090,7 +1048,7 @@ def test_custom_extension_no_init_2():
def test_invalid_custom_property_in_extension(): def test_invalid_custom_property_in_extension():
with pytest.raises(ValueError) as excinfo: with pytest.raises(ValueError) as excinfo:
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new3-ext', [ 'x-new3-ext', [
('6property1', stix2.properties.StringProperty(required=True)), ('6property1', stix2.properties.StringProperty(required=True)),
], ],
) )
@ -1205,7 +1163,7 @@ def test_register_custom_object():
def test_extension_property_location(): def test_extension_property_location():
assert 'extensions' in stix2.v21.OBJ_MAP_OBSERVABLE['x-new-observable']._properties assert 'extensions' in stix2.v21.OBJ_MAP_OBSERVABLE['x-new-observable']._properties
assert 'extensions' not in stix2.v21.EXT_MAP['domain-name']['x-new-ext']._properties assert 'extensions' not in stix2.v21.EXT_MAP['x-new-ext']._properties
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -1312,7 +1270,7 @@ def test_register_duplicate_observable():
def test_register_observable_custom_extension(): def test_register_observable_custom_extension():
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new-2-ext', [ 'x-new-2-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),
], ],
@ -1324,13 +1282,13 @@ def test_register_observable_custom_extension():
v = 'v21' v = 'v21'
assert 'domain-name' in stix2.parsing.STIX2_OBJ_MAPS[v]['observables'] assert 'domain-name' in stix2.parsing.STIX2_OBJ_MAPS[v]['observables']
assert example._type in stix2.parsing.STIX2_OBJ_MAPS[v]['observable-extensions']['domain-name'] assert example._type in stix2.parsing.STIX2_OBJ_MAPS[v]['extensions']
def test_register_duplicate_observable_extension(): def test_register_duplicate_observable_extension():
with pytest.raises(DuplicateRegistrationError) as excinfo: with pytest.raises(DuplicateRegistrationError) as excinfo:
@stix2.v21.CustomExtension( @stix2.v21.CustomExtension(
stix2.v21.DomainName, 'x-new-2-ext', [ 'x-new-2-ext', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),
], ],

View File

@ -48,11 +48,7 @@ def test_no_contrib_props_defined():
_properties = OrderedDict(( _properties = OrderedDict((
('type', TypeProperty(_type, spec_version='2.1')), ('type', TypeProperty(_type, spec_version='2.1')),
('id', IDProperty(_type, spec_version='2.1')), ('id', IDProperty(_type, spec_version='2.1')),
( ('extensions', ExtensionsProperty(spec_version='2.1')),
'extensions', ExtensionsProperty(
spec_version='2.1', enclosing_type=_type,
),
),
)) ))
_id_contributing_properties = [] _id_contributing_properties = []
@ -69,11 +65,7 @@ def test_json_compatible_prop_values():
_properties = OrderedDict(( _properties = OrderedDict((
('type', TypeProperty(_type, spec_version='2.1')), ('type', TypeProperty(_type, spec_version='2.1')),
('id', IDProperty(_type, spec_version='2.1')), ('id', IDProperty(_type, spec_version='2.1')),
( ('extensions', ExtensionsProperty(spec_version='2.1')),
'extensions', ExtensionsProperty(
spec_version='2.1', enclosing_type=_type,
),
),
('string', StringProperty()), ('string', StringProperty()),
('int', IntegerProperty()), ('int', IntegerProperty()),
('float', FloatProperty()), ('float', FloatProperty()),
@ -109,11 +101,7 @@ def test_json_incompatible_timestamp_value():
_properties = OrderedDict(( _properties = OrderedDict((
('type', TypeProperty(_type, spec_version='2.1')), ('type', TypeProperty(_type, spec_version='2.1')),
('id', IDProperty(_type, spec_version='2.1')), ('id', IDProperty(_type, spec_version='2.1')),
( ('extensions', ExtensionsProperty(spec_version='2.1')),
'extensions', ExtensionsProperty(
spec_version='2.1', enclosing_type=_type,
),
),
('timestamp', TimestampProperty()), ('timestamp', TimestampProperty()),
)) ))
_id_contributing_properties = ['timestamp'] _id_contributing_properties = ['timestamp']
@ -145,11 +133,7 @@ def test_embedded_object():
_properties = OrderedDict(( _properties = OrderedDict((
('type', TypeProperty(_type, spec_version='2.1')), ('type', TypeProperty(_type, spec_version='2.1')),
('id', IDProperty(_type, spec_version='2.1')), ('id', IDProperty(_type, spec_version='2.1')),
( ('extensions', ExtensionsProperty(spec_version='2.1')),
'extensions', ExtensionsProperty(
spec_version='2.1', enclosing_type=_type,
),
),
('sub_obj', EmbeddedObjectProperty(type=SubObj)), ('sub_obj', EmbeddedObjectProperty(type=SubObj)),
)) ))
_id_contributing_properties = ['sub_obj'] _id_contributing_properties = ['sub_obj']
@ -176,11 +160,7 @@ def test_empty_hash():
_properties = OrderedDict(( _properties = OrderedDict((
('type', TypeProperty(_type, spec_version='2.1')), ('type', TypeProperty(_type, spec_version='2.1')),
('id', IDProperty(_type, spec_version='2.1')), ('id', IDProperty(_type, spec_version='2.1')),
( ('extensions', ExtensionsProperty(spec_version='2.1')),
'extensions', ExtensionsProperty(
spec_version='2.1', enclosing_type=_type,
),
),
('hashes', HashesProperty()), ('hashes', HashesProperty()),
)) ))
_id_contributing_properties = ['hashes'] _id_contributing_properties = ['hashes']

View File

@ -10,13 +10,9 @@ MALWARE_ANALYSIS_JSON = """{
"type": "malware-analysis", "type": "malware-analysis",
"spec_version": "2.1", "spec_version": "2.1",
"id": "malware-analysis--f8afc020-f92f-4906-a971-88ee5882eb46", "id": "malware-analysis--f8afc020-f92f-4906-a971-88ee5882eb46",
"created_by_ref": "identity--e0353ed3-991e-4f71-a332-114c2f10b84f",
"created": "2017-11-28T09:44:58.418Z", "created": "2017-11-28T09:44:58.418Z",
"modified": "2017-12-31T21:27:49.754Z", "modified": "2017-12-31T21:27:49.754Z",
"created_by_ref": "identity--e0353ed3-991e-4f71-a332-114c2f10b84f",
"labels": [
"label1",
"label2"
],
"product": "Acme Malware Analyzer", "product": "Acme Malware Analyzer",
"version": "2.5", "version": "2.5",
"host_vm_ref": "software--1bda7336-fe67-469f-a8ca-ab6268b0449b", "host_vm_ref": "software--1bda7336-fe67-469f-a8ca-ab6268b0449b",
@ -40,7 +36,11 @@ MALWARE_ANALYSIS_JSON = """{
"file--fc27e371-6c88-4c5c-868a-4dda0e60b167", "file--fc27e371-6c88-4c5c-868a-4dda0e60b167",
"url--6f7a74cd-8eb2-4b88-a4da-aa878e50ac2e" "url--6f7a74cd-8eb2-4b88-a4da-aa878e50ac2e"
], ],
"sample_ref": "email-addr--499a32d7-74c1-4276-ace9-725ac933e243" "sample_ref": "email-addr--499a32d7-74c1-4276-ace9-725ac933e243",
"labels": [
"label1",
"label2"
]
}""" }"""

View File

@ -244,7 +244,7 @@ def test_embedded_property():
def test_extension_property_valid(): def test_extension_property_valid():
ext_prop = ExtensionsProperty(spec_version='2.1', enclosing_type='file') ext_prop = ExtensionsProperty(spec_version='2.1')
assert ext_prop({ assert ext_prop({
'windows-pebinary-ext': { 'windows-pebinary-ext': {
'pe_type': 'exe', 'pe_type': 'exe',
@ -253,13 +253,13 @@ def test_extension_property_valid():
def test_extension_property_invalid1(): def test_extension_property_invalid1():
ext_prop = ExtensionsProperty(spec_version='2.1', enclosing_type='file') ext_prop = ExtensionsProperty(spec_version='2.1')
with pytest.raises(ValueError): with pytest.raises(ValueError):
ext_prop.clean(1) ext_prop.clean(1)
def test_extension_property_invalid2(): def test_extension_property_invalid2():
ext_prop = ExtensionsProperty(spec_version='2.1', enclosing_type='file') ext_prop = ExtensionsProperty(spec_version='2.1')
with pytest.raises(CustomContentError): with pytest.raises(CustomContentError):
ext_prop.clean( ext_prop.clean(
{ {
@ -270,19 +270,6 @@ def test_extension_property_invalid2():
) )
def test_extension_property_invalid_type():
ext_prop = ExtensionsProperty(spec_version='2.1', enclosing_type='indicator')
with pytest.raises(CustomContentError) as excinfo:
ext_prop.clean(
{
'windows-pebinary-ext': {
'pe_type': 'exe',
},
},
)
assert "Can't parse unknown extension" in str(excinfo.value)
def test_extension_at_least_one_property_constraint(): def test_extension_at_least_one_property_constraint():
with pytest.raises(AtLeastOnePropertyError): with pytest.raises(AtLeastOnePropertyError):
stix2.v21.TCPExt() stix2.v21.TCPExt()