Commit 362acd71 authored by Romain Courteaud's avatar Romain Courteaud 🐙

slapos_panel_ui_test:

* validate testFunctionalSlapOSPanelStyle
* dependency
*  HARDCODED data/user bootstrap
*  passwd policy
parent c4c4f025
from Products.ERP5Security import SUPER_USER
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
def ERP5Site_bootstrapSlapOSPanelTest(self, scenario):
if scenario not in ['customer', 'customer_shared']:
raise ValueError('Unsupported bootstrap scenario: %s' % scenario)
portal = self.getPortalObject()
sm = getSecurityManager()
try:
newSecurityManager(None, portal.acl_users.getUser(SUPER_USER))
# Create Project
project = portal.project_module.newContent(
portal_type="Project",
title='Test Project'
)
project.validate()
# Bootstrap one manager user
manager_person = portal.person_module.newContent(
portal_type='Person',
first_name='Manual test Project Manager',
default_email_coordinate_text='romain+manager@nexedi.com'
)
manager_person.newContent(
portal_type='Assignment',
title='Production Manager for project %s' % project.getTitle(),
destination_project_value=project,
function='production/manager'
).open()
if scenario == 'customer_shared':
# XXX For shared instance, user must also be a customer
# How to create Instance Node without any user related document?
manager_person.newContent(
portal_type='Assignment',
title='Customer for project %s' % project.getTitle(),
destination_project_value=project,
function='customer'
).open()
manager_person.newContent(
portal_type='ERP5 Login',
reference='manager',
password='eiChaxo5Eefier9vAek7phie#'
).validate()
manager_person.validate()
# Bootstrap one customer user
customer_person = portal.person_module.newContent(
portal_type='Person',
first_name='Manual test Project Customer',
default_email_coordinate_text='romain+customer@nexedi.com'
)
customer_person.newContent(
portal_type='Assignment',
title='Customer for project %s' % project.getTitle(),
destination_project_value=project,
function='customer'
).open()
customer_person.newContent(
portal_type='ERP5 Login',
reference='customer',
password='eiChaxo5Eefier9vAek7phie#'
).validate()
customer_person.validate()
finally:
setSecurityManager(sm)
return "Done."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SlapOSPanelUiTest</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.SlapOSPanelUiTest</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSPanel</string> </value>
<value> <string>testCustomerInstanceScenario</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
......@@ -14,7 +14,9 @@
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/slapos_init" />
<tal:block tal:define="init_configuration python: {'scenario': 'customer'}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/slapos_init" />
</tal:block>
<tr>
<td>open</td>
......@@ -25,7 +27,7 @@
<tal:block tal:define="login_configuration python: {'user': 'manager#', 'password': 'manager#'}">
<tal:block tal:define="login_configuration python: {'user': 'manager', 'password': 'eiChaxo5Eefier9vAek7phie#'}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
......@@ -211,7 +213,7 @@
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/logout" />
<tal:block tal:define="login_configuration python: {'user': 'customer#', 'password': 'customer#'}">
<tal:block tal:define="login_configuration python: {'user': 'customer', 'password': 'eiChaxo5Eefier9vAek7phie#'}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
......@@ -309,7 +311,7 @@
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/logout" />
<tal:block tal:define="login_configuration python: {'user': 'manager#', 'password': 'manager#'}">
<tal:block tal:define="login_configuration python: {'user': 'manager', 'password': 'eiChaxo5Eefier9vAek7phie#'}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_bootstrapSlapOSPanelTest</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSPanelUiTest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_bootstrapSlapOSPanelTest</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -11,7 +11,7 @@
<tr>
<td>open</td>
<td tal:content="python:'${base_url}/ERP5Site_bootstrapSlapOSPanelTest'">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?scenario=%s' % init_configuration['scenario']">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td></td>
</tr>
<tr>
......
......@@ -117,13 +117,11 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>draft</string> </value>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
......
erp5_ui_test_core
\ No newline at end of file
erp5_ui_test_core
erp5_web_renderjs_ui_test
\ No newline at end of file
extension.erp5.SlapOSPanelUiTest
\ No newline at end of file
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