[Erp5-report] r28959 - /erp5/trunk/products/ERP5/tests/testERP5Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Sep 11 15:58:54 CEST 2009


Author: lucas
Date: Fri Sep 11 15:58:51 2009
New Revision: 28959

URL: http://svn.erp5.org?rev=28959&view=rev
Log:
If person has the same address than organisation, the subobject (default_address) should not be created.

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Base.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Base.py?rev=28959&r1=28958&r2=28959&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Base.py [utf8] Fri Sep 11 15:58:51 2009
@@ -722,7 +722,7 @@
                        new_organisation.getRelativeUrl() )
     self.assertEquals( new_career_step.getSubordinationTitle(),
                        new_organisation_title )
-    
+
   def stepCheckChangePersonAddress(self, sequence=None, **kw) :
     """
     We must make sure that if we change the address of a person,
@@ -779,6 +779,27 @@
     self.assertEquals(person.getDefaultAddressZipCode(), '69000')
     self.assertEquals(organisation.getDefaultAddressCity(),'Lille')
     self.assertEquals(organisation.getDefaultAddressZipCode(), '59000')
+
+    # if the address of the person is the same of the organisation
+    # there is no reason to create a subobject (default_address)
+    person.manage_delObjects(['default_address'])
+    person.edit(career_subordination_value=organisation)
+    self.assertTrue('default_address' not in person.objectIds())
+    self.assertEquals(person.getDefaultAddress(),
+        organisation.getDefaultAddress())
+    self.assertEquals(person.getDefaultAddressCity(),
+        organisation.getDefaultAddressCity())
+    self.assertEquals(person.getDefaultAddressZipCode(),
+        organisation.getDefaultAddressZipCode())
+    # if the address of the person is different then the subobject
+    # (default_address) must be created.
+    person.edit(default_address_city='La Garnache')
+    self.assertTrue('default_address' in person.objectIds())
+    self.assertNotEquals(person.getDefaultAddressCity(),
+         organisation.getDefaultAddressCity())
+
+
+
 
   ##################################
   ##  Tests
@@ -1405,7 +1426,6 @@
                                      translated_portal_type='Personne')])
     transaction.abort()
 
-
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestERP5Base))




More information about the Erp5-report mailing list