Refactor process_letter_notification to make the code easier to read.

- Separated the logic of precompiled and template letters.
- Remove the check for research mode, research mode is not relevant to api calls. The test key is used for testing.
Refactor upload_pdf_letter to accept a precompile boolean to save a query to template.
This commit is contained in:
Rebecca Law
2018-04-09 13:56:44 +01:00
parent e7bd6380ab
commit b73bf4220f
4 changed files with 95 additions and 134 deletions

View File

@@ -128,7 +128,7 @@ def test_upload_letter_pdf_to_correct_bucket(
is_scan_letter=is_precompiled_letter
)
upload_letter_pdf(sample_letter_notification, b'\x00\x01')
upload_letter_pdf(sample_letter_notification, b'\x00\x01', precompiled=is_precompiled_letter)
mock_s3.assert_called_once_with(
bucket_name=current_app.config[bucket_config_name],