diff --git a/stix2/common.py b/stix2/common.py index 1ec8cca..f8e2981 100644 --- a/stix2/common.py +++ b/stix2/common.py @@ -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(), } diff --git a/stix2/test/test_external_reference.py b/stix2/test/test_external_reference.py index 5c39852..3b26675 100644 --- a/stix2/test/test_external_reference.py +++ b/stix2/test/test_external_reference.py @@ -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