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
6cca1c8d
Commit
6cca1c8d
authored
May 22, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_payzen: (Test) always create Integrator Site and setup preferences
whenever the tests need it.
parent
ca088953
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
23 deletions
+63
-23
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
...Item/portal_components/test.erp5.testSlapOSPayzenAlarm.py
+4
-4
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.py
...Item/portal_components/test.erp5.testSlapOSPayzenSkins.py
+56
-8
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
...m/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
+3
-11
No files found.
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
View file @
6cca1c8d
...
@@ -19,11 +19,11 @@
...
@@ -19,11 +19,11 @@
#
#
##############################################################################
##############################################################################
from
erp5.component.test.
SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.
testSlapOSPayzenSkins
import
TestSlapOSPayzenMixin
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestSlapOSPayzenUpdateStartedPayment
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPayzenUpdateStartedPayment
(
TestSlapOSPayzenMixin
):
def
test_not_started_payment
(
self
):
def
test_not_started_payment
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -81,7 +81,7 @@ class Foo:
...
@@ -81,7 +81,7 @@ class Foo:
def updateStatus(self):
def updateStatus(self):
context.stop()
context.stop()
return Foo()
return Foo()
"""
)
"""
)
self
.
commit
()
self
.
commit
()
def
_simulatePaymentTransaction_createNotPaidPayzenEvent
(
self
):
def
_simulatePaymentTransaction_createNotPaidPayzenEvent
(
self
):
...
@@ -168,7 +168,7 @@ return Foo()
...
@@ -168,7 +168,7 @@ return Foo()
'*args, **kwargs'
,
'*args, **kwargs'
,
'# Script body
\
n
'
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_updateStatus') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_updateStatus') """
)
self
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_updateStatus
(
self
):
def
_dropPaymentTransaction_updateStatus
(
self
):
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.py
View file @
6cca1c8d
...
@@ -25,23 +25,71 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
...
@@ -25,23 +25,71 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
class
PayzenServiceTestCase
(
SlapOSTestCaseMixin
):
class
TestSlapOSPayzenMixin
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
payzen_secure_payment
=
self
.
portal
.
portal_secure_payments
.
newContent
(
self
.
payzen_secure_payment
=
self
.
portal
.
portal_secure_payments
.
newContent
(
portal_type
=
"Payzen Service"
,
portal_type
=
"Payzen Service"
,
reference
=
"PSERV-Payzen-Test
"
reference
=
"PSERV-Payzen-Test
-%s"
%
self
.
generateNewId
()
)
)
# Include a simple Integration site
self
.
integration_site
=
self
.
portal
.
portal_integrations
.
newContent
(
title
=
"Integration site for: %s"
%
(
self
.
payzen_secure_payment
),
reference
=
"payzen"
,
portal_type
=
"Integration Site"
)
self
.
integration_site
.
newContent
(
id
=
"Causality"
,
portal_type
=
"Integration Base Category Mapping"
,
default_source_reference
=
"Causality"
,
default_destination_reference
=
"causality"
)
resource_map
=
self
.
integration_site
.
newContent
(
id
=
"Resource"
,
portal_type
=
"Integration Base Category Mapping"
,
default_source_reference
=
"Resource"
,
default_destination_reference
=
"resource"
)
resource_map
.
newContent
(
# This is required for integration
id
=
'978'
,
portal_type
=
"Integration Category Mapping"
,
default_destination_reference
=
'resource/currency_module/EUR'
,
default_source_reference
=
'978'
)
system_preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
self
.
older_service_reference
=
system_preference
.
getPreferredPayzenPaymentServiceReference
()
system_preference
.
setPreferredPayzenPaymentServiceReference
(
self
.
payzen_secure_payment
.
getReference
())
self
.
older_integration_site
=
system_preference
.
getPreferredPayzenIntegrationSite
()
system_preference
.
setPreferredPayzenIntegrationSite
(
self
.
integration_site
.
getRelativeUrl
()
)
self
.
tic
()
self
.
tic
()
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
SlapOSTestCaseMixin
.
beforeTearDown
(
self
)
SlapOSTestCaseMixin
.
beforeTearDown
(
self
)
self
.
portal
.
portal_secure_payments
.
manage_delObjects
(
self
.
portal
.
portal_secure_payments
.
manage_delObjects
(
ids
=
[
self
.
payzen_secure_payment
.
getId
()])
ids
=
[
self
.
payzen_secure_payment
.
getId
()])
self
.
portal
.
portal_integrations
.
manage_delObjects
(
ids
=
[
self
.
integration_site
.
getId
()])
system_preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
system_preference
.
setPreferredPayzenPaymentServiceReference
(
self
.
older_service_reference
)
system_preference
.
setPreferredPayzenIntegrationSite
(
self
.
older_integration_site
)
self
.
tic
()
self
.
tic
()
class
TestSlapOSCurrency_getIntegrationMapping
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSCurrency_getIntegrationMapping
(
TestSlapOSPayzenMixin
):
def
test_integratedCurrency
(
self
):
def
test_integratedCurrency
(
self
):
currency
=
self
.
portal
.
currency_module
.
EUR
currency
=
self
.
portal
.
currency_module
.
EUR
...
@@ -76,7 +124,7 @@ class TestSlapOSAccountingTransaction_updateStartDate(SlapOSTestCaseMixinWithAbo
...
@@ -76,7 +124,7 @@ class TestSlapOSAccountingTransaction_updateStartDate(SlapOSTestCaseMixinWithAbo
date
,
REQUEST
=
{})
date
,
REQUEST
=
{})
class
TestSlapOSPaymentTransaction_getPayzenId
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPaymentTransaction_getPayzenId
(
TestSlapOSPayzenMixin
):
def
test_getPayzenId_newPaymentTransaction
(
self
):
def
test_getPayzenId_newPaymentTransaction
(
self
):
payment_transaction
=
self
.
createPaymentTransaction
()
payment_transaction
=
self
.
createPaymentTransaction
()
...
@@ -116,7 +164,7 @@ class TestSlapOSPaymentTransaction_getPayzenId(SlapOSTestCaseMixinWithAbort):
...
@@ -116,7 +164,7 @@ class TestSlapOSPaymentTransaction_getPayzenId(SlapOSTestCaseMixinWithAbort):
REQUEST
=
{})
REQUEST
=
{})
class
TestSlapOSPaymentTransaction_generatePayzenId
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPaymentTransaction_generatePayzenId
(
TestSlapOSPayzenMixin
):
def
test_generatePayzenId_newPaymentTransaction
(
self
):
def
test_generatePayzenId_newPaymentTransaction
(
self
):
payment_transaction
=
self
.
createPaymentTransaction
()
payment_transaction
=
self
.
createPaymentTransaction
()
...
@@ -176,7 +224,7 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
...
@@ -176,7 +224,7 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
REQUEST
=
{})
REQUEST
=
{})
class
TestSlapOSPaymentTransaction_createPayzenEvent
(
PayzenServiceTestCase
):
class
TestSlapOSPaymentTransaction_createPayzenEvent
(
TestSlapOSPayzenMixin
):
def
test_createPayzenEvent_REQUEST_disallowed
(
self
):
def
test_createPayzenEvent_REQUEST_disallowed
(
self
):
payment_transaction
=
self
.
createPaymentTransaction
()
payment_transaction
=
self
.
createPaymentTransaction
()
...
@@ -643,7 +691,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
...
@@ -643,7 +691,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
'Aborting refused payzen payment.'
,
'Aborting refused payzen payment.'
,
payment
.
workflow_history
[
'accounting_workflow'
][
-
1
][
'comment'
])
payment
.
workflow_history
[
'accounting_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSPayzenBase_getPayzenServiceRelativeUrl
(
PayzenServiceTestCase
):
class
TestSlapOSPayzenBase_getPayzenServiceRelativeUrl
(
TestSlapOSPayzenMixin
):
def
test_getPayzenServiceRelativeUrl_REQUEST_disallowed
(
self
):
def
test_getPayzenServiceRelativeUrl_REQUEST_disallowed
(
self
):
self
.
assertRaises
(
self
.
assertRaises
(
...
@@ -663,7 +711,7 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(PayzenServiceTestCase):
...
@@ -663,7 +711,7 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(PayzenServiceTestCase):
class
TestSlapOSPayzenPaymentTransaction_redirectToManualPayzenPayment
(
class
TestSlapOSPayzenPaymentTransaction_redirectToManualPayzenPayment
(
PayzenServiceTestCase
):
TestSlapOSPayzenMixin
):
@
simulate
(
"PaymentTransaction_getVADSUrlDict"
,
'*args, **kwargs'
,
@
simulate
(
"PaymentTransaction_getVADSUrlDict"
,
'*args, **kwargs'
,
"""payment_transaction_url = context.getRelativeUrl()
"""payment_transaction_url = context.getRelativeUrl()
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
View file @
6cca1c8d
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
,
\
from
erp5.component.test.SlapOSTestCaseMixin
import
simulate
simulate
from
erp5.component.test.testSlapOSPayzenSkins
import
TestSlapOSPayzenMixin
import
lxml.html
import
lxml.html
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -34,7 +34,7 @@ vads_url_refused = 'http://example.org/refused'
...
@@ -34,7 +34,7 @@ vads_url_refused = 'http://example.org/refused'
vads_url_success
=
'http://example.org/success'
vads_url_success
=
'http://example.org/success'
vads_url_return
=
'http://example.org/return'
vads_url_return
=
'http://example.org/return'
class
TestSlapOSPayzenInterfaceWorkflow
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPayzenInterfaceWorkflow
(
TestSlapOSPayzenMixin
):
def
createPayzenService
(
self
):
def
createPayzenService
(
self
):
self
.
payzen_secure_payment
=
self
.
portal
.
portal_secure_payments
.
newContent
(
self
.
payzen_secure_payment
=
self
.
portal
.
portal_secure_payments
.
newContent
(
...
@@ -43,14 +43,6 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
...
@@ -43,14 +43,6 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
)
)
self
.
tic
()
self
.
tic
()
def
beforeTearDown
(
self
):
SlapOSTestCaseMixinWithAbort
.
beforeTearDown
(
self
)
if
getattr
(
self
,
"payzen_secure_payment"
,
None
):
self
.
portal
.
portal_secure_payments
.
manage_delObjects
(
ids
=
[
self
.
payzen_secure_payment
.
getId
()])
self
.
tic
()
slapos_payzen_html
=
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
slapos_payzen_html
=
'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<head>
...
...
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