def testTemplateFromImageID(self):
     template_id = self.warehouse.store_template(self.template_xml)
     template = Template(template_id)
     target = "mock"
     builder = Mock_Builder(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)
Ejemplo n.º 2
0
 def testTemplateFromImageID(self):
     template_id = self.warehouse.store_template(self.template_xml)
     template = Template(template_id)
     target = "mock"
     builder = Mock_Builder(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.assertFalse(template.url)
Ejemplo n.º 3
0
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 = Mock_Builder(self.template, self.target)

    def tearDown(self):
        del self.builder
        del self.template
        del self.target

    def testImplementsIBuilder(self):
        self.assert_(IBuilder.implementedBy(Mock_Builder), 'Mock_Builder does not implement the ImageBuilder interface...')

    def testInit(self):
        self.assertEqual(self.builder.template, self.template)
        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))
Ejemplo n.º 4
0
 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 = Mock_Builder(self.template, self.target)