Stop posting job metadata to the API

The API is looking at the S3 metadata for this information now, so
there’s no need for us to continue sending it through.
This commit is contained in:
Chris Hill-Scott
2018-04-30 12:07:36 +01:00
parent 6ea4cf7c07
commit 98214884d3
5 changed files with 8 additions and 33 deletions

View File

@@ -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,
)

View File

@@ -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

View File

@@ -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)