From 1e8de2638cba91bce4d5ccf49639b41a5c8508ec Mon Sep 17 00:00:00 2001 From: Helder Ribeiro Date: Wed, 13 Nov 2024 17:32:19 +0000 Subject: [PATCH] fmd-984 - Remove `data owner` references from app code - replaced `data_owner` with `data_custodian` in the codebase - did not replace any reference to data owner on datahub lib Signed-off-by: Helder Ribeiro --- feedback/migrations/0001_initial.py | 2 +- feedback/models.py | 4 ++-- feedback/service.py | 6 +++--- feedback/views.py | 4 ++-- templates/partial/contact_info.html | 2 +- tests/feedback/test_notify_service.py | 8 ++++---- tests/feedback/test_views.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/feedback/migrations/0001_initial.py b/feedback/migrations/0001_initial.py index ead7ed37..a0950b9b 100644 --- a/feedback/migrations/0001_initial.py +++ b/feedback/migrations/0001_initial.py @@ -80,7 +80,7 @@ class Migration(migrations.Migration): ), ("entity_name", models.CharField(max_length=250)), ("entity_url", models.CharField(max_length=250)), - ("data_owner_email", models.CharField(max_length=250)), + ("data_custodian_email", models.CharField(max_length=250)), ( "user_email", models.CharField( diff --git a/feedback/models.py b/feedback/models.py index 28c40078..0cf06e36 100644 --- a/feedback/models.py +++ b/feedback/models.py @@ -28,7 +28,7 @@ class Feedback(models.Model): class Issue(models.Model): class IssueChoices(models.TextChoices): BROKEN_LINK = "Link is broken" - INCORRECT_OWNER = "Owner is incorrect" + INCORRECT_CUSTODIAN = "Data Custodian is incorrect" OUTDATED_CONTACT = "Contact is outdated" OTHER = "Other" @@ -54,4 +54,4 @@ class IssueChoices(models.TextChoices): ) entity_name = models.CharField(max_length=250) entity_url = models.CharField(max_length=250) - data_owner_email = models.CharField(max_length=250) + data_custodian_email = models.CharField(max_length=250) diff --git a/feedback/service.py b/feedback/service.py index 5c4bd727..859963c1 100644 --- a/feedback/service.py +++ b/feedback/service.py @@ -28,7 +28,7 @@ def send( personalisation = { "assetOwner": ( - issue.data_owner_email if issue.data_owner_email else "Data Catalog Team" + issue.data_custodian_email if issue.data_custodian_email else "Data Catalog Team" ), "userEmail": issue.created_by.email if issue.created_by else "", "assetName": issue.entity_name, @@ -39,11 +39,11 @@ def send( reference = str(issue.id) # Notify Data Owner - if issue.data_owner_email: + if issue.data_custodian_email: notify( personalisation=personalisation, template_id=settings.NOTIFY_DATA_OWNER_TEMPLATE_ID, - email_address=issue.data_owner_email, + email_address=issue.data_custodian_email, reference=reference, client=client, ) diff --git a/feedback/views.py b/feedback/views.py index 033b6833..1fc0adfe 100644 --- a/feedback/views.py +++ b/feedback/views.py @@ -47,7 +47,7 @@ def report_issue_view(request) -> HttpResponse: issue = form.save(commit=False) issue.entity_name = request.session.get("entity_name") issue.entity_url = request.session.get("entity_url") - issue.data_owner_email = request.session.get("data_owner_email") + issue.data_custodian_email = request.session.get("data_custodian_email") # in production, there should always be a signed in user, # but this may not be the case in local development/unit tests @@ -81,7 +81,7 @@ def report_issue_view(request) -> HttpResponse: request.session["entity_name"] = entity_name request.session["entity_url"] = entity_url - request.session["data_owner_email"] = _(request.GET.get("data_owner_email", "")) + request.session["data_custodian_email"] = _(request.GET.get("data_custodian_email", "")) form = IssueForm() diff --git a/templates/partial/contact_info.html b/templates/partial/contact_info.html index b34f9f3f..a38c16d6 100644 --- a/templates/partial/contact_info.html +++ b/templates/partial/contact_info.html @@ -69,6 +69,6 @@

{% translate "Data custodian {% if NOTIFY_ENABLED and entity_name %} {% endif %} diff --git a/tests/feedback/test_notify_service.py b/tests/feedback/test_notify_service.py index 08b5f307..b342fd20 100644 --- a/tests/feedback/test_notify_service.py +++ b/tests/feedback/test_notify_service.py @@ -11,7 +11,7 @@ def test_send_all_notifications(mock_notifications_client, reporter): "additional_info": "This is some additional information.", "entity_name": "my_entity", "entity_url": "http://localhost/my_entity", - "data_owner_email": "entity_owner@justice.gov.uk", + "data_custodian_email": "entity_owner@justice.gov.uk", "created_by": reporter, } @@ -24,7 +24,7 @@ def test_send_all_notifications(mock_notifications_client, reporter): @pytest.mark.django_db -def test_send_notifications_no_data_owner_email(mock_notifications_client, reporter): +def test_send_notifications_no_data_custodian_email(mock_notifications_client, reporter): data = { "reason": "Other", "additional_info": "This is some additional information.", @@ -48,7 +48,7 @@ def test_send_all_notifications_no_reporter(mock_notifications_client): "additional_info": "This is some additional information.", "entity_name": "my_entity", "entity_url": "http://localhost/my_entity", - "data_owner_email": "entity_owner@justice.gov.uk", + "data_custodian_email": "entity_owner@justice.gov.uk", } issue = Issue.objects.create(**data) @@ -59,7 +59,7 @@ def test_send_all_notifications_no_reporter(mock_notifications_client): @pytest.mark.django_db -def test_send_all_notifications_no_reporter_no_data_owner_email( +def test_send_all_notifications_no_reporter_no_data_custodian_email( mock_notifications_client, reporter ): data = { diff --git a/tests/feedback/test_views.py b/tests/feedback/test_views.py index 779125e5..4807e7b2 100644 --- a/tests/feedback/test_views.py +++ b/tests/feedback/test_views.py @@ -36,7 +36,7 @@ def test_form_renders(self, client): data={ "entity_name": "my_entity", "entity_url": "http://localhost/my_entity", - "data_owner_email": "data.owner@justice.gov.uk", + "data_custodian_email": "data.owner@justice.gov.uk", }, ) assert response.status_code == 200