Esempio n. 1
0
    def test_target_invalid(self):
        """ test Initiator target path invalid, raise OSError
        """

        target_error = "/foo/bar/why/not"
        i = Initiator(self.config_file, target_error)
        self.assertRaises(OSError, lambda: i.init())
Esempio n. 2
0
    def test_target_invalid(self):
        """ test Initiator target path invalid, raise OSError
        """

        target_error = "/foo/bar/why/not"
        i = Initiator(self.config_file, target_error)
        self.assertRaises(OSError, lambda: i.init())
Esempio n. 3
0
def init_site(target_path):
    default_config_file = os.path.join(os.path.dirname(__file__),
                                       "conf_templates", "_config.yml.in")
    try:
        initiator = Initiator(default_config_file, target_path)
        initiator.init()
    except Exception:
        # always in debug mode when init site
        logging.exception("Initialize site with error:")
        sys.exit(1)
Esempio n. 4
0
def init_site(target_path):
    default_config_file = os.path.join(os.path.dirname(__file__),
                                       "conf_templates",
                                       "_config.yml.in")
    try:
        initiator = Initiator(default_config_file, target_path)
        initiator.init()
    except Exception:
        # always in debug mode when init site
        logging.exception("Initialize site with error:")
        sys.exit(1)
Esempio n. 5
0
    def test_target_exist(self):
        """ test Initiator target path exist
        """

        i = Initiator(self.config_file, self.target_path)
        i.init(ask=False)

        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
Esempio n. 6
0
    def test_target_exist(self):
        """ test Initiator target path exist
        """

        i = Initiator(self.config_file, self.target_path)
        i.init()

        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))