Commit 618920dd authored by Jérome Perrin's avatar Jérome Perrin

tests field values rather than presence of a string in HTML code


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17905 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82434de9
...@@ -896,17 +896,24 @@ class TestHR(ERP5TypeTestCase): ...@@ -896,17 +896,24 @@ class TestHR(ERP5TypeTestCase):
person = self.getPersonModule().newContent(portal_type='Person', person = self.getPersonModule().newContent(portal_type='Person',
career_subordination_value=organisation) career_subordination_value=organisation)
# on Organisation_view, the user usually select node for functions: # on Organisation_view, the user usually select node for functions:
organisation_view_html = organisation.Organisation_view() self.assertEquals([['', ''], ['Function Node', 'function_node']],
self.assertTrue('Function Node' in organisation_view_html) organisation.Organisation_view.my_function.get_value('items'))
self.assertTrue('Function Leave' not in organisation_view_html)
# on Person_view, the user select leaves for functions:
field = person.Person_view.my_career_function
self.assertTrue('function_node' not in [x[1] for x in
field.get_value('items')])
self.assertTrue('function_node/function_leave' in [x[1] for x in
field.get_value('items')])
# person acquire function from the organisation # person acquire function from the organisation
self.assertEquals(person.getFunctionValue(), function_node) self.assertEquals(person.getFunctionValue(), function_node)
# but the user interface does not show the acquired value in this case # but the user interface does not show the acquired value in this case
person_view_html = person.Person_view() self.assertEquals('', field.get_value('default'))
self.assertTrue('Function Leave' in person_view_html) # (the field is working)
self.assertTrue('value="function_node/function_leave"' person.setDefaultCareerFunctionValue(function_leave)
in person_view_html) self.assertEquals(person.getFunctionValue(), function_leave)
self.assertTrue('value="function_node"' not in person_view_html) self.assertEquals('function_node/function_leave',
field.get_value('default'))
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