From efedfbf47c2cd184d8827c050ba23ffb4b5cb227 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 15:44:12 +0100 Subject: [PATCH] test for singleton requirement Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 91150334..8f1b9776 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -73,3 +73,18 @@ class EmulatorTestCase(test.CdistTestCase): os.environ['require'] = '__file/bad/id/with/.cdist/inside' emu = emulator.Emulator(argv) self.assertRaises(core.IllegalObjectIdError, emu.run) + + def test_missing_object_id_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__file' + emu = emulator.Emulator(argv) + self.assertRaises(emulator.IllegalRequirementError, emu.run) + + def test_singleton_object_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__issue' + emu = emulator.Emulator(argv) + emu.run() + # if we get here all is fine