def test_add_aid_type_item(self): """ Test adding an AidType code list item """ # category should already be in the db aidTypeCategory = iati_factory.AidTypeCategoryFactory.create(code='A') element = Element('aidType') code = Element('code') code.text = 'A01' name = Element('name') name.text = 'General budget support' language = Element('language') language.text = 'en' category = Element('category') category.text = 'A' description = Element('description') description.text = 'test description' element.extend([code, name, language, category, description]) importer = CodeListImporter() importer.add_code_list_item(element) self.assertEqual(1, AidType.objects.count(), "New AidType should be added into database") self.assertEqual(aidTypeCategory, AidType.objects.all()[0].category, "New AidType should be added into database")
def test_add_aid_type_item(self): """ Test adding an AidType code list item """ # category should already be in the db aidTypeCategory = AidTypeCategoryFactory.create(code='A') element = Element('aidType') code = Element('code') code.text = 'A01' name = Element('name') name.text = 'General budget support' language = Element('language') language.text = 'en' category = Element('category') category.text = 'A' description = Element('description') description.text = 'test description' element.extend([code, name, language, category, description]) importer = CodeListImporter() importer.add_code_list_item(element) self.assertEqual(1, AidType.objects.count(), "New AidType should be added into database") self.assertEqual(aidTypeCategory, AidType.objects.all()[0].category, "New AidType should be added into database")
def test_add_aid_type_category_item(self): """ Test adding an AidTypeCategory code list item """ code_text = 'A' name_text = 'Budget support' description_text = 'For contributions under this category...' # use factory to create AidTypeCategory, check if set on model aidTypeCategory = iati_factory.AidTypeCategoryFactory.create( code=code_text, name=name_text, description=description_text) element = Element('AidType-category') code = Element('code') code.text = code_text name = Element('name') name.text = name_text description = Element('description') description.text = description_text element.extend([code, name, description]) importer = CodeListImporter() importer.add_code_list_item(element) self.assertEqual(1, AidTypeCategory.objects.count(), "New AidTypeCategory should be added into database") self.assertEqual(aidTypeCategory, AidTypeCategory.objects.all()[0], "New AidTypeCategory should match input")
def test_add_aid_type_category_item(self): """ Test adding an AidTypeCategory code list item """ code_text = 'A' name_text = 'Budget support' description_text = 'For contributions under this category...' # use factory to create AidTypeCategory, check if set on model aidTypeCategory = AidTypeCategoryFactory.create( code=code_text, name=name_text, description=description_text) element = Element('AidType-category') code = Element('code') code.text = code_text name = Element('name') name.text = name_text description = Element('description') description.text = description_text element.extend([code, name, description]) importer = CodeListImporter() importer.add_code_list_item(element) self.assertEqual(1, AidTypeCategory.objects.count(), "New AidTypeCategory should be added into database") self.assertEqual(aidTypeCategory, AidTypeCategory.objects.all()[0], "New AidTypeCategory should match input")