From 4b8de2e3e3f37c8dc79002a58e6c82fc935abfb9 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Mon, 17 Mar 2008 16:37:37 +0000
Subject: [PATCH] Adapt tests to new title behaviour: if no title is defined,
 getTitle should try to return the reference or the id.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19967 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBase.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/tests/testBase.py b/product/ERP5/tests/testBase.py
index e46066c05a..0e33f907b5 100644
--- a/product/ERP5/tests/testBase.py
+++ b/product/ERP5/tests/testBase.py
@@ -138,7 +138,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
     object_instance = module.newContent(portal_type=self.object_portal_type)
     sequence.edit(
         object_instance=object_instance,
-        current_title='',
+        current_title=object_instance.getId(), # title defaults to id
         current_group_value=None
     )
 
@@ -824,8 +824,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self, quiet=quiet)
   
-  def test_08_emptyObjectHasNoTitle(self, quiet=quiet, run=run_all_test):
-    """Test that an empty object has no title.
+  def test_08_emptyObjectAcquiresTitle(self, quiet=quiet, run=run_all_test):
+    """
+    Test that an empty object has no title, and that getTitle on it acquires a
+    value form the object's id.
     """
     if not run: return
     portal = self.getPortal()
@@ -834,8 +836,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
     obj = module.newContent(portal_type=portal_type)
     # XXX title is an empty string by default, but it's still unsure wether it
     # should be None or ''
-    self.assertEquals('', obj.getProperty("title"))
-    self.assertEquals('', obj.getTitle())
+    self.assertEquals(obj.title, '')
+    self.assertEquals(obj.getProperty("title"), obj.getId())
+    self.assertEquals(obj._baseGetTitle(), obj.getId())
+    self.assertEquals(obj.getTitle(), obj.getId())
 
   def test_09_setPropertyDefinedProperty(self, quiet=quiet, run=run_all_test):
     """Test for setProperty on Base, when the property is defined.
-- 
2.30.9