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
Xiaowu Zhang
slapos.core
Commits
71c9e9ea
Commit
71c9e9ea
authored
Sep 24, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Test Subscription Scenarios with Chinese currency
parent
5e5d4803
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
260 additions
and
267 deletions
+260
-267
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
...onents/test.erp5.testSlapOSSubscriptionChineseScenario.py
+46
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.xml
...nents/test.erp5.testSlapOSSubscriptionChineseScenario.xml
+124
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+87
-266
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
...l_components/test.erp5.testSlapOSSubscriptionScenario.xml
+1
-0
master/bt5/slapos_subscription_request/bt/template_test_id_list
.../bt5/slapos_subscription_request/bt/template_test_id_list
+2
-1
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
0 → 100644
View file @
71c9e9ea
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
from
erp5.component.test.testSlapOSSubscriptionScenario
import
TestSlapOSSubscriptionScenarioMixin
class
TestSlapOSSubscriptionChineseScenario
(
TestSlapOSSubscriptionScenarioMixin
):
def
afterSetUp
(
self
):
TestSlapOSSubscriptionScenarioMixin
.
afterSetUp
(
self
)
self
.
expected_individual_price_without_tax
=
1573.3333333333335
self
.
expected_individual_price_with_tax
=
1888.00
def
createSubscriptionCondition
(
self
,
slave
=
False
):
self
.
subscription_condition
=
self
.
portal
.
subscription_condition_module
.
newContent
(
portal_type
=
"Subscription Condition"
,
title
=
"TestSubscriptionChineseScenario"
,
short_tile
=
"Test Your Chinese Scenario"
,
description
=
"This is a Chinese test"
,
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
root_slave
=
slave
,
price
=
1888.00
,
resource
=
"currency_module/RMB"
,
default_source_reference
=
"default"
,
reference
=
"rapidvm%s"
%
self
.
new_id
,
# Aggregate and Follow up to web pages for product description and
# Terms of service
sla_xml
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
,
text_content
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
,
user_input
=
{}
)
self
.
subscription_condition
.
validate
()
self
.
subscription_condition
.
updateLocalRolesOnSecurityGroups
()
self
.
tic
()
def
test_subscription_scenario
(
self
):
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_with_3_vms_scenario
(
self
):
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_two_subscription_scenario
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.xml
0 → 100644
View file @
71c9e9ea
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSSubscriptionChineseScenario
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSSubscriptionChineseScenario
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
<none/>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
71c9e9ea
...
@@ -9,9 +9,12 @@ from erp5.component.test.SlapOSTestCaseDefaultScenarioMixin import DefaultScenar
...
@@ -9,9 +9,12 @@ from erp5.component.test.SlapOSTestCaseDefaultScenarioMixin import DefaultScenar
from
erp5.component.test.SlapOSTestCaseMixin
import
changeSkin
from
erp5.component.test.SlapOSTestCaseMixin
import
changeSkin
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestSlapOS
TrialScenario
(
DefaultScenarioMixin
):
class
TestSlapOS
SubscriptionScenarioMixin
(
DefaultScenarioMixin
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
expected_individual_price_without_tax
=
162.50
self
.
expected_individual_price_with_tax
=
195.00
self
.
login
()
self
.
login
()
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_draft
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_draft
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_ordered
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_ordered
.
setEnabled
(
True
)
...
@@ -35,6 +38,13 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -35,6 +38,13 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
text_content
=
'${name} ${login_name}'
)
text_content
=
'${name} ${login_name}'
)
self
.
cleanUpSubscriptionRequest
()
self
.
cleanUpSubscriptionRequest
()
self
.
tic
()
self
.
tic
()
self
.
login
()
self
.
createSubscriptionCondition
()
# some preparation
self
.
logout
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
def
cleanUpSubscriptionRequest
(
self
):
def
cleanUpSubscriptionRequest
(
self
):
for
subscription_request
in
self
.
portal
.
portal_catalog
(
for
subscription_request
in
self
.
portal
.
portal_catalog
(
...
@@ -182,10 +192,11 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -182,10 +192,11 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
# 195 is the month payment
# 195 is the month payment
# 195*3 is the 3 months to pay upfront to use.
# 195*3 is the 3 months to pay upfront to use.
# 25 is the reservation fee deduction.
# 25 is the reservation fee deduction.
authAmount
=
(
int
(
self
.
expected_individual_price_with_tax
*
100
)
*
3
-
2500
)
*
quantity
data_kw
=
{
data_kw
=
{
'errorCode'
:
'0'
,
'errorCode'
:
'0'
,
'transactionStatus'
:
'6'
,
'transactionStatus'
:
'6'
,
'authAmount'
:
(
19500
*
3
-
2500
)
*
quantity
,
'authAmount'
:
authAmount
,
'authDevise'
:
'978'
,
'authDevise'
:
'978'
,
}
}
payment
.
PaymentTransaction_createPayzenEvent
().
PayzenEvent_processUpdate
(
data_kw
,
True
)
payment
.
PaymentTransaction_createPayzenEvent
().
PayzenEvent_processUpdate
(
data_kw
,
True
)
...
@@ -306,8 +317,10 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -306,8 +317,10 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
quantity
=
subscription_request
.
getQuantity
()
quantity
=
subscription_request
.
getQuantity
()
# The values are without tax
# The values are without tax
self
.
assertEqual
(
sale_packing_list_line
.
getQuantity
(),
3
*
quantity
)
self
.
assertEqual
(
sale_packing_list_line
.
getQuantity
(),
3
*
quantity
)
self
.
assertEqual
(
sale_packing_list_line
.
getPrice
(),
162.50
)
self
.
assertEqual
(
sale_packing_list_line
.
getPrice
(),
self
.
assertEqual
(
sale_packing_list_line
.
getTotalPrice
(),
3
*
162.50
*
quantity
)
self
.
expected_individual_price_without_tax
)
self
.
assertEqual
(
round
(
sale_packing_list_line
.
getTotalPrice
()),
3
*
self
.
expected_individual_price_without_tax
*
quantity
)
self
.
assertEqual
(
sale_packing_list
.
getCausality
(),
self
.
assertEqual
(
sale_packing_list
.
getCausality
(),
subscription_request
.
getRelativeUrl
())
subscription_request
.
getRelativeUrl
())
...
@@ -325,7 +338,7 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -325,7 +338,7 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
subscription_request
.
getRelativeUrl
())
subscription_request
.
getRelativeUrl
())
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
_requestSubscription
(
self
,
**
kw
):
def
_requestSubscription
(
self
,
**
kw
):
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscri
t
ption
(
**
kw
)
def
getAggregatedSalePackingList
(
self
,
subscription_request
,
specialise
):
def
getAggregatedSalePackingList
(
self
,
subscription_request
,
specialise
):
person_uid
=
subscription_request
.
getDestinationSectionValue
().
getUid
()
person_uid
=
subscription_request
.
getDestinationSectionValue
().
getUid
()
...
@@ -351,17 +364,7 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -351,17 +364,7 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
destination_decision_uid
=
person_uid
,
destination_decision_uid
=
person_uid
,
specialise_uid
=
specialise_uid
)
specialise_uid
=
specialise_uid
)
def
test_subscription_scenario
(
self
,
amount
=
1
):
def
createPublicServerForAdminUser
(
self
):
""" The admin creates an computer, user can request instances on it"""
self
.
login
()
self
.
createSubscriptionCondition
()
# some preparation
self
.
logout
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
# Call here, We should create the instance in advance...
# hooray, now it is time to create computers
# hooray, now it is time to create computers
self
.
login
(
self
.
admin_user
.
getUserId
())
self
.
login
(
self
.
admin_user
.
getUserId
())
...
@@ -383,10 +386,12 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -383,10 +386,12 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
tic
()
self
.
tic
()
self
.
logout
()
self
.
logout
()
return
subscription_server
# Call as anonymous... check response?
def
requestAndCheckHostingSubscription
(
self
,
amount
,
name
,
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
default_email_text
):
name
=
"ABC %s"
%
self
.
new_id
self
.
logout
()
self
.
_requestSubscription
(
self
.
_requestSubscription
(
subscription_reference
=
self
.
subscription_condition
.
getReference
(),
subscription_reference
=
self
.
subscription_condition
.
getReference
(),
amount
=
amount
,
amount
=
amount
,
...
@@ -426,8 +431,15 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -426,8 +431,15 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
tic
()
self
.
tic
()
# Check if instance was requested
return
subscription_request
self
.
checkRelatedInstance
(
subscription_request
)
def
checkSubscriptionDeploymentAndSimulation
(
self
,
default_email_text
,
subscription_server
):
subscription_request_list
=
self
.
getSubscriptionRequestList
(
default_email_text
,
self
.
subscription_condition
)
for
subscription_request
in
subscription_request_list
:
# Check if instance was requested
self
.
checkRelatedInstance
(
subscription_request
)
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
tic
()
self
.
tic
()
...
@@ -436,9 +448,10 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -436,9 +448,10 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
tic
()
self
.
tic
()
# Re-check, as instance shouldn't be allocated until
for
subscription_request
in
subscription_request_list
:
# the confirmation of the new Payment.
# Re-check, as instance shouldn't be allocated until
self
.
checkRelatedInstance
(
subscription_request
)
# the confirmation of the new Payment.
self
.
checkRelatedInstance
(
subscription_request
)
# check the Open Sale Order coverage
# check the Open Sale Order coverage
self
.
stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm
()
self
.
stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm
()
...
@@ -469,32 +482,36 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -469,32 +482,36 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
specialise_subscription_uid
=
preference_tool
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()
specialise_subscription_uid
=
preference_tool
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()
specialise_uid
=
preference_tool
.
getPreferredAggregatedSaleTradeCondition
()
specialise_uid
=
preference_tool
.
getPreferredAggregatedSaleTradeCondition
()
sale_packing_list_list
=
self
.
getAggregatedSalePackingList
(
for
subscription_request
in
subscription_request_list
:
subscription_request
,
specialise_subscription_uid
)
sale_packing_list_list
=
self
.
getAggregatedSalePackingList
(
self
.
assertEqual
(
1
,
len
(
sale_packing_list_list
))
subscription_request
,
specialise_subscription_uid
)
self
.
assertEqual
(
1
,
len
(
sale_packing_list_list
))
self
.
checkAggregatedSalePackingList
(
subscription_request
,
sale_packing_list_list
[
0
])
self
.
checkAggregatedSalePackingList
(
subscription_request
,
sale_packing_list_list
[
0
])
self
.
assertEqual
(
3
,
len
(
self
.
getSubscriptionSalePackingList
(
expected_sale_packing_list_amount
=
len
(
subscription_request_list
)
*
3
subscription_request
)))
self
.
assertEqual
(
expected_sale_packing_list_amount
,
len
(
self
.
getSubscriptionSalePackingList
(
subscription_request
)))
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_uid
)))
subscription_request
,
specialise_uid
)))
# Call this alarm shouldn't affect the delivery
# Call this alarm shouldn't affect the delivery
self
.
stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm
(
self
.
stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm
(
accounting_date
=
DateTime
(
'2222/01/01'
))
accounting_date
=
DateTime
(
'2222/01/01'
))
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
1
,
len
(
self
.
getAggregatedSalePackingList
(
for
subscription_request
in
subscription_request_list
:
subscription_request
,
specialise_subscription_uid
)))
self
.
assertEqual
(
1
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_subscription_uid
)))
# Call this alarm shouldn't affect the delivery
# Call this alarm shouldn't affect the delivery
self
.
stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm
()
self
.
stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
for
subscription_request
in
subscription_request_list
:
subscription_request
,
specialise_uid
)))
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_uid
)))
# stabilise aggregated deliveries and expand them
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
...
@@ -555,17 +572,19 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -555,17 +572,19 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
self
.
checkAndPayFirstTreeMonth
(
subscription_request
)
for
subscription_request
in
subscription_request_list
:
self
.
tic
()
self
.
checkAndPayFirstTreeMonth
(
subscription_request
)
self
.
tic
()
# After the payment re-call the Alarm in order to confirm the subscription
# After the payment re-call the Alarm in order to confirm the subscription
# Request.
# Request.
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
tic
()
self
.
tic
()
# Check if instance was already allocated, in this case, it shouldn't
for
subscription_request
in
subscription_request_list
:
# until the allocation alarm kicks in.
# Check if instance was already allocated, in this case, it shouldn't
self
.
checkRelatedInstance
(
subscription_request
)
# until the allocation alarm kicks in.
self
.
checkRelatedInstance
(
subscription_request
)
# Now really allocate the instance
# Now really allocate the instance
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
stepCallSlaposAllocateInstanceAlarm
()
...
@@ -575,85 +594,36 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -575,85 +594,36 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
tic
()
self
.
tic
()
# Re-check, now it should be allocated.
for
subscription_request
in
subscription_request_list
:
self
.
checkAllocationOnRelatedInstance
(
subscription_request
)
# Re-check, now it should be allocated.
self
.
checkAllocationOnRelatedInstance
(
subscription_request
)
def
test_subscription_with_3_vms_scenario
(
self
):
self
.
test_subscription_scenario
(
amount
=
3
)
def
test_two
_subscription_scenario
(
self
,
amount
=
1
):
def
_test
_subscription_scenario
(
self
,
amount
=
1
):
""" The admin creates an computer, user can request instances on it"""
""" The admin creates an computer, user can request instances on it"""
self
.
login
()
self
.
createSubscriptionCondition
()
# some preparation
subscription_server
=
self
.
createPublicServerForAdminUser
()
self
.
logout
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
# Call here, We should create the instance in advance...
# hooray, now it is time to create computers
self
.
login
(
self
.
admin_user
.
getUserId
())
# Create a Public Server for admin user, and allow
subscription_server_title
=
'Trial Public Server for Admin User %s'
%
self
.
new_id
subscription_server_id
=
self
.
requestComputer
(
subscription_server_title
)
subscription_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Computer'
,
reference
=
subscription_server_id
)
self
.
setAccessToMemcached
(
subscription_server
)
self
.
assertNotEqual
(
None
,
subscription_server
)
self
.
setServerOpenSubscription
(
subscription_server
)
# and install some software on them
subscription_server_software
=
self
.
subscription_condition
.
getUrlString
()
self
.
supplySoftware
(
subscription_server
,
subscription_server_software
)
# format the computers
self
.
formatComputer
(
subscription_server
)
self
.
tic
()
self
.
logout
()
# Call as anonymous... check response?
# Call as anonymous... check response?
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"ABC %s"
%
self
.
new_id
name
=
"ABC %s"
%
self
.
new_id
self
.
_requestSubscription
(
self
.
requestAndCheckHostingSubscription
(
amount
,
name
,
default_email_text
)
subscription_reference
=
self
.
subscription_condition
.
getReference
(),
amount
=
amount
,
name
=
name
,
default_email_text
=
default_email_text
,
REQUEST
=
self
.
portal
.
REQUEST
)
self
.
login
()
self
.
checkSubscriptionDeploymentAndSimulation
(
# I'm not sure if this is realistic
default_email_text
,
subscription_server
)
self
.
tic
()
subscription_request
=
self
.
getSubscriptionRequest
(
def
_test_two_subscription_scenario
(
self
,
amount
=
1
):
default_email_text
,
self
.
subscription_condition
)
""" The admin creates an computer, user can request instances on it"""
self
.
checkDraftSubscriptionRequest
(
subscription_request
,
default_email_text
,
self
.
subscription_condition
)
subscription_server
=
self
.
createPublicServerForAdminUser
()
# Check Payment and pay it.
self
.
checkAndPaySubscriptionPayment
(
subscription_request
)
self
.
tic
()
# Call alarm to check payment and invoice and move foward to planned.
self
.
stepCallSlaposSubscriptionRequestProcessDraftAlarm
()
self
.
tic
()
self
.
checkPlannedSubscriptionRequest
(
subscription_request
,
default_email_text
,
self
.
subscription_condition
)
# Call alarm to mark subscription request as ordered, bootstrap the user
# and check if email is sent, once done move to ordered state.
self
.
stepCallSlaposSubscriptionRequestProcessPlannedAlarm
()
self
.
tic
()
self
.
checkOrderedSubscriptionRequest
(
subscription_request
,
# Call as anonymous... check response?
default_email_text
,
self
.
subscription_condition
)
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"ABC %s"
%
self
.
new_id
self
.
requestAndCheckHostingSubscription
(
amount
,
name
,
default_email_text
)
self
.
logout
()
self
.
logout
()
# Request a second one
# Request a second one, without require confirmation and verifing the second subscription request
self
.
_requestSubscription
(
self
.
_requestSubscription
(
subscription_reference
=
self
.
subscription_condition
.
getReference
(),
subscription_reference
=
self
.
subscription_condition
.
getReference
(),
amount
=
amount
,
amount
=
amount
,
...
@@ -694,165 +664,16 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
...
@@ -694,165 +664,16 @@ class TestSlapOSTrialScenario(DefaultScenarioMixin):
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
tic
()
self
.
tic
()
subscription_request_list
=
self
.
getSubscriptionRequestList
(
self
.
checkSubscriptionDeploymentAndSimulation
(
default_email_text
,
self
.
subscription_condition
)
default_email_text
,
subscription_server
)
for
subscription_request
in
subscription_request_list
:
# Check if instance was requested
self
.
checkRelatedInstance
(
subscription_request
)
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
tic
()
# now instantiate it on computer and set some nice connection dict
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
# Re-check, as instance shouldn't be allocated until
# the confirmation of the new Payment.
self
.
checkRelatedInstance
(
subscription_request
)
# check the Open Sale Order coverage
self
.
stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm
()
self
.
tic
()
# generate simulation for open order
self
.
stepCallUpdateOpenOrderSimulationAlarm
()
self
.
tic
()
# build subscription packing list
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
# stabilise build deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# build aggregated packing list
self
.
stepCallSlaposTriggerAggregatedDeliveryOrderBuilderAlarm
()
self
.
tic
()
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# check if Packing list is generated with the right trade condition
preference_tool
=
self
.
portal
.
portal_preferences
specialise_subscription_uid
=
preference_tool
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()
specialise_uid
=
preference_tool
.
getPreferredAggregatedSaleTradeCondition
()
for
subscription_request
in
subscription_request_list
:
sale_packing_list_list
=
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_subscription_uid
)
self
.
assertEqual
(
1
,
len
(
sale_packing_list_list
))
self
.
checkAggregatedSalePackingList
(
subscription_request
,
sale_packing_list_list
[
0
])
self
.
assertEqual
(
6
,
len
(
self
.
getSubscriptionSalePackingList
(
subscription_request
)))
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_uid
)))
# Call this alarm shouldn't affect the delivery
self
.
stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm
(
accounting_date
=
DateTime
(
'2222/01/01'
))
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
self
.
assertEqual
(
1
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_subscription_uid
)))
# Call this alarm shouldn't affect the delivery
self
.
stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm
()
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
self
.
assertEqual
(
0
,
len
(
self
.
getAggregatedSalePackingList
(
subscription_request
,
specialise_uid
)))
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# deliver aggregated deliveries
self
.
stepCallSlaposDeliverStartedAggregatedSalePackingListAlarm
()
self
.
tic
()
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# build aggregated invoices
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
# stabilise aggregated invoices and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# update invoices with their tax & discount
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# update invoices with their tax & discount transaction lines
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# stop the invoices and solve them again
self
.
stepCallSlaposStopConfirmedAggregatedSaleInvoiceTransactionAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
self
.
checkAndPayFirstTreeMonth
(
subscription_request
)
self
.
tic
()
# After the payment re-call the Alarm in order to confirm the subscription
# Request.
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
# Check if instance was already allocated, in this case, it shouldn't
# until the allocation alarm kicks in.
self
.
checkRelatedInstance
(
subscription_request
)
# Now really allocate the instance
class
TestSlapOSSubscriptionScenario
(
TestSlapOSSubscriptionScenarioMixin
):
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
tic
()
# now instantiate it on computer and set some nice connection dict
def
test_subscription_scenario
(
self
):
self
.
simulateSlapgridCP
(
subscription_server
)
self
.
_test_subscription_scenario
(
amount
=
1
)
self
.
tic
()
for
subscription_request
in
subscription_request_list
:
def
test_subscription_with_3_vms_scenario
(
self
):
# Re-check, now it should be allocated.
self
.
_test_subscription_scenario
(
amount
=
3
)
self
.
checkAllocationOnRelatedInstance
(
subscription_request
)
def
test_two_subscription_scenario
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
\ No newline at end of file
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
View file @
71c9e9ea
...
@@ -117,6 +117,7 @@
...
@@ -117,6 +117,7 @@
</item>
</item>
</dictionary>
</dictionary>
</list>
</list>
<none/>
</tuple>
</tuple>
</pickle>
</pickle>
</record>
</record>
...
...
master/bt5/slapos_subscription_request/bt/template_test_id_list
View file @
71c9e9ea
...
@@ -3,4 +3,5 @@ test.erp5.testSlapOSTrialAlarm
...
@@ -3,4 +3,5 @@ test.erp5.testSlapOSTrialAlarm
test.erp5.testSlapOSTrialScenario
test.erp5.testSlapOSTrialScenario
test.erp5.testSlapOSSubscriptionAlarm
test.erp5.testSlapOSSubscriptionAlarm
test.erp5.testSlapOSSubscriptionSkins
test.erp5.testSlapOSSubscriptionSkins
test.erp5.testSlapOSSubscriptionScenario
test.erp5.testSlapOSSubscriptionScenario
\ No newline at end of file
test.erp5.testSlapOSSubscriptionChineseScenario
\ No newline at end of file
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