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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
292ba646
Commit
292ba646
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
9087524b
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 @
292ba646
...
@@ -20,41 +20,61 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
...
@@ -20,41 +20,61 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
return
"Alarms activated."
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
,
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
()
if
step
==
'trade_condition'
:
#################################################
# Bootstrap users
#################################################
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
try
:
try
:
newSecurityManager
(
None
,
portal
.
acl_users
.
getUser
(
SUPER_USER
))
newSecurityManager
(
None
,
portal
.
acl_users
.
getUser
(
SUPER_USER
))
self
.
testromain
()
if
scenario
==
'accounting'
:
# 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
# Create Project
# Currency
project
=
portal
.
project_module
.
newContent
(
currency
=
portal
.
currency_module
.
newContent
(
portal_type
=
"Project"
,
portal_type
=
"Currency"
,
title
=
'Test Project'
,
title
=
"Test currency"
destination_section_value
=
organisation
)
)
project
.
validate
()
if
scenario
==
'customer_remote'
:
# Sale trade condition
remote_project
=
portal
.
project_module
.
newContent
(
trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Project"
,
portal_type
=
"Sale Trade Condition"
,
title
=
'Test Remote Project'
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
# Bootstrap one manager user
manager_person
=
portal
.
person_module
.
newContent
(
manager_person
=
portal
.
person_module
.
newContent
(
...
@@ -62,21 +82,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
...
@@ -62,21 +82,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
first_name
=
'Manual test Project Manager'
,
first_name
=
'Manual test Project Manager'
,
default_email_coordinate_text
=
'romain+manager@nexedi.com'
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
(
manager_person
.
newContent
(
portal_type
=
'ERP5 Login'
,
portal_type
=
'ERP5 Login'
,
reference
=
manager_login
,
reference
=
manager_login
,
...
@@ -90,12 +95,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
...
@@ -90,12 +95,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
first_name
=
'Manual test Project Customer'
,
first_name
=
'Manual test Project Customer'
,
default_email_coordinate_text
=
'romain+customer@nexedi.com'
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
(
customer_person
.
newContent
(
portal_type
=
'ERP5 Login'
,
portal_type
=
'ERP5 Login'
,
reference
=
customer_login
,
reference
=
customer_login
,
...
@@ -104,25 +103,12 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
...
@@ -104,25 +103,12 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
customer_person
.
validate
()
customer_person
.
validate
()
if
scenario
==
'customer_remote'
:
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
# Bootstrap one customer user for the remote project
remote_customer_person
=
portal
.
person_module
.
newContent
(
remote_customer_person
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
portal_type
=
'Person'
,
first_name
=
'Manual test Remote Project Customer'
,
first_name
=
'Manual test Remote Project Customer'
,
default_email_coordinate_text
=
'romain+remote+customer@nexedi.com'
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
(
remote_customer_person
.
newContent
(
portal_type
=
'ERP5 Login'
,
portal_type
=
'ERP5 Login'
,
reference
=
remote_customer_login
,
reference
=
remote_customer_login
,
...
@@ -130,6 +116,63 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
...
@@ -130,6 +116,63 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
).
validate
()
).
validate
()
remote_customer_person
.
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
:
finally
:
setSecurityManager
(
sm
)
setSecurityManager
(
sm
)
...
...
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.xml
View file @
292ba646
...
@@ -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>
...
...
master/bt5/slapos_panel_ui_test/SkinTemplateItem/portal_skins/slapos_panel_ui_test/Zuite_SlapOSPanelTemplate.zpt
View file @
292ba646
...
@@ -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>
...
...
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