Files
notifications-admin/tests/app/main/notify_client/test_job_client.py
2016-04-15 11:08:19 +01:00

29 lines
922 B
Python

from app.notify_client.job_api_client import JobApiClient
def test_client_creates_job_data_correctly(mocker, fake_uuid):
job_id = fake_uuid
service_id = fake_uuid
template_id = fake_uuid
original_file_name = 'test.csv'
notification_count = 1
expected_data = {
"id": job_id,
"template": template_id,
"original_file_name": original_file_name,
"notification_count": 1
}
expected_url = '/service/{}/job'.format(service_id)
client = JobApiClient()
mock_attach_user = mocker.patch(
'app.notify_client.job_api_client._attach_current_user',
return_value={'created_by': fake_uuid})
mock_post = mocker.patch('app.notify_client.job_api_client.JobApiClient.post')
client.create_job(job_id, service_id, template_id, original_file_name, notification_count)
mock_post.assert_called_once_with(url=expected_url, data=expected_data)