remove pdf sanitize tasks

This commit is contained in:
stvnrlly
2022-12-07 11:55:24 -05:00
parent edb0ddf2ea
commit 4260576fb2
9 changed files with 3 additions and 185 deletions

View File

@@ -18,7 +18,6 @@ from app.letters.utils import (
get_letter_pdf_and_metadata,
letter_print_day,
move_failed_pdf,
move_sanitised_letter_to_test_or_live_pdf_bucket,
upload_letter_pdf,
)
from app.models import (
@@ -353,66 +352,6 @@ def test_get_folder_name_in_british_summer_time(notify_api, timestamp, expected_
assert folder_name == expected_folder_name
@mock_s3
def test_move_sanitised_letter_to_live_pdf_bucket(notify_api, mocker):
filename = 'my_letter.pdf'
source_bucket_name = current_app.config['LETTER_SANITISE_BUCKET_NAME']
target_bucket_name = current_app.config['LETTERS_PDF_BUCKET_NAME']
conn = boto3.resource('s3', region_name='eu-west-1')
source_bucket = conn.create_bucket(
Bucket=source_bucket_name,
CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}
)
target_bucket = conn.create_bucket(
Bucket=target_bucket_name,
CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}
)
s3 = boto3.client('s3', region_name='eu-west-1')
s3.put_object(Bucket=source_bucket_name, Key=filename, Body=b'pdf_content')
move_sanitised_letter_to_test_or_live_pdf_bucket(
filename=filename,
is_test_letter=False,
created_at=datetime.utcnow(),
new_filename=filename
)
assert not [x for x in source_bucket.objects.all()]
assert len([x for x in target_bucket.objects.all()]) == 1
@mock_s3
def test_move_sanitised_letter_to_test_pdf_bucket(notify_api, mocker):
filename = 'my_letter.pdf'
source_bucket_name = current_app.config['LETTER_SANITISE_BUCKET_NAME']
target_bucket_name = current_app.config['TEST_LETTERS_BUCKET_NAME']
conn = boto3.resource('s3', region_name='eu-west-1')
source_bucket = conn.create_bucket(
Bucket=source_bucket_name,
CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}
)
target_bucket = conn.create_bucket(
Bucket=target_bucket_name,
CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}
)
s3 = boto3.client('s3', region_name='eu-west-1')
s3.put_object(Bucket=source_bucket_name, Key=filename, Body=b'pdf_content')
move_sanitised_letter_to_test_or_live_pdf_bucket(
filename=filename,
is_test_letter=True,
created_at=datetime.utcnow(),
new_filename=filename
)
assert not [x for x in source_bucket.objects.all()]
assert len([x for x in target_bucket.objects.all()]) == 1
@freeze_time('2017-07-07 20:00:00')
def test_letter_print_day_returns_today_if_letter_was_printed_after_1730_yesterday():
created_at = datetime(2017, 7, 6, 17, 30)

View File

@@ -1229,7 +1229,7 @@ def test_post_notification_should_set_reply_to_text(client, sample_service, mock
assert notifications[0].reply_to_text == expected_reply_to
@pytest.mark.skip(reason="Rewrite without letters")
@pytest.mark.skip(reason="Rewrite without letters?")
@pytest.mark.parametrize('reference_paceholder,', [None, 'ref2'])
def test_send_notification_should_set_client_reference_from_placeholder(
sample_letter_template, mocker, reference_paceholder