Service and job id were incorrectly in bucket name.

This commit is contained in:
Adam Shimali
2016-02-04 12:06:06 +00:00
parent 2e4e354680
commit 90a17bc0a7
5 changed files with 33 additions and 6 deletions

View File

@@ -0,0 +1,27 @@
from app.notify_client.job_api_client import JobApiClient
def test_client_creates_job_data_correctly(mocker):
import uuid
job_id = str(uuid.uuid4())
service_id = str(uuid.uuid4())
template_id = 1
original_file_name = 'test.csv'
expected_data = {
"id": job_id,
"service": service_id,
"template": template_id,
"original_file_name": original_file_name,
"bucket_name": "service-{}-notify".format(service_id),
"file_name": "{}.csv".format(job_id)
}
expected_url = '/service/{}/job'.format(service_id)
client = JobApiClient()
mock_post = mocker.patch('app.notify_client.job_api_client.JobApiClient.post')
client.create_job(job_id, service_id, template_id, original_file_name)
mock_post.assert_called_once_with(url=expected_url, data=expected_data)

View File

@@ -184,4 +184,3 @@ def test_create_job_should_call_api(app_,
assert response.status_code == 200
mock_create_job.assert_called_with(job_id, service_id, template_id, original_file_name)
assert job_data['bucket_name'] == "service-{}-{}-notify".format(service_id, job_id)