mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Remove join to Template table.
Fix typo in unit test.
This commit is contained in:
@@ -149,9 +149,8 @@ def dao_get_job_statistics_for_job(service_id, job_id):
|
|||||||
query = Job.query.join(
|
query = Job.query.join(
|
||||||
JobStatistics, Job.id == JobStatistics.job_id
|
JobStatistics, Job.id == JobStatistics.job_id
|
||||||
).filter(
|
).filter(
|
||||||
Job.id == job_id
|
Job.id == job_id,
|
||||||
).join(
|
Job.service_id == service_id
|
||||||
Template, Template.id == Job.template_id and Template.version == Job.template_version
|
|
||||||
).add_columns(
|
).add_columns(
|
||||||
JobStatistics.job_id,
|
JobStatistics.job_id,
|
||||||
Job.original_file_name,
|
Job.original_file_name,
|
||||||
@@ -165,8 +164,6 @@ def dao_get_job_statistics_for_job(service_id, job_id):
|
|||||||
JobStatistics.sent,
|
JobStatistics.sent,
|
||||||
JobStatistics.delivered,
|
JobStatistics.delivered,
|
||||||
JobStatistics.failed
|
JobStatistics.failed
|
||||||
).filter(
|
|
||||||
Job.service_id == service_id
|
|
||||||
)
|
)
|
||||||
return query.one()
|
return query.one()
|
||||||
|
|
||||||
|
|||||||
@@ -796,8 +796,9 @@ def test_get_jobs_raises_for_bad_limit_days(client, sample_service):
|
|||||||
query_string={'limit_days': 'bad_number'},
|
query_string={'limit_days': 'bad_number'},
|
||||||
headers=[auth_header])
|
headers=[auth_header])
|
||||||
assert response.status_code == 400
|
assert response.status_code == 400
|
||||||
assert response.get_data(as_text=True) == '{\n "message": {\n "limit_days": [\n ' \
|
resp_json = json.loads(response.get_data(as_text=True))
|
||||||
'"bad_number is not an integer"\n ]\n },\n "result": "error"\n}'
|
assert resp_json["result"] == "error"
|
||||||
|
assert resp_json["message"] == {'limit_days': ['bad_number is not an integer']}
|
||||||
|
|
||||||
|
|
||||||
def test_parse_status_turns_comma_sep_strings_into_list():
|
def test_parse_status_turns_comma_sep_strings_into_list():
|
||||||
@@ -831,8 +832,7 @@ def test_get_job_stats_by_service_id_and_job_id(client, sample_job):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_job_stats_with_invalid_job_id_returns404(client, sample_template):
|
def test_get_job_stats_with_invalid_job_id_returns404(client, sample_template):
|
||||||
service_id = sample_template.service.id
|
path = '/service/{}/job/job-stats{}'.format(sample_template.service.id, uuid.uuid4())
|
||||||
path = '/service/{}/job/job-=stats{}'.format(service_id, "bad-id")
|
|
||||||
auth_header = create_authorization_header()
|
auth_header = create_authorization_header()
|
||||||
response = client.get(path, headers=[auth_header])
|
response = client.get(path, headers=[auth_header])
|
||||||
assert response.status_code == 404
|
assert response.status_code == 404
|
||||||
@@ -842,7 +842,7 @@ def test_get_job_stats_with_invalid_job_id_returns404(client, sample_template):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_job_stats_with_invalid_service_id_returns404(client, sample_job):
|
def test_get_job_stats_with_invalid_service_id_returns404(client, sample_job):
|
||||||
path = '/service/{}/job/job-=stats{}'.format(uuid.uuid4(), sample_job.id)
|
path = '/service/{}/job/job-stats{}'.format(uuid.uuid4(), sample_job.id)
|
||||||
auth_header = create_authorization_header()
|
auth_header = create_authorization_header()
|
||||||
response = client.get(path, headers=[auth_header])
|
response = client.get(path, headers=[auth_header])
|
||||||
assert response.status_code == 404
|
assert response.status_code == 404
|
||||||
|
|||||||
Reference in New Issue
Block a user