Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
slapos.core
Commits
f4c6f74a
Commit
f4c6f74a
authored
Jun 27, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel_ui_test: use Person_addVirtualMaster
parent
3de9bcbd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
92 deletions
+151
-92
master/bt5/slapos_panel_ui_test/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSPanelUiTest.py
...tem/portal_components/extension.erp5.SlapOSPanelUiTest.py
+132
-89
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.xml
..._skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.xml
+6
-2
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.zpt
..._skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.zpt
+13
-1
No files found.
master/bt5/slapos_panel_ui_test/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSPanelUiTest.py
View file @
f4c6f74a
...
...
@@ -20,41 +20,61 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
return
"Alarms activated."
def
ERP5Site_bootstrapSlapOSPanelTest
(
self
,
scenario
,
customer_login
,
def
ERP5Site_bootstrapSlapOSPanelTest
(
self
,
s
tep
,
s
cenario
,
customer_login
,
manager_login
,
remote_customer_login
,
passwd
):
if
step
not
in
[
'trade_condition'
,
'account'
]:
raise
ValueError
(
'Unsupported bootstrap step: %s'
%
step
)
if
scenario
not
in
[
'accounting'
,
'customer'
,
'customer_shared'
,
'customer_remote'
]:
raise
ValueError
(
'Unsupported bootstrap scenario: %s'
%
scenario
)
portal
=
self
.
getPortalObject
()
if
step
==
'trade_condition'
:
#################################################
# Bootstrap users
#################################################
sm
=
getSecurityManager
()
try
:
newSecurityManager
(
None
,
portal
.
acl_users
.
getUser
(
SUPER_USER
))
self
.
testromain
()
if
scenario
==
'accounting'
:
# Organisation
organisation
=
portal
.
organisation_module
.
newContent
(
portal_type
=
"Organisation"
,
title
=
"Test accounting organisation"
)
else
:
organisation
=
None
# Create Project
project
=
portal
.
project_module
.
newContent
(
portal_type
=
"Project"
,
title
=
'Test Project'
,
destination_section_value
=
organisation
# Currency
currency
=
portal
.
currency_module
.
newContent
(
portal_type
=
"Currency"
,
title
=
"Test currency"
)
project
.
validate
()
if
scenario
==
'customer_remote'
:
remote_project
=
portal
.
project_module
.
newContent
(
portal_type
=
"Project"
,
title
=
'Test Remote Project'
# Sale trade condition
trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
title
=
"Test currency"
,
price_currency_value
=
currency
,
source_value
=
organisation
,
#source_section_value=organisation,
source_section_value
=
organisation
if
(
scenario
==
'accounting'
)
else
None
,
specialise
=
'business_process_module/slapos_ultimate_business_process'
,
)
remote_project
.
validate
()
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
(
...
...
@@ -62,21 +82,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
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_login
,
...
...
@@ -90,12 +95,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
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
,
...
...
@@ -104,25 +103,12 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
customer_person
.
validate
()
if
scenario
==
'customer_remote'
:
customer_person
.
newContent
(
portal_type
=
'Assignment'
,
title
=
'Production Manager for project %s'
%
remote_project
.
getTitle
(),
destination_project_value
=
remote_project
,
function
=
'production/manager'
).
open
()
# 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'
,
title
=
'Customer for project %s'
%
remote_project
.
getTitle
(),
destination_project_value
=
remote_project
,
function
=
'customer'
).
open
()
remote_customer_person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
remote_customer_login
,
...
...
@@ -130,6 +116,63 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
).
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'
,
title
=
'Manager for project %s'
%
project
.
getTitle
(),
destination_project_value
=
project
,
function
=
'production/manager'
).
open
()
customer_person
.
newContent
(
portal_type
=
'Assignment'
,
title
=
'Customer for project %s'
%
project
.
getTitle
(),
destination_project_value
=
project
,
function
=
'customer'
).
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
()
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
)
...
...
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.xml
View file @
f4c6f74a
...
...
@@ -11,9 +11,13 @@
<value>
<object>
<klass>
<global
name=
"
NameAssignments"
module=
"Shared.DC.Scripts.Bindings
"
/>
<global
name=
"
_reconstructor"
module=
"copy_reg
"
/>
</klass>
<tuple/>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
...
...
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.zpt
View file @
f4c6f74a
...
...
@@ -11,7 +11,19 @@
<tr>
<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>
</tr>
<tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment