Merge pull request #557 from alphagov/notification_show_updated_at

Notifications display updated_at instead of created_at.
This commit is contained in:
minglis
2016-05-11 16:55:37 +01:00
5 changed files with 11 additions and 3 deletions

View File

@@ -27,7 +27,7 @@
align='right',
status='error' if item.status == 'Failed' else 'default'
) %}
{{ item.status|title }} at {{ item.sent_at|format_time }}
{{ item.status|title }} at {{ item.updated_at|format_time }}
{% endcall %}
{% endcall %}
</div>

View File

@@ -94,7 +94,7 @@
{{ text_field(item.status|capitalize) }}
{% call field(align='right') %}
{{ item.created_at|format_datetime_short }}
{{ item.updated_at|format_datetime_short }}
{% endcall %}
{% endcall %}

View File

@@ -7,3 +7,4 @@ coveralls==1.1
moto==0.4.23
httpretty==0.8.14
beautifulsoup4==4.4.1
freezegun==0.3.6

View File

@@ -138,6 +138,7 @@ def notification_json(service_id,
status='sent',
sent_at=None,
created_at=None,
updated_at=None,
with_links=False):
if job is None:
job = job_json()
@@ -147,6 +148,8 @@ def notification_json(service_id,
sent_at = str(datetime.datetime.utcnow().time())
if created_at is None:
created_at = str(datetime.datetime.utcnow().time())
if updated_at is None:
updated_at = str((datetime.datetime.utcnow() + datetime.timedelta(minutes=1)).time())
links = {}
if with_links:
links = {
@@ -164,7 +167,8 @@ def notification_json(service_id,
'job': {'id': job['id'], 'original_file_name': job['original_file_name']},
'sent_at': sent_at,
'status': status,
'created_at': created_at
'created_at': created_at,
'updated_at': updated_at
} for i in range(5)],
'total': 5,
'page_size': 50,

View File

@@ -5,6 +5,7 @@ from app.utils import generate_notifications_csv
from tests import notification_json, job_json_with_created_by
from tests.conftest import fake_uuid
from tests.conftest import mock_get_job as mock_get_job1
from freezegun import freeze_time
def test_should_return_list_of_all_jobs(app_,
@@ -24,6 +25,7 @@ def test_should_return_list_of_all_jobs(app_,
assert len(jobs) == 5
@freeze_time("2016-01-01 11:09:00.061258")
def test_should_show_page_for_one_job(
app_,
service_one,
@@ -45,6 +47,7 @@ def test_should_show_page_for_one_job(
content = response.get_data(as_text=True)
assert "{}: Your vehicle tax is about to expire".format(service_one['name']) in content
assert file_name in content
assert "Sent at 11:10" in content
def test_should_show_updates_for_one_job_as_json(