diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-08 17:02:56 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:42:35 +0200 | 
| commit | 8d480e2dfef30252f9ef35c60c66e8876fd464f1 (patch) | |
| tree | 75958b276b6976439feed600807ec32b01a88a07 /ishtar_common/tests.py | |
| parent | bc470e8759a77bb8ab150403232596598dcf3b4c (diff) | |
| download | Ishtar-8d480e2dfef30252f9ef35c60c66e8876fd464f1.tar.bz2 Ishtar-8d480e2dfef30252f9ef35c60c66e8876fd464f1.zip | |
Fix person merge when the target have an ishtar profile (refs #4477)
Diffstat (limited to 'ishtar_common/tests.py')
| -rw-r--r-- | ishtar_common/tests.py | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 7166f9cb7..17cc874fe 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -898,6 +898,10 @@ class MergeTest(TestCase):              title=self.title, attached_to=self.company_2)          self.user.ishtaruser.person = self.person_2          self.user.ishtaruser.save() +        models.UserProfile.objects.create( +            profile_type=models.ProfileType.objects.all()[0], +            person=self.person_2 +        )          self.person_2.person_types.add(self.person_types[1])          self.author_2_pk = models.Author.objects.create( @@ -906,7 +910,7 @@ class MergeTest(TestCase):              name='George', history_modifier=self.user,              attached_to=self.company_1) -    def testPersonMerge(self): +    def test_person_merge(self):          self.person_1.merge(self.person_2)          # preserve existing fields          self.assertEqual(self.person_1.name, 'Boule') @@ -925,7 +929,7 @@ class MergeTest(TestCase):          # add new many to many          self.assertTrue(self.person_types[1]                          in self.person_1.person_types.all()) -        # update reverse foreign key association and dont break the existing +        # update reverse foreign key association and do not break the existing          self.assertEqual(models.Author.objects.get(pk=self.author_1_pk).person,                           self.person_1)          self.assertEqual(models.Author.objects.get(pk=self.author_2_pk).person, @@ -936,7 +940,11 @@ class MergeTest(TestCase):          self.assertTrue(self.person_types[1]                          in self.person_3.person_types.all()) -    def testPersonMergeCandidate(self): +    def test_person_with_use_account_merge(self): +        # bug: merge when the target is not the one having a Ishtar user account +        self.person_1.merge(self.person_2) + +    def test_person_merge_candidate(self):          init_mc = self.person_1.merge_candidate.count()          person = models.Person.objects.create(              name=self.person_1.name, | 
