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
Eric Zheng
slapos.core
Commits
1e63dc32
Commit
1e63dc32
authored
Sep 02, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Test Stop Subscription Request after HS been destroyed
parent
a9aa597c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
3 deletions
+43
-3
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+43
-3
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
1e63dc32
...
...
@@ -219,7 +219,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
subscription_request
.
getDefaultEmailText
(),
email
)
self
.
assertEqual
(
subscription_request
.
getUrlString
(),
subscription_condition
.
getUrlString
())
self
.
assertEqual
(
subscription_request
.
getRootSlave
(),
slave
)
self
.
assertEqual
(
subscription_request
.
getTextContent
(),
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
)
self
.
assertEqual
(
subscription_request
.
getTextContent
(),
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
)
#self.assertEqual(trial_request.getSlaXml(), '<?xml version="1.0" encoding="utf-8"?>\n<instance>\n</instance>')
self
.
assertEqual
(
subscription_request
.
getSourceReference
(),
"default"
)
...
...
@@ -269,6 +270,12 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"started"
)
self
.
checkEmailInstanceNotification
(
subscription_request
,
notification_message
)
def
checkStoppedSubscriptionRequest
(
self
,
subscription_request
,
email
,
subscription_condition
,
slave
=
0
):
self
.
checkSubscriptionRequest
(
subscription_request
,
email
,
subscription_condition
,
slave
=
slave
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"stopped"
)
def
_getRelatedPaymentValue
(
self
,
subscription_request
):
invoice
=
subscription_request
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
)
return
invoice
.
getCausalityRelatedValue
(
portal_type
=
"Payment Transaction"
)
...
...
@@ -510,7 +517,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
hosting_subscription
.
getUrlString
())
self
.
assertEqual
(
subscription_request
.
getRootSlave
(),
hosting_subscription
.
getRootSlave
())
self
.
assertEqual
(
hosting_subscription
.
getTextContent
(),
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
)
self
.
assertEqual
(
hosting_subscription
.
getTextContent
(),
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
)
#self.assertEqual(trial_request.getSlaXml(), '<?xml version="1.0" encoding="utf-8"?>\n<instance>\n</instance>')
self
.
assertEqual
(
hosting_subscription
.
getSourceReference
(),
"default"
)
...
...
@@ -951,7 +959,26 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
default_email_text
,
self
.
subscription_condition
)
def
destroyAndCheckSubscription
(
self
,
default_email_text
,
subscription_server
):
subscription_request_list
=
self
.
getSubscriptionRequestList
(
default_email_text
,
self
.
subscription_condition
)
for
subscription_request
in
subscription_request_list
:
self
.
assertEquals
(
'start_requested'
,
subscription_request
.
getAggregateValue
().
getSlapState
())
# Destroy all instances and process
hosting_subscription
=
subscription_request
.
getAggregateValue
()
hosting_subscription
.
HostingSubscription_requestPerson
(
'destroyed'
)
self
.
tic
()
self
.
stepCallSlaposSubscriptionRequestProcessStartedAlarm
()
self
.
tic
()
self
.
checkStoppedSubscriptionRequest
(
subscription_request
,
default_email_text
,
self
.
subscription_condition
)
def
_test_subscription_scenario
(
self
,
amount
=
1
):
""" The admin creates an computer, user can request instances on it"""
...
...
@@ -967,6 +994,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkSubscriptionDeploymentAndSimulation
(
default_email_text
,
subscription_server
)
self
.
destroyAndCheckSubscription
(
default_email_text
,
subscription_server
)
def
_test_subscription_scenario_with_existing_user
(
self
,
amount
=
1
,
language
=
None
):
""" The admin creates an computer, user can request instances on it"""
...
...
@@ -992,6 +1023,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
self
.
normal_user
,
subscription_request
.
getDestinationSectionValue
())
self
.
destroyAndCheckSubscription
(
default_email_text
,
subscription_server
)
def
_test_two_subscription_scenario
(
self
,
amount
=
1
,
create_invitation
=
False
,
max_invoice_delay
=
0
,
max_invoice_credit_eur
=
0.0
,
max_invoice_credit_cny
=
0.0
):
...
...
@@ -1106,6 +1140,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkSubscriptionDeploymentAndSimulation
(
default_email_text
,
subscription_server
)
self
.
destroyAndCheckSubscription
(
default_email_text
,
subscription_server
)
def
_test_subscription_scenario_with_reversal_transaction
(
self
,
amount
=
1
):
""" The admin creates an computer, user can request instances on it"""
...
...
@@ -1120,6 +1157,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkSubscriptionDeploymentAndSimulationWithReversalTransaction
(
default_email_text
,
subscription_server
)
self
.
destroyAndCheckSubscription
(
default_email_text
,
subscription_server
)
class
TestSlapOSSubscriptionScenario
(
TestSlapOSSubscriptionScenarioMixin
):
...
...
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