Skip to content

Commit

Permalink
test defns: Remove some 1.0x compatibility we don't need any more
Browse files Browse the repository at this point in the history
These changes were already made in the previous Technical Paper
appendix, but hadn't been made here.
  • Loading branch information
Bjwebb committed Oct 26, 2023
1 parent 01e24ca commit 5fc301d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test_definitions/finance/11_commitment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions test_definitions/project_attributes/14_title.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions test_definitions/project_attributes/15_description.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions test_definitions/project_attributes/16_planned_dates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions test_definitions/project_attributes/17_actual_dates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions tests/project_attributes/test_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
Expand All @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
Expand All @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
<description>A short description</description>
<description>
<narrative>A short description</narrative>
</description>
</iati-activity>
'''

Expand Down
14 changes: 9 additions & 5 deletions tests/project_attributes/test_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
Expand All @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
Expand All @@ -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 = '''
<iati-activity>
<activity-status code="2"/>
<title>Too short</title>
<title>
<narrative>Too short</narrative>
</title>
</iati-activity>
'''

Expand All @@ -75,7 +77,9 @@ def test_title_is_sufficiently_long(self):
xml = '''
<iati-activity>
<activity-status code="2"/>
<title>A much much longer title</title>
<title>
<narrative>A much much longer title</narrative>
</title>
</iati-activity>
'''

Expand Down

0 comments on commit 5fc301d

Please sign in to comment.