summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Topol <btopol@us.ibm.com>2015-04-11 23:30:28 -0500
committerBrad Topol <btopol@us.ibm.com>2015-05-03 14:32:35 -0500
commit4aa2c3e9680c181bf5bc1925b8f2f0b760f2109b (patch)
treebaefc1f9b395d367f771d9c41e3897a61995aced
parentf436f9bcdf7f38141f4287721ba23ab80f14258c (diff)
downloadpycadf-4aa2c3e9680c181bf5bc1925b8f2f0b760f2109b.tar.gz
Add unit tests to increase coverage of cadftype
Unit tests were added to bring test coverage of cadftype up to 98%. Coverage was increased for ValidatorDescriptor and CADFAbstractType. Change-Id: I66ea3455999df92251212fac89ea3c95d57f6655
-rw-r--r--pycadf/tests/test_cadf_spec.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pycadf/tests/test_cadf_spec.py b/pycadf/tests/test_cadf_spec.py
index 577f429..9ba9676 100644
--- a/pycadf/tests/test_cadf_spec.py
+++ b/pycadf/tests/test_cadf_spec.py
@@ -13,8 +13,10 @@
# the License.
import time
+import uuid
from pycadf import attachment
+from pycadf import cadftype
from pycadf import credential
from pycadf import endpoint
from pycadf import event
@@ -296,3 +298,24 @@ class TestCADFSpec(base.TestCase):
target=resource.Resource(typeURI='storage'),
observer=resource.Resource(id='target'),
outcome='success'))
+
+ def _create_none_validator_descriptor(self):
+ class Owner(object):
+ x = cadftype.ValidatorDescriptor(uuid.uuid4().hex)
+
+ owner = Owner()
+ owner.x = None
+
+ def test_invalid_value_descriptor(self):
+ """Test setting a ValidatorDescriptor to None results in ValueError"""
+
+ self.assertRaises(ValueError, self._create_none_validator_descriptor)
+
+ def test_cadfabstracttype_attribute_error(self):
+ """Test an invalid CADFAbstractType attribute is set returns False"""
+
+ h = host.Host(id=identifier.generate_uuid(),
+ address='192.168.0.1',
+ agent='client',
+ platform='AIX')
+ self.assertEqual(h._isset(uuid.uuid4().hex), False)