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
Lu Xu
slapos.core
Commits
a4158284
Commit
a4158284
authored
Jun 25, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Prefer use the language from the Subscription Request
... rather them the user's language
parent
a080668b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
171 additions
and
52 deletions
+171
-52
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyInstanceIsReady.py
...tion_request/SubscriptionRequest_notifyInstanceIsReady.py
+3
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.py
...ption_request/SubscriptionRequest_notifyPaymentIsReady.py
+3
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_sendAcceptedNotification.py
...n_request/SubscriptionRequest_sendAcceptedNotification.py
+4
-2
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
...onents/test.erp5.testSlapOSSubscriptionChineseScenario.py
+21
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.xml
...nents/test.erp5.testSlapOSSubscriptionChineseScenario.xml
+20
-17
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+100
-14
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
...l_components/test.erp5.testSlapOSSubscriptionScenario.xml
+20
-17
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyInstanceIsReady.py
View file @
a4158284
...
@@ -15,10 +15,12 @@ portal = context.getPortalObject()
...
@@ -15,10 +15,12 @@ portal = context.getPortalObject()
sender
=
context
.
getSourceSectionValue
(
portal_type
=
"Person"
)
sender
=
context
.
getSourceSectionValue
(
portal_type
=
"Person"
)
recipient
=
context
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
recipient
=
context
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
language
=
context
.
getLanguage
(
recipient
.
getLanguage
())
# Get message from catalog
# Get message from catalog
notification_reference
=
'subscription_request-instance-is-ready'
notification_reference
=
'subscription_request-instance-is-ready'
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_reference
,
language
=
recipient
.
getLanguage
()
)
reference
=
notification_reference
,
language
=
language
)
if
notification_message
is
None
:
if
notification_message
is
None
:
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.py
View file @
a4158284
...
@@ -11,9 +11,11 @@ recipient = context.getDestinationSectionValue(portal_type="Person")
...
@@ -11,9 +11,11 @@ recipient = context.getDestinationSectionValue(portal_type="Person")
# Get message from catalog
# Get message from catalog
notification_reference
=
'subscription_request-payment-is-ready'
notification_reference
=
'subscription_request-payment-is-ready'
language
=
context
.
getLanguage
(
recipient
.
getLanguage
())
# This implies the language to notify.
# This implies the language to notify.
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_reference
,
language
=
recipient
.
getLanguage
()
)
reference
=
notification_reference
,
language
=
language
)
if
notification_message
is
None
:
if
notification_message
is
None
:
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_sendAcceptedNotification.py
View file @
a4158284
...
@@ -7,10 +7,12 @@ notification_type = "without-password"
...
@@ -7,10 +7,12 @@ notification_type = "without-password"
if
password
:
if
password
:
notification_type
=
"with-password"
notification_type
=
"with-password"
language
=
context
.
getLanguage
(
recipient
.
getLanguage
())
#Get message from catalog
#Get message from catalog
notification_reference
=
'subscription_request-confirmation-%s'
%
notification_type
notification_reference
=
'subscription_request-confirmation-%s'
%
notification_type
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_reference
,
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_reference
,
language
=
recipient
.
getLanguage
()
)
language
=
language
)
if
notification_message
is
None
:
if
notification_message
is
None
:
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
raise
ValueError
,
'Unable to found Notification Message with reference "%s".'
%
notification_reference
...
@@ -36,7 +38,7 @@ else:
...
@@ -36,7 +38,7 @@ else:
mail_text
=
notification_message
.
asText
(
mail_text
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
notification_mapping_dict
})
substitution_method_parameter_dict
=
{
'mapping_dict'
:
notification_mapping_dict
})
#Send email
#
Send email
portal
.
portal_notifications
.
sendMessage
(
portal
.
portal_notifications
.
sendMessage
(
sender
=
sender
,
sender
=
sender
,
recipient
=
recipient
,
recipient
=
recipient
,
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
View file @
a4158284
...
@@ -34,8 +34,20 @@ class TestSlapOSSubscriptionChineseScenario(TestSlapOSSubscriptionScenarioMixin)
...
@@ -34,8 +34,20 @@ class TestSlapOSSubscriptionChineseScenario(TestSlapOSSubscriptionScenarioMixin)
self
.
expected_reservation_quantity_tax
=
0
self
.
expected_reservation_quantity_tax
=
0
self
.
expected_reservation_tax
=
0
self
.
expected_reservation_tax
=
0
self
.
expected_price_currency
=
"currency_module/CNY"
self
.
expected_price_currency
=
"currency_module/CNY"
self
.
normal_user
=
None
self
.
expected_notification_language
=
"zh"
self
.
login
()
self
.
createNotificationMessage
(
"subscription_request-confirmation-with-password"
,
language
=
"zh"
,
text_content
=
'CHINESE! ${name} ${login_name} ${login_password}'
)
self
.
createNotificationMessage
(
"subscription_request-confirmation-without-password"
,
language
=
"zh"
,
text_content
=
'CHINESE! ${name} ${login_name}'
)
self
.
createNotificationMessage
(
"subscription_request-instance-is-ready"
,
language
=
"zh"
,
text_content
=
'CHINESE! ${name} ${subscription_title} ${hosting_subscription_relative_url}'
)
self
.
createNotificationMessage
(
"subscription_request-payment-is-ready"
,
language
=
"zh"
,
text_content
=
'CHINESE! ${name} ${subscription_title} ${payment_relative_relative_url}'
)
def
_simulatePaymentTransaction_getVADSUrlDict
(
self
):
def
_simulatePaymentTransaction_getVADSUrlDict
(
self
):
script_name
=
'PaymentTransaction_getVADSUrlDict'
script_name
=
'PaymentTransaction_getVADSUrlDict'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -69,6 +81,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -69,6 +81,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
_simulatePaymentTransaction_getVADSUrlDict
()
self
.
_simulatePaymentTransaction_getVADSUrlDict
()
try
:
try
:
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
logout
()
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
finally
:
finally
:
self
.
_dropPaymentTransaction_getVADSUrlDict
()
self
.
_dropPaymentTransaction_getVADSUrlDict
()
...
@@ -170,3 +183,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -170,3 +183,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
def
test_two_subscription_scenario
(
self
):
def
test_two_subscription_scenario
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
self
.
_test_two_subscription_scenario
(
amount
=
1
)
def
test_subscription_scenario_with_existing_user
(
self
):
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
def
test_subscription_scenario_with_existing_english_user
(
self
):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.xml
View file @
a4158284
...
@@ -100,25 +100,28 @@
...
@@ -100,25 +100,28 @@
</record>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<tuple>
<dictionary>
<none/>
<item>
<list>
<key>
<string>
_log
</string>
</key>
<dictionary>
<value>
<item>
<list>
<key>
<string>
action
</string>
</key>
<dictionary>
<value>
<string>
validate
</string>
</value>
<item>
</item>
<key>
<string>
action
</string>
</key>
<item>
<value>
<string>
validate
</string>
</value>
<key>
<string>
validation_state
</string>
</key>
</item>
<value>
<string>
validated
</string>
</value>
<item>
</item>
<key>
<string>
validation_state
</string>
</key>
</dictionary>
<value>
<string>
validated
</string>
</value>
</list>
</item>
<none/>
</dictionary>
</tuple>
</list>
</value>
</item>
</dictionary>
</pickle>
</pickle>
</record>
</record>
</ZopeData>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
a4158284
...
@@ -26,6 +26,7 @@ from DateTime import DateTime
...
@@ -26,6 +26,7 @@ from DateTime import DateTime
class
TestSlapOSSubscriptionScenarioMixin
(
DefaultScenarioMixin
):
class
TestSlapOSSubscriptionScenarioMixin
(
DefaultScenarioMixin
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
normal_user
=
None
self
.
expected_individual_price_without_tax
=
162.50
self
.
expected_individual_price_without_tax
=
162.50
self
.
expected_individual_price_with_tax
=
195.00
self
.
expected_individual_price_with_tax
=
195.00
self
.
expected_reservation_fee
=
25.00
self
.
expected_reservation_fee
=
25.00
...
@@ -33,6 +34,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -33,6 +34,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
expected_reservation_quantity_tax
=
20.833333333333333
self
.
expected_reservation_quantity_tax
=
20.833333333333333
self
.
expected_reservation_tax
=
4.166666666666667
self
.
expected_reservation_tax
=
4.166666666666667
self
.
expected_price_currency
=
"currency_module/EUR"
self
.
expected_price_currency
=
"currency_module/EUR"
self
.
expected_notification_language
=
"en"
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
)
...
@@ -52,7 +54,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -52,7 +54,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
# One user to create computers to deploy the subscription
# One user to create computers to deploy the subscription
self
.
createAdminUser
()
self
.
createAdminUser
()
self
.
cleanUpNotificationMessage
()
self
.
tic
()
self
.
createNotificationMessage
(
"subscription_request-confirmation-with-password"
)
self
.
createNotificationMessage
(
"subscription_request-confirmation-with-password"
)
self
.
createNotificationMessage
(
"subscription_request-confirmation-without-password"
,
self
.
createNotificationMessage
(
"subscription_request-confirmation-without-password"
,
text_content
=
'${name} ${login_name}'
)
text_content
=
'${name} ${login_name}'
)
...
@@ -74,7 +78,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -74,7 +78,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def
cleanUpSubscriptionRequest
(
self
):
def
cleanUpSubscriptionRequest
(
self
):
for
subscription_request
in
self
.
portal
.
portal_catalog
(
for
subscription_request
in
self
.
portal
.
portal_catalog
(
portal_type
=
"Subscription Request"
,
portal_type
=
"Subscription Request"
,
simulation_state
=
[
"draft"
,
"planned"
,
"ordered"
],
simulation_state
=
[
"draft"
,
"planned"
,
"ordered"
,
"confirmed"
],
title
=
"Test Subscription Request %"
):
title
=
"Test Subscription Request %"
):
if
subscription_request
.
getSimulationState
()
==
"draft"
:
if
subscription_request
.
getSimulationState
()
==
"draft"
:
subscription_request
.
cancel
()
subscription_request
.
cancel
()
...
@@ -82,19 +86,31 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -82,19 +86,31 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
subscription_request
.
order
()
subscription_request
.
order
()
if
subscription_request
.
getSimulationState
()
==
"ordered"
:
if
subscription_request
.
getSimulationState
()
==
"ordered"
:
subscription_request
.
confirm
()
subscription_request
.
confirm
()
if
subscription_request
.
getSimulationState
()
==
"confirmed"
:
subscription_request
.
start
()
if
subscription_request
.
getSimulationState
()
==
"started"
:
subscription_request
.
stop
()
def
cleanUpNotificationMessage
(
self
):
for
notification_message
in
self
.
portal
.
portal_catalog
(
portal_type
=
"Notification Message"
,
validation_state
=
[
"validated"
],
title
=
"TestSubscriptionSkins %"
):
if
str
(
notification_message
.
getVersion
(
""
))
==
"999"
:
notification_message
.
invalidate
()
def
createNotificationMessage
(
self
,
reference
,
def
createNotificationMessage
(
self
,
reference
,
content_type
=
'text/html'
,
text_content
=
'${name} ${login_name} ${login_password}'
):
content_type
=
'text/html'
,
language
=
"en"
,
text_content
=
'${name} ${login_name} ${login_password}'
):
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
portal_type
=
"Notification Message"
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
title
=
'TestSubscriptionSkins Notification Message %s
'
%
reference
,
title
=
'TestSubscriptionSkins Notification Message %s
%s'
%
(
language
,
reference
)
,
text_content
=
text_content
,
text_content
=
text_content
,
content_type
=
content_type
,
content_type
=
content_type
,
reference
=
reference
,
reference
=
reference
,
version
=
999
,
version
=
999
,
language
=
"en"
language
=
language
)
)
notification_message
.
validate
()
notification_message
.
validate
()
return
notification_message
return
notification_message
...
@@ -129,6 +145,37 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -129,6 +145,37 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
else
:
else
:
self
.
admin_user
=
admin_user_login
.
getParentValue
()
self
.
admin_user
=
admin_user_login
.
getParentValue
()
def
createNormalUser
(
self
,
email
,
name
,
language
):
""" Create a Normal user """
normal_user_login
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
email
,
validation_state
=
"validated"
)
if
normal_user_login
is
None
:
normal_user
=
self
.
portal
.
person_module
.
template_member
.
\
Base_createCloneDocument
(
batch_mode
=
1
)
normal_user
.
newContent
(
portal_type
=
"ERP5 Login"
,
reference
=
email
).
validate
()
normal_user
.
edit
(
first_name
=
name
,
reference
=
email
,
default_email_text
=
email
,
)
for
assignment
in
normal_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
normal_user
.
validate
()
self
.
normal_user
=
normal_user
else
:
self
.
normal_user
=
normal_user_login
.
getParentValue
()
self
.
normal_user
.
setLanguage
(
language
)
def
createSubscriptionCondition
(
self
,
slave
=
False
):
def
createSubscriptionCondition
(
self
,
slave
=
False
):
self
.
subscription_condition
=
self
.
portal
.
subscription_condition_module
.
newContent
(
self
.
subscription_condition
=
self
.
portal
.
subscription_condition_module
.
newContent
(
portal_type
=
"Subscription Condition"
,
portal_type
=
"Subscription Condition"
,
...
@@ -349,13 +396,21 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -349,13 +396,21 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def
checkEmailNotification
(
self
,
subscription_request
,
def
checkEmailNotification
(
self
,
subscription_request
,
notification_message
=
"subscription_request-confirmation-with-password"
):
notification_message
=
"subscription_request-confirmation-with-password"
):
expected_amount
=
1
if
self
.
normal_user
is
not
None
:
# If user already exists we do not expect to send an email
expected_amount
=
0
mail_message_list
=
[
i
for
i
in
subscription_request
.
getFollowUpRelatedValueList
(
mail_message_list
=
[
i
for
i
in
subscription_request
.
getFollowUpRelatedValueList
(
portal_type
=
"Mail Message"
)
if
notification_message
in
i
.
getTitle
()]
portal_type
=
"Mail Message"
)
if
notification_message
in
i
.
getTitle
()]
self
.
assertEqual
(
len
(
mail_message_list
),
1
)
self
.
assertEqual
(
len
(
mail_message_list
),
expected_amount
)
if
not
expected_amount
:
return
mail_message
=
mail_message_list
[
0
]
mail_message
=
mail_message_list
[
0
]
self
.
assertEqual
(
self
.
assertEqual
(
"TestSubscriptionSkins Notification Message %s
"
%
notification_message
,
"TestSubscriptionSkins Notification Message %s
%s"
%
(
self
.
expected_notification_language
,
notification_message
)
,
mail_message
.
getTitle
())
mail_message
.
getTitle
())
self
.
assertTrue
(
subscription_request
.
getDefaultEmailText
()
in
\
self
.
assertTrue
(
subscription_request
.
getDefaultEmailText
()
in
\
mail_message
.
getTextContent
())
mail_message
.
getTextContent
())
...
@@ -370,7 +425,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -370,7 +425,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
len
(
mail_message_list
),
1
)
self
.
assertEqual
(
len
(
mail_message_list
),
1
)
mail_message
=
mail_message_list
[
0
]
mail_message
=
mail_message_list
[
0
]
self
.
assertEqual
(
self
.
assertEqual
(
"TestSubscriptionSkins Notification Message %s
"
%
notification_message
,
"TestSubscriptionSkins Notification Message %s
%s"
%
(
self
.
expected_notification_language
,
notification_message
)
,
mail_message
.
getTitle
())
mail_message
.
getTitle
())
payment
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
payment
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
self
.
assertEqual
(
payment
.
getSimulationState
(),
'started'
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
'started'
)
...
@@ -388,7 +443,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -388,7 +443,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
len
(
mail_message_list
),
1
)
self
.
assertEqual
(
len
(
mail_message_list
),
1
)
mail_message
=
mail_message_list
[
0
]
mail_message
=
mail_message_list
[
0
]
self
.
assertEqual
(
self
.
assertEqual
(
"TestSubscriptionSkins Notification Message %s
"
%
notification_message
,
"TestSubscriptionSkins Notification Message %s
%s"
%
(
self
.
expected_notification_language
,
notification_message
)
,
mail_message
.
getTitle
())
mail_message
.
getTitle
())
hosting_subscription
=
subscription_request
.
getAggregateValue
()
hosting_subscription
=
subscription_request
.
getAggregateValue
()
self
.
assertEqual
(
hosting_subscription
.
getSlapState
(),
'start_requested'
)
self
.
assertEqual
(
hosting_subscription
.
getSlapState
(),
'start_requested'
)
...
@@ -514,6 +569,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -514,6 +569,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
amount
=
amount
,
amount
=
amount
,
name
=
name
,
name
=
name
,
default_email_text
=
default_email_text
,
default_email_text
=
default_email_text
,
confirmation_required
=
False
,
REQUEST
=
self
.
portal
.
REQUEST
)
REQUEST
=
self
.
portal
.
REQUEST
)
self
.
login
()
self
.
login
()
...
@@ -825,7 +881,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -825,7 +881,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
default_email_text
,
self
.
subscription_condition
)
default_email_text
,
self
.
subscription_condition
)
def
_test_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"""
...
@@ -841,8 +896,32 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -841,8 +896,32 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkSubscriptionDeploymentAndSimulation
(
self
.
checkSubscriptionDeploymentAndSimulation
(
default_email_text
,
subscription_server
)
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"""
# Call as anonymous... check response?
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"ABC %s"
%
self
.
new_id
self
.
login
()
self
.
createNormalUser
(
default_email_text
,
name
,
language
)
self
.
tic
()
subscription_server
=
self
.
createPublicServerForAdminUser
()
self
.
requestAndCheckHostingSubscription
(
amount
,
name
,
default_email_text
)
self
.
checkSubscriptionDeploymentAndSimulation
(
default_email_text
,
subscription_server
)
subscription_request
=
self
.
getSubscriptionRequest
(
default_email_text
,
self
.
subscription_condition
)
self
.
assertEqual
(
self
.
normal_user
,
subscription_request
.
getDestinationSectionValue
())
def
_test_two_subscription_scenario
(
self
,
amount
=
1
):
def
_test_two_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"""
...
@@ -954,7 +1033,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -954,7 +1033,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
default_email_text
,
subscription_server
)
default_email_text
,
subscription_server
)
class
TestSlapOSSubscriptionScenario
(
TestSlapOSSubscriptionScenarioMixin
):
class
TestSlapOSSubscriptionScenario
(
TestSlapOSSubscriptionScenarioMixin
):
def
test_subscription_scenario_with_single_vm
(
self
):
def
test_subscription_scenario_with_single_vm
(
self
):
...
@@ -967,4 +1045,12 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
...
@@ -967,4 +1045,12 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
self
.
_test_subscription_scenario
(
amount
=
3
)
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_two_subscription_scenario
(
self
):
def
test_two_subscription_scenario
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
self
.
_test_two_subscription_scenario
(
amount
=
1
)
\ No newline at end of file
def
test_subscription_scenario_with_existing_user
(
self
):
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
def
test_subscription_scenario_with_existing_chinese_user
(
self
):
# Messages are in english, when subscribed via english website. Even if the chinese language is
# defined at user level.
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
View file @
a4158284
...
@@ -100,25 +100,28 @@
...
@@ -100,25 +100,28 @@
</record>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<tuple>
<dictionary>
<none/>
<item>
<list>
<key>
<string>
_log
</string>
</key>
<dictionary>
<value>
<item>
<list>
<key>
<string>
action
</string>
</key>
<dictionary>
<value>
<string>
validate
</string>
</value>
<item>
</item>
<key>
<string>
action
</string>
</key>
<item>
<value>
<string>
validate
</string>
</value>
<key>
<string>
validation_state
</string>
</key>
</item>
<value>
<string>
validated
</string>
</value>
<item>
</item>
<key>
<string>
validation_state
</string>
</key>
</dictionary>
<value>
<string>
validated
</string>
</value>
</list>
</item>
<none/>
</dictionary>
</tuple>
</list>
</value>
</item>
</dictionary>
</pickle>
</pickle>
</record>
</record>
</ZopeData>
</ZopeData>
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