mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 20:01:01 -05:00
Add count and disabled checkbox until ready / dvla state
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
<tr>
|
||||
<th>Service name</th>
|
||||
<th>Job ID</th>
|
||||
<th>Count</th>
|
||||
<th>Status</th>
|
||||
<th colspan="3">Created at</th>
|
||||
</tr>
|
||||
@@ -25,9 +26,10 @@
|
||||
<tr>
|
||||
<td>{{ job.service_name.name }}</td>
|
||||
<td>{{ job.id }}</td>
|
||||
<td>{{ job.notification_count }}</td>
|
||||
<td>{{ job.job_status }}</td>
|
||||
<td>{{ job.created_at|format_datetime_short }}</td>
|
||||
<td><input name="job_id" value='{{ job.id }}' type="checkbox"{% if job.send %} checked{% endif %}></td>
|
||||
<td><input name="job_id" value='{{ job.id }}' type="checkbox"{% if not (job.job_status == 'ready to send' or job.job_status == 'sent to dvla') %} disabled{% endif %}></td>
|
||||
<td>{{ job.sending }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from enum import IntEnum
|
||||
from flask import url_for
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
@@ -6,23 +7,23 @@ from app import format_datetime_short
|
||||
valid_letter_jobs = [
|
||||
{
|
||||
'service_name': {'name': 'test_name'},
|
||||
'template_version': 1,
|
||||
'id': 'test_id',
|
||||
'job_status': 'test_status',
|
||||
'notification_count': 2,
|
||||
'job_status': 'ready to send',
|
||||
'created_at': '2017-04-01T12:00:00'
|
||||
},
|
||||
{
|
||||
'service_name': {'name': 'test_name 2'},
|
||||
'template_version': 2,
|
||||
'id': 'test_id 2',
|
||||
'job_status': 'test_status 2',
|
||||
'notification_count': 1,
|
||||
'job_status': 'sent to dvla',
|
||||
'created_at': '2017-04-02T13:00:00'
|
||||
},
|
||||
{
|
||||
'service_name': {'name': 'test_name 3'},
|
||||
'template_version': 3,
|
||||
'id': 'test_id 3',
|
||||
'job_status': 'test_status 3',
|
||||
'notification_count': 1,
|
||||
'job_status': 'in progress',
|
||||
'created_at': '2017-04-03T14:00:00'
|
||||
}
|
||||
]
|
||||
@@ -30,6 +31,16 @@ valid_letter_jobs = [
|
||||
send_letter_jobs_response = {"response": "Task created to send files to DVLA"}
|
||||
|
||||
|
||||
class letter_jobs_header(IntEnum):
|
||||
SERVICE_NAME = 0
|
||||
JOB_ID = 1
|
||||
NOTIFICATION_COUNT = 2
|
||||
JOB_STATUS = 3
|
||||
CREATED_AT = 4
|
||||
CHECKBOX = 5
|
||||
TEMP_STATUS = 6
|
||||
|
||||
|
||||
def test_get_letter_jobs_returns_list_of_all_letter_jobs(logged_in_platform_admin_client, mocker):
|
||||
mock_get_letters = mocker.patch('app.letter_jobs_client.get_letter_jobs', return_value=valid_letter_jobs)
|
||||
|
||||
@@ -49,10 +60,15 @@ def test_get_letter_jobs_returns_list_of_all_letter_jobs(logged_in_platform_admi
|
||||
|
||||
for row_pos in range(len(rows)):
|
||||
cols = rows[row_pos].find_all('td')
|
||||
assert valid_letter_jobs[row_pos]['service_name']['name'] == cols[0].text
|
||||
assert valid_letter_jobs[row_pos]['id'] == cols[1].text
|
||||
assert valid_letter_jobs[row_pos]['job_status'] == cols[2].text
|
||||
assert format_datetime_short(valid_letter_jobs[row_pos]['created_at']) == cols[3].text
|
||||
assert valid_letter_jobs[row_pos]['service_name']['name'] == cols[letter_jobs_header.SERVICE_NAME].text
|
||||
assert valid_letter_jobs[row_pos]['id'] == cols[letter_jobs_header.JOB_ID].text
|
||||
assert valid_letter_jobs[row_pos]['notification_count'] == int(cols[letter_jobs_header.NOTIFICATION_COUNT].text)
|
||||
assert valid_letter_jobs[row_pos]['job_status'] == cols[letter_jobs_header.JOB_STATUS].text
|
||||
assert format_datetime_short(
|
||||
valid_letter_jobs[row_pos]['created_at']) == cols[letter_jobs_header.CREATED_AT].text
|
||||
if not (valid_letter_jobs[row_pos]['job_status'] == 'ready to send' or
|
||||
valid_letter_jobs[row_pos]['job_status'] == 'sent to dvla'):
|
||||
assert 'disabled' in str(cols[letter_jobs_header.CHECKBOX])
|
||||
|
||||
|
||||
def test_post_letter_jobs_select_1_letter_job_submits_1_job(logged_in_platform_admin_client, mocker):
|
||||
@@ -79,9 +95,9 @@ def test_post_letter_jobs_select_1_letter_job_submits_1_job(logged_in_platform_a
|
||||
colr1 = rows[1].find_all('td')
|
||||
colr2 = rows[2].find_all('td')
|
||||
|
||||
assert colr0[5].text == "sending"
|
||||
assert colr1[5].text == ""
|
||||
assert colr2[5].text == ""
|
||||
assert colr0[letter_jobs_header.TEMP_STATUS].text == "sending"
|
||||
assert colr1[letter_jobs_header.TEMP_STATUS].text == ""
|
||||
assert colr2[letter_jobs_header.TEMP_STATUS].text == ""
|
||||
|
||||
message = page.find('p', attrs={'id': 'message'}).text
|
||||
assert "Task created to send files to DVLA" in message
|
||||
|
||||
Reference in New Issue
Block a user