Пример #1
0
    def test_removing_pics(self, MockViewer, mock_remove_pics):
        mock_viewer_inst = MockViewer.return_value
        mock_viewer_inst.show.return_value = self.repo.index.pics()[4:7]

        app.view_pics(self.repo, prog=None)

        pic_filenames = [pic.filename for pic in self.repo.index.pics()[4:7]]
        mock_remove_pics.assert_called_with(self.repo, pic_filenames)
Пример #2
0
    def test_default_prog(self, MockViewer, mock_remove_pics):
        mock_viewer_inst = MockViewer.return_value
        mock_viewer_inst.show.return_value = []

        app.view_pics(self.repo, prog=None)

        MockViewer.assert_called_once_with(self.repo.config['viewer.prog'])
        mock_viewer_inst.show.assert_called_once_with(self.repo.index.pics())
        mock_remove_pics.assert_called_once_with(self.repo, [])
Пример #3
0
    def test_supplied_prog(self, MockViewer, mock_remove_pics):
        mock_viewer_inst = MockViewer.return_value
        mock_viewer_inst.show.return_value = []

        prog = 'awesome-viewer-app arg1 --opt1 -o2'
        app.view_pics(self.repo, prog)

        MockViewer.assert_called_once_with(prog)
        mock_viewer_inst.show.assert_called_once_with(self.repo.index.pics())
        mock_remove_pics.assert_called_once_with(self.repo, [])
Пример #4
0
 def handle_view_cmd(self, conf):
     repo = app.load_repo(conf['working_dir'])
     app.view_pics(repo, conf['viewer.prog'])
     return 0