Add stubbed job_id

So that we can get a better sense of what the URLs look like.

Leaving unsigned for now because we don’t know if the ID will be a string or int
or…
This commit is contained in:
Chris Hill-Scott
2016-01-13 12:49:31 +00:00
parent 04b9c120d4
commit b4a8c2732d
8 changed files with 17 additions and 16 deletions

View File

@@ -52,9 +52,9 @@ def showjobs(service_id):
) )
@main.route("/<int:service_id>/jobs/job") @main.route("/<int:service_id>/jobs/<job_id>")
@login_required @login_required
def showjob(service_id): def showjob(service_id, job_id):
return render_template( return render_template(
'views/job.html', 'views/job.html',
messages=messages, messages=messages,
@@ -76,9 +76,9 @@ def showjob(service_id):
) )
@main.route("/<int:service_id>/jobs/job/notification/<string:notification_id>") @main.route("/<int:service_id>/jobs/<job_id>/notification/<string:notification_id>")
@login_required @login_required
def shownotification(service_id, notification_id): def shownotification(service_id, job_id, notification_id):
return render_template( return render_template(
'views/notification.html', 'views/notification.html',
message=[ message=[
@@ -86,5 +86,6 @@ def shownotification(service_id, notification_id):
][0], ][0],
delivered_at=now, delivered_at=now,
uploaded_at=now, uploaded_at=now,
service_id=service_id service_id=service_id,
job_id=job_id
) )

View File

@@ -83,7 +83,7 @@ def checksms(service_id):
service_id=service_id service_id=service_id
) )
elif request.method == 'POST': elif request.method == 'POST':
return redirect(url_for('.showjob', service_id=service_id)) return redirect(url_for('.showjob', service_id=service_id, job_id=456))
def _build_upload_result(csv_file): def _build_upload_result(csv_file):

View File

@@ -30,10 +30,10 @@
field_headings=['Job', 'File', 'Time', 'Status'] field_headings=['Job', 'File', 'Time', 'Status']
) %} ) %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.showjob', service_id=service_id) }}">{{ item.file }}</a> <a href="{{ url_for('.showjob', service_id=service_id, job_id=456) }}">{{ item.file }}</a>
{% endcall %} {% endcall %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.showjob', service_id=service_id) }}">{{ item.job }}</a> <a href="{{ url_for('.showjob', service_id=service_id, job_id=456) }}">{{ item.job }}</a>
{% endcall %} {% endcall %}
{% call field() %} {% call field() %}
{{ item.time }} {{ item.time }}

View File

@@ -52,10 +52,10 @@ GOV.UK Notify | Notifications activity
] ]
) %} ) %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.shownotification', service_id=service_id, notification_id=item.id) }}">{{item.phone}}</a> <a href="{{ url_for('.shownotification', service_id=service_id, job_id=456, notification_id=item.id) }}">{{item.phone}}</a>
{% endcall %} {% endcall %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.shownotification', service_id=service_id, notification_id=item.id) }}">{{item.message[:50]}}…</a> <a href="{{ url_for('.shownotification', service_id=service_id, job_id=456, notification_id=item.id) }}">{{item.message[:50]}}…</a>
{% endcall %} {% endcall %}
{% call field( {% call field(
align='right', align='right',

View File

@@ -16,10 +16,10 @@ GOV.UK Notify | Notifications activity
field_headings=['Job', 'File', 'Time', 'Status'] field_headings=['Job', 'File', 'Time', 'Status']
) %} ) %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.showjob', service_id=service_id) }}">{{ item.file }}</a> <a href="{{ url_for('.showjob', service_id=service_id, job_id=456) }}">{{ item.file }}</a>
{% endcall %} {% endcall %}
{% call field() %} {% call field() %}
<a href="{{ url_for('.showjob', service_id=service_id) }}">{{ item.job }}</a> <a href="{{ url_for('.showjob', service_id=service_id, job_id=456) }}">{{ item.job }}</a>
{% endcall %} {% endcall %}
{% call field() %} {% call field() %}
{{ item.time }} {{ item.time }}

View File

@@ -26,7 +26,7 @@ GOV.UK Notify | Notifications activity
</div> </div>
{{ page_footer( {{ page_footer(
back_link = url_for('.showjob', service_id=service_id), back_link = url_for('.showjob', service_id=service_id, job_id=job_id),
back_link_text = 'View other messages in this job' back_link_text = 'View other messages in this job'
) }} ) }}

View File

@@ -18,7 +18,7 @@ def test_should_show_page_for_one_job(notifications_admin, notifications_admin_d
with notifications_admin.test_client() as client: with notifications_admin.test_client() as client:
user = create_test_user('active') user = create_test_user('active')
client.login(user) client.login(user)
response = client.get('/123/jobs/job') response = client.get('/123/jobs/456')
assert response.status_code == 200 assert response.status_code == 200
assert 'dispatch_20151114.csv' in response.get_data(as_text=True) assert 'dispatch_20151114.csv' in response.get_data(as_text=True)
@@ -30,7 +30,7 @@ def test_should_show_page_for_one_notification(notifications_admin, notification
with notifications_admin.test_client() as client: with notifications_admin.test_client() as client:
user = create_test_user('active') user = create_test_user('active')
client.login(user) client.login(user)
response = client.get('/123/jobs/job/notification/3') response = client.get('/123/jobs/456/notification/3')
assert response.status_code == 200 assert response.status_code == 200
assert 'Text message' in response.get_data(as_text=True) assert 'Text message' in response.get_data(as_text=True)

View File

@@ -105,4 +105,4 @@ def test_should_redirect_to_job(notifications_admin, notifications_admin_db,
response = client.post('/123/sms/check') response = client.post('/123/sms/check')
assert response.status_code == 302 assert response.status_code == 302
assert response.location == 'http://localhost/123/jobs/job' assert response.location == 'http://localhost/123/jobs/456'