From 5fc301df5511da726ed7dc3a1d5d8457f2c285d2 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 26 Oct 2023 10:36:42 +0000 Subject: [PATCH] test defns: Remove some 1.0x compatibility we don't need any more These changes were already made in the previous Technical Paper appendix, but hadn't been made here. --- test_definitions/finance/11_commitment.feature | 2 +- .../project_attributes/14_title.feature | 4 ++-- .../project_attributes/15_description.feature | 4 ++-- .../project_attributes/16_planned_dates.feature | 4 ++-- .../project_attributes/17_actual_dates.feature | 4 ++-- tests/project_attributes/test_description.py | 10 ++++++---- tests/project_attributes/test_title.py | 14 +++++++++----- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/test_definitions/finance/11_commitment.feature b/test_definitions/finance/11_commitment.feature index d1e74ef..d0ae788 100644 --- a/test_definitions/finance/11_commitment.feature +++ b/test_definitions/finance/11_commitment.feature @@ -5,4 +5,4 @@ Feature: Commitment Given an IATI activity And the activity is current And `activity-status/@code` is one of 2, 3 or 4 - Then `transaction[transaction-type/@code="2" or transaction-type/@code="C"]` should be present and of non-zero value + Then `transaction/transaction-type[@code="2"]` should be present and of non-zero value diff --git a/test_definitions/project_attributes/14_title.feature b/test_definitions/project_attributes/14_title.feature index b47d8ed..944ffe0 100644 --- a/test_definitions/project_attributes/14_title.feature +++ b/test_definitions/project_attributes/14_title.feature @@ -4,9 +4,9 @@ Feature: Title Scenario Outline: Title is present Given an IATI activity And the activity is current - Then `title[text() or narrative/text()]` should be present + Then `title/narrative/text()` should be present Scenario Outline: Title has at least 10 characters Given an IATI activity And the activity is current - Then `title/text() | title/narrative/text()` should have at least 10 characters + Then `title/narrative/text()` should have at least 10 characters diff --git a/test_definitions/project_attributes/15_description.feature b/test_definitions/project_attributes/15_description.feature index ec4e056..0ad5f01 100644 --- a/test_definitions/project_attributes/15_description.feature +++ b/test_definitions/project_attributes/15_description.feature @@ -4,9 +4,9 @@ Feature: Description Scenario Outline: Description is present Given an IATI activity And the activity is current - Then `description[text() or narrative/text()]` should be present + Then `description/narrative/text()` should be present Scenario Outline: Description has at least 80 characters Given an IATI activity And the activity is current - Then `description/text() | description/narrative/text()` should have at least 80 characters + Then `description/narrative/text()` should have at least 80 characters diff --git a/test_definitions/project_attributes/16_planned_dates.feature b/test_definitions/project_attributes/16_planned_dates.feature index 6342305..e95ab91 100644 --- a/test_definitions/project_attributes/16_planned_dates.feature +++ b/test_definitions/project_attributes/16_planned_dates.feature @@ -4,10 +4,10 @@ Feature: Planned dates Scenario Outline: Planned start date is present Given an IATI activity And the activity is current - Then `activity-date[@type="1" or @type="start-planned"]` should be present + Then `activity-date[@type="1"]` should be present Scenario Outline: Planned end date is present Given an IATI activity And the activity is current And `finance-type/@code` is not any of 501, 433, 432, 1100 or 210 - Then `activity-date[@type="3" or @type="end-planned"]` should be present + Then `activity-date[@type="3"]` should be present diff --git a/test_definitions/project_attributes/17_actual_dates.feature b/test_definitions/project_attributes/17_actual_dates.feature index 76928a3..8a5a196 100644 --- a/test_definitions/project_attributes/17_actual_dates.feature +++ b/test_definitions/project_attributes/17_actual_dates.feature @@ -5,10 +5,10 @@ Feature: Actual dates Given an IATI activity And the activity is current And `activity-status/@code` is one of 2, 3 or 4 - Then `activity-date[@type="2" or @type="start-actual"]` should be present + Then `activity-date[@type="2"]` should be present Scenario Outline: Actual end date is present Given an IATI activity And the activity is current And `activity-status/@code` is one of 3 or 4 - Then `activity-date[@type="4" or @type="end-actual"]` should be present + Then `activity-date[@type="4"]` should be present diff --git a/tests/project_attributes/test_description.py b/tests/project_attributes/test_description.py index 7b7f0d6..2c83dcd 100644 --- a/tests/project_attributes/test_description.py +++ b/tests/project_attributes/test_description.py @@ -29,7 +29,7 @@ def test_description_not_present(self): assert result is False - def test_description_narrative_is_present(self): + def test_description_is_present(self): xml = ''' @@ -44,7 +44,7 @@ def test_description_narrative_is_present(self): assert result is True - def test_description_is_present(self): + def test_description_no_narrative(self): xml = ''' @@ -55,13 +55,15 @@ def test_description_is_present(self): activity = etree.fromstring(xml) result = self.test(activity) - assert result is True + assert result is False def test_description_is_insufficiently_short(self): xml = ''' - A short description + + A short description + ''' diff --git a/tests/project_attributes/test_title.py b/tests/project_attributes/test_title.py index 775d0cb..c656bf5 100644 --- a/tests/project_attributes/test_title.py +++ b/tests/project_attributes/test_title.py @@ -29,7 +29,7 @@ def test_title_not_present(self): assert result is False - def test_title_narrative_is_present(self): + def test_title_is_present(self): xml = ''' @@ -44,7 +44,7 @@ def test_title_narrative_is_present(self): assert result is True - def test_title_is_present(self): + def test_title_no_narrative(self): xml = ''' @@ -55,13 +55,15 @@ def test_title_is_present(self): activity = etree.fromstring(xml) result = self.test(activity) - assert result is True + assert result is False def test_title_is_insufficiently_short(self): xml = ''' - Too short + + <narrative>Too short</narrative> + ''' @@ -75,7 +77,9 @@ def test_title_is_sufficiently_long(self): xml = ''' - A much much longer title + + <narrative>A much much longer title</narrative> + '''