mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Service and job id were incorrectly in bucket name.
This commit is contained in:
27
tests/app/main/notify_client/test_job_client.py
Normal file
27
tests/app/main/notify_client/test_job_client.py
Normal 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)
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user