def test_export_groups(self, mock_comps_xml): # Set up just a group unit group_unit = [AssociatedUnit(ids.TYPE_ID_PKG_GROUP, None, None, None, None, None, None, None)] # Export a list of units that only contains groups result = export_utils.export_package_groups_and_cats('/working/dir', group_unit) self.assertEqual(1, result[1]['num_package_groups_exported']) self.assertEqual(0, result[1]['num_package_categories_exported']) mock_comps_xml.assert_called_once_with('/working/dir', group_unit, [])
def test_export_groups_and_cats(self, mock_comps_xml): # Set up a group and category unit to be exported group_unit = AssociatedUnit(ids.TYPE_ID_PKG_GROUP, None, None, None, None, None, None, None) cat_unit = AssociatedUnit(ids.TYPE_ID_PKG_CATEGORY, None, None, None, None, None, None, None) # Test that the groups and categories were sorted correctly and comps_xml was called result = export_utils.export_package_groups_and_cats('/working/dir', [group_unit, cat_unit]) self.assertEqual(1, result[1]['num_package_groups_exported']) self.assertEqual(1, result[1]['num_package_categories_exported']) mock_comps_xml.assert_called_once_with('/working/dir', [group_unit], [cat_unit])