Repository: cloudpassage/cloudpassage-halo-python-sdk

Issue:
New ID format fails validation
Issue IDs for `/v3/issues` have a format like this:`be35b286-a36c-11e9-bb19-71dc777df26f`

This doesn't pass object ID validation.

Discussion:

Patch:
diff --git a/cloudpassage/sanity.py b/cloudpassage/sanity.py
index bb4bd7c..ec5b497 100644
--- a/cloudpassage/sanity.py
+++ b/cloudpassage/sanity.py
@@ -20,7 +20,7 @@ def validate_object_id(object_id):
 
     """
 
-    rex = re.compile('^[A-Za-z0-9]+$')
+    rex = re.compile('^[A-Za-z0-9-]+$')
     if is_it_a_string(object_id):
         if not rex.match(object_id):
             msg = "Object ID failed validation: {}".format(object_id)


Test patch:
diff --git a/tests/unit/test_unit_sanity.py b/tests/unit/test_unit_sanity.py
index 60eca25..763a1f3 100644
--- a/tests/unit/test_unit_sanity.py
+++ b/tests/unit/test_unit_sanity.py
@@ -8,11 +8,21 @@ class TestUnitSanity:
         sample_object_id = "951ffd865e4f11e59ba055477bd3e868"
         assert sanity.validate_object_id(sample_object_id)
 
+    def test_valid_object_id_hyphenated(self):
+        sample_object_id = "be35b286-a36c-11e9-bb19-71dc777df26f"
+        assert sanity.validate_object_id(sample_object_id)
+
     def test_valid_object_id_list(self):
         sample_object_id = ["951ffd865e4f11e59ba055477bd3e868",
                             "951ffd865e4f11e59ba055477bd3e999"]
         assert sanity.validate_object_id(sample_object_id)
 
+    def test_valid_object_id_list_mixed_format(self):
+        sample_object_id = ["951ffd865e4f11e59ba055477bd3e868",
+                            "951ffd865e4f11e59ba055477bd3e999",
+                            "be35b286-a36c-11e9-bb19-71dc777df26f"]
+        assert sanity.validate_object_id(sample_object_id)
+
     def test_invalid_object_id_list(self):
         rejected = False
         sample_object_id = ["951ffd865e4f11e59ba055477bd3e868",