How to use the mackup.constants.ENGINE_BOX function in mackup

To help you get started, we’ve selected a few mackup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lra / mackup / tests / config_tests.py View on Github external
def test_config_engine_box(self):
        cfg = Config("mackup-engine-box.cfg")

        assert isinstance(cfg.engine, str)
        assert cfg.engine == ENGINE_BOX

        assert isinstance(cfg.path, str)
        assert cfg.path == u"/Users/whatever/Box Sync"

        assert isinstance(cfg.directory, str)
        assert cfg.directory == u"some_weirder_name"

        assert isinstance(cfg.fullpath, str)
        assert cfg.fullpath == u"/Users/whatever/Box Sync/some_weirder_name"

        assert cfg.apps_to_ignore == set()
        assert cfg.apps_to_sync == set()
github lra / mackup / mackup / config.py View on Github external
def _parse_path(self):
        """
        Parse the storage path in the config.

        Returns:
            str
        """
        if self.engine == ENGINE_DROPBOX:
            path = get_dropbox_folder_location()
        elif self.engine == ENGINE_GDRIVE:
            path = get_google_drive_folder_location()
        elif self.engine == ENGINE_COPY:
            path = get_copy_folder_location()
        elif self.engine == ENGINE_ICLOUD:
            path = get_icloud_folder_location()
        elif self.engine == ENGINE_BOX:
            path = get_box_folder_location()
        elif self.engine == ENGINE_FS:
            if self._parser.has_option("storage", "path"):
                cfg_path = self._parser.get("storage", "path")
                path = os.path.join(os.environ["HOME"], cfg_path)
            else:
                raise ConfigError(
                    "The required 'path' can't be found while"
                    " the 'file_system' engine is used."
                )

        return str(path)