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_engine_copy(self):
cfg = Config("mackup-engine-copy.cfg")
assert isinstance(cfg.engine, str)
assert cfg.engine == ENGINE_COPY
assert isinstance(cfg.path, str)
assert cfg.path == u"/Users/someuser/Copy"
assert isinstance(cfg.directory, str)
assert cfg.directory == u"Mackup"
assert isinstance(cfg.fullpath, str)
assert cfg.fullpath.endswith(u"/Copy/Mackup")
assert cfg.apps_to_ignore == set(["subversion", "sequel-pro", "sabnzbd"])
assert cfg.apps_to_sync == set(["sublime-text-3", "x11", "sabnzbd"])
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)