Commit f68df8ce authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Vincent Pelletier

erp5_configurator: migrate to ERP5 Login authentication.

parent c194772a
...@@ -225,7 +225,6 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ...@@ -225,7 +225,6 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
person.getFirstName()) person.getFirstName())
self.assertEqual(user_info["field_your_last_name"], self.assertEqual(user_info["field_your_last_name"],
person.getLastName()) person.getLastName())
self.assertNotEquals(person.getPassword(), None)
self.assertEqual(user_info["field_your_function"], self.assertEqual(user_info["field_your_function"],
person.getFunction()) person.getFunction())
self.assertEqual(user_info["field_your_default_email_text"], self.assertEqual(user_info["field_your_default_email_text"],
...@@ -236,6 +235,9 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ...@@ -236,6 +235,9 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
assignment_list = person.contentValues(portal_type='Assignment') assignment_list = person.contentValues(portal_type='Assignment')
self.assertEqual(len(assignment_list), 1) self.assertEqual(len(assignment_list), 1)
self.assertEqual('my_group', assignment_list[0].getGroup()) self.assertEqual('my_group', assignment_list[0].getGroup())
login_list = person.contentValues(portal_type='ERP5 Login')
self.assertEqual(len(login_list), 1)
self.assertNotEquals(login_list[0].getPassword(), None)
def stepCheckSocialTitleCategory(self, sequence=None,sequence_list=None, **kw): def stepCheckSocialTitleCategory(self, sequence=None,sequence_list=None, **kw):
"""Check that the social title category is configured. """Check that the social title category is configured.
...@@ -406,18 +408,18 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ...@@ -406,18 +408,18 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
def stepCheckEventResourceItemList(self, sequence=None, sequence_list=None): def stepCheckEventResourceItemList(self, sequence=None, sequence_list=None):
self.assertTrue(self.all_username_list) self.assertTrue(self.all_username_list)
for username in self.all_username_list: for user_id in self._getUserIdList(self.all_username_list):
for event_type in ('Visit', 'Web Message', 'Letter', 'Note', for event_type in ('Visit', 'Web Message', 'Letter', 'Note',
'Phone Call', 'Mail Message', 'Fax Message'): 'Phone Call', 'Mail Message', 'Fax Message'):
self._loginAsUser(username) self._loginAsUser(user_id)
event = self.portal.event_module.newContent(portal_type=event_type) event = self.portal.event_module.newContent(portal_type=event_type)
self.assertTrue(('Complaint', 'service_module/event_complaint') self.assertTrue(('Complaint', 'service_module/event_complaint')
in event.Event_getResourceItemList()) in event.Event_getResourceItemList())
def stepCheckTicketResourceItemList(self, sequence=None, sequence_list=None): def stepCheckTicketResourceItemList(self, sequence=None, sequence_list=None):
self.assertTrue(self.all_username_list) self.assertTrue(self.all_username_list)
for username in self.all_username_list: for user_id in self._getUserIdList(self.all_username_list):
self._loginAsUser(username) self._loginAsUser(user_id)
ticket = self.portal.support_request_module.newContent( ticket = self.portal.support_request_module.newContent(
portal_type='Support Request') portal_type='Support Request')
self.assertTrue(('Financial Support', 'service_module/support_financial') self.assertTrue(('Financial Support', 'service_module/support_financial')
...@@ -1000,7 +1002,8 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ...@@ -1000,7 +1002,8 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
# stepPlanSaleOrders # stepPlanSaleOrders
self.assertEqual(order.getSimulationState(), 'draft') self.assertEqual(order.getSimulationState(), 'draft')
self._loginAsUser(self.sales_manager_reference) sales_manager_id, = self._getUserIdList([self.sales_manager_reference])
self._loginAsUser(sales_manager_id)
self.portal.portal_workflow.doActionFor(order, 'plan_action') self.portal.portal_workflow.doActionFor(order, 'plan_action')
self.tic() self.tic()
self.assertEqual(order.getSimulationState(), 'planned') self.assertEqual(order.getSimulationState(), 'planned')
......
...@@ -87,7 +87,6 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -87,7 +87,6 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
'career_function': self.getFunction(), 'career_function': self.getFunction(),
'last_name': self.getLastName(), 'last_name': self.getLastName(),
'reference': self.getReference(), 'reference': self.getReference(),
'password': self.getPassword(),
}) })
assignment = person.newContent(portal_type="Assignment", assignment = person.newContent(portal_type="Assignment",
...@@ -95,6 +94,10 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -95,6 +94,10 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
group = group_id, group = group_id,
site = site_id) site = site_id)
login = person.newContent(portal_type='ERP5 Login',
reference=self.getReference(),
password=self.getPassword())
# Set dates are required to create valid assigments. # Set dates are required to create valid assigments.
now = DateTime() now = DateTime()
assignment.setStartDate(now) assignment.setStartDate(now)
...@@ -102,9 +105,10 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -102,9 +105,10 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
# Define valid for 10 years. # Define valid for 10 years.
assignment.setStopDate(now + (365*10)) assignment.setStopDate(now + (365*10))
# Validate the Person and Assigment # Validate the Person, Assigment and Login
person.validate(comment=translateString("Validated by Configurator")) person.validate(comment=translateString("Validated by Configurator"))
assignment.open(comment=translateString("Open by Configuration")) assignment.open(comment=translateString("Open by Configuration"))
login.validate(comment=translateString("Validated by Configurator"))
## add to customer template ## add to customer template
business_configuration = self.getBusinessConfigurationValue() business_configuration = self.getBusinessConfigurationValue()
......
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