Commit c9d1489c authored by Jérome Perrin's avatar Jérome Perrin

base: rename tests for person property acqusition

In 93e30e5e (Person: Store user id in new user_id property., 2016-12-09)
we adapted this test to the new behavior: title fallback to user_id or
id, but since persons always have a user_id by default, this test was
changed to check that title fallbacks to user_id, but the name of the
test still mention "fallback to id" which became a bit different from
what was tested here.

Revert testEmptyTitleFallbackOnId to check that title fallbacks on id,
using persons without user id and introduce new
testEmptyTitleFallbackOnUserId to describe the new behaviour with user
id.
parent cfc9ef81
...@@ -96,22 +96,39 @@ class TestPerson(ERP5TypeTestCase): ...@@ -96,22 +96,39 @@ class TestPerson(ERP5TypeTestCase):
self.assertEqual("title", p.getTitle()) self.assertEqual("title", p.getTitle())
# title & first_name, last_name # title & first_name, last_name
def testEmptyTitleFallbackOnId(self): def testEmptyTitleFallbackOnUserId(self):
p = self._makeOne() p = self._makeOne()
self.assertEqual(p.getUserId(), p.getTitle()) self.assertEqual(p.getUserId(), p.getTitle())
def testEmptyTranslatedTitleFallbackOnId(self): def testEmptyTranslatedTitleFallbackOnUserId(self):
p = self._makeOne() p = self._makeOne()
self.assertEqual(p.getUserId(), p.getTranslatedTitle()) self.assertEqual(p.getUserId(), p.getTranslatedTitle())
def testEmptyCompactTitleFallbackOnId(self): def testEmptyCompactTitleFallbackOnUserId(self):
p = self._makeOne() p = self._makeOne()
self.assertEqual(p.getUserId(), p.getCompactTitle()) self.assertEqual(p.getUserId(), p.getCompactTitle())
def testEmptyCompactTranslatedTitleFallbackOnId(self): def testEmptyCompactTranslatedTitleFallbackOnUserId(self):
p = self._makeOne() p = self._makeOne()
self.assertEqual(p.getUserId(), p.getCompactTranslatedTitle()) self.assertEqual(p.getUserId(), p.getCompactTranslatedTitle())
def testEmptyTitleFallbackOnId(self):
# in the now rare event of a person without user id, the fallback is still to the id.
p = self._makeOne(id=self.id(), user_id=None)
self.assertEqual(self.id(), p.getTitle())
def testEmptyTranslatedTitleFallbackOnId(self):
p = self._makeOne(id=self.id(), user_id=None)
self.assertEqual(self.id(), p.getTranslatedTitle())
def testEmptyCompactTitleFallbackOnId(self):
p = self._makeOne(id=self.id(), user_id=None)
self.assertEqual(self.id(), p.getCompactTitle())
def testEmptyCompactTranslatedTitleFallbackOnId(self):
p = self._makeOne(id=self.id(), user_id=None)
self.assertEqual(self.id(), p.getCompactTranslatedTitle())
def testEmptyTitleFallbackOnReference(self): def testEmptyTitleFallbackOnReference(self):
p = self._makeOne(reference='reference') p = self._makeOne(reference='reference')
self.assertEqual('reference', p.getTitle()) self.assertEqual('reference', p.getTitle())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment