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
Thomas Gambier
slapos.core
Commits
9bed111f
Commit
9bed111f
authored
May 19, 2020
by
Rafael Monnerat
Committed by
Thomas Gambier
Jun 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Adjust tests for comply with the current changes
parent
88947404
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
1 deletion
+69
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyPaymentBalanceIsReady.py
...equest/SubscriptionRequest_verifyPaymentBalanceIsReady.py
+2
-0
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+67
-1
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyPaymentBalanceIsReady.py
View file @
9bed111f
...
@@ -4,6 +4,8 @@ portal = context.getPortalObject()
...
@@ -4,6 +4,8 @@ portal = context.getPortalObject()
reservation_fee_invoice
=
context
.
getCausalityValue
(
reservation_fee_invoice
=
context
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
portal_type
=
"Sale Invoice Transaction"
)
)
if
reservation_fee_invoice
is
None
:
return
reservation_fee_total_price
=
reservation_fee_invoice
.
getTotalPrice
()
reservation_fee_total_price
=
reservation_fee_invoice
.
getTotalPrice
()
subscription_request_total_price
=
context
.
getPrice
()
*
context
.
getQuantity
()
subscription_request_total_price
=
context
.
getPrice
()
*
context
.
getQuantity
()
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
9bed111f
...
@@ -26,6 +26,22 @@ from DateTime import DateTime
...
@@ -26,6 +26,22 @@ from DateTime import DateTime
class
TestSubscriptionSkinsMixin
(
SlapOSTestCaseMixinWithAbort
):
class
TestSubscriptionSkinsMixin
(
SlapOSTestCaseMixinWithAbort
):
def
createNotificationMessage
(
self
,
reference
,
content_type
=
'text/html'
,
text_content
=
'${name} ${login_name} ${login_password}'
):
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
title
=
'TestSubscriptionSkins Notification Message %s'
%
reference
,
text_content
=
text_content
,
content_type
=
content_type
,
reference
=
reference
,
version
=
999
,
language
=
"en"
)
notification_message
.
validate
()
return
notification_message
def
newSubscriptionCondition
(
self
,
**
kw
):
def
newSubscriptionCondition
(
self
,
**
kw
):
subscription_condition
=
self
.
portal
.
subscription_condition_module
.
newContent
(
subscription_condition
=
self
.
portal
.
subscription_condition_module
.
newContent
(
portal_type
=
'Subscription Condition'
,
portal_type
=
'Subscription Condition'
,
...
@@ -1064,6 +1080,7 @@ class TestSubscriptionRequest_verifyReservationPaymentTransaction(TestSubscripti
...
@@ -1064,6 +1080,7 @@ class TestSubscriptionRequest_verifyReservationPaymentTransaction(TestSubscripti
class
TestSubscriptionRequest_processOrdered
(
TestSubscriptionSkinsMixin
):
class
TestSubscriptionRequest_processOrdered
(
TestSubscriptionSkinsMixin
):
def
test_no_sale_invoice
(
self
):
def
test_no_sale_invoice
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
subscription_request
=
self
.
newSubscriptionRequest
(
...
@@ -1093,6 +1110,17 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
...
@@ -1093,6 +1110,17 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
instance
=
hosting_subscription
.
getPredecessorValue
()
instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
assertNotEqual
(
instance
,
None
)
self
.
assertNotEqual
(
instance
,
None
)
self
.
assertEqual
(
'diverged'
,
hosting_subscription
.
getCausalityState
())
instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
assertNotEqual
(
instance
,
None
)
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
self
.
tic
()
self
.
assertEqual
(
'solved'
,
hosting_subscription
.
getCausalityState
())
contract
=
self
.
portal
.
portal_catalog
.
getResultValue
(
contract
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
[
"Cloud Contract"
],
portal_type
=
[
"Cloud Contract"
],
default_destination_section_uid
=
person
.
getUid
(),
default_destination_section_uid
=
person
.
getUid
(),
...
@@ -1116,6 +1144,9 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
...
@@ -1116,6 +1144,9 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
"draft"
"draft"
)
)
@
simulate
(
'SubscriptionRequest_verifyPaymentBalanceIsReady'
,
'*args, **kwrgs'
,
'return None'
)
@
simulate
(
'HostingSubscription_requestUpdateOpenSaleOrder'
,
'*args, **kwargs'
,
'context.converge()'
)
@
simulate
(
'SubscriptionRequest_verifyInstanceIsAllocated'
,
'*args, **kwargs'
,
'return True'
)
def
test_with_reservation_fee
(
self
):
def
test_with_reservation_fee
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
subscription_request
=
self
.
newSubscriptionRequest
(
...
@@ -1148,10 +1179,17 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
...
@@ -1148,10 +1179,17 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
hosting_subscription
=
subscription_request
.
getAggregateValue
(
portal_type
=
"Hosting Subscription"
)
hosting_subscription
=
subscription_request
.
getAggregateValue
(
portal_type
=
"Hosting Subscription"
)
self
.
assertNotEqual
(
hosting_subscription
,
None
)
self
.
assertNotEqual
(
hosting_subscription
,
None
)
self
.
assertEqual
(
'diverged'
,
hosting_subscription
.
getCausalityState
())
instance
=
hosting_subscription
.
getPredecessorValue
()
instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
assertNotEqual
(
instance
,
None
)
self
.
assertNotEqual
(
instance
,
None
)
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
self
.
tic
()
self
.
assertEqual
(
'solved'
,
hosting_subscription
.
getCausalityState
())
contract
=
self
.
portal
.
portal_catalog
.
getResultValue
(
contract
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
[
"Cloud Contract"
],
portal_type
=
[
"Cloud Contract"
],
default_destination_section_uid
=
person
.
getUid
(),
default_destination_section_uid
=
person
.
getUid
(),
...
@@ -1175,7 +1213,9 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
...
@@ -1175,7 +1213,9 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
"draft"
"draft"
)
)
@
simulate
(
'SubscriptionRequest_testPaymentBalance'
,
'*args, **kwargs'
,
'return True'
)
@
simulate
(
'SubscriptionRequest_verifyPaymentBalanceIsReady'
,
'*args, **kwrgs'
,
'return context.fake_payment'
)
@
simulate
(
'HostingSubscription_requestUpdateOpenSaleOrder'
,
'*args, **kwargs'
,
'context.converge()'
)
@
simulate
(
'SubscriptionRequest_verifyInstanceIsAllocated'
,
'*args, **kwargs'
,
'return True'
)
def
test_confirmed
(
self
):
def
test_confirmed
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
subscription_request
=
self
.
newSubscriptionRequest
(
...
@@ -1196,12 +1236,38 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
...
@@ -1196,12 +1236,38 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
subscription_request
.
plan
()
subscription_request
.
plan
()
subscription_request
.
order
()
subscription_request
.
order
()
self
.
createNotificationMessage
(
"subscription_request-payment-is-ready"
,
text_content
=
'${name} ${subscription_title} ${payment_relative_relative_url}'
)
fake_invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
fake_payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
causality
=
fake_invoice
.
getRelativeUrl
())
# Set this to the mock script can return it
setattr
(
subscription_request
,
'fake_payment'
,
fake_payment
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
self
.
tic
()
self
.
tic
()
hosting_subscription
=
subscription_request
.
getAggregateValue
()
self
.
assertNotEqual
(
None
,
hosting_subscription
)
self
.
assertEqual
(
'diverged'
,
hosting_subscription
.
getCausalityState
())
self
.
assertEqual
(
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
'solved'
,
hosting_subscription
.
getCausalityState
())
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processOrdered
(),
None
)
self
.
tic
()
self
.
assertEqual
(
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
subscription_request
.
getSimulationState
(),
"confirmed"
"confirmed"
...
...
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