def __init__(self, conf):
     """conf is preupg.conf.Conf object, contains configuration"""
     self.conf = conf
     if self.conf.debug is None:
         LoggerHelper.add_stream_handler(logger, logging.INFO)
     else:
         LoggerHelper.add_stream_handler(logger, logging.DEBUG)
     self.ui_helper = UIHelper(self.conf.maindir)
Esempio n. 2
0
    def test_create_properties_ini(self):
        """ Create valid properties.ini file """
        ini_content = [
            "[preupgrade-assistant-modules]", "src_major_version = 6",
            "dst_major_version = 7", ""
        ]

        ui = UIHelper()
        ui.src_version = 6
        ui.dst_version = 7

        tmp_file_name = tempfile.mkstemp()[1]
        ui.properties_ini_path = tmp_file_name
        ui.create_properties_ini()
        tmp_content = load_file(tmp_file_name)
        self.assertEqual(tmp_content, ini_content)
        os.remove(tmp_file_name)
Esempio n. 3
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp()
     self.upgrade_dir = os.path.join(self.tempdir, "FOOBAR6_7")
     os.makedirs(self.upgrade_dir)
     self.puh = UIHelper(self.upgrade_dir)
     self.puh._group_name = self.group_name
     self.puh._content_name = self.content_name
     self.puh.check_script = True
     self.puh.solution_file = True
     self.content_dict['content_title'] = "foobar_test_title"
     self.content_dict[
         'content_description'] = "Foobar content test description"
     self.puh.content_dict = self.content_dict
     self.puh.content_path = os.path.join(self.puh.get_group_name(),
                                          self.puh.get_content_name())
     if os.path.exists(self.puh.get_content_path()):
         shutil.rmtree(self.puh.get_content_path())
     os.makedirs(self.puh.get_content_path())