-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IATI-Dashboard-468-traceability
- Loading branch information
Showing
9 changed files
with
267 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from lxml import etree | ||
|
||
from stats.dashboard import ActivityStats | ||
|
||
class MockActivityStats(ActivityStats): | ||
def __init__(self, major_version='2'): | ||
self.major_version = major_version | ||
return super(MockActivityStats, self).__init__() | ||
|
||
def _major_version(self): | ||
return self.major_version | ||
|
||
def test_budget_not_provided_works(): | ||
activity_stats = MockActivityStats() | ||
activity_stats.element = etree.fromstring(''' | ||
<iati-activity budget-not-provided="1"> | ||
</iati-activity> | ||
''') | ||
assert activity_stats._budget_not_provided() == 1 | ||
|
||
|
||
def test_budget_not_provided_fails(): | ||
activity_stats = MockActivityStats() | ||
activity_stats.element = etree.fromstring(''' | ||
<iati-activity> | ||
</iati-activity> | ||
''') | ||
assert activity_stats._budget_not_provided() is None | ||
|
||
|
||
def test_budget_validation_bools(): | ||
activity_stats = MockActivityStats() | ||
activity_stats.element = etree.fromstring(''' | ||
<iati-activity budget-not-provided="3"> | ||
</iati-activity> | ||
''') | ||
assert (len(activity_stats.element.findall('budget')) == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.