Skip to content

Commit

Permalink
[#959] Test that IATI org xlsx file converts
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Aug 21, 2018
1 parent 009c82d commit 993cc84
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cove_iati/tests_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def buttons():
('example.xml', ['Valid against Schema'], False),
('basic_iati_unordered_valid.xlsx', ['Valid against Schema'], True),
('basic_iati_unordered_invalid_iso_dates.xlsx', ['Invalid against Schema'], True),
('basic_iati_org_valid.xlsx', ['Valid against Schema'], True),
('bad.xml', ['We think you tried to upload a XML file'], False),
('bad_spaces.csv', ['Converted to XML 2 Errors'], True),
('basic_iati_ruleset_errors.xml', ['Invalid against Schema 12 Errors', '20140101',
Expand Down Expand Up @@ -145,6 +146,40 @@ def check_url_input_result_page(server_url, browser, httpserver, source_filename
</iati-activities>
'''

if source_filename == 'basic_iati_org_valid.xlsx':
converted_file = browser.find_element_by_link_text("XML (Converted from Original)").get_attribute("href")
assert requests.get(converted_file).text == '''<iati-organisations version="2.03">
<!--XML generated by flatten-tool-->
<iati-organisation default-currency="EUR" last-updated-datetime="2014-09-10T07:15:37Z" xml:lang="en">
<organisation-identifier>AA-AAA-123456789</organisation-identifier>
<name>
<narrative>Organisation name</narrative>
</name>
<reporting-org ref="AA-AAA-123456789" type="40">
<narrative>Organisation name</narrative>
</reporting-org>
<document-link format="application/vnd.oasis.opendocument.text" url="http://www.example.org/docs/report_en.odt">
<title>
<narrative>Annual Report 2013</narrative>
</title>
<category code="B01"/>
<language code="en"/>
<document-date iso-date="2014-02-05"/>
<recipient-country code="AF"/>
</document-link>
<document-link format="application/vnd.oasis.opendocument.text" url="http://www.example.org/docs/report_fr.odt">
<title>
<narrative xml:lang="fr">Rapport annuel 2013</narrative>
</title>
<category code="B01"/>
<language code="fr"/>
<document-date iso-date="2014-02-05"/>
<recipient-country code="AF"/>
</document-link>
</iati-organisation>
</iati-organisations>
'''


def test_rulesets_table_toggle(server_url, browser, httpserver):
with open(os.path.join('cove_iati', 'fixtures', 'basic_iati_ruleset_errors.xml'), 'rb') as fp:
Expand Down

0 comments on commit 993cc84

Please sign in to comment.