Use service_id in the query to make it safer, also use named parameters

This commit is contained in:
Pea Tyczynska
2019-09-25 15:48:28 +01:00
parent 8cf8d24e37
commit c48aa77dd5
4 changed files with 19 additions and 7 deletions

View File

@@ -566,8 +566,9 @@ def test_get_all_notifications_for_job_returns_correct_format(
def test_get_notification_count_for_job_id(admin_request, mocker):
mock_dao = mocker.patch('app.job.rest.dao_get_notification_count_for_job_id', return_value=3)
job_id = uuid.uuid4()
response = admin_request.get('job.get_notification_count_for_job_id', service_id=uuid.uuid4(), job_id=job_id)
mock_dao.assert_called_once_with(str(job_id))
service_id = uuid.uuid4()
response = admin_request.get('job.get_notification_count_for_job_id', service_id=service_id, job_id=job_id)
mock_dao.assert_called_once_with(service_id=service_id, job_id=str(job_id))
assert response["count"] == 3