Merge branch 'master' into autorequire

Conflicts:
	lib/cdist/test/emulator/__init__.py

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-11-15 10:47:16 +01:00
commit f36d09289d
17 changed files with 445 additions and 21 deletions

View file

@ -74,6 +74,21 @@ class EmulatorTestCase(test.CdistTestCase):
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
import os.path as op
my_dir = op.abspath(op.dirname(__file__))

View file

@ -58,12 +58,18 @@ class ObjectIdTestCase(test.CdistTestCase):
with self.assertRaises(core.IllegalObjectIdError):
core.Object(cdist_type, object_base_path, illegal_object_id)
def test_object_id_contains_dotcdist(self):
def test_object_id_contains_object_marker(self):
cdist_type = core.Type(type_base_path, '__third')
illegal_object_id = 'object_id/may/not/contain/.cdist/anywhere'
illegal_object_id = 'object_id/may/not/contain/%s/anywhere' % core.OBJECT_MARKER
with self.assertRaises(core.IllegalObjectIdError):
core.Object(cdist_type, object_base_path, illegal_object_id)
def test_object_id_contains_object_marker_string(self):
cdist_type = core.Type(type_base_path, '__third')
illegal_object_id = 'object_id/may/contain_%s_in_filename' % core.OBJECT_MARKER
core.Object(cdist_type, object_base_path, illegal_object_id)
# if we get here, the test passed
class ObjectTestCase(test.CdistTestCase):