Commit 42b1a116 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5&cloud: (test) Use same action the end-user will call

parent 82bda8f4
...@@ -673,20 +673,25 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin): ...@@ -673,20 +673,25 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self.tic() self.tic()
amount = sum([i.total_price for i in person.Entity_getOutstandingDepositAmountList( outstanding_amount_list = person.Entity_getOutstandingDepositAmountList(
currency.getUid(), ledger_uid=subscription_request.getLedgerUid())]) currency.getUid(), ledger_uid=subscription_request.getLedgerUid())
self.assertEqual(amount, deposit_amount)
self.assertEqual(sum([i.total_price for i in outstanding_amount_list]), deposit_amount)
# Action to submit project subscription
def wrapWithShadow(_person, *arg): self.login(person.getUserId())
return _person.Entity_addDepositPayment(*arg) # Ensure to pay from the website
payment_transaction = person.Person_restrictMethodAsShadowUser( outstanding_amount = self.web_site.restrictedTraverse(outstanding_amount_list[0].getRelativeUrl())
shadow_document=person, outstanding_amount.Base_createExternalPaymentTransactionFromOutstandingAmountAndRedirect()
callable_object=wrapWithShadow,
argument_list=[person, deposit_amount, currency.getRelativeUrl()])
self.tic() self.tic()
self.logout() self.logout()
self.login() self.login()
payment_transaction = self.portal.portal_catalog.getResultValue(
portal_type="Payment Transaction",
destination_section_uid=person.getUid(),
simulation_state="started"
)
self.assertEqual(payment_transaction.getSpecialiseValue().getTradeConditionType(), "deposit")
# payzen interface will only stop the payment # payzen interface will only stop the payment
payment_transaction.stop() payment_transaction.stop()
self.tic() self.tic()
......
...@@ -486,6 +486,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -486,6 +486,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
shadow_document=owner_person, shadow_document=owner_person,
callable_object=wrapWithShadow, callable_object=wrapWithShadow,
argument_list=[owner_person, total_price, currency.getRelativeUrl()]) argument_list=[owner_person, total_price, currency.getRelativeUrl()])
self.tic() self.tic()
self.logout() self.logout()
self.login() self.login()
...@@ -860,20 +861,23 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -860,20 +861,23 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# Pay deposit to validate virtual master + one computer # Pay deposit to validate virtual master + one computer
deposit_amount = 42.0 + 99.0 deposit_amount = 42.0 + 99.0
ledger = self.portal.portal_categories.ledger.automated ledger = self.portal.portal_categories.ledger.automated
amount = sum([i.total_price for i in project_owner_person.Entity_getOutstandingDepositAmountList( amount = sum([i.total_price for i in project_owner_person.Entity_getOutstandingDepositAmountList(
currency.getUid(), ledger_uid=ledger.getUid())]) currency.getUid(), ledger_uid=ledger.getUid())])
self.assertEqual(amount, deposit_amount) self.assertEqual(amount, deposit_amount)
def wrapWithShadow(_person, *arg): project_owner_person.Entity_createExternalPaymentTransactionFromDepositAndRedirect(
return _person.Entity_addDepositPayment(*arg) currency.getReference())
payment_transaction = project_owner_person.Person_restrictMethodAsShadowUser(
shadow_document=project_owner_person,
callable_object=wrapWithShadow,
argument_list=[project_owner_person, deposit_amount, currency.getRelativeUrl()])
self.tic() self.tic()
self.logout() self.logout()
self.login() self.login()
# payzen interface will only stop the payment payment_transaction = self.portal.portal_catalog.getResultValue(
portal_type="Payment Transaction",
destination_section_uid=project_owner_person.getUid(),
simulation_state="started"
)
self.assertEqual(payment_transaction.getSpecialiseValue().getTradeConditionType(), "deposit")
# payzen/wechat or accountant will only stop the payment
payment_transaction.stop() payment_transaction.stop()
self.tic() self.tic()
assert payment_transaction.receivable.getGroupingReference(None) is not None assert payment_transaction.receivable.getGroupingReference(None) is not None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment