Ejemplo n.º 1
0
    def test_load(self):
        path = "/test/path"
        rep_saved = new_mock_repo(path, num_pics=11)
        rep_loaded = app.load_repo(path)

        self.assertEqual(rep_loaded.connector.url.path, path)
        self.assertEqual(rep_loaded.index, rep_saved.index)
        self.assertEqual(rep_loaded.config, rep_saved.config)
Ejemplo n.º 2
0
 def handle_check_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     corrupt_pics, missing_pics = app.check_pics(repo)
     exit_code = 0
     if corrupt_pics:
         print '\n'.join('CORRUPT: %s' % pic for pic in corrupt_pics)
         exit_code = 1
     if missing_pics:
         print '\n'.join('MISSING: %s' % pic for pic in missing_pics)
         exit_code = 1
     return exit_code
Ejemplo n.º 3
0
 def handle_migrate_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.migrate_repo(repo)
     return 0
Ejemplo n.º 4
0
 def handle_view_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.view_pics(repo, conf['viewer.prog'])
     return 0
Ejemplo n.º 5
0
 def handle_list_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     print app.list_pics(repo, conf['list.mode'])
     return 0
Ejemplo n.º 6
0
 def handle_remove_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.remove_pics(repo, conf['remove.files'])
     return 0
Ejemplo n.º 7
0
 def handle_add_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.add_pics(repo, conf['add.files'], conf['add.process'], conf['add.recipe'])
     return 0
Ejemplo n.º 8
0
 def handle_backup_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.backup_repo(repo, *conf['backup.path'])
     return 0
Ejemplo n.º 9
0
 def handle_merge_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.merge_repos(repo, *conf['merge.repos'])
     return 0