From 9961de6107f9a9800a32c405f512396a5e6804fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 27 Nov 2007 12:32:49 +0000
Subject: [PATCH] test that acquired function are not shown in the UI

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17817 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testERP5HR.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/product/ERP5/tests/testERP5HR.py b/product/ERP5/tests/testERP5HR.py
index b5ec4f5d8f..8189ae3732 100644
--- a/product/ERP5/tests/testERP5HR.py
+++ b/product/ERP5/tests/testERP5HR.py
@@ -882,6 +882,31 @@ class TestHR(ERP5TypeTestCase):
     email = pers.getDefaultEmailValue()
     self.assertEquals('Default Email', str(email.getTranslatedId()))
     
+  def test_SubordinationAcquisitionAndFunction(self):
+    # function is acquired from the subordination, organisation function are
+    # usually only nodes, and persons functions are leaves.
+    function_node = self.portal.portal_categories.function.newContent(
+         portal_type='Category', id='function_node', title='Function Node')
+    function_leave = function_node.newContent(
+         portal_type='Category', id='function_leave', title='Function Leave')
+    self.portal.portal_caches.clearAllCache()
+    organisation = self.getOrganisationModule().newContent(
+                                  portal_type='Organisation',
+                                  function_value=function_node)
+    person = self.getPersonModule().newContent(portal_type='Person',
+                            career_subordination_value=organisation)
+    # on Organisation_view, the user usually select node for functions:
+    organisation_view_html = organisation.Organisation_view()
+    self.assertTrue('Function Node' in organisation_view_html)
+    # person acquire function from the organisation
+    self.assertEquals(person.getFunctionValue(), function_node)
+    # but the user interface does not show the acquired value in this case
+    person_view_html = person.Person_view()
+    self.assertTrue('Function Leave' in person_view_html)
+    self.assertTrue('value="function_node/function_leave"'
+                               in person_view_html)
+    self.assertTrue('value="function_node"' not in person_view_html)
+
 
 def test_suite():
   suite = unittest.TestSuite()
-- 
2.30.9