Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_config_apps_to_ignore_and_sync(self):
cfg = Config("mackup-apps_to_ignore_and_sync.cfg")
assert isinstance(cfg.engine, str)
assert cfg.engine == ENGINE_DROPBOX
assert isinstance(cfg.path, str)
assert cfg.path == u"/home/some_user/Dropbox"
assert isinstance(cfg.directory, str)
assert cfg.directory == u"Mackup"
assert isinstance(cfg.fullpath, str)
assert cfg.fullpath == u"/home/some_user/Dropbox/Mackup"
assert cfg.apps_to_ignore == set(["subversion", "sequel-pro", "sabnzbd"])
assert cfg.apps_to_sync == set(["sabnzbd", "sublime-text-3", "x11", "vim"])
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"
def _parse_engine(self):
"""
Parse the storage engine in the config.
Returns:
str
"""
if self._parser.has_option("storage", "engine"):
engine = str(self._parser.get("storage", "engine"))
else:
engine = ENGINE_DROPBOX
assert isinstance(engine, str)
if engine not in [
ENGINE_DROPBOX,
ENGINE_GDRIVE,
ENGINE_COPY,
ENGINE_ICLOUD,
ENGINE_BOX,
ENGINE_FS,
]:
raise ConfigError("Unknown storage engine: {}".format(engine))
return str(engine)
def _parse_engine(self):
"""
Parse the storage engine in the config.
Returns:
str
"""
if self._parser.has_option("storage", "engine"):
engine = str(self._parser.get("storage", "engine"))
else:
engine = ENGINE_DROPBOX
assert isinstance(engine, str)
if engine not in [
ENGINE_DROPBOX,
ENGINE_GDRIVE,
ENGINE_COPY,
ENGINE_ICLOUD,
ENGINE_BOX,
ENGINE_FS,
]:
raise ConfigError("Unknown storage engine: {}".format(engine))
return str(engine)