Add update_letter_branding view function

This works in a similar way to the create_letter_branding view function,
but with a few minor differences:
* Since we already have a file, uploading a file is no longer required
(since we can just use the current file if a new one is not uploaded)
* We save the changes in the database, then upload the new files to S3.
If saving to S3 raises an error, we now rollback the database changes to
prevent any errors when trying to view letters with the original logo.
This commit is contained in:
Katie Smith
2019-02-11 15:31:12 +00:00
parent 53627fd1ba
commit 1cb1ce310a
6 changed files with 428 additions and 22 deletions

View File

@@ -2540,7 +2540,7 @@ def mock_get_all_letter_branding(mocker):
'id': str(UUID(int=1)),
'name': 'Land Registry',
'filename': 'land-registry',
'domain': None,
'domain': 'landregistry.gov.uk',
},
{
'id': str(UUID(int=2)),
@@ -2562,7 +2562,7 @@ def mock_get_letter_branding_by_id(mocker):
'id': _id,
'name': 'HM Government',
'filename': 'hm-government',
'domain': None,
'domain': 'cabinet-office.gov.uk',
}
return mocker.patch(
'app.letter_branding_client.get_letter_branding', side_effect=_get_branding_by_id