Use correct property classes for ExternalReference
parent
40810646fb
commit
cf0b56c04f
|
@ -19,10 +19,10 @@ COMMON_PROPERTIES = {
|
|||
|
||||
class ExternalReference(_STIXBase):
|
||||
_properties = {
|
||||
'source_name': Property(required=True),
|
||||
'description': Property(),
|
||||
'url': Property(),
|
||||
'external_id': Property(),
|
||||
'source_name': StringProperty(required=True),
|
||||
'description': StringProperty(),
|
||||
'url': StringProperty(),
|
||||
'external_id': StringProperty(),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Tests for stix.ExternalReference"""
|
||||
|
||||
import pytest
|
||||
import re
|
||||
|
||||
import stix2
|
||||
|
||||
|
@ -34,7 +35,7 @@ def test_external_reference_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 = """{
|
||||
|
@ -101,7 +102,7 @@ def test_external_reference_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
|
||||
assert eval("stix2." + repr(ref)) == ref
|
||||
|
||||
|
|
Loading…
Reference in New Issue