Add test for CustomMarking. closes #109

stix2.0
Emmanuelle Vargas-Gonzalez 2017-11-15 13:12:00 -05:00
parent fbce8f15fe
commit e6a8b555d3
1 changed files with 20 additions and 0 deletions

View File

@ -94,6 +94,26 @@ def test_custom_property_in_bundled_object():
assert '"x_foo": "bar"' in str(bundle) assert '"x_foo": "bar"' in str(bundle)
def test_custom_marking_no_init():
@stix2.CustomMarking('x-new-obj', [
('property1', stix2.properties.StringProperty(required=True)),
])
class NewObj():
pass
no = NewObj(property1='something')
assert no.property1 == 'something'
@stix2.CustomMarking('x-new-obj2', [
('property1', stix2.properties.StringProperty(required=True)),
])
class NewObj2(object):
pass
no2 = NewObj2(property1='something')
assert no2.property1 == 'something'
@stix2.sdo.CustomObject('x-new-type', [ @stix2.sdo.CustomObject('x-new-type', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),
('property2', stix2.properties.IntegerProperty()), ('property2', stix2.properties.IntegerProperty()),