Make ‘too many rows’ error actually work

Was using the wrong attribute name on the instance of `RecipientCSV`
(needed to match 19df1eb4ef/notifications_utils/recipients.py (L156) )

The ‘can’t show file contents’ message wasn’t showing up, now it is.
This commit is contained in:
Chris Hill-Scott
2016-10-17 10:20:14 +01:00
parent c4df3d1109
commit fb906fbfdb
2 changed files with 9 additions and 5 deletions

View File

@@ -15,7 +15,7 @@
{% block maincolumn_content %}
{% if recipients.has_too_many_rows %}
{% if recipients.too_many_rows %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous') %}
@@ -174,8 +174,7 @@
{% call(item, row_number) list_table(
recipients.initial_annotated_rows_with_errors if row_errors and not recipients.missing_column_headers else recipients.initial_annotated_rows,
caption=original_file_name,
field_headings=['1'] + recipients.column_headers,
empty_message='Cant show the contents of this file'
field_headings=['1'] + recipients.column_headers
) %}
{{ index_field(item.index + 2) }}
{% for column in recipients.column_headers %}
@@ -203,7 +202,12 @@
{% endif %}
{% endcall %}
{% if count_of_displayed_recipients < count_of_recipients %}
{% if recipients.too_many_rows %}
<p class="table-show-more-link">
Cant show the contents of this file
</p>
{% elif count_of_displayed_recipients < count_of_recipients %}
<p class="table-show-more-link">
{% if row_errors and not recipients.missing_column_headers %}
Only showing the first {{ count_of_displayed_recipients }} rows with errors

View File

@@ -795,7 +795,7 @@ def test_check_messages_shows_over_max_row_error(
mock_recipients = mocker.patch('app.main.views.send.RecipientCSV').return_value
mock_recipients.max_rows = 11111
mock_recipients.__len__.return_value = 99999
mock_recipients.has_too_many_rows.return_value = True
mock_recipients.too_many_rows.return_value = True
client.login(api_user_active)
with client.session_transaction() as session: