Use correct property classes for ExternalReference
parent
40810646fb
commit
cf0b56c04f
|
@ -19,10 +19,10 @@ COMMON_PROPERTIES = {
|
||||||
|
|
||||||
class ExternalReference(_STIXBase):
|
class ExternalReference(_STIXBase):
|
||||||
_properties = {
|
_properties = {
|
||||||
'source_name': Property(required=True),
|
'source_name': StringProperty(required=True),
|
||||||
'description': Property(),
|
'description': StringProperty(),
|
||||||
'url': Property(),
|
'url': StringProperty(),
|
||||||
'external_id': Property(),
|
'external_id': StringProperty(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Tests for stix.ExternalReference"""
|
"""Tests for stix.ExternalReference"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import re
|
||||||
|
|
||||||
import stix2
|
import stix2
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ def test_external_reference_capec():
|
||||||
)
|
)
|
||||||
|
|
||||||
assert str(ref) == CAPEC
|
assert str(ref) == CAPEC
|
||||||
assert repr(ref) == "ExternalReference(external_id='CAPEC-550', source_name='capec')"
|
assert re.match("ExternalReference\(external_id=u?'CAPEC-550', source_name=u?'capec'\)", repr(ref))
|
||||||
|
|
||||||
|
|
||||||
CAPEC_URL = """{
|
CAPEC_URL = """{
|
||||||
|
@ -101,7 +102,7 @@ def test_external_reference_offline():
|
||||||
)
|
)
|
||||||
|
|
||||||
assert str(ref) == OFFLINE
|
assert str(ref) == OFFLINE
|
||||||
assert repr(ref) == "ExternalReference(description='Threat report', source_name='ACME Threat Intel')"
|
assert re.match("ExternalReference\(description=u?'Threat report', source_name=u?'ACME Threat Intel'\)", repr(ref))
|
||||||
# Yikes! This works
|
# Yikes! This works
|
||||||
assert eval("stix2." + repr(ref)) == ref
|
assert eval("stix2." + repr(ref)) == ref
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue