Skip to content

Commit

Permalink
fix constant name
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilouf committed Dec 31, 2024
1 parent db1cb1b commit 7501083
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lemarche/conversations/constants.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions lemarche/conversations/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 7501083

Please sign in to comment.