Beispiel #1
0
    def test_config_engine_filesystem(self):
        cfg = Config('mackup-engine-file_system.cfg')

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

        assert isinstance(cfg.path, str)
        assert cfg.path.endswith(
            os.path.join(os.environ[u'HOME'], u'some/relative/folder'))

        assert isinstance(cfg.directory, str)
        assert cfg.directory == u'Mackup'

        assert isinstance(cfg.fullpath, str)
        assert cfg.fullpath == os.path.join(os.environ[u'HOME'],
                                            u'some/relative/folder', u'Mackup')

        assert cfg.apps_to_ignore == set()
        assert cfg.apps_to_sync == set(['sabnzbd', 'sublime-text-3', 'x11'])
Beispiel #2
0
    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'])
Beispiel #3
0
    def test_config_engine_filesystem(self):
        cfg = Config("mackup-engine-file_system.cfg")

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

        assert isinstance(cfg.path, str)
        assert cfg.path.endswith(
            os.path.join(os.environ[u"HOME"], u"some/relative/folder"))

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

        assert isinstance(cfg.fullpath, str)
        assert cfg.fullpath == os.path.join(os.environ[u"HOME"],
                                            u"some/relative/folder", u"Mackup")

        assert cfg.apps_to_ignore == set()
        assert cfg.apps_to_sync == set(["sabnzbd", "sublime-text-3", "x11"])
Beispiel #4
0
    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"])
Beispiel #5
0
    def test_config_no_config(self):
        cfg = Config()

        # Should should do the same as the default, empty configuration
        assert isinstance(cfg.engine, str)
        assert cfg.engine == ENGINE_DROPBOX

        assert isinstance(cfg.path, str)
        print(cfg.path)
        assert cfg.path == "/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()
        assert cfg.apps_to_sync == set()
Beispiel #6
0
    def test_config_engine_icloud(self):
        cfg = Config("mackup-engine-icloud.cfg")

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

        assert isinstance(cfg.path, str)
        assert cfg.path == os.path.expanduser(
            "~/Library/Mobile Documents/com~apple~CloudDocs/")

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

        assert isinstance(cfg.fullpath, str)
        assert cfg.fullpath.endswith(u"/com~apple~CloudDocs/Mackup")

        assert cfg.apps_to_ignore == set(
            ["subversion", "sequel-pro", "sabnzbd"])
        assert cfg.apps_to_sync == set(["sublime-text-3", "x11", "sabnzbd"])
Beispiel #7
0
 def test_config_engine_unknown(self):
     with self.assertRaises(ConfigError):
         Config("mackup-engine-unknown.cfg")
Beispiel #8
0
 def test_config_engine_filesystem_no_path(self):
     with self.assertRaises(ConfigError):
         Config("mackup-engine-file_system-no_path.cfg")