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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
ddeb07f6
Commit
ddeb07f6
authored
Aug 06, 2018
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: add test for UpgradeDecision_requestChangeState
parent
670507ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
13 deletions
+44
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
...ateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
+0
-3
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+44
-10
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
View file @
ddeb07f6
...
@@ -15,12 +15,9 @@ computer = context.UpgradeDecision_getComputer()
...
@@ -15,12 +15,9 @@ computer = context.UpgradeDecision_getComputer()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
software_product_title
=
software_release
.
getAggregateTitle
(
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
portal_type
=
"Software Product"
)
reference
=
context
.
getReference
()
mapping_dict
=
{
mapping_dict
=
{
'software_product_title'
:
software_product_title
,
'software_product_title'
:
software_product_title
,
'upgrade_accept_link'
:
'Base_acceptUpgradeDecision?reference=%s'
%
reference
,
'upgrade_reject_link'
:
'Base_rejectUpgradeDecision?reference=%s'
%
reference
,
'software_release_name'
:
software_release
.
getTitle
(),
'software_release_name'
:
software_release
.
getTitle
(),
'software_release_reference'
:
software_release
.
getReference
(),
'software_release_reference'
:
software_release
.
getReference
(),
'new_software_release_url'
:
software_release
.
getUrlString
(),
'new_software_release_url'
:
software_release
.
getUrlString
(),
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
ddeb07f6
...
@@ -1499,6 +1499,48 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
...
@@ -1499,6 +1499,48 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
self
.
tic
()
self
.
tic
()
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
def
testUpgradeDecision_requestChangeState_started
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
setReference
(
"UD-TESTDECISION"
)
upgrade_decision
.
confirm
()
requested_state
=
"started"
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'confirmed'
)
upgrade_decision
.
UpgradeDecision_requestChangeState
(
requested_state
)
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'started'
)
def
testUpgradeDecision_requestChangeState_reject
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
setReference
(
"UD-TESTDECISION"
)
upgrade_decision
.
confirm
()
requested_state
=
"rejected"
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'confirmed'
)
upgrade_decision
.
UpgradeDecision_requestChangeState
(
requested_state
)
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'rejected'
)
def
testUpgradeDecision_requestChangeState_stopped
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
setReference
(
"UD-TESTDECISION"
)
upgrade_decision
.
confirm
()
upgrade_decision
.
stop
()
requested_state
=
"started"
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'stopped'
)
result
=
upgrade_decision
.
UpgradeDecision_requestChangeState
(
requested_state
)
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'stopped'
)
self
.
assertEquals
(
result
,
"Transition from state %s to %s is not permitted"
%
(
upgrade_decision
.
getSimulationState
(),
requested_state
))
def
testUpgradeDecision_requestChangeState_rejected
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
setReference
(
"UD-TESTDECISION"
)
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
requested_state
=
"rejected"
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'started'
)
result
=
upgrade_decision
.
UpgradeDecision_requestChangeState
(
requested_state
)
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'started'
)
self
.
assertEquals
(
result
,
"Transition from state %s to %s is not permitted"
%
(
upgrade_decision
.
getSimulationState
(),
requested_state
))
def
testUpgradeDecision_isUpgradeFinished_hosting_subscription
(
self
):
def
testUpgradeDecision_isUpgradeFinished_hosting_subscription
(
self
):
hosting_subscription
=
self
.
_makeHostingSubscription
()
hosting_subscription
=
self
.
_makeHostingSubscription
()
software_release
=
self
.
_makeSoftwareRelease
()
software_release
=
self
.
_makeSoftwareRelease
()
...
@@ -1540,8 +1582,6 @@ ${computer_title}
...
@@ -1540,8 +1582,6 @@ ${computer_title}
${computer_reference}
${computer_reference}
${software_release_name}
${software_release_name}
${software_release_reference}
${software_release_reference}
${upgrade_accept_link}
${upgrade_reject_link}
${new_software_release_url}"""
,
${new_software_release_url}"""
,
content_type
=
'text/html'
,
content_type
=
'text/html'
,
)
)
...
@@ -1570,9 +1610,7 @@ ${new_software_release_url}""",
...
@@ -1570,9 +1610,7 @@ ${new_software_release_url}""",
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
[
software_product
.
getTitle
(),
computer
.
getTitle
(),
computer
.
getReference
(),
[
software_product
.
getTitle
(),
computer
.
getTitle
(),
computer
.
getReference
(),
software_release
.
getTitle
(),
software_release
.
getReference
(),
software_release
.
getTitle
(),
software_release
.
getReference
(),
'Base_acceptUpgradeDecision?reference=%s'
%
upgrade_decision
.
getReference
(),
'Base_rejectUpgradeDecision?reference=%s'
%
upgrade_decision
.
getReference
(),
software_release
.
getUrlString
()])
software_release
.
getUrlString
()])
...
@@ -1607,8 +1645,6 @@ ${hosting_subscription_title}
...
@@ -1607,8 +1645,6 @@ ${hosting_subscription_title}
${old_software_release_url}
${old_software_release_url}
${software_release_name}
${software_release_name}
${software_release_reference}
${software_release_reference}
${upgrade_accept_link}
${upgrade_reject_link}
${new_software_release_url}"""
,
${new_software_release_url}"""
,
content_type
=
'text/html'
,
content_type
=
'text/html'
,
)
)
...
@@ -1637,9 +1673,7 @@ ${new_software_release_url}""",
...
@@ -1637,9 +1673,7 @@ ${new_software_release_url}""",
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
[
software_product
.
getTitle
(),
hosting_subscription
.
getTitle
(),
[
software_product
.
getTitle
(),
hosting_subscription
.
getTitle
(),
old_url
,
software_release
.
getTitle
(),
software_release
.
getReference
(),
old_url
,
software_release
.
getTitle
(),
software_release
.
getReference
(),
'Base_acceptUpgradeDecision?reference=%s'
%
upgrade_decision
.
getReference
(),
'Base_rejectUpgradeDecision?reference=%s'
%
upgrade_decision
.
getReference
(),
software_release
.
getUrlString
()])
software_release
.
getUrlString
()])
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
...
...
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