Skip to content

Commit

Permalink
Test activity default language for organistaion names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed (ODSC) committed Jan 10, 2023
1 parent e37db6a commit b0b9ba5
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<iati-activities version="2.03">
<iati-activity default-currency="EUR" hierarchy="1" xml:lang="de">
<iati-identifier>DE-1-998966376</iati-identifier>
<reporting-org ref="DE-1" secondary-reporter="0" type="10">
<narrative>Bundesministerium für wirtschaftliche Zusammenarbeit und Entwicklung (BMZ)</narrative>
<narrative xml:lang="en">Federal Ministry for Economic Cooperation and Development (BMZ)</narrative>
</reporting-org>
<title>
<narrative xml:lang="pt">Esgotamento Sanitário Pernambuco</narrative>
<narrative>Abwasserentsorgung Pernambuco (Invest.)</narrative>
</title>
<participating-org ref="DE-1" role="1" type="10">
<narrative>Bundesministerium für wirtschaftliche Zusammenarbeit und Entwicklung (BMZ)</narrative>
<narrative xml:lang="en">Federal Ministry for Economic Cooperation and Development (BMZ)</narrative>
</participating-org>
<participating-org ref="XM-DAC-5-2" role="2">
<narrative>KfW Bankengruppe (KfW)</narrative>
</participating-org>
<participating-org ref="XM-DAC-5-2" role="3">
<narrative>KfW Bankengruppe (KfW)</narrative>
</participating-org>
<transaction>
<transaction-type code="11"/>
<transaction-date iso-date="2015-09-08"/>
<value value-date="2015-09-08">1749796.82</value>
<description>
<narrative xml:lang="en">Aid from other bilateral donors</narrative>
</description>
<provider-org ref="NO-BRC-971277882" type="10">
<narrative>Norwegische Agentur für Entwicklungszusammenarbeit (NORAD)</narrative>
</provider-org>
<receiver-org ref="DK-CVR-12921047" receiver-activity-id="DK-CVR-12921047-2018-21LotCivSPA" type="22">
<narrative>Pflege Dänemark</narrative>
</receiver-org>
</transaction>
<transaction>
<transaction-type code="11"/>
<transaction-date iso-date="2016-12-22"/>
<value value-date="2016-12-22">4555468.00</value>
<description>
<narrative xml:lang="en">Aid from other bilateral donors</narrative>
</description>
<provider-org ref="BD-NAB-0210" provider-activity-id="BD-NAB-0210-POWER" type="21">
<narrative>ActionAid Bangladesch</narrative>
</provider-org>
<receiver-org type="22">
<narrative>SKS-Stiftung</narrative>
</receiver-org>
</transaction>
</iati-activity>
</iati-activities>
43 changes: 42 additions & 1 deletion iati_datastore/iatilib/test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ def test_budget_conversion_usd(self):
def test_budget_conversion_eur(self):
self.assertEquals(548485.69, self.act.budgets[0].value_eur) # 2011-08-01: GBP 480637

class TestLocalsedOrganisationNames(AppTestCase):
class TestLocalisedOrganisationNames(AppTestCase):
def setUp(self):
super().setUp()
self.activities = list(parse.document_from_file(fixture_filename("localised-org-names.xml")))
Expand Down Expand Up @@ -1150,3 +1150,44 @@ def test_transaction_reciever_org_name(self):
{"en": 'SKS Foundation'}
)

class TestLocalisedOrganisationNamesActivityDefault(AppTestCase):
def setUp(self):
super().setUp()
self.activities = list(parse.document_from_file(fixture_filename("localised-org-names-default.xml")))
self.act = self.activities[0]

def test_reporting_org_name(self):
self.assertEquals(
self.act.reporting_org.name_all_values,
{'de': 'Bundesministerium für wirtschaftliche Zusammenarbeit und Entwicklung (BMZ)',
'en': 'Federal Ministry for Economic Cooperation and Development (BMZ)'}
)

def test_participating_orgs(self):
self.assertEquals(
self.act.participating_orgs[0].organisation.name_all_values,
{"de": 'Bundesministerium für wirtschaftliche Zusammenarbeit und Entwicklung (BMZ)',
"en": 'Federal Ministry for Economic Cooperation and Development (BMZ)'}
)
self.assertEquals(
self.act.participating_orgs[1].organisation.name_all_values,
{"de": 'KfW Bankengruppe (KfW)'}
)
self.assertEquals(
self.act.participating_orgs[2].organisation.name_all_values,
{"de": 'KfW Bankengruppe (KfW)'}
)

def test_transaction_reciever_org_name(self):
self.assertEquals(self.act.transactions[0].provider_org.name_all_values,
{"de": 'Norwegische Agentur für Entwicklungszusammenarbeit (NORAD)'}
)
self.assertEquals(self.act.transactions[0].receiver_org.name_all_values,
{"de": 'Pflege Dänemark'}
)
self.assertEquals(self.act.transactions[1].provider_org.name_all_values,
{"de": 'ActionAid Bangladesch'}
)
self.assertEquals(self.act.transactions[1].receiver_org.name_all_values,
{"de": 'SKS-Stiftung'}
)

0 comments on commit b0b9ba5

Please sign in to comment.