def test_create_letters_pdf_calls_s3upload(mocker, sample_letter_notification): mocker.patch('app.celery.letters_pdf_tasks.get_letters_pdf', return_value=(b'\x00\x01', '1')) mock_s3 = mocker.patch('app.letters.utils.s3upload') create_letters_pdf(sample_letter_notification.id) mock_s3.assert_called_with( bucket_name=current_app.config['LETTERS_PDF_BUCKET_NAME'], file_location='2017-12-04/NOTIFY.FOO.D.2.C.C.20171204173100.PDF', filedata=b'\x00\x01', region=current_app.config['AWS_REGION'])
def test_create_letters_pdf_calls_s3upload(mocker, sample_letter_notification): mocker.patch("app.celery.letters_pdf_tasks.get_letters_pdf", return_value=(b"\x00\x01", "1")) mock_s3 = mocker.patch("app.letters.utils.s3upload") create_letters_pdf(sample_letter_notification.id) mock_s3.assert_called_with( bucket_name=current_app.config["LETTERS_PDF_BUCKET_NAME"], file_location="2017-12-04/NOTIFY.FOO.D.2.C.C.20171204173100.PDF", filedata=b"\x00\x01", region=current_app.config["AWS_REGION"], )
def test_create_letters_pdf_calls_s3upload_for_test_letters(mocker, sample_letter_template): mocker.patch('app.celery.letters_pdf_tasks.get_letters_pdf', return_value=(b'\x00\x01', '1')) mock_s3 = mocker.patch('app.letters.utils.s3upload') notification = create_notification(template=sample_letter_template, reference='FOO', key_type='test') create_letters_pdf(notification.id) mock_s3.assert_called_with( bucket_name=current_app.config['TEST_LETTERS_BUCKET_NAME'], file_location='NOTIFY.FOO.D.2.C.C.20171204173100.PDF', filedata=b'\x00\x01', region=current_app.config['AWS_REGION'] )