def test_compute_pfile_stats__excluded(self): stats = {'blacklisted_files': 10} config = Config(None) config.exclude_paths = ['tmp/*'] farcy = self._farcy_instance(config=config) self.assertEqual(None, farcy._compute_pfile_stats( mockpfile(filename='tmp/foo'), stats)) self.assertEqual({'blacklisted_files': 11}, stats)
def test_compute_pfile_stats__removed(self): stats = {'deleted_files': 10} config = Config(None) config.exclude_paths = ['tmp/*'] farcy = self._farcy_instance(config=config) self.assertEqual(None, farcy._compute_pfile_stats( mockpfile(filename='a/tmp/b', status='removed'), stats)) self.assertEqual({'deleted_files': 11}, stats)
def _farcy_instance(self, mock_get_session, config=None): if config is None: config = Config(None) if config.repository is None: config.repository = 'dummy/dummy' farcy = Farcy(config) self.assertTrue(mock_get_session.called) return farcy
def test_compute_pfile_stats__excluded(self): stats = {'blacklisted_files': 10} config = Config(None) config.exclude_paths = ['tmp/*'] farcy = self._farcy_instance(config=config) self.assertEqual( None, farcy._compute_pfile_stats(mockpfile(filename='tmp/foo'), stats)) self.assertEqual({'blacklisted_files': 11}, stats)
def test_compute_pfile_stats__removed(self): stats = {'deleted_files': 10} config = Config(None) config.exclude_paths = ['tmp/*'] farcy = self._farcy_instance(config=config) self.assertEqual( None, farcy._compute_pfile_stats( mockpfile(filename='a/tmp/b', status='removed'), stats)) self.assertEqual({'deleted_files': 11}, stats)
def _farcy_instance(self, mock_get_session, mock_update_checker, config=None): if config is None: config = Config(None) if config.repository is None: config.repository = 'dummy/dummy' farcy = Farcy(config) self.assertTrue(mock_get_session.called) self.assertTrue(mock_update_checker.called) return farcy