def test_process_unit(self): # verify that the process unit calls the unit process method self._init_publisher() step = publish.PublishCompsStep() mock_unit = mock.Mock() step.process_main(mock_unit) mock_unit.process.assert_called_once_with(mock_unit.unit)
def test_finalize_no_initialization(self): """ Test to ensure that calling finalize before initialize_metadata() doesn't raise an exception """ step = publish.PublishCompsStep() step.parent = self.publisher step.finalize()
def test_finalize_metadata(self): self._init_publisher() step = publish.PublishCompsStep() step.parent = self.publisher step.parent.repomd_file_context = mock.Mock() step.comps_context = mock.Mock() step.finalize() step.comps_context.finalize.assert_called_once_with() step.parent.repomd_file_context. \ add_metadata_file_metadata.assert_called_once_with('group', mock.ANY, mock.ANY)
def test_units_generator(self): self._init_publisher() step = publish.PublishCompsStep() step.parent = self.publisher step.comps_context = mock.Mock() self.publisher.get_conduit().get_units = mock.Mock(side_effect=[['foo', 'bar'], ['baz', 'qux'], ['quux', 'waldo']]) unit_list = [x.unit for x in step.get_iterator()] self.assertEquals(unit_list, ['foo', 'bar', 'baz', 'qux', 'quux', 'waldo'])
def test_initialize_metadata(self, mock_context): self._init_publisher() step = publish.PublishCompsStep() step.parent = self.publisher step.initialize() mock_context.return_value.initialize.assert_called_once_with()
def test_units_total(self): step = publish.PublishCompsStep() step.parent = self.publisher self.publisher.repo.content_unit_counts = {TYPE_ID_PKG_CATEGORY: 3, TYPE_ID_PKG_GROUP: 5} self.assertEquals(8, step._get_total())