Modify UUID checking

stix2.1
clenk 2017-04-25 10:03:37 -04:00
parent cd815bfe84
commit c5ba5dad65
2 changed files with 3 additions and 3 deletions

View File

@ -149,9 +149,9 @@ class IDProperty(Property):
if not value.startswith(self.required_prefix):
raise ValueError("must start with '{0}'.".format(self.required_prefix))
try:
uuid.UUID(value.split('--', 1)[1], version=4)
uuid.UUID(value.split('--', 1)[1])
except Exception:
raise ValueError("must have a valid version 4 UUID after the prefix.")
raise ValueError("must have a valid UUID after the prefix.")
return value
def default(self):

View File

@ -86,7 +86,7 @@ def test_id_property():
assert str(excinfo.value) == "must start with 'my-type--'."
with pytest.raises(ValueError) as excinfo:
idprop.clean('my-type--foo')
assert str(excinfo.value) == "must have a valid version 4 UUID after the prefix."
assert str(excinfo.value) == "must have a valid UUID after the prefix."
assert idprop.clean(idprop.default())