Use correct property classes for ExternalReference

stix2.1
clenk 2017-04-17 14:15:01 -04:00
parent 40810646fb
commit cf0b56c04f
2 changed files with 7 additions and 6 deletions

View File

@ -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(),
}

View File

@ -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