mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Make _attach_current_user a pure function
Mutating dictionaries is gross and doesn’t work as you’d expect. Better to have the function return a new dictionary instead. Means we can be explicit that `created_by` is one of the allowed params when updating a service.
This commit is contained in:
@@ -7,20 +7,19 @@ def test_client_creates_job_data_correctly(mocker, 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
|
||||
"notification_count": 1,
|
||||
"created_by": '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)
|
||||
|
||||
Reference in New Issue
Block a user