diff --git a/app/main/views/send.py b/app/main/views/send.py index 21f09d657..9b1341f16 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -656,9 +656,6 @@ def start_job(service_id, upload_id): job_api_client.create_job( upload_id, service_id, - upload_data.get('template_id'), - request.args.get('original_file_name'), - upload_data.get('notification_count'), scheduled_for=request.form.get('scheduled_for', '') ) diff --git a/app/notify_client/job_api_client.py b/app/notify_client/job_api_client.py index 8b4a85563..3099827f7 100644 --- a/app/notify_client/job_api_client.py +++ b/app/notify_client/job_api_client.py @@ -60,13 +60,9 @@ class JobApiClient(NotifyAdminAPIClient): return jobs - def create_job(self, job_id, service_id, template_id, original_file_name, notification_count, scheduled_for=None): - data = { - "id": job_id, - "template": template_id, - "original_file_name": original_file_name, - "notification_count": notification_count - } + def create_job(self, job_id, service_id, scheduled_for=None): + + data = {"id": job_id} if scheduled_for: data.update({'scheduled_for': scheduled_for}) diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index b9fb71350..906f11c52 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -1711,10 +1711,7 @@ def test_create_job_should_call_api( mock_create_job.assert_called_with( job_id, service_id, - template_id, - original_file_name, - notification_count, - scheduled_for=when + scheduled_for=when, ) diff --git a/tests/app/notify_client/test_job_client.py b/tests/app/notify_client/test_job_client.py index 02e6f740a..47c86dcdb 100644 --- a/tests/app/notify_client/test_job_client.py +++ b/tests/app/notify_client/test_job_client.py @@ -7,16 +7,10 @@ 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 mocker.patch('app.notify_client.current_user', id='1') expected_data = { "id": job_id, - "template": template_id, - "original_file_name": original_file_name, - "notification_count": 1, "created_by": '1' } @@ -28,13 +22,7 @@ def test_client_creates_job_data_correctly(mocker, fake_uuid): return_value={'data': dict(statistics=[], **expected_data)} ) - result = client.create_job(job_id, service_id, template_id, original_file_name, notification_count) - - assert result['data']['notifications_requested'] == 0 - assert result['data']['notifications_sent'] == 0 - assert result['data']['notification_count'] == 1 - assert result['data']['notifications_failed'] == 0 - + client.create_job(service_id, job_id) mock_post.assert_called_once_with(url=expected_url, data=expected_data) @@ -47,7 +35,7 @@ def test_client_schedules_job(mocker, fake_uuid): when = '2016-08-25T13:04:21.767198' JobApiClient().create_job( - fake_uuid, fake_uuid, fake_uuid, fake_uuid, 1, scheduled_for=when + fake_uuid, 1, scheduled_for=when ) assert mock_post.call_args[1]['data']['scheduled_for'] == when diff --git a/tests/conftest.py b/tests/conftest.py index f66e07713..43a20c432 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1660,15 +1660,12 @@ def mock_check_verify_code_code_expired(mocker): @pytest.fixture(scope='function') def mock_create_job(mocker, api_user_active): - def _create(job_id, service_id, template_id, file_name, notification_count, scheduled_for=None): + def _create(job_id, service_id, scheduled_for=None): return job_json( service_id, api_user_active, job_id=job_id, - template_id=template_id, - bucket_name='service-{}-notify'.format(job_id), - original_file_name='{}.csv'.format(job_id), - notification_count=notification_count) + ) return mocker.patch('app.job_api_client.create_job', side_effect=_create)