From af367a76f8f1c9c2ea838b5f8f28db3d6e4e2d6f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:41:38 +0200 Subject: [PATCH] test for: .cdist may not be used in object_id Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 9a13f524..84d2cf8f 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -53,12 +53,18 @@ class ObjectClassTestCase(unittest.TestCase): class ObjectIdTestCase(unittest.TestCase): - def test_illegal_object_id(self): + def test_object_id_starts_with_slash(self): cdist_type = core.Type(type_base_path, '__third') illegal_object_id = '/object_id/may/not/start/with/slash' with self.assertRaises(core.IllegalObjectIdError): core.Object(cdist_type, object_base_path, illegal_object_id) + def test_object_id_contains_dotcdist(self): + cdist_type = core.Type(type_base_path, '__third') + illegal_object_id = 'object_id/may/not/contain/.cdist/anywhere' + with self.assertRaises(core.IllegalObjectIdError): + core.Object(cdist_type, object_base_path, illegal_object_id) + class ObjectTestCase(unittest.TestCase):