def test_process_main_with_error(self, Popen): step = publish.GenerateSqliteForRepoStep('/foo') pipe_output = ('some output', None) Popen.return_value = mock.MagicMock() Popen.return_value.returncode = 1 Popen.return_value.communicate.return_value = pipe_output self.assertRaises(PulpCodedException, step.process_main)
def test_process_main(self, Popen): pipe_output = ('some output', None) Popen.return_value = mock.MagicMock() Popen.return_value.returncode = 0 Popen.return_value.communicate.return_value = pipe_output step = publish.GenerateSqliteForRepoStep('/foo') step.process_main() Popen.assert_called_once_with('createrepo_c -d --update --keep-all-metadata ' '--skip-stat /foo', shell=True, stderr=mock.ANY, stdout=mock.ANY)
def test_is_skipped_config_true(self): step = publish.GenerateSqliteForRepoStep('/foo') self.publisher.add_child(step) self.publisher.get_config().default_config.update({'generate_sqlite': True}) self.assertFalse(step.is_skipped())
def test_is_skipped_no_config(self): # Generating sqlite files is turned off by default step = publish.GenerateSqliteForRepoStep('/foo') self.publisher.add_child(step) self.assertTrue(step.is_skipped())