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
7c6f1a73
Commit
7c6f1a73
authored
Dec 20, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: starts moving test to virtual master design
parent
f4c1c3e3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
34 deletions
+98
-34
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+98
-34
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
7c6f1a73
...
...
@@ -156,6 +156,28 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
"""Overwrite this function on project context to tweak production focus tests"""
pass
def
addProjectProductionManagerAssignment
(
self
,
person
,
project
):
person
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
project
,
function
=
'production/manager'
).
open
()
def
addProjectCustomerAssignment
(
self
,
person
,
project
):
person
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
project
,
function
=
'customer'
).
open
()
def
addProject
(
self
):
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'project-%s'
%
self
.
generateNewId
()
)
project
.
validate
()
return
project
def
makeCustomOrganisation
(
self
,
new_id
=
None
,
index
=
True
,
price_currency
=
"currency_module/EUR"
):
# Create a custom organisation same as slapos, for ensure we can have
...
...
@@ -210,7 +232,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
login
.
validate
()
return
login
def
makePerson
(
self
,
new_id
=
None
,
index
=
True
,
user
=
True
):
def
makePerson
(
self
,
project
,
new_id
=
None
,
index
=
True
,
user
=
True
):
if
new_id
is
None
:
new_id
=
self
.
generateNewId
()
...
...
@@ -224,9 +246,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
)
person_user
.
validate
()
for
assignment
in
person_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
self
.
addProjectCustomerAssignment
(
person_user
,
project
)
if
user
:
login
=
self
.
_addERP5Login
(
person_user
)
...
...
@@ -239,7 +259,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
return
person_user
def
_makeTree
(
self
,
requested_template_id
=
'template_software_instance'
):
def
_makeTree
(
self
,
project
,
requested_template_id
=
'template_software_instance'
):
new_id
=
self
.
generateNewId
()
self
.
request_kw
=
dict
(
...
...
@@ -252,7 +272,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
state
=
"started"
)
self
.
person_user
=
self
.
makePerson
(
new_id
=
new_id
,
index
=
False
)
self
.
person_user
=
self
.
makePerson
(
project
,
new_id
=
new_id
,
index
=
False
)
self
.
commit
()
# prepare part of tree
self
.
instance_tree
=
self
.
portal
.
instance_tree_module
\
...
...
@@ -306,10 +326,10 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
self
.
portal
.
portal_alarms
.
slapos_request_update_instance_tree_open_sale_order
.
activeSense
()
self
.
tic
()
def
_makeSlaveTree
(
self
,
requested_template_id
=
'template_slave_instance'
):
return
self
.
_makeTree
(
requested_template_id
=
requested_template_id
)
def
_makeSlaveTree
(
self
,
project
,
requested_template_id
=
'template_slave_instance'
):
return
self
.
_makeTree
(
project
,
requested_template_id
=
requested_template_id
)
def
_makeComputeNode
(
self
,
owner
=
None
,
allocation_scope
=
'open
/public
'
):
def
_makeComputeNode
(
self
,
owner
=
None
,
allocation_scope
=
'open'
):
self
.
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
...
...
@@ -543,40 +563,84 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
self
.
tic
()
self
.
_cleaupREQUEST
()
def
_makeSoftwareProduct
(
self
,
new_id
=
None
):
def
_makeSoftwareProduct
(
self
,
project
,
new_id
=
None
,
url
=
None
,
software_type
=
'foobar'
):
if
new_id
is
None
:
new_id
=
self
.
generateNewId
()
software_product
=
self
.
portal
.
software_product_module
\
.
template_software_product
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_product
.
edi
t
(
if
url
is
None
:
url
=
self
.
generateNewSoftwareReleaseUrl
(
)
software_product
=
self
.
portal
.
software_product_module
.
newConten
t
(
reference
=
'TESTSOFTPROD-%s'
%
new_id
,
title
=
'Test software product %s'
%
new_id
title
=
'Test software product %s'
%
new_id
,
follow_up_value
=
project
)
software_product
.
newContent
(
portal_type
=
'Software Product Release Variation'
,
url_string
=
url
)
software_product
.
newContent
(
portal_type
=
'Software Product Type Variation'
,
reference
=
software_type
)
software_product
.
publish
()
return
software_product
def
_makeSoftwareRelease
(
self
,
new_id
=
None
):
if
new_id
is
None
:
new_id
=
self
.
generateNewId
()
software_release
=
self
.
portal
.
software_release_module
\
.
template_software_release
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_release
.
edit
(
def
_makeSoftwareRelease
(
self
,
software_product
):
return
software_product
.
newContent
(
portal_type
=
'Software Product Release Variation'
,
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
reference
=
'TESTSOFTRELS-%s'
%
new_id
,
title
=
'Start requested for %s'
%
new_id
)
software_release
.
release
()
return
software_release
def
_makeCustomSoftwareRelease
(
self
,
software_product_url
,
software_url
):
software_release
=
self
.
_makeSoftwareRelease
()
software_release
.
edit
(
aggregate_value
=
software_product_url
,
url_string
=
software_url
)
software_release
.
publish
()
return
software_release
def
_makeSoftwareType
(
self
,
software_product
):
return
software_product
.
newContent
(
portal_type
=
'Software Product Type Variation'
,
url_string
=
'type%s'
%
self
.
generateNewId
(),
)
def
addAllocationSupply
(
self
,
title
,
node
,
software_product
,
software_release
,
software_type
,
destination_value
=
None
,
is_slave_on_same_instance_tree_allocable
=
False
):
allocation_supply
=
self
.
portal
.
allocation_supply_module
.
newContent
(
portal_type
=
"Allocation Supply"
,
title
=
title
,
aggregate_value
=
node
,
destination_value
=
destination_value
,
destination_project_value
=
software_product
.
getFollowUpValue
(),
slave_on_same_instance_tree_allocable
=
is_slave_on_same_instance_tree_allocable
)
resource_vcl
=
[
'software_release/%s'
%
software_release
.
getRelativeUrl
(),
'software_type/%s'
%
software_type
.
getRelativeUrl
()
]
resource_vcl
.
sort
()
allocation_supply_line
=
allocation_supply
.
newContent
(
portal_type
=
"Allocation Supply Line"
,
resource_value
=
software_product
,
)
allocation_supply_line
.
edit
(
p_variation_base_category_list
=
allocation_supply_line
.
getVariationRangeBaseCategoryList
()
)
base_id
=
'path'
allocation_supply_line
.
setCellRange
(
base_id
=
base_id
,
*
allocation_supply_line
.
SupplyLine_asCellRange
(
base_id
=
base_id
)
)
#cell_key = list(allocation_supply_line.getCellKeyList(base_id=base_id))[0]
cell_key
=
resource_vcl
allocation_supply_line
.
log
(
resource_vcl
,
cell_key
)
allocation_supply_cell
=
allocation_supply_line
.
newCell
(
base_id
=
base_id
,
portal_type
=
'Allocation Supply Cell'
,
*
cell_key
)
allocation_supply_cell
.
edit
(
mapped_value_property_list
=
[
'allocable'
],
allocable
=
True
,
predicate_category_list
=
cell_key
,
variation_category_list
=
cell_key
)
allocation_supply
.
validate
()
return
allocation_supply
def
generateNewSoftwareReleaseUrl
(
self
):
return
'http://example.org/têst%s.cfg'
%
self
.
generateNewId
()
...
...
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