Skip to content

Commit

Permalink
Add test for EC international partnerships activity budgets
Browse files Browse the repository at this point in the history
  • Loading branch information
markbrough committed Oct 25, 2023
1 parent e75858a commit 4b18177
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions iatiflattener/tests/fixtures/ec-intpa-activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iati-activities xmlns:iati-extra="https://datastore.codeforiati.org/ns" generated-datetime="2023-10-25T15:48:37.572184"><iati-activity iati-extra:version="2.03" last-updated-datetime="2023-09-28T15:31:07Z" xml:lang="en" default-currency="EUR" humanitarian="0" hierarchy="2"><iati-identifier>XI-IATI-EC_INTPA-2019/405-854</iati-identifier><reporting-org ref="XI-IATI-EC_INTPA" type="15" secondary-reporter="0"><narrative>European Commission - International Partnerships</narrative></reporting-org><title><narrative>Long Term Technical Assistance for the implementation of the Voluntary Partnership Agreement (VPA) in Liberia</narrative></title><description type="1"><narrative>The service provider will support the implementation of the FLEGT VPA in Liberia. Building on a first phase of support (2013-2018) that established systems, institutions and capacities, in this second phase, the needs are: complementing the systems setting up, applying these new processes and transferring them from donors to the Government of Liberia. The VPA entails comprehensive development of forest governance and depends for success on the combined efforts and resources of the Liberian and i</narrative></description><participating-org ref="XI-IATI-EC_INTPA" role="1" type="15" activity-id="XI-IATI-EC_INTPA-2019/405-854"><narrative>European Commission - Directorate-General for International Partnerships (INTPA)</narrative></participating-org><participating-org ref="XT-IATI-EC_INTPA" role="3" type="15" activity-id="XI-IATI-EC_INTPA-2019/405-854"><narrative>European Development Fund</narrative></participating-org><participating-org ref="60000" role="2" activity-id="XI-IATI-EC_INTPA-2019/405-854"><narrative>Private sector institution</narrative></participating-org><participating-org ref="N/A" role="4" type="15" activity-id="XI-IATI-EC_INTPA-2019/405-854"><narrative>EC_INTPA</narrative></participating-org><other-identifier ref="2018000130001" type="A2"/><other-identifier ref="XI-IATI-EC_DEVCO" type="B1"/><activity-status code="2"/><activity-date iso-date="2019-03-19" type="1"><narrative>Planned Start: 19-MAR-19</narrative></activity-date><activity-date iso-date="2019-03-19" type="2"><narrative>Actual Start: 19-MAR-19</narrative></activity-date><activity-date iso-date="2022-06-30" type="3"><narrative>Planned End: 30-JUN-22</narrative></activity-date><contact-info type="1"><organisation><narrative>Delegation of the European Union to Liberia</narrative></organisation><department><narrative>Delegation of the European Union to Liberia</narrative></department><telephone>+231 77-7757826</telephone><email>[email protected] </email><website>http://eeas.europa.eu/delegations/liberia/index_en.htm</website></contact-info><activity-scope code="1"/><recipient-country code="LR"><narrative>Liberia</narrative></recipient-country><location><description><narrative>Liberia</narrative></description><point srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><pos>6.3106 -10.8048</pos></point></location><sector vocabulary="1" code="31210" percentage="100"><narrative>Forestry policy and administrative management</narrative></sector><tag vocabulary="2" code="12"><narrative>SDG 12: Responsible Consumption and Production</narrative></tag><tag vocabulary="2" code="15"><narrative>SDG 15: Life on Land</narrative></tag><policy-marker code="1" significance="0" vocabulary="1"><narrative>Gender Equality</narrative></policy-marker><policy-marker code="2" significance="2" vocabulary="1"><narrative>Aid to Environment</narrative></policy-marker><policy-marker code="3" significance="2" vocabulary="1"><narrative>Participatory Development/Good Governance</narrative></policy-marker><policy-marker code="4" significance="0" vocabulary="1"><narrative>Trade Development</narrative></policy-marker><policy-marker code="5" significance="1" vocabulary="1"><narrative>Aid Targeting the Objectives of the Convention on Biological Diversity</narrative></policy-marker><policy-marker code="6" significance="1" vocabulary="1"><narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Mitigation</narrative></policy-marker><policy-marker code="7" significance="0" vocabulary="1"><narrative>Aid Targeting the Objectives of the Framework Convention on Climate Change - Adaptation</narrative></policy-marker><policy-marker code="8" significance="1" vocabulary="1"><narrative>Aid Targeting the Objectives of the Convention to Combat Desertification</narrative></policy-marker><policy-marker code="9" significance="0" vocabulary="1"><narrative>Reproductive, Maternal, Newborn and Child Health (RMNCH)</narrative></policy-marker><policy-marker code="10" significance="0" vocabulary="1"><narrative>Disaster Risk Reduction (DRR)</narrative></policy-marker><policy-marker code="11" significance="0" vocabulary="1"><narrative>Disability</narrative></policy-marker><policy-marker code="12" significance="0" vocabulary="1"><narrative>Nutrition</narrative></policy-marker><collaboration-type code="1"/><default-flow-type code="10"/><default-finance-type code="110"/><default-aid-type code="D02"/><budget type="1" status="2"><period-start iso-date="2019-03-19"/><period-end iso-date="2050-12-31"/><value currency="EUR" value-date="2023-09-28">0</value></budget><planned-disbursement type="1"><period-start iso-date="2023-01-01"/><period-end iso-date="2021-02-01"/><value currency="EUR" value-date="2023-09-28">500000</value><provider-org provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"><narrative>XI-IATI-EC_INTPA</narrative></provider-org></planned-disbursement><planned-disbursement type="1"><period-start iso-date="2023-01-01"/><period-end iso-date="2022-08-01"/><value currency="EUR" value-date="2023-09-28">313561</value><provider-org provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"><narrative>XI-IATI-EC_INTPA</narrative></provider-org></planned-disbursement><planned-disbursement type="1"><period-start iso-date="2023-01-01"/><period-end iso-date="2021-09-01"/><value currency="EUR" value-date="2023-09-28">337500</value><provider-org provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"><narrative>XI-IATI-EC_INTPA</narrative></provider-org></planned-disbursement><planned-disbursement type="1"><period-start iso-date="2023-01-01"/><period-end iso-date="2022-02-01"/><value currency="EUR" value-date="2023-09-28">300000</value><provider-org provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"><narrative>XI-IATI-EC_INTPA</narrative></provider-org></planned-disbursement><capital-spend percentage="0"/><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VPA IN LIBERIA - 20% PRE-FINANCING" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2019-06-19"/><value currency="EUR" value-date="2023-09-28">646207</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VPA - FIRST INTERIM PAYMENT" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2019-12-20"/><value currency="EUR" value-date="2023-09-28">376220.27</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VPA - SECOND INTERIM PAYMENT" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2020-06-17"/><value currency="EUR" value-date="2023-09-28">545046.51</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VO" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2021-02-05"/><value currency="EUR" value-date="2023-09-28">499863.79</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VO - 4TH INTERIM PAYMENT + PARTIAL CLEARING" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2021-07-29"/><value currency="EUR" value-date="2023-09-28">517490.43</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><transaction ref="XI-IATI-EC_INTPA-2019/405-854/FED/2019/405-854-LONG TERM TECHNICAL ASSISTANCE FOR THE IMPLEMENTATION OF THE VOLUNTARY PARTNERSHIP AGREEMENT (VPA) IN LIBERIA FINAL INTERIM PAYMENT &amp; CLEARING" humanitarian="0"><transaction-type code="4"/><transaction-date iso-date="2023-03-30"/><value currency="EUR" value-date="2023-09-28">530126.73</value><provider-org ref="XI-IATI-EC_INTPA" provider-activity-id="XI-IATI-EC_INTPA-2019/405-854" type="15"/><receiver-org><narrative xml:lang="en">Dai Global Belgium</narrative></receiver-org><disbursement-channel code="2"/><flow-type code="10"/><finance-type code="110"/><aid-type code="D02"/></transaction><document-link url="https://webgate.ec.europa.eu/europeaid/online-services/index.cfm?do=publi.welcome&amp;nbPubliList=15&amp;orderby=upd&amp;orderbyad=Desc&amp;searchtype=RS&amp;aofr=139731" format="application/pdf"><title><narrative>Long Term Technical Assistance for the implementation of the Voluntary Partnership Agreement (VPA) in Liberia</narrative></title><category code="A10"/><language code="en"/></document-link><related-activity ref="XI-IATI-EC_INTPA-2018/40656/0" type="1"/><conditions attached="0"/></iati-activity></iati-activities>
25 changes: 25 additions & 0 deletions iatiflattener/tests/test_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,28 @@ def test_activity_budget_values_split_for_budget_with_dates_issue(self, activity
assert total_activity_budgets == 100000

TestActivityBudgetModel.verify_budget_values(activity_budget, expected_values[publisher])


@pytest.mark.parametrize("publisher", ["ec-intpa"])
def test_activity_budget_values_split_for_ec_budget_with_dates_issue(self, activity_budget, publisher):

# EC international partnerships has 0-value budgets and >0 value
# planned disbursements, though the latter have issues (e.g. start date
# often after end date)
# see e.g. planned disbursements in `XI-IATI-EC_INTPA-2019/405-854`
# there are 0 value budgets running from 2019 Q1 to 2050 Q4
quarters = (2050-2018)*4
od_budget_per_day = 0
od_budget_per_quarter = [0 for quarter in range(0, quarters+1)]

expected_values = {'ec-intpa': {'value_original': od_budget_per_quarter}}

one_quarter = activity_budget.budgets.value[0]
assert one_quarter['fiscal_year'] == 2019
assert one_quarter['fiscal_quarter'] == 'Q1'
assert one_quarter['value_original'] == 0

total_activity_budgets = sum([budget['value_original'] for budget in activity_budget.budgets.value])
assert total_activity_budgets == 0

TestActivityBudgetModel.verify_budget_values(activity_budget, expected_values[publisher])

0 comments on commit 4b18177

Please sign in to comment.