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

View File

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