Skip to content

Commit

Permalink
[#1117] Fix validation modals and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Feb 28, 2019
1 parent d974282 commit 604a0ee
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
26 changes: 18 additions & 8 deletions cove_360/templates/cove_360/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h3 class="panel-title panel-title-explore">
<br>
<p class="explanation">&nbsp;{% trans "There are some <strong>validation errors</strong> in your data, please check them in the table(s) below." %}</p>
<br>
{% with validation_errors=validation_errors_grouped.required %}
{% with validation_errors=validation_errors_grouped.required error_prefix='required-' %}
{% if validation_errors %}
<div class="panel panel-default">
<div class="panel-heading">
Expand All @@ -165,9 +165,14 @@ <h4>Missing Fields</h4>
{% include "validation_table.html" %}
</div>
</div>
{% for error_json, values in validation_errors %}
{% with error=error_json|json_decode %}
{% cove_modal_errors className="validation-errors-"|concat:error_prefix|concat:forloop.counter modalTitle=error.message errorList=values file_type=file_type full_table=True %}
{% endwith %}
{% endfor %}
{% endif %}
{% endwith %}
{% with validation_errors=validation_errors_grouped.format %}
{% with validation_errors=validation_errors_grouped.format error_prefix='format-' %}
{% if validation_errors %}
<div class="panel panel-default">
<div class="panel-heading">
Expand All @@ -178,9 +183,14 @@ <h4>Incorrect Formats</h4>
{% include "validation_table.html" %}
</div>
</div>
{% for error_json, values in validation_errors %}
{% with error=error_json|json_decode %}
{% cove_modal_errors className="validation-errors-"|concat:error_prefix|concat:forloop.counter modalTitle=error.message errorList=values file_type=file_type full_table=True %}
{% endwith %}
{% endfor %}
{% endif %}
{% endwith %}
{% with validation_errors=validation_errors_grouped.other %}
{% with validation_errors=validation_errors_grouped.other error_prefix='other-' %}
{% if validation_errors %}
<div class="panel panel-default">
<div class="panel-heading">
Expand All @@ -191,17 +201,17 @@ <h4>Other</h4>
{% include "validation_table.html" %}
</div>
</div>
{% for error_json, values in validation_errors %}
{% with error=error_json|json_decode %}
{% cove_modal_errors className="validation-errors-"|concat:error_prefix|concat:forloop.counter modalTitle=error.message errorList=values file_type=file_type full_table=True %}
{% endwith %}
{% endfor %}
{% endif %}
{% endwith %}
{% endif %}
</div>
</div>
</div>
{% for error_json, values in validation_errors %}
{% with error=error_json|json_decode %}
{% cove_modal_errors className="validation-errors-"|concat:forloop.counter modalTitle=error.message errorList=values file_type=file_type full_table=True %}
{% endwith %}
{% endfor %}
{% endblock validation %}

{% block quality_accuracy %}
Expand Down
10 changes: 5 additions & 5 deletions cove_360/tests_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def server_url(request, live_server):
'individual awards ranging from £152,505 (lowest) to £178,990 (highest)',
'Convert to Spreadsheet',
'Invalid against Schema 15 Errors',
'There are some validation errors in your data, please check them in the table below',
'There are some validation errors in your data, please check them in the table(s) below',
'Non-unique ID Values',
'Grant identifiers: 2',
'Funder organisation identifiers: 1',
Expand Down Expand Up @@ -407,17 +407,17 @@ def test_error_modal(server_url, browser, httpserver, source_filename):
section.click()
time.sleep(0.5)

browser.find_element_by_css_selector('a[data-target=".validation-errors-3"]').click()
browser.find_element_by_css_selector('a[data-target=".validation-errors-format-1"]').click()

modal = browser.find_element_by_css_selector('.validation-errors-3')
modal = browser.find_element_by_css_selector('.validation-errors-format-1')
assert "in" in modal.get_attribute("class").split()
modal_text = modal.text
assert "24/07/2014" in modal_text
assert "grants/0/awardDate" in modal_text
table_rows = browser.find_elements_by_css_selector('.validation-errors-4 tbody tr')
table_rows = browser.find_elements_by_css_selector('.validation-errors-format-2 tbody tr')
assert len(table_rows) == 4

browser.find_element_by_css_selector('div.modal.validation-errors-3 button.close').click()
browser.find_element_by_css_selector('div.modal.validation-errors-format-1 button.close').click()
browser.find_element_by_css_selector('a[data-target=".additional-checks-1"]').click()

modal_additional_checks = browser.find_element_by_css_selector('.additional-checks-1')
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Django<1.12
#^^ rq.filter: <1.12
-e git+https://github.com/OpenDataServices/[email protected]#egg=flattentool
-e git+https://github.com/open-contracting/[email protected]#egg=libcoveocds
-e git+https://github.com/OpenDataServices/lib-cove-web.git@v0.1.0#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove-web.git@e1cbc4bdc7d3fe254aed9a349c0e63751c3da796#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove.git@79995dd6137431bd3b2ed40235d8d58eda82d7d7#egg=libcove
django-bootstrap3
django-debug-toolbar
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pip==9.0.3
Django==1.11.20 # rq.filter: <1.12
-e git+https://github.com/OpenDataServices/[email protected]#egg=flattentool
-e git+https://github.com/open-contracting/[email protected]#egg=libcoveocds
-e git+https://github.com/OpenDataServices/lib-cove-web.git@v0.1.0#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove-web.git@e1cbc4bdc7d3fe254aed9a349c0e63751c3da796#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove.git@79995dd6137431bd3b2ed40235d8d58eda82d7d7#egg=libcove
django-bootstrap3==9.1.0
django-debug-toolbar==1.9.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pip==9.0.3
Django==1.11.20 # rq.filter: <1.12
-e git+https://github.com/OpenDataServices/[email protected]#egg=flattentool
-e git+https://github.com/open-contracting/[email protected]#egg=libcoveocds
-e git+https://github.com/OpenDataServices/lib-cove-web.git@v0.1.0#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove-web.git@e1cbc4bdc7d3fe254aed9a349c0e63751c3da796#egg=libcoveweb
-e git+https://github.com/OpenDataServices/lib-cove.git@79995dd6137431bd3b2ed40235d8d58eda82d7d7#egg=libcove
django-bootstrap3==9.1.0
django-debug-toolbar==1.9.1
Expand Down

0 comments on commit 604a0ee

Please sign in to comment.