class TestMockBuilder(unittest.TestCase): def setUp(self): logging.basicConfig( level=logging.NOTSET, format= '%(asctime)s %(levelname)s %(name)s pid(%(process)d) Message: %(message)s', filename='/tmp/imagefactory-unittests.log') self.template = Template("<template></template>") self.target = "mock" self.builder = MockBuilder(self.template, self.target) def tearDown(self): del self.builder del self.template del self.target def testImplementsIBuilder(self): self.assert_( IBuilder.implementedBy(MockBuilder), 'MockBuilder does not implement the ImageBuilder interface...') def testInit(self): self.assertIn(self.builder.template, (self.template, self.builder.new_image_id)) self.assertEqual(self.builder.target, self.target) def testBuildImage(self): self.builder.build_image() self.assertEqual(self.builder.status, "COMPLETED") self.assert_(os.path.exists(self.builder.image))
def setUp(self): logging.basicConfig( level=logging.NOTSET, format= '%(asctime)s %(levelname)s %(name)s pid(%(process)d) Message: %(message)s', filename='/tmp/imagefactory-unittests.log') self.template = Template("<template></template>") self.target = "mock" self.builder = MockBuilder(self.template, self.target)
def testTemplateFramImageID(self): template_id = self.warehouse.store_template(self.template_xml) template = Template(template_id) target = "mock" builder = MockBuilder(self.template_xml, target) builder.build_image() metadata = dict(template=template_id, target=target, icicle="None", target_parameters="None") self.warehouse.store_target_image(builder.new_image_id, builder.image, metadata=metadata) image_template = Template(builder.new_image_id) self.assertEqual(template_id, image_template.identifier) self.assertEqual(self.template_xml, image_template.xml) self.assertIsNone(template.url)
class TestMockBuilder(unittest.TestCase): def setUp(self): logging.basicConfig(level=logging.NOTSET, format='%(asctime)s %(levelname)s %(name)s pid(%(process)d) Message: %(message)s', filename='/tmp/imagefactory-unittests.log') self.template = Template("<template></template>") self.target = "mock" self.builder = MockBuilder(self.template, self.target) def tearDown(self): del self.builder del self.template del self.target def testImplementsIBuilder(self): self.assert_(IBuilder.implementedBy(MockBuilder), 'MockBuilder does not implement the ImageBuilder interface...') def testInit(self): self.assertIn(self.builder.template, (self.template, self.builder.new_image_id)) self.assertEqual(self.builder.target, self.target) def testBuildImage(self): self.builder.build_image() self.assertEqual(self.builder.status, "COMPLETED") self.assert_(os.path.exists(self.builder.image))
def setUp(self): logging.basicConfig(level=logging.NOTSET, format='%(asctime)s %(levelname)s %(name)s pid(%(process)d) Message: %(message)s', filename='/tmp/imagefactory-unittests.log') self.template = Template("<template></template>") self.target = "mock" self.builder = MockBuilder(self.template, self.target)