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
576b7681
Commit
576b7681
authored
Jan 18, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: lint test
parent
10740fb9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
109 deletions
+134
-109
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+134
-109
No files found.
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
576b7681
...
...
@@ -35,9 +35,8 @@ class TestSlapOSPDMMixinSkins(SlapOSTestCaseMixin):
state
=
"started"
)
def
_makePerson
(
self
):
person_user
=
self
.
makePerson
(
new_id
=
self
.
new_id
)
return
person_user
def
_makePerson
(
self
,
project
):
return
self
.
makePerson
(
project
,
new_id
=
self
.
new_id
)
def
_makeComputePartitions
(
self
,
compute_node
):
for
i
in
range
(
1
,
5
):
...
...
@@ -59,7 +58,7 @@ class TestSlapOSPDMMixinSkins(SlapOSTestCaseMixin):
break
def
_requestSoftwareRelease
(
self
,
software_product_url
,
effective_date
=
None
):
software_release
=
self
.
_makeSoftwareRelease
()
software_release
=
self
.
_makeSoftwareRelease
(
self
.
project
)
if
not
effective_date
:
effective_date
=
DateTime
()
software_release
.
edit
(
...
...
@@ -69,14 +68,8 @@ class TestSlapOSPDMMixinSkins(SlapOSTestCaseMixin):
software_release
.
publish
()
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
_makeCustomSoftwareRelease
(
self
,
software_product
,
software_url
):
return
self
.
_makeSoftwareRelease
(
software_product
,
url
=
software_url
)
def
_makeSoftwareInstallation
(
self
,
compute_node
,
software_release_url
):
software_installation
=
self
.
portal
\
...
...
@@ -120,9 +113,9 @@ class TestSlapOSPDMMixinSkins(SlapOSTestCaseMixin):
instance_tree
.
requestStart
(
**
kw
)
instance_tree
.
requestInstance
(
**
kw
)
def
_makeFullInstanceTree
(
self
,
software_url
=
""
,
person
=
None
):
def
_makeFullInstanceTree
(
self
,
project
,
software_url
=
""
,
person
=
None
):
if
not
person
:
person
=
self
.
_makePerson
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
portal
\
.
instance_tree_module
.
template_instance_tree
\
...
...
@@ -186,25 +179,26 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
tic
()
def
test_getSortedSoftwareReleaseListFromSoftwareProduct
(
self
):
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
release_list
=
software_product
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_product
.
getReference
())
self
.
assertEqual
(
release_list
,
[])
# published software release
software_release1
=
self
.
_makeSoftwareRelease
()
software_release1
=
self
.
_makeSoftwareRelease
(
software_product
)
software_release1
.
edit
(
aggregate_value
=
software_product
.
getRelativeUrl
(),
url_string
=
'http://example.org/1-%s.cfg'
%
self
.
new_id
,
effective_date
=
(
DateTime
()
+
5
)
)
software_release1
.
publish
()
software_release2
=
self
.
_makeSoftwareRelease
()
software_release2
=
self
.
_makeSoftwareRelease
(
software_product
)
software_release2
.
edit
(
aggregate_value
=
software_product
.
getRelativeUrl
(),
url_string
=
'http://example.org/2-%s.cfg'
%
self
.
new_id
)
software_release2
.
publish
()
# 1 released software release, should not appear
software_release3
=
self
.
_makeSoftwareRelease
()
software_release3
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
assertTrue
(
software_release3
.
getValidationState
()
==
'released'
)
software_release3
.
edit
(
aggregate_value
=
software_product
.
getRelativeUrl
(),
url_string
=
'http://example.org/3-%s.cfg'
%
self
.
new_id
...
...
@@ -217,20 +211,21 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
[
'http://example.org/2-%s.cfg'
%
self
.
new_id
,
'http://example.org/1-%s.cfg'
%
self
.
new_id
])
def
test_getSortedSoftwareReleaseListFromSoftwareProduct_Changed
(
self
):
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
release_list
=
software_product
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_product
.
getReference
())
self
.
assertEqual
(
release_list
,
[])
# 2 published software releases
software_release2
=
self
.
_makeSoftwareRelease
()
software_release2
=
self
.
_makeSoftwareRelease
(
software_product
)
software_release2
.
publish
()
software_release2
.
edit
(
aggregate_value
=
software_product
.
getRelativeUrl
(),
url_string
=
'http://example.org/2-%s.cfg'
%
self
.
new_id
,
effective_date
=
(
DateTime
()
-
2
)
)
# Newest software release
software_release1
=
self
.
_makeSoftwareRelease
()
software_release1
=
self
.
_makeSoftwareRelease
(
software_product
)
software_release1
.
publish
()
software_release1
.
edit
(
aggregate_value
=
software_product
.
getRelativeUrl
(),
url_string
=
'http://example.org/1-%s.cfg'
%
self
.
new_id
,
...
...
@@ -249,9 +244,10 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
test_InstanceTree_getNewerSofwareRelease
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
oldest_software_url
=
'http://example.org/oldest-%s.cfg'
%
self
.
new_id
newest_software_url
=
'http://example.org/newest-%s.cfg'
%
self
.
new_id
...
...
@@ -274,10 +270,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
release
.
getUrlString
(),
newest_software_url
)
def
testInstanceTree_getUpgradableSoftwareRelease_no_installation
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
self
.
_makeComputePartitions
(
compute_node
)
software_product
=
self
.
_makeSoftwareProduct
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
oldest_software_url
=
'http://example.org/oldest-%s.cfg'
%
self
.
new_id
newest_software_url
=
'http://example.org/newest-%s.cfg'
%
self
.
new_id
self
.
_makeCustomSoftwareRelease
(
...
...
@@ -299,10 +296,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
None
)
def
testInstanceTree_getUpgradableSoftwareRelease
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
self
.
_makeComputePartitions
(
compute_node
)
software_product
=
self
.
_makeSoftwareProduct
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
oldest_software_url
=
'http://example.org/oldest-%s.cfg'
%
self
.
new_id
newest_software_url
=
'http://example.org/newest-%s.cfg'
%
self
.
new_id
self
.
_makeCustomSoftwareRelease
(
...
...
@@ -319,7 +317,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
_makeSoftwareInstallation
(
compute_node
,
newest_software_url
)
# software_release should be ignored!
software_release
=
self
.
_makeSoftwareRelease
()
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
_makeSoftwareInstallation
(
compute_node
,
software_release
.
getUrlString
())
self
.
tic
()
release
=
hs
.
InstanceTree_getUpgradableSoftwareRelease
()
...
...
@@ -330,9 +328,9 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
hs
.
InstanceTree_getUpgradableSoftwareRelease
(),
None
)
def
testUpgradeDecision_getComputeNode
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -343,7 +341,8 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_compute_node
.
getRelativeUrl
())
def
testUpgradeDecision_getComputeNode_2_lines
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -356,7 +355,8 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_compute_node
.
getRelativeUrl
())
def
testUpgradeDecision_getComputeNode_2_compute_node
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -422,9 +422,10 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
self
.
assertEqual
(
None
,
found_instance_tree
)
def
testUpgradeDecision_getAggregateValue_SoftwareRelease
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -435,7 +436,9 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_software_release
.
getRelativeUrl
())
def
testUpgradeDecision_getAggregateValue_SoftwareRelease_2_lines
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -448,7 +451,9 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_software_release
.
getRelativeUrl
())
def
testUpgradeDecision_getAggregateValue_SoftwareRelease_2_sr
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -479,9 +484,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
software_release
.
getUrlString
(),
url_string
)
def
testSoftwareRelease_createUpgradeDecision_compute_node
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
software_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
compute_node
.
getRelativeUrl
(),
...
...
@@ -506,11 +513,13 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
testSoftwareRelease_createUpgradeDecision_hostingSubscription
(
self
):
person
=
self
.
_makePerson
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
software_release
=
self
.
_makeSoftwareRelease
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
software_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
instance_tree
.
getRelativeUrl
(),
...
...
@@ -531,14 +540,15 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
testSoftwareRelease_getUpgradeDecisionInProgress
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
software_release2
=
self
.
_makeSoftwareRelease
()
software_release2
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
.
confirm
()
reference
=
upgrade_decision
.
getReference
()
...
...
@@ -557,8 +567,9 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
in_progress
,
None
)
def
testSoftwareRelease_getUpgradeDecisionInProgress_cancelled
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -584,8 +595,9 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
in_progress
.
getReference
(),
upgrade_decision2
.
getReference
())
def
testSoftwareRelease_getUpgradeDecisionInProgress_rejected
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -620,11 +632,12 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
in_progress
.
getReference
(),
upgrade_decision2
.
getReference
())
def
testSoftwareRelease_getUpgradeDecisionInProgress_hosting_subs
(
self
):
person
=
self
.
_makePerson
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
software_product
=
self
.
_makeSoftwareProduct
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -648,13 +661,14 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
testSoftwareRelease_getUpgradeDecisionInProgress_software_product
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_release2
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_release3
=
self
.
_makeSoftwareRelease
()
software_release3
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
...
...
@@ -677,16 +691,17 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
testSoftwareRelease_getUpgradeDecisionInProgress_software_product_hs
(
self
):
person
=
self
.
_makePerson
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
software_product
=
self
.
_makeSoftwareProduct
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_release2
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_release3
=
self
.
_makeSoftwareRelease
()
software_release3
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
...
...
@@ -711,13 +726,12 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
def
testComputeNode_checkAndCreateUpgradeDecision_auto
(
self
):
p
erson
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
p
roject
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
,
allocation_scope
=
"open"
)
compute_node
.
edit
(
upgrade_scope
=
"auto"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
_makeSoftwareInstallation
(
compute_node
,
software_release
.
getUrlString
())
self
.
tic
()
...
...
@@ -746,13 +760,12 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
len
(
upgrade_decision2
),
0
)
def
testComputeNode_checkAndCreateUpgradeDecision_ask_confirmation_with_exist
(
self
):
p
erson
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
p
roject
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
,
allocation_scope
=
"open/personal"
)
compute_node
.
edit
(
upgrade_scope
=
"ask_confirmation"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
_makeSoftwareInstallation
(
compute_node
,
software_release
.
getUrlString
())
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
...
...
@@ -775,13 +788,12 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
software_release3
.
getUrlString
())
def
testComputeNode_checkAndCreateUpgradeDecision_auto_with_exist
(
self
):
p
erson
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
p
roject
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
,
allocation_scope
=
"open"
)
compute_node
.
edit
(
upgrade_scope
=
"auto"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
_makeSoftwareInstallation
(
compute_node
,
software_release
.
getUrlString
())
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
self
.
tic
()
...
...
@@ -1008,8 +1020,10 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
"%s contains the wrong message"
%
redirect_url
)
def
testUpgradeDecision_isUpgradeFinished_compute_node
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
...
...
@@ -1066,8 +1080,10 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision
.
getSimulationState
(),
requested_state
))
def
testUpgradeDecision_isUpgradeFinished_instance_tree
(
self
):
project
=
self
.
addProject
()
instance_tree
=
self
.
_makeInstanceTree
()
software_release
=
self
.
_makeSoftwareRelease
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
...
...
@@ -1086,11 +1102,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecision_notify_compute_node"])'
)
def
testUpgradeDecision_notify_compute_node
(
self
):
p
erson
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
)
software_release
=
self
.
_makeSoftwareRelease
(
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
.
setAggregateValu
e
(
software_product
)
p
roject
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareReleas
e
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -1146,11 +1162,11 @@ ${new_software_release_url}""",
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecision_notify_instance_tree"])'
)
def
testUpgradeDecision_notify_instance_tree
(
self
):
person
=
self
.
_makePerson
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
_makeInstanceTree
()
software_release
=
self
.
_makeSoftwareRelease
()
software_product
=
self
.
_makeSoftwareProduct
()
software_release
.
setAggregateValue
(
software_product
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -1211,11 +1227,11 @@ ${new_software_release_url}""",
@
simulate
(
'UpgradeDecision_isUpgradeFinished'
,
''
,
'return 1'
)
def
testUpgradeDecision_notifyDelivered_compute_node
(
self
):
p
erson
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
)
software_release
=
self
.
_makeSoftwareRelease
(
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
.
setAggregateValu
e
(
software_product
)
p
roject
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
compute_node
,
_
=
self
.
_makeComputeNode
(
project
)
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareReleas
e
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -1274,11 +1290,12 @@ ${new_software_release_url}""",
@
simulate
(
'UpgradeDecision_isUpgradeFinished'
,
''
,
'return 1'
)
def
testUpgradeDecision_notifyDelivered_instance_tree
(
self
):
person
=
self
.
_makePerson
()
project
=
self
.
addProject
()
person
=
self
.
_makePerson
(
project
)
instance_tree
=
self
.
_makeInstanceTree
()
software_
release
=
self
.
_makeSoftwareRelease
(
)
software_
product
=
self
.
_makeSoftwareProduct
(
)
software_release
.
setAggregateValue
(
software_product
)
software_
product
=
self
.
_makeSoftwareProduct
(
project
)
software_
release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -1333,7 +1350,9 @@ ${new_software_release_url}""",
self
.
assertEqual
(
event
.
getSimulationState
(),
"delivered"
)
def
testUpgradeDecisionLine_cancel_already_cancelled
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
cancel
(
comment
=
"Cancelled by the test"
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
...
...
@@ -1346,8 +1365,10 @@ ${new_software_release_url}""",
self
.
assertEqual
(
"Cancelled by the test"
,
workflow_history_list
[
-
1
].
comment
)
def
testUpgradeDecisionLine_cancel_archived_software_release
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
software_product
=
self
.
_makeSoftwareProduct
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
])
...
...
@@ -1370,7 +1391,9 @@ ${new_software_release_url}""",
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecisionLine_cancel_destroyed_instance_tree"])'
)
def
testUpgradeDecisionLine_cancel_destroyed_instance_tree
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
instance_tree
=
self
.
_makeFullInstanceTree
(
software_release
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -1415,7 +1438,9 @@ ${new_software_release_url}""",
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecisionLine_cancel_destroyed_instance_tree"])'
)
def
testUpgradeDecisionLine_cancel_destroyed_instance_tree_and_disabled_monitor
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareRelease
(
software_product
)
instance_tree
=
self
.
_makeFullInstanceTree
(
software_release
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -1461,9 +1486,9 @@ ${new_software_release_url}""",
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecisionLine_cancel_destroyed_hs_archived_sr"])'
)
def
testUpgradeDecisionLine_cancel_destroyed_hs_archived_sr
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
software_product
=
self
.
_makeSoftwareProduct
()
software_release
.
setAggregateValu
e
(
software_product
)
project
=
self
.
addProject
()
software_product
=
self
.
_makeSoftwareProduct
(
project
)
software_release
=
self
.
_makeSoftwareReleas
e
(
software_product
)
instance_tree
=
self
.
_makeFullInstanceTree
(
software_release
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
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