Commit 70af6fd7 authored by Fabien Morin's avatar Fabien Morin

change the check of the list (now it's used set) because the order doesn't

matter.
Now subobject are not yet copied but just gets from there path and return a
list of them


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18329 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ff479218
...@@ -852,7 +852,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -852,7 +852,7 @@ class TestPayroll(TestPayrollMixin):
# return a list of data that should contain data from all model # return a list of data that should contain data from all model
portal_type_list = ['Annotation Line', ] portal_type_list = ['Annotation Line', ]
model_reference_dict = {} model_reference_dict = {}
model_reference_dict = model_employee.getInheritanceModelReferenceDict(\ model_employee.getInheritanceModelReferenceDict(\
model_reference_dict, model_employee, portal_type_list, []) model_reference_dict, model_employee, portal_type_list, [])
...@@ -916,14 +916,16 @@ class TestPayroll(TestPayrollMixin): ...@@ -916,14 +916,16 @@ class TestPayroll(TestPayrollMixin):
# 4 differents annotation lines, and with the 3 ones have been had before # 4 differents annotation lines, and with the 3 ones have been had before
# that's make 7 ! # that's make 7 !
# check the model number # check the model number
self.assertEqual(len(model_reference_dict), 3) self.assertEqual(len(model_reference_dict), 3)
self.assertEqual(model_reference_dict[model_employee.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_employee.getRelativeUrl()]),
['1', 'over_time_duration']) set(['1', 'over_time_duration']))
self.assertEqual(model_reference_dict[model_company.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_company.getRelativeUrl()]),
['2', 'worked_time_duration']) set(['2', 'worked_time_duration']))
self.assertEqual(model_reference_dict[model_country.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_country.getRelativeUrl()]),
['3','4', 'social_insurance']) set(['3','4', 'social_insurance']))
# same test with a multi model inheritance # same test with a multi model inheritance
...@@ -971,15 +973,15 @@ class TestPayroll(TestPayrollMixin): ...@@ -971,15 +973,15 @@ class TestPayroll(TestPayrollMixin):
self.assertEqual(len(model_reference_dict), 5) # (6-1 because model_b self.assertEqual(len(model_reference_dict), 5) # (6-1 because model_b
# haven't any subobject not # haven't any subobject not
# yet added) # yet added)
self.assertEqual(model_reference_dict[model_employee.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_employee.getRelativeUrl()]),
['1', 'over_time_duration']) set(['1', 'over_time_duration']))
self.assertEqual(model_reference_dict[model_company.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_company.getRelativeUrl()]),
['2', 'worked_time_duration']) set(['2', 'worked_time_duration']))
self.assertEqual(model_reference_dict[model_a.getRelativeUrl()], ['5',]) self.assertEqual(model_reference_dict[model_a.getRelativeUrl()], ['5',])
self.assertEqual(model_reference_dict[model_c.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_c.getRelativeUrl()]),
['6', '7', '8']) set(['6', '7', '8']))
self.assertEqual(model_reference_dict[model_country.getRelativeUrl()], self.assertEqual(set(model_reference_dict[model_country.getRelativeUrl()]),
['3','4', 'social_insurance']) set(['3','4', 'social_insurance']))
# copy sub object from all inhéritance models into the a paysheet # copy sub object from all inhéritance models into the a paysheet
...@@ -996,27 +998,13 @@ class TestPayroll(TestPayrollMixin): ...@@ -996,27 +998,13 @@ class TestPayroll(TestPayrollMixin):
title = id, title = id,
specialise_value = model_employee) specialise_value = model_employee)
# inherite model
#paysheet.setSpecialiseValue(model_employee)
# check heneritance works # check heneritance works
self.assertEqual(paysheet.getSpecialiseValue(), model_employee) self.assertEqual(paysheet.getSpecialiseValue(), model_employee)
# copy sub objects # get a list of all this subObjects:
nb_subobject_before = len(paysheet.contentValues(\ sub_oject_list = paysheet.getSubObjectValueList(portal_type_list)
portal_type=portal_type_list)) self.assertEqual(len(sub_oject_list), 11)
paysheet.copyInheritanceSubObjects(model_reference_dict)
get_transaction().commit()
self.paysheet_model_module.reindexObject()
self.tic()
nb_subobject_after = len(paysheet.contentValues(\
portal_type=portal_type_list))
# check there are all here:
nb_added_sub_objects = nb_subobject_after - nb_subobject_before
self.assertEqual(nb_added_sub_objects, 11)
import unittest import unittest
def test_suite(): def test_suite():
......
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