From 6854488bbf5e97c67928bc422ce5b01bd5daf581 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 11:30:21 +0100 Subject: [PATCH 1/7] Add INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS setting param --- config/settings/base.py | 3 +++ .../commands/delete_outdated_conversations.py | 7 +------ lemarche/conversations/models.py | 9 --------- lemarche/conversations/tests.py | 11 ----------- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index 333c6d555..eb22f5e08 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -833,6 +833,9 @@ } BITOUBI_ENV_COLOR = ENV_COLOR_MAPPING.get(BITOUBI_ENV, "") +# Privacy timeouts +# ------------------------------------------------------------------------------ +INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS = env.int("INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS", 6) # Wagtail # ------------------------------------------------------------------------------ diff --git a/lemarche/conversations/management/commands/delete_outdated_conversations.py b/lemarche/conversations/management/commands/delete_outdated_conversations.py index 28adb4db5..3a1006dc8 100644 --- a/lemarche/conversations/management/commands/delete_outdated_conversations.py +++ b/lemarche/conversations/management/commands/delete_outdated_conversations.py @@ -1,4 +1,3 @@ -from lemarche.conversations.models import Conversation from lemarche.utils.commands import BaseCommand @@ -11,8 +10,4 @@ class Command(BaseCommand): """ def handle(self, *args, **options): - self.stdout_info("Delete script of outdated conversations") - conversations_outdated = Conversation.objects.outdated() - self.stdout_info(f"Found {conversations_outdated.count()} outdated conversation(s) to delete") - deleted_count, _ = conversations_outdated.delete() - self.stdout_info(f"Deleted {deleted_count} outdated conversation(s)") + pass diff --git a/lemarche/conversations/models.py b/lemarche/conversations/models.py index b82b79c10..683013cf4 100644 --- a/lemarche/conversations/models.py +++ b/lemarche/conversations/models.py @@ -1,4 +1,3 @@ -from datetime import timedelta from uuid import uuid4 from django.conf import settings @@ -40,14 +39,6 @@ def get_conv_from_uuid(self, conv_uuid: str, version=1): else: return self.get(Q(sender_encoded__endswith=conv_uuid) | Q(siae_encoded__endswith=conv_uuid)) - def outdated(self): - """the conversations must be deleted after six month - So we get all conversations outdated with this method - """ - # we use shortcut of 30 days x 6 month because timedelta doesn't accept months - six_months_ago = timezone.now() - timedelta(days=30 * 6) - return self.filter(created_at__lte=six_months_ago) - class Conversation(models.Model): KIND_SEARCH = "SEARCH" diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index 70d46ae3d..2ee41a7d1 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -1,9 +1,6 @@ -from datetime import timedelta - from django.core.exceptions import ValidationError from django.db import IntegrityError from django.test import TestCase, TransactionTestCase -from django.utils import timezone from lemarche.conversations import constants as conversation_constants from lemarche.conversations.factories import ConversationFactory, TemplateTransactionalFactory @@ -71,14 +68,6 @@ def test_with_answer_stats(self): self.assertEqual(conversation_queryset.get(id=self.conversation.id).answer_count_annotated, 0) self.assertEqual(conversation_queryset.get(id=self.conversation_with_answer.id).answer_count_annotated, 1) - def test_outdated(self): - one_year_ago = timezone.now() - timedelta(days=365) - ConversationFactory(created_at=one_year_ago) - five_weeks_ago = timezone.now() - timedelta(weeks=5) - ConversationFactory(created_at=five_weeks_ago) - self.assertEqual(Conversation.objects.all().count(), 2 + 2) - self.assertEqual(Conversation.objects.outdated().count(), 1) - class TemplateTransactionalModelTest(TestCase): @classmethod From d71103b7e244507dda754b03eeae7413944caa78 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 11:42:46 +0100 Subject: [PATCH 2/7] Rename delete_outdated_conversations.py to anonymize_outdated_conversations.py --- ...te_outdated.sh => conversations_anonymize_outdated.sh} | 8 ++++---- clevercloud/cron.json | 2 +- ...nversations.py => anonymize_outdated_conversations.py} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename clevercloud/{conversations_delete_outdated.sh => conversations_anonymize_outdated.sh} (62%) mode change 100755 => 100644 rename lemarche/conversations/management/commands/{delete_outdated_conversations.py => anonymize_outdated_conversations.py} (62%) diff --git a/clevercloud/conversations_delete_outdated.sh b/clevercloud/conversations_anonymize_outdated.sh old mode 100755 new mode 100644 similarity index 62% rename from clevercloud/conversations_delete_outdated.sh rename to clevercloud/conversations_anonymize_outdated.sh index d139c247c..81ed6d183 --- a/clevercloud/conversations_delete_outdated.sh +++ b/clevercloud/conversations_anonymize_outdated.sh @@ -1,10 +1,10 @@ #!/bin/bash -l -# delete outdated conversations +# anonymize outdated conversations # Do not run if this env var is not set: -if [[ -z "$CRON_CONVERSATIONS_DELETE_OUTDATED" ]]; then - echo "CRON_CONVERSATIONS_DELETE_OUTDATED not set. Exiting..." +if [[ -z "$CRON_CONVERSATIONS_ANONYMIZE_OUTDATED" ]]; then + echo "CRON_CONVERSATIONS_ANONYMIZE_OUTDATED not set. Exiting..." exit 0 fi @@ -19,4 +19,4 @@ fi # $APP_HOME is set by default by clever cloud. cd $APP_HOME -django-admin delete_outdated_conversations +django-admin anonymize_outdated_conversations diff --git a/clevercloud/cron.json b/clevercloud/cron.json index 9a85f2c18..a9c943dc2 100644 --- a/clevercloud/cron.json +++ b/clevercloud/cron.json @@ -3,7 +3,7 @@ "15 0 * * * $ROOT/clevercloud/stats_export_user_download_list_to_file.sh", "30 0 * * * $ROOT/clevercloud/stats_export_user_search_list_to_file.sh", "0 1 * * * $ROOT/clevercloud/tenders_update_count_fields.sh", - "0 6 * * * $ROOT/clevercloud/conversations_delete_outdated.sh", + "0 6 * * * $ROOT/clevercloud/conversations_anonymize_outdated.sh", "0 7 * * 1 $ROOT/clevercloud/siaes_sync_with_emplois_inclusion.sh", "5 7 * * 1 $ROOT/clevercloud/siaes_sync_c2_c4.sh", "10 7 * * 1 $ROOT/clevercloud/siaes_update_api_entreprise_fields.sh", diff --git a/lemarche/conversations/management/commands/delete_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py similarity index 62% rename from lemarche/conversations/management/commands/delete_outdated_conversations.py rename to lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 3a1006dc8..1bbd6874e 100644 --- a/lemarche/conversations/management/commands/delete_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -3,10 +3,10 @@ class Command(BaseCommand): """ - Command to delete outdated conversations + Command to anonymize outdated conversations Note: run via a CRON every day - Usage: python manage.py delete_outdated_conversations + Usage: python manage.py anonymize_outdated_conversations """ def handle(self, *args, **options): From af97dc505c333a08e893f892df8042d270f4d751 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 12:37:05 +0100 Subject: [PATCH 3/7] Anonymize command --- .../anonymize_outdated_conversations.py | 28 +++++++++++++- lemarche/conversations/tests.py | 37 ++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 1bbd6874e..9a8d051e1 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -1,3 +1,8 @@ +from dateutil.relativedelta import relativedelta +from django.conf import settings +from django.utils import timezone + +from lemarche.conversations.models import Conversation from lemarche.utils.commands import BaseCommand @@ -10,4 +15,25 @@ class Command(BaseCommand): """ def handle(self, *args, **options): - pass + inactive_datetime = timezone.now() - relativedelta(months=settings.INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS) + outdated_conversations = Conversation.objects.filter(created_at__lte=inactive_datetime) + + for conversation in outdated_conversations: + conversation.sender_user = None + conversation.sender_email = None + conversation.sender_first_name = "" + conversation.sender_last_name = "" + conversation.initial_body_message = str(len(conversation.initial_body_message)) + conversation.data = [str(len(element)) for element in conversation.data] + + Conversation.objects.bulk_update( + outdated_conversations, + fields=[ + "sender_user", + "sender_email", + "sender_first_name", + "sender_last_name", + "initial_body_message", + "data", + ], + ) diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index 2ee41a7d1..d9aed7c43 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -1,6 +1,11 @@ +from datetime import datetime +from unittest.mock import patch + from django.core.exceptions import ValidationError +from django.core.management import call_command from django.db import IntegrityError -from django.test import TestCase, TransactionTestCase +from django.test import TestCase, TransactionTestCase, override_settings +from django.utils import timezone from lemarche.conversations import constants as conversation_constants from lemarche.conversations.factories import ConversationFactory, TemplateTransactionalFactory @@ -69,6 +74,36 @@ def test_with_answer_stats(self): self.assertEqual(conversation_queryset.get(id=self.conversation_with_answer.id).answer_count_annotated, 1) +@patch("django.utils.timezone.now", lambda: datetime(year=2024, month=1, day=1, tzinfo=timezone.utc)) +@override_settings( + INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS=6, +) +class ConversationAnonymizationTestCase(TestCase): + """ + Check that conversation are correctly anonymized + """ + + def setUp(self): + ConversationFactory( + title="anonymized", + created_at=datetime(year=2023, month=6, day=1, tzinfo=timezone.utc), + initial_body_message="blabla", + data=["blabla", "blabla"], + ) + ConversationFactory(created_at=datetime(year=2023, month=8, day=1, tzinfo=timezone.utc)) + + def test_anonymize_command(self): + call_command("anonymize_outdated_conversations") + + conv = Conversation.objects.get(title="anonymized") + self.assertIsNone(conv.sender_user) + self.assertIsNone(conv.sender_email) + self.assertEqual(conv.sender_first_name, "") + self.assertEqual(conv.sender_last_name, "") + self.assertEqual(conv.initial_body_message, "6") + self.assertEqual(conv.data, ["6", "6"]) + + class TemplateTransactionalModelTest(TestCase): @classmethod def setUpTestData(cls): From 8d44a625f46e4fbfa8e3f93a2688c89b7d328bb5 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 13:54:33 +0100 Subject: [PATCH 4/7] Add is_anonymized flag --- .../anonymize_outdated_conversations.py | 4 +++- .../0018_conversation_is_anonymized.py | 17 +++++++++++++++++ lemarche/conversations/models.py | 2 ++ lemarche/conversations/tests.py | 16 +++++++++------- 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 lemarche/conversations/migrations/0018_conversation_is_anonymized.py diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 9a8d051e1..30d35d14c 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -16,7 +16,7 @@ class Command(BaseCommand): def handle(self, *args, **options): inactive_datetime = timezone.now() - relativedelta(months=settings.INACTIVE_CONVERSATION_TIMEOUT_IN_MONTHS) - outdated_conversations = Conversation.objects.filter(created_at__lte=inactive_datetime) + outdated_conversations = Conversation.objects.filter(created_at__lte=inactive_datetime, is_anonymized=False) for conversation in outdated_conversations: conversation.sender_user = None @@ -25,6 +25,7 @@ def handle(self, *args, **options): conversation.sender_last_name = "" conversation.initial_body_message = str(len(conversation.initial_body_message)) conversation.data = [str(len(element)) for element in conversation.data] + conversation.is_anonymized = True Conversation.objects.bulk_update( outdated_conversations, @@ -35,5 +36,6 @@ def handle(self, *args, **options): "sender_last_name", "initial_body_message", "data", + "is_anonymized", ], ) diff --git a/lemarche/conversations/migrations/0018_conversation_is_anonymized.py b/lemarche/conversations/migrations/0018_conversation_is_anonymized.py new file mode 100644 index 000000000..5bddccc93 --- /dev/null +++ b/lemarche/conversations/migrations/0018_conversation_is_anonymized.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.15 on 2024-12-30 12:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("conversations", "0017_emailgroup_disabledemail_templatetransactional_group_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="conversation", + name="is_anonymized", + field=models.BooleanField(default=False, verbose_name="Est anonymisé"), + ), + ] diff --git a/lemarche/conversations/models.py b/lemarche/conversations/models.py index 683013cf4..282960831 100644 --- a/lemarche/conversations/models.py +++ b/lemarche/conversations/models.py @@ -88,6 +88,8 @@ class Conversation(models.Model): data = models.JSONField(default=list) + is_anonymized = models.BooleanField(verbose_name="Est anonymisé", default=False) + created_at = models.DateTimeField(verbose_name="Date de création", default=timezone.now) updated_at = models.DateTimeField(verbose_name="Date de modification", auto_now=True) validated_at = models.DateTimeField(verbose_name="Date de validation", blank=True, null=True) diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index d9aed7c43..cc62238b3 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -95,13 +95,15 @@ def setUp(self): def test_anonymize_command(self): call_command("anonymize_outdated_conversations") - conv = Conversation.objects.get(title="anonymized") - self.assertIsNone(conv.sender_user) - self.assertIsNone(conv.sender_email) - self.assertEqual(conv.sender_first_name, "") - self.assertEqual(conv.sender_last_name, "") - self.assertEqual(conv.initial_body_message, "6") - self.assertEqual(conv.data, ["6", "6"]) + conv_anonymized = Conversation.objects.get(title="anonymized", is_anonymized=True) + self.assertIsNone(conv_anonymized.sender_user) + self.assertIsNone(conv_anonymized.sender_email) + self.assertEqual(conv_anonymized.sender_first_name, "") + self.assertEqual(conv_anonymized.sender_last_name, "") + self.assertEqual(conv_anonymized.initial_body_message, "6") + self.assertEqual(conv_anonymized.data, ["6", "6"]) + + self.assertTrue(Conversation.objects.get(is_anonymized=False), msg="active conversation wrongly anonymised !!") class TemplateTransactionalModelTest(TestCase): From 882b240e2ee05d42648e8728791fabb7c0199a24 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 14:11:38 +0100 Subject: [PATCH 5/7] Anonymize email data by saving length --- .../management/commands/anonymize_outdated_conversations.py | 2 +- lemarche/conversations/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 30d35d14c..449c0dabb 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -24,7 +24,7 @@ def handle(self, *args, **options): conversation.sender_first_name = "" conversation.sender_last_name = "" conversation.initial_body_message = str(len(conversation.initial_body_message)) - conversation.data = [str(len(element)) for element in conversation.data] + conversation.data = [str(len(conversation.data))] conversation.is_anonymized = True Conversation.objects.bulk_update( diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index cc62238b3..8af0376b6 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -101,7 +101,7 @@ def test_anonymize_command(self): self.assertEqual(conv_anonymized.sender_first_name, "") self.assertEqual(conv_anonymized.sender_last_name, "") self.assertEqual(conv_anonymized.initial_body_message, "6") - self.assertEqual(conv_anonymized.data, ["6", "6"]) + self.assertEqual(conv_anonymized.data, ["2"]) self.assertTrue(Conversation.objects.get(is_anonymized=False), msg="active conversation wrongly anonymised !!") From db1cb1bf3963b007d8e6029d2d8647343ee70e3a Mon Sep 17 00:00:00 2001 From: Guilouf Date: Mon, 30 Dec 2024 14:53:13 +0100 Subject: [PATCH 6/7] Anonymize inbound data --- lemarche/conversations/constants.py | 1 + .../commands/anonymize_outdated_conversations.py | 8 +++++++- lemarche/conversations/tests.py | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lemarche/conversations/constants.py b/lemarche/conversations/constants.py index e625b1d14..cf4f48de2 100644 --- a/lemarche/conversations/constants.py +++ b/lemarche/conversations/constants.py @@ -1,4 +1,5 @@ ATTRIBUTES_TO_SAVE_FOR_INBOUND = ["From", "To", "CC", "ReplyTo", "SentAtDate", "Attachments"] +ATTRIBUTES_TO_KEEP_FOR_INBOUND = ["SentAtDate", "Attachments"] SOURCE_MAILJET = "MAILJET" SOURCE_BREVO = "BREVO" diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 449c0dabb..64424414f 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -2,10 +2,16 @@ from django.conf import settings from django.utils import timezone +from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND from lemarche.conversations.models import Conversation from lemarche.utils.commands import BaseCommand +def clean_inbound_data(inbound_data: dict) -> dict: + """Keep only allowed data once anonymized""" + return {key: inbound_data[key] for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + + class Command(BaseCommand): """ Command to anonymize outdated conversations @@ -24,7 +30,7 @@ def handle(self, *args, **options): conversation.sender_first_name = "" conversation.sender_last_name = "" conversation.initial_body_message = str(len(conversation.initial_body_message)) - conversation.data = [str(len(conversation.data))] + conversation.data = [clean_inbound_data(data) for data in conversation.data] conversation.is_anonymized = True Conversation.objects.bulk_update( diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index 8af0376b6..8f88608e8 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -8,6 +8,7 @@ from django.utils import timezone from lemarche.conversations import constants as conversation_constants +from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND, ATTRIBUTES_TO_SAVE_FOR_INBOUND from lemarche.conversations.factories import ConversationFactory, TemplateTransactionalFactory from lemarche.conversations.models import Conversation, TemplateTransactional from lemarche.siaes.factories import SiaeFactory @@ -84,11 +85,14 @@ class ConversationAnonymizationTestCase(TestCase): """ def setUp(self): + inbound_data = {key: "something" for key in ATTRIBUTES_TO_SAVE_FOR_INBOUND} + self.anonymized_inbound_data = {key: "something" for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + ConversationFactory( title="anonymized", created_at=datetime(year=2023, month=6, day=1, tzinfo=timezone.utc), initial_body_message="blabla", - data=["blabla", "blabla"], + data=[inbound_data, inbound_data], ) ConversationFactory(created_at=datetime(year=2023, month=8, day=1, tzinfo=timezone.utc)) @@ -101,7 +105,7 @@ def test_anonymize_command(self): self.assertEqual(conv_anonymized.sender_first_name, "") self.assertEqual(conv_anonymized.sender_last_name, "") self.assertEqual(conv_anonymized.initial_body_message, "6") - self.assertEqual(conv_anonymized.data, ["2"]) + self.assertEqual(conv_anonymized.data, [self.anonymized_inbound_data, self.anonymized_inbound_data]) self.assertTrue(Conversation.objects.get(is_anonymized=False), msg="active conversation wrongly anonymised !!") From 7501083755d7ecc530b87f126b35463ce8d92de4 Mon Sep 17 00:00:00 2001 From: Guilouf Date: Tue, 31 Dec 2024 10:30:25 +0100 Subject: [PATCH 7/7] fix constant name --- lemarche/conversations/constants.py | 2 +- .../management/commands/anonymize_outdated_conversations.py | 4 ++-- lemarche/conversations/tests.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lemarche/conversations/constants.py b/lemarche/conversations/constants.py index cf4f48de2..f30ed27c9 100644 --- a/lemarche/conversations/constants.py +++ b/lemarche/conversations/constants.py @@ -1,5 +1,5 @@ ATTRIBUTES_TO_SAVE_FOR_INBOUND = ["From", "To", "CC", "ReplyTo", "SentAtDate", "Attachments"] -ATTRIBUTES_TO_KEEP_FOR_INBOUND = ["SentAtDate", "Attachments"] +ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND = ["SentAtDate", "Attachments"] SOURCE_MAILJET = "MAILJET" SOURCE_BREVO = "BREVO" diff --git a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py index 64424414f..796f53d4c 100644 --- a/lemarche/conversations/management/commands/anonymize_outdated_conversations.py +++ b/lemarche/conversations/management/commands/anonymize_outdated_conversations.py @@ -2,14 +2,14 @@ from django.conf import settings from django.utils import timezone -from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND +from lemarche.conversations.constants import ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND from lemarche.conversations.models import Conversation from lemarche.utils.commands import BaseCommand def clean_inbound_data(inbound_data: dict) -> dict: """Keep only allowed data once anonymized""" - return {key: inbound_data[key] for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + return {key: inbound_data[key] for key in ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND} class Command(BaseCommand): diff --git a/lemarche/conversations/tests.py b/lemarche/conversations/tests.py index 8f88608e8..ffb109dd8 100644 --- a/lemarche/conversations/tests.py +++ b/lemarche/conversations/tests.py @@ -8,7 +8,7 @@ from django.utils import timezone from lemarche.conversations import constants as conversation_constants -from lemarche.conversations.constants import ATTRIBUTES_TO_KEEP_FOR_INBOUND, ATTRIBUTES_TO_SAVE_FOR_INBOUND +from lemarche.conversations.constants import ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND, ATTRIBUTES_TO_SAVE_FOR_INBOUND from lemarche.conversations.factories import ConversationFactory, TemplateTransactionalFactory from lemarche.conversations.models import Conversation, TemplateTransactional from lemarche.siaes.factories import SiaeFactory @@ -86,7 +86,7 @@ class ConversationAnonymizationTestCase(TestCase): def setUp(self): inbound_data = {key: "something" for key in ATTRIBUTES_TO_SAVE_FOR_INBOUND} - self.anonymized_inbound_data = {key: "something" for key in ATTRIBUTES_TO_KEEP_FOR_INBOUND} + self.anonymized_inbound_data = {key: "something" for key in ATTRIBUTES_TO_NOT_ANONYMIZE_FOR_INBOUND} ConversationFactory( title="anonymized",