Commit b38c5f92 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel_ui_test:

* use Person_addVirtualMaster
* do not explicitely call alarms
  rely on interaction workflow instead
parent 144d49c4
...@@ -20,118 +20,161 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self): ...@@ -20,118 +20,161 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
return "Alarms activated." return "Alarms activated."
def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login, def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login,
manager_login, remote_customer_login, manager_login, remote_customer_login,
passwd): passwd):
if step not in ['trade_condition', 'account']:
raise ValueError('Unsupported bootstrap step: %s' % step)
if scenario not in ['accounting', 'customer', 'customer_shared', if scenario not in ['accounting', 'customer', 'customer_shared',
'customer_remote']: 'customer_remote']:
raise ValueError('Unsupported bootstrap scenario: %s' % scenario) raise ValueError('Unsupported bootstrap scenario: %s' % scenario)
portal = self.getPortalObject() portal = self.getPortalObject()
sm = getSecurityManager()
try:
newSecurityManager(None, portal.acl_users.getUser(SUPER_USER))
if scenario == 'accounting': if step == 'trade_condition':
#################################################
# Bootstrap users
#################################################
sm = getSecurityManager()
try:
newSecurityManager(None, portal.acl_users.getUser(SUPER_USER))
self.testromain()
# Organisation
organisation = portal.organisation_module.newContent( organisation = portal.organisation_module.newContent(
portal_type="Organisation", portal_type="Organisation",
title="Test accounting organisation" title="Test accounting organisation"
) )
else:
organisation = None # Currency
currency = portal.currency_module.newContent(
# Create Project portal_type="Currency",
project = portal.project_module.newContent( title="Test currency"
portal_type="Project", )
title='Test Project',
destination_section_value=organisation # Sale trade condition
) trade_condition = portal.sale_trade_condition_module.newContent(
project.validate() portal_type="Sale Trade Condition",
title="Test currency",
if scenario == 'customer_remote': price_currency_value=currency,
remote_project = portal.project_module.newContent( source_value=organisation,
portal_type="Project", #source_section_value=organisation,
title='Test Remote Project' source_section_value=organisation if (scenario == 'accounting') else None,
specialise='business_process_module/slapos_ultimate_business_process',
)
trade_condition.validate()
finally:
setSecurityManager(sm)
elif step == 'account':
sm = getSecurityManager()
try:
newSecurityManager(None, portal.acl_users.getUser(SUPER_USER))
# Fake user registrations
# 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'
) )
remote_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( manager_person.newContent(
portal_type='Assignment', portal_type='ERP5 Login',
title='Customer for project %s' % project.getTitle(), reference=manager_login,
destination_project_value=project, password=passwd
function='customer' ).validate()
).open() manager_person.validate()
manager_person.newContent(
portal_type='ERP5 Login', # Bootstrap one customer user
reference=manager_login, customer_person = portal.person_module.newContent(
password=passwd portal_type='Person',
).validate() first_name='Manual test Project Customer',
manager_person.validate() default_email_coordinate_text='romain+customer@nexedi.com'
)
# 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_login,
password=passwd
).validate()
customer_person.validate()
if scenario == 'customer_remote':
customer_person.newContent( customer_person.newContent(
portal_type='ERP5 Login',
reference=customer_login,
password=passwd
).validate()
customer_person.validate()
if scenario == 'customer_remote':
# Bootstrap one customer user for the remote project
remote_customer_person = portal.person_module.newContent(
portal_type='Person',
first_name='Manual test Remote Project Customer',
default_email_coordinate_text='romain+remote+customer@nexedi.com'
)
remote_customer_person.newContent(
portal_type='ERP5 Login',
reference=remote_customer_login,
password=passwd
).validate()
remote_customer_person.validate()
currency = portal.portal_catalog.getResultValue(
portal_type="Currency",
title="Test currency",
sort_on=[['creation_date', 'DESC']]
)
# Create Project
project = manager_person.Person_addVirtualMaster(
'Test Project',
scenario == 'accounting',
scenario == 'accounting',
currency.getRelativeUrl(),
batch=1)
manager_person.newContent(
portal_type='Assignment', portal_type='Assignment',
title='Production Manager for project %s' % remote_project.getTitle(), title='Manager for project %s' % project.getTitle(),
destination_project_value=remote_project, destination_project_value=project,
function='production/manager' function='production/manager'
).open() ).open()
customer_person.newContent(
# Bootstrap one customer user for the remote project
remote_customer_person = portal.person_module.newContent(
portal_type='Person',
first_name='Manual test Remote Project Customer',
default_email_coordinate_text='romain+remote+customer@nexedi.com'
)
remote_customer_person.newContent(
portal_type='Assignment', portal_type='Assignment',
title='Customer for project %s' % remote_project.getTitle(), title='Customer for project %s' % project.getTitle(),
destination_project_value=remote_project, destination_project_value=project,
function='customer' function='customer'
).open() ).open()
remote_customer_person.newContent(
portal_type='ERP5 Login',
reference=remote_customer_login,
password=passwd
).validate()
remote_customer_person.validate()
finally: if scenario == 'customer_shared':
setSecurityManager(sm) # 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()
if scenario == 'customer_remote':
remote_project = customer_person.Person_addVirtualMaster(
'Test Remote Project',
scenario == 'accounting',
scenario == 'accounting',
currency.getRelativeUrl(),
batch=1)
customer_person.newContent(
portal_type='Assignment',
title='Manager for project %s' % project.getTitle(),
destination_project_value=project,
function='production/manager'
).open()
remote_customer_person.newContent(
portal_type='Assignment',
title='Customer for project %s' % remote_project.getTitle(),
destination_project_value=remote_project,
function='customer'
).open()
finally:
setSecurityManager(sm)
return "Done." return "Done."
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> <global name="_reconstructor" module="copy_reg"/>
</klass> </klass>
<tuple/> <tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state> <state>
<dictionary> <dictionary>
<item> <item>
......
...@@ -267,11 +267,7 @@ ...@@ -267,11 +267,7 @@
<td>javascript{selenium.browserbot.currentWindow.location.href}</td> <td>javascript{selenium.browserbot.currentWindow.location.href}</td>
<td>current_location</td> <td>current_location</td>
</tr> </tr>
<!-- run alarms multiple times, to detect unexpected side effects --> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tal:block tal:repeat="step python: range(0, 3)">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tr> <tr>
<td>open</td> <td>open</td>
<td>${current_location}</td> <td>${current_location}</td>
......
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> <global name="_reconstructor" module="copy_reg"/>
</klass> </klass>
<tuple/> <tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state> <state>
<dictionary> <dictionary>
<item> <item>
......
...@@ -267,11 +267,8 @@ ...@@ -267,11 +267,8 @@
<td>javascript{selenium.browserbot.currentWindow.location.href}</td> <td>javascript{selenium.browserbot.currentWindow.location.href}</td>
<td>current_location</td> <td>current_location</td>
</tr> </tr>
<!-- run alarms multiple times, to detect unexpected side effects --> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tal:block tal:repeat="step python: range(0, 3)">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tr> <tr>
<td>open</td> <td>open</td>
<td>${current_location}</td> <td>${current_location}</td>
......
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> <global name="_reconstructor" module="copy_reg"/>
</klass> </klass>
<tuple/> <tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state> <state>
<dictionary> <dictionary>
<item> <item>
......
...@@ -442,11 +442,6 @@ ...@@ -442,11 +442,6 @@
<td colspan="3"><b>Trigger Upgrade Decision creation</b></td> <td colspan="3"><b>Trigger Upgrade Decision creation</b></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/slapos_master_panel/#?editable=1</td> <td>${base_url}/web_site_module/slapos_master_panel/#?editable=1</td>
......
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> <global name="_reconstructor" module="copy_reg"/>
</klass> </klass>
<tuple/> <tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state> <state>
<dictionary> <dictionary>
<item> <item>
......
...@@ -11,7 +11,19 @@ ...@@ -11,7 +11,19 @@
<tr> <tr>
<td>open</td> <td>open</td>
<td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?scenario=%s&manager_login=%s&customer_login=%s&remote_customer_login=%s&passwd=%s' % (init_configuration['scenario'], user_configuration['manager_login'], user_configuration['customer_login'], user_configuration['remote_customer_login'], user_configuration['passwd'])">.../ERP5Site_bootstrapSlapOSPanelTest</td> <td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?step=trade_condition&scenario=%s&manager_login=%s&customer_login=%s&remote_customer_login=%s&passwd=%s' % (init_configuration['scenario'], user_configuration['manager_login'], user_configuration['customer_login'], user_configuration['remote_customer_login'], user_configuration['passwd'])">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?step=account&scenario=%s&manager_login=%s&customer_login=%s&remote_customer_login=%s&passwd=%s' % (init_configuration['scenario'], user_configuration['manager_login'], user_configuration['customer_login'], user_configuration['remote_customer_login'], user_configuration['passwd'])">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -124,11 +136,9 @@ ...@@ -124,11 +136,9 @@
<td>current_location</td> <td>current_location</td>
</tr> </tr>
<!-- run alarms multiple times, to detect unexpected side effects --> <!-- run all alarms, to detect unexpected side effects -->
<tal:block tal:repeat="step python: range(0, 5)"> <tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" />
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tr> <tr>
<td>open</td> <td>open</td>
......
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