diff --git a/product/ERP5/tests/testERP5Base.py b/product/ERP5/tests/testERP5Base.py index 3bef9056259a7c4360ac77f0830575f7ac09148f..b598ab1ddb024ffd303fc83b796e7a3d60cfe973 100644 --- a/product/ERP5/tests/testERP5Base.py +++ b/product/ERP5/tests/testERP5Base.py @@ -722,7 +722,7 @@ class TestERP5Base(ERP5TypeTestCase): 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, @@ -780,6 +780,27 @@ class TestERP5Base(ERP5TypeTestCase): 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 @@ class TestERP5Base(ERP5TypeTestCase): translated_portal_type='Personne')]) transaction.abort() - def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestERP5Base))