-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If siae contact_full_name is empty, use slug
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
from lemarche.conversations.factories import ConversationFactory | ||
from lemarche.conversations.models import Conversation | ||
from lemarche.siaes.factories import SiaeFactory | ||
|
||
|
||
class ConversationModelTest(TestCase): | ||
|
@@ -19,6 +20,35 @@ def test_str(self): | |
self.assertEqual(str(self.conversation), "Je souhaite me renseigner") | ||
|
||
|
||
class ConversationModelSaveTest(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.siae_with_contact_full_name = SiaeFactory( | ||
name="Une structure", | ||
contact_first_name="Prénom", | ||
contact_last_name="Nom", | ||
contact_email="[email protected]", | ||
) | ||
cls.conversation_1 = ConversationFactory( | ||
title="Je souhaite me renseigner", | ||
sender_first_name="Acheteur", | ||
sender_last_name="Curieux", | ||
sender_email="[email protected]", | ||
siae=cls.siae_with_contact_full_name, | ||
) | ||
cls.siae_without_contact_full_name = SiaeFactory( | ||
name="Une autre structure", contact_first_name="", contact_last_name="", contact_email="[email protected]" | ||
) | ||
cls.conversation_2 = ConversationFactory( | ||
title="Je souhaite encore me renseigner", siae=cls.siae_without_contact_full_name | ||
) | ||
|
||
def test_set_siae_encoded(self): | ||
self.assertTrue("acheteur_curieux" in self.conversation_1.sender_encoded) | ||
self.assertTrue("prenom_nom" in self.conversation_1.siae_encoded) | ||
self.assertTrue("une_autre_structure" in self.conversation_2.siae_encoded) | ||
|
||
|
||
class ConversationQuerysetTest(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters