test for: transfer_type_explorers_only_once

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-14 23:42:16 +02:00
parent 1e57ae469e
commit c38959699f

View file

@ -95,6 +95,20 @@ class ExplorerClassTestCase(unittest.TestCase):
destination = os.path.join(self.remote.type_path, cdist_type.explorer_path)
self.assertEqual(os.listdir(source), os.listdir(destination))
def test_transfer_type_explorers_only_once(self):
cdist_type = core.Type(self.local.type_path, '__test_type')
# first transfer
self.explorer.transfer_type_explorers(cdist_type)
source = os.path.join(self.local.type_path, cdist_type.explorer_path)
destination = os.path.join(self.remote.type_path, cdist_type.explorer_path)
self.assertEqual(os.listdir(source), os.listdir(destination))
# nuke destination folder content, but recreate directory
shutil.rmtree(destination)
os.makedirs(destination)
# second transfer, should not happen
self.explorer.transfer_type_explorers(cdist_type)
self.assertFalse(os.listdir(destination))
def test_transfer_object_parameters(self):
cdist_type = core.Type(self.local.type_path, '__test_type')
cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')