Add 'labels' property to COMMON_PROPERTIES
parent
85b5a1971b
commit
958e60b01d
|
@ -2,7 +2,7 @@
|
|||
|
||||
from .other import ExternalReference, GranularMarking
|
||||
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
|
||||
TimestampProperty)
|
||||
StringProperty, TimestampProperty)
|
||||
from .utils import NOW
|
||||
|
||||
COMMON_PROPERTIES = {
|
||||
|
@ -11,6 +11,7 @@ COMMON_PROPERTIES = {
|
|||
'modified': TimestampProperty(default=lambda: NOW),
|
||||
'external_references': ListProperty(ExternalReference),
|
||||
'revoked': BooleanProperty(),
|
||||
'labels': ListProperty(StringProperty),
|
||||
'created_by_ref': ReferenceProperty(type="identity"),
|
||||
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")),
|
||||
'granular_markings': ListProperty(GranularMarking),
|
||||
|
|
|
@ -57,7 +57,6 @@ class Identity(_STIXBase):
|
|||
_properties.update({
|
||||
'type': TypeProperty(_type),
|
||||
'id': IDProperty(_type),
|
||||
'labels': ListProperty(StringProperty),
|
||||
'name': StringProperty(required=True),
|
||||
'description': StringProperty(),
|
||||
'identity_class': StringProperty(required=True),
|
||||
|
|
|
@ -67,4 +67,15 @@ def test_parse_attack_pattern(data):
|
|||
assert ap.external_references[0].source_name == 'capec'
|
||||
assert ap.name == "Spear Phishing"
|
||||
|
||||
|
||||
def test_attack_pattern_invalid_labels():
|
||||
with pytest.raises(stix2.exceptions.InvalidValueError):
|
||||
stix2.AttackPattern(
|
||||
id="attack-pattern--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061",
|
||||
created="2016-05-12T08:17:27Z",
|
||||
modified="2016-05-12T08:17:27Z",
|
||||
name="Spear Phishing",
|
||||
labels=1
|
||||
)
|
||||
|
||||
# TODO: Add other examples
|
||||
|
|
Loading…
Reference in New Issue