Refactor to split s3_client.py into multiple files

Separated s3_client.py into 3 files - for logos, CSV files and the MOU.
This helps to keep things clearer now that we need to add lots more logo
functions for letters.
This commit is contained in:
Katie Smith
2019-01-30 09:42:15 +00:00
parent 5e6d48e50f
commit f005d7a569
15 changed files with 202 additions and 185 deletions

View File

@@ -78,7 +78,7 @@ def test_downloading_agreement(
expected_file_served,
):
mock_get_s3_object = mocker.patch(
'app.main.s3_client.get_s3_object',
'app.s3_client.s3_mou_client.get_s3_object',
return_value=_MockS3Object(b'foo')
)
user = active_user_with_permissions(fake_uuid)
@@ -100,7 +100,7 @@ def test_agreement_cant_be_downloaded_unknown_crown_status(
fake_uuid,
):
mock_get_s3_object = mocker.patch(
'app.main.s3_client.get_s3_object',
'app.s3_client.s3_mou_client.get_s3_object',
return_value=_MockS3Object()
)
user = active_user_with_permissions(fake_uuid)
@@ -116,7 +116,7 @@ def test_agreement_requires_login(
mocker,
):
mock_get_s3_object = mocker.patch(
'app.main.s3_client.get_s3_object',
'app.s3_client.s3_mou_client.get_s3_object',
return_value=_MockS3Object()
)
response = client.get(url_for('main.download_agreement'))
@@ -142,7 +142,7 @@ def test_show_public_agreement_page(
expected_status,
):
mocker.patch(
'app.main.s3_client.get_s3_object',
'app.s3_client.s3_mou_client.get_s3_object',
return_value=_MockS3Object()
)
response = client.get(url_for(

View File

@@ -6,7 +6,7 @@ from bs4 import BeautifulSoup
from flask import url_for
from notifications_python_client.errors import HTTPError
from app.main.s3_client import LOGO_LOCATION_STRUCTURE, TEMP_TAG
from app.s3_client.s3_logo_client import LOGO_LOCATION_STRUCTURE, TEMP_TAG
from tests.conftest import (
mock_get_email_branding,
normalize_spaces,