commit
f937e2bb3f
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from .other import ExternalReference, GranularMarking
|
from .other import ExternalReference, GranularMarking
|
||||||
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
|
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
|
||||||
TimestampProperty)
|
StringProperty, TimestampProperty)
|
||||||
from .utils import NOW
|
from .utils import NOW
|
||||||
|
|
||||||
COMMON_PROPERTIES = {
|
COMMON_PROPERTIES = {
|
||||||
|
@ -11,6 +11,7 @@ COMMON_PROPERTIES = {
|
||||||
'modified': TimestampProperty(default=lambda: NOW),
|
'modified': TimestampProperty(default=lambda: NOW),
|
||||||
'external_references': ListProperty(ExternalReference),
|
'external_references': ListProperty(ExternalReference),
|
||||||
'revoked': BooleanProperty(),
|
'revoked': BooleanProperty(),
|
||||||
|
'labels': ListProperty(StringProperty),
|
||||||
'created_by_ref': ReferenceProperty(type="identity"),
|
'created_by_ref': ReferenceProperty(type="identity"),
|
||||||
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")),
|
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")),
|
||||||
'granular_markings': ListProperty(GranularMarking),
|
'granular_markings': ListProperty(GranularMarking),
|
||||||
|
|
|
@ -57,7 +57,6 @@ class Identity(_STIXBase):
|
||||||
_properties.update({
|
_properties.update({
|
||||||
'type': TypeProperty(_type),
|
'type': TypeProperty(_type),
|
||||||
'id': IDProperty(_type),
|
'id': IDProperty(_type),
|
||||||
'labels': ListProperty(StringProperty),
|
|
||||||
'name': StringProperty(required=True),
|
'name': StringProperty(required=True),
|
||||||
'description': StringProperty(),
|
'description': StringProperty(),
|
||||||
'identity_class': StringProperty(required=True),
|
'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.external_references[0].source_name == 'capec'
|
||||||
assert ap.name == "Spear Phishing"
|
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
|
# TODO: Add other examples
|
||||||
|
|
Loading…
Reference in New Issue