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
Labels
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
a296ad59
Commit
a296ad59
authored
Aug 28, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: WIP tests for subscription with Invitation Token
parent
258aa0f7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
496 additions
and
7 deletions
+496
-7
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
...onents/test.erp5.testSlapOSSubscriptionChineseScenario.py
+3
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario.py
...5.testSlapOSSubscriptionInvitationTokenChineseScenario.py
+92
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario.xml
....testSlapOSSubscriptionInvitationTokenChineseScenario.xml
+127
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenScenario.py
...est.erp5.testSlapOSSubscriptionInvitationTokenScenario.py
+92
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenScenario.xml
...st.erp5.testSlapOSSubscriptionInvitationTokenScenario.xml
+127
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+52
-6
master/bt5/slapos_subscription_request/bt/template_test_id_list
.../bt5/slapos_subscription_request/bt/template_test_id_list
+3
-1
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionChineseScenario.py
View file @
a296ad59
...
@@ -73,6 +73,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -73,6 +73,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
_requestSubscription
(
self
,
**
kw
):
def
_requestSubscription
(
self
,
**
kw
):
if
self
.
cloud_invitation_token
is
not
None
:
kw
[
"token"
]
=
self
.
cloud_invitation_token
.
getId
()
if
'target_language'
not
in
kw
:
if
'target_language'
not
in
kw
:
kw
[
"target_language"
]
=
"zh"
kw
[
"target_language"
]
=
"zh"
kw
[
"subscription_reference"
]
=
self
.
subscription_condition
.
getReference
().
replace
(
"_zh"
,
""
)
kw
[
"subscription_reference"
]
=
self
.
subscription_condition
.
getReference
().
replace
(
"_zh"
,
""
)
...
@@ -82,6 +84,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -82,6 +84,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
try
:
try
:
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
logout
()
self
.
logout
()
self
.
changeSkin
(
'Hal'
)
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
finally
:
finally
:
self
.
_dropPaymentTransaction_getVADSUrlDict
()
self
.
_dropPaymentTransaction_getVADSUrlDict
()
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario.py
0 → 100644
View file @
a296ad59
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.testSlapOSSubscriptionChineseScenario
import
TestSlapOSSubscriptionChineseScenarioMixin
class
testSlapOSSubscriptionCloudInvitationTokenScenario
(
TestSlapOSSubscriptionChineseScenarioMixin
):
def
test_subscription_scenario_with_single_vm_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_with_3_vms_scenario_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_subscription_scenario_with_reversal_transaction_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_reversal_transaction
(
amount
=
1
)
def
test_two_subscription_scenario_and_empty_invitation
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
def
test_subscription_scenario_with_existing_user_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
def
test_subscription_scenario_with_existing_english_user_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
def
_init_test_with_valid_invitation
(
self
):
self
.
expected_reservation_fee
=
0.0
self
.
expected_reservation_quantity_tax
=
0.0
self
.
expected_reservation_tax
=
0.0
self
.
expected_free_reservation
=
1
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
(
max_invoice_delay
=
99
,
max_invoice_credit_eur
=
900
,
max_invoice_credit_cny
=
900
)
def
test_subscription_scenario_with_single_vm_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_with_3_vms_scenario_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_subscription_scenario_with_reversal_transaction_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_reversal_transaction
(
amount
=
1
)
def
test_two_subscription_scenario_with_invitation
(
self
):
self
.
expected_reservation_fee
=
0.0
self
.
expected_reservation_quantity_tax
=
0.0
self
.
expected_reservation_tax
=
0.0
self
.
expected_free_reservation
=
1
self
.
_test_two_subscription_scenario
(
amount
=
1
,
create_invitation
=
True
,
max_invoice_delay
=
99
,
max_invoice_credit_eur
=
900
,
max_invoice_credit_cny
=
900
)
def
test_subscription_scenario_with_existing_user_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
def
test_subscription_scenario_with_existing_english_user_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario.xml
0 → 100644
View file @
a296ad59
<?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>
testSlapOSSubscriptionInvitationTokenChineseScenario
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario
</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.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<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>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenScenario.py
0 → 100644
View file @
a296ad59
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.testSlapOSSubscriptionScenario
import
TestSlapOSSubscriptionScenarioMixin
class
testSlapOSSubscriptionCloudInvitationTokenScenario
(
TestSlapOSSubscriptionScenarioMixin
):
def
test_subscription_scenario_with_single_vm_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_with_3_vms_scenario_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_subscription_scenario_with_reversal_transaction_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_reversal_transaction
(
amount
=
1
)
def
test_two_subscription_scenario_and_empty_invitation
(
self
):
self
.
_test_two_subscription_scenario
(
amount
=
1
)
def
test_subscription_scenario_with_existing_user_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
def
test_subscription_scenario_with_existing_english_user_and_empty_invitation
(
self
):
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
def
_init_test_with_valid_invitation
(
self
):
self
.
expected_reservation_fee
=
0.0
self
.
expected_reservation_quantity_tax
=
0.0
self
.
expected_reservation_tax
=
0.0
self
.
expected_free_reservation
=
1
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
(
max_invoice_delay
=
99
,
max_invoice_credit_eur
=
900
,
max_invoice_credit_cny
=
900
)
def
test_subscription_scenario_with_single_vm_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_with_3_vms_scenario_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario
(
amount
=
3
)
def
test_subscription_scenario_with_reversal_transaction_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_reversal_transaction
(
amount
=
1
)
def
test_two_subscription_scenario_with_invitation
(
self
):
self
.
expected_reservation_fee
=
0.0
self
.
expected_reservation_quantity_tax
=
0.0
self
.
expected_reservation_tax
=
0.0
self
.
expected_free_reservation
=
1
self
.
_test_two_subscription_scenario
(
amount
=
1
,
create_invitation
=
True
,
max_invoice_delay
=
99
,
max_invoice_credit_eur
=
900
,
max_invoice_credit_cny
=
900
)
def
test_subscription_scenario_with_existing_user_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"zh"
)
def
test_subscription_scenario_with_existing_english_user_with_invitation
(
self
):
self
.
_init_test_with_valid_invitation
()
self
.
_test_subscription_scenario_with_existing_user
(
amount
=
1
,
language
=
"en"
)
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionInvitationTokenScenario.xml
0 → 100644
View file @
a296ad59
<?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>
testSlapOSSubscriptionInvitationTokenScenario
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSSubscriptionInvitationTokenScenario
</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.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<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>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
a296ad59
...
@@ -37,12 +37,15 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -37,12 +37,15 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
expected_notification_language
=
"en"
self
.
expected_notification_language
=
"en"
self
.
expected_source
=
"organisation_module/slapos"
self
.
expected_source
=
"organisation_module/slapos"
self
.
expected_source_section
=
"organisation_module/slapos"
self
.
expected_source_section
=
"organisation_module/slapos"
self
.
cloud_invitation_token
=
None
self
.
expected_free_reservation
=
0
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
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_planned
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_planned
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_confirmed
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_confirmed
.
setEnabled
(
True
)
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_started
.
setEnabled
(
True
)
DefaultScenarioMixin
.
afterSetUp
(
self
)
DefaultScenarioMixin
.
afterSetUp
(
self
)
...
@@ -385,7 +388,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -385,7 +388,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
invoice
.
getPriceCurrency
(),
self
.
expected_price_currency
)
self
.
assertEqual
(
invoice
.
getPriceCurrency
(),
self
.
expected_price_currency
)
for
line
in
invoice
.
objectValues
():
for
line
in
invoice
.
objectValues
():
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
if
self
.
expected_free_reservation
:
self
.
assertEqual
(
line
.
getQuantity
(),
0
)
else
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
self
.
expected_reservation_fee_without_tax
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
self
.
expected_reservation_fee_without_tax
)
if
line
.
getResource
()
==
"service_module/slapos_tax"
:
if
line
.
getResource
()
==
"service_module/slapos_tax"
:
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
2
),
round
(
self
.
expected_reservation_quantity_tax
*
quantity
,
2
))
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
2
),
round
(
self
.
expected_reservation_quantity_tax
*
quantity
,
2
))
...
@@ -520,8 +526,33 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -520,8 +526,33 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
sale_packing_list
.
getPriceCurrency
(),
self
.
assertEqual
(
sale_packing_list
.
getPriceCurrency
(),
self
.
expected_price_currency
)
self
.
expected_price_currency
)
def
makeCloudInvitationToken
(
self
,
max_invoice_delay
=
0
,
max_invoice_credit_eur
=
0.0
,
max_invoice_credit_cny
=
0.0
):
self
.
login
()
contract_invitation_token
=
self
.
portal
.
invitation_token_module
.
newContent
(
portal_type
=
"Contract Invitation Token"
,
maximum_invoice_delay
=
max_invoice_delay
)
if
max_invoice_credit_eur
>
0
:
contract_invitation_token
.
newContent
(
maximum_invoice_credit
=
max_invoice_credit_eur
,
price_currency
=
"currency_module/EUR"
)
if
max_invoice_credit_cny
>
0
:
contract_invitation_token
.
newContent
(
maximum_invoice_credit
=
max_invoice_credit_cny
,
price_currency
=
"currency_module/CNY"
)
contract_invitation_token
.
validate
()
self
.
logout
()
return
contract_invitation_token
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
_requestSubscription
(
self
,
**
kw
):
def
_requestSubscription
(
self
,
**
kw
):
if
self
.
cloud_invitation_token
is
not
None
:
kw
[
"token"
]
=
self
.
cloud_invitation_token
.
getId
()
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
def
getAggregatedSalePackingList
(
self
,
subscription_request
,
specialise
):
def
getAggregatedSalePackingList
(
self
,
subscription_request
,
specialise
):
...
@@ -852,8 +883,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -852,8 +883,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
checkSubscriptionDeploymentAndSimulation
(
self
,
default_email_text
,
subscription_server
):
def
checkSubscriptionDeploymentAndSimulation
(
self
,
default_email_text
,
subscription_server
):
subscription_request_list
=
self
.
getSubscriptionRequestList
(
subscription_request_list
=
self
.
getSubscriptionRequestList
(
default_email_text
,
self
.
subscription_condition
)
default_email_text
,
self
.
subscription_condition
)
...
@@ -934,7 +963,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -934,7 +963,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
subscription_request
.
getDestinationSectionValue
())
subscription_request
.
getDestinationSectionValue
())
def
_test_two_subscription_scenario
(
self
,
amount
=
1
):
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
):
""" The admin creates an computer, user can request instances on it"""
""" The admin creates an computer, user can request instances on it"""
subscription_server
=
self
.
createPublicServerForAdminUser
()
subscription_server
=
self
.
createPublicServerForAdminUser
()
...
@@ -942,6 +972,13 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -942,6 +972,13 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
# 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
if
create_invitation
:
self
.
login
()
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
(
max_invoice_delay
=
max_invoice_delay
,
max_invoice_credit_eur
=
max_invoice_credit_eur
,
max_invoice_credit_cny
=
max_invoice_credit_cny
)
self
.
logout
()
self
.
logout
()
self
.
_requestSubscription
(
self
.
_requestSubscription
(
...
@@ -981,8 +1018,17 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -981,8 +1018,17 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
checkOrderedSubscriptionRequest
(
first_subscription_request
,
self
.
checkOrderedSubscriptionRequest
(
first_subscription_request
,
default_email_text
,
self
.
subscription_condition
)
default_email_text
,
self
.
subscription_condition
)
if
create_invitation
:
self
.
login
()
self
.
cloud_invitation_token
=
self
.
makeCloudInvitationToken
(
max_invoice_delay
=
max_invoice_delay
,
max_invoice_credit_eur
=
max_invoice_credit_eur
,
max_invoice_credit_cny
=
max_invoice_credit_cny
)
self
.
logout
()
self
.
logout
()
# Request a second one, without require confirmation and verifing the second subscription request
# 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
,
...
...
master/bt5/slapos_subscription_request/bt/template_test_id_list
View file @
a296ad59
...
@@ -6,4 +6,6 @@ test.erp5.testSlapOSSubscriptionSkins
...
@@ -6,4 +6,6 @@ test.erp5.testSlapOSSubscriptionSkins
test.erp5.testSlapOSSubscriptionScenario
test.erp5.testSlapOSSubscriptionScenario
test.erp5.testSlapOSSubscriptionChineseScenario
test.erp5.testSlapOSSubscriptionChineseScenario
test.erp5.testSlapOSSubscriptionNewTemplateScenario
test.erp5.testSlapOSSubscriptionNewTemplateScenario
test.erp5.testSlapOSSubscriptionNewTemplateChineseScenario
test.erp5.testSlapOSSubscriptionNewTemplateChineseScenario
\ No newline at end of file
test.erp5.testSlapOSSubscriptionInvitationTokenScenario
test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario
\ 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