Add revoked property
parent
e2f60bc8c5
commit
417b43b1fe
|
@ -24,6 +24,11 @@ REF_PROPERTY = {
|
||||||
'error_msg': "{type} {field} values must consist of a valid STIX type name and a valid UUID, separated by '--'."
|
'error_msg': "{type} {field} values must consist of a valid STIX type name and a valid UUID, separated by '--'."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL_PROPERTY = {
|
||||||
|
'validate': (lambda x, val: isinstance(val, bool)),
|
||||||
|
'error_msg': "{type} {field} value must be a boolean."
|
||||||
|
}
|
||||||
|
|
||||||
COMMON_PROPERTIES = {
|
COMMON_PROPERTIES = {
|
||||||
'type': TYPE_PROPERTY,
|
'type': TYPE_PROPERTY,
|
||||||
'id': ID_PROPERTY,
|
'id': ID_PROPERTY,
|
||||||
|
@ -33,6 +38,7 @@ COMMON_PROPERTIES = {
|
||||||
'modified': {
|
'modified': {
|
||||||
'default': NOW,
|
'default': NOW,
|
||||||
},
|
},
|
||||||
|
'revoked': BOOL_PROPERTY,
|
||||||
'created_by_ref': REF_PROPERTY
|
'created_by_ref': REF_PROPERTY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,12 @@ def test_indicator_created_ref_invalid_format():
|
||||||
assert str(excinfo.value) == "Indicator created_by_ref values must consist of a valid STIX type name and a valid UUID, separated by '--'."
|
assert str(excinfo.value) == "Indicator created_by_ref values must consist of a valid STIX type name and a valid UUID, separated by '--'."
|
||||||
|
|
||||||
|
|
||||||
|
def test_indicator_revoked_invalid():
|
||||||
|
with pytest.raises(ValueError) as excinfo:
|
||||||
|
indicator = stix2.Indicator(revoked='false', **INDICATOR_KWARGS)
|
||||||
|
assert str(excinfo.value) == "Indicator revoked value must be a boolean."
|
||||||
|
|
||||||
|
|
||||||
def test_cannot_assign_to_indicator_attributes(indicator):
|
def test_cannot_assign_to_indicator_attributes(indicator):
|
||||||
with pytest.raises(ValueError) as excinfo:
|
with pytest.raises(ValueError) as excinfo:
|
||||||
indicator.valid_from = dt.datetime.now()
|
indicator.valid_from = dt.datetime.now()
|
||||||
|
|
Loading…
Reference in New Issue