From 7e4eabf3e2e35eeeaa7cfa61d6d3a6abd38938e0 Mon Sep 17 00:00:00 2001 From: Sarah Sloan Date: Tue, 20 Sep 2022 15:22:11 +0100 Subject: [PATCH 1/2] utils version and fixed field names --- app/notification/magic_link/map_contents.py | 14 +++++++------- examplar_data/magic_link_data.py | 10 ++++++---- requirements-dev.txt | 2 +- requirements.in | 3 +-- requirements.txt | 3 +-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/notification/magic_link/map_contents.py b/app/notification/magic_link/map_contents.py index febf3b43..62a57ef9 100644 --- a/app/notification/magic_link/map_contents.py +++ b/app/notification/magic_link/map_contents.py @@ -28,13 +28,13 @@ def from_json(json_data: dict): content = MagicLink.process_data(json_data).get("content") return MagicLink( contact_info=data.contact_info, - fund_name=content.get(NotifyConstants.FIELD_FUND_NAME), - magic_link=content.get(NotifyConstants.FIELD_MAGIC_LINK_URL), + fund_name=content.get(NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD), + magic_link=content.get(NotifyConstants.MAGIC_LINK_URL_FIELD), request_new_link_url=content.get( - NotifyConstants.FIELD_REQUEST_NEW_LINK_URL + NotifyConstants.MAGIC_LINK_REQUEST_NEW_LINK_URL_FIELD ), contact_help_email=content.get( - NotifyConstants.FIELD_CONTACT_HELP_EMAIL + NotifyConstants.MAGIC_LINK_CONTACT_HELP_EMAIL_FIELD ), ) @@ -52,9 +52,9 @@ def process_data(data: dict) -> dict: """ data["content"].update( { - NotifyConstants.FIELD_FUND_NAME: data["content"].get( - NotifyConstants.FIELD_FUND_NAME, "Funds" - ) + NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD: data[ + "content" + ].get(NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD, "Funds") } ) return data diff --git a/examplar_data/magic_link_data.py b/examplar_data/magic_link_data.py index 2459dabe..8b1caf2b 100644 --- a/examplar_data/magic_link_data.py +++ b/examplar_data/magic_link_data.py @@ -1,10 +1,12 @@ from fsd_utils.config.notify_constants import NotifyConstants valid_content = { - NotifyConstants.FIELD_MAGIC_LINK_URL: "MAGIC-LINK-GOES-HERE", - NotifyConstants.FIELD_FUND_NAME: "FUND NAME GOES HERE", - NotifyConstants.FIELD_CONTACT_HELP_EMAIL: "help@email.com", - NotifyConstants.FIELD_REQUEST_NEW_LINK_URL: "NEW LINK URL GOES HERE", + NotifyConstants.MAGIC_LINK_URL_FIELD: "MAGIC-LINK-GOES-HERE", + NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD: "FUND NAME GOES HERE", + NotifyConstants.MAGIC_LINK_CONTACT_HELP_EMAIL_FIELD: "help@email.com", + NotifyConstants.MAGIC_LINK_REQUEST_NEW_LINK_URL_FIELD: ( + "NEW LINK URL GOES HERE" + ), } expected_magic_link_content = ( diff --git a/requirements-dev.txt b/requirements-dev.txt index c76accbd..ef6fb2aa 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -95,7 +95,7 @@ flask-babel==2.0.0 # funding-service-design-utils flask-talisman==0.8.1 # via -r requirements.txt -funding-service-design-utils @ https://github.com/communitiesuk/funding-service-design-utils/archive/refs/tags/0.0.20.tar.gz +funding-service-design-utils==1.0.0 # via -r requirements.txt gitdb==4.0.9 # via gitpython diff --git a/requirements.in b/requirements.in index e92b104c..a4325de9 100644 --- a/requirements.in +++ b/requirements.in @@ -1,8 +1,7 @@ #----------------------------------- # FSD Utils #----------------------------------- -https://github.com/communitiesuk/funding-service-design-utils/archive/refs/tags/0.0.20.tar.gz -requests +funding-service-design-utils==1.0.0 #----------------------------------- # Flask Version diff --git a/requirements.txt b/requirements.txt index 6fdabafe..964cf1e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,7 +40,7 @@ flask-babel==2.0.0 # via funding-service-design-utils flask-talisman==0.8.1 # via -r requirements.in -funding-service-design-utils @ https://github.com/communitiesuk/funding-service-design-utils/archive/refs/tags/0.0.20.tar.gz +funding-service-design-utils==1.0.0 # via -r requirements.in gunicorn==20.1.0 # via funding-service-design-utils @@ -103,7 +103,6 @@ pyyaml==6.0 # openapi-spec-validator requests==2.28.1 # via - # -r requirements.in # connexion # notifications-python-client # prance From c4845b1197134b7bd1b41267ffed405b35666213 Mon Sep 17 00:00:00 2001 From: Sarah Sloan Date: Tue, 20 Sep 2022 15:22:11 +0100 Subject: [PATCH 2/2] utils version and fixed field names --- app/notification/magic_link/map_contents.py | 6 +++--- requirements-dev.txt | 2 +- requirements.in | 2 +- requirements.txt | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/notification/magic_link/map_contents.py b/app/notification/magic_link/map_contents.py index 50d570e6..6b4a9058 100644 --- a/app/notification/magic_link/map_contents.py +++ b/app/notification/magic_link/map_contents.py @@ -54,9 +54,9 @@ def process_data(data: dict) -> dict: """ data.content.update( { - NotifyConstants.FIELD_FUND_NAME: data.content.get( - NotifyConstants.FIELD_FUND_NAME, "Funds" - ) + NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD: data[ + "content" + ].get(NotifyConstants.MAGIC_LINK_FUND_NAME_FIELD, "Funds") } ) return data diff --git a/requirements-dev.txt b/requirements-dev.txt index 07ce57c2..ef6fb2aa 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -95,7 +95,7 @@ flask-babel==2.0.0 # funding-service-design-utils flask-talisman==0.8.1 # via -r requirements.txt -funding-service-design-utils==0.1.1 +funding-service-design-utils==1.0.0 # via -r requirements.txt gitdb==4.0.9 # via gitpython diff --git a/requirements.in b/requirements.in index a60dcc23..5cb0d3b0 100644 --- a/requirements.in +++ b/requirements.in @@ -1,7 +1,7 @@ #----------------------------------- # FSD Utils #----------------------------------- -funding-service-design-utils==0.1.1 +funding-service-design-utils==1.0.0 requests #----------------------------------- diff --git a/requirements.txt b/requirements.txt index 4805096f..964cf1e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,7 +40,7 @@ flask-babel==2.0.0 # via funding-service-design-utils flask-talisman==0.8.1 # via -r requirements.in -funding-service-design-utils==0.1.1 +funding-service-design-utils==1.0.0 # via -r requirements.in gunicorn==20.1.0 # via funding-service-design-utils @@ -103,7 +103,6 @@ pyyaml==6.0 # openapi-spec-validator requests==2.28.1 # via - # -r requirements.in # connexion # notifications-python-client # prance