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
18
Merge Requests
18
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
f756596d
Commit
f756596d
authored
Dec 28, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_payzen: Update testSlapOSPayzenWorkflow on the new API
parent
9272a841
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
...m/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
+8
-9
No files found.
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
View file @
f756596d
...
@@ -254,17 +254,17 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
...
@@ -254,17 +254,17 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
AttributeError
,
event
.
updateStatus
)
self
.
assertRaises
(
AttributeError
,
event
.
updateStatus
)
def
mock
Soap
GetInfo
(
self
,
method_to_call
,
expected_args
,
result_tuple
):
def
mock
Rest
GetInfo
(
self
,
method_to_call
,
expected_args
,
result_tuple
):
payment_service
=
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
payment_service
=
self
.
portal
.
portal_secure_payments
.
slapos_payzen_test
def
mock
soad
_getInfo
(
arg1
,
arg2
):
def
mock
rest
_getInfo
(
arg1
,
arg2
):
self
.
assertEqual
(
arg1
,
expected_args
[
0
])
self
.
assertEqual
(
arg1
,
expected_args
[
0
])
self
.
assertEqual
(
arg2
,
expected_args
[
1
])
self
.
assertEqual
(
arg2
,
expected_args
[
1
])
return
result_tuple
return
result_tuple
setattr
(
payment_service
,
'
soap_getInfo'
,
mocksoad
_getInfo
)
setattr
(
payment_service
,
'
rest_getInfo'
,
mockrest
_getInfo
)
try
:
try
:
return
method_to_call
()
return
method_to_call
()
finally
:
finally
:
del
payment_service
.
soap
_getInfo
del
payment_service
.
rest
_getInfo
def
_simulatePayzenEvent_processUpdate
(
self
):
def
_simulatePayzenEvent_processUpdate
(
self
):
script_name
=
'PayzenEvent_processUpdate'
script_name
=
'PayzenEvent_processUpdate'
...
@@ -295,16 +295,15 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -295,16 +295,15 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
payment
.
PaymentTransaction_generatePayzenId
()
payment
.
PaymentTransaction_generatePayzenId
()
mocked_data_kw
=
'mocked_data_kw'
mocked_data_kw
=
'mocked_data_kw'
mocked_signature
=
'mocked_signature'
mocked_sent_text
=
'mocked_sent_text'
mocked_sent_text
=
'mocked_sent_text'
mocked_received_text
=
'mocked_received_text'
mocked_received_text
=
'mocked_received_text'
self
.
_simulatePayzenEvent_processUpdate
()
self
.
_simulatePayzenEvent_processUpdate
()
try
:
try
:
self
.
mock
Soap
GetInfo
(
self
.
mock
Rest
GetInfo
(
event
.
updateStatus
,
event
.
updateStatus
,
(
transaction_date
.
toZone
(
'UTC'
).
asdatetime
(),
transaction_id
),
(
transaction_date
.
toZone
(
'UTC'
).
asdatetime
(),
transaction_id
),
(
mocked_data_kw
,
mocked_s
ignature
,
mocked_s
ent_text
,
mocked_received_text
),
(
mocked_data_kw
,
mocked_sent_text
,
mocked_received_text
),
)
)
finally
:
finally
:
self
.
_dropPayzenEvent_processUpdate
()
self
.
_dropPayzenEvent_processUpdate
()
...
@@ -313,11 +312,11 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -313,11 +312,11 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self
.
assertEqual
(
len
(
event_message_list
),
2
)
self
.
assertEqual
(
len
(
event_message_list
),
2
)
sent_message
=
[
x
for
x
in
event_message_list
\
sent_message
=
[
x
for
x
in
event_message_list
\
if
x
.
getTitle
()
==
'Sent
SOAP
'
][
0
]
if
x
.
getTitle
()
==
'Sent
Data
'
][
0
]
self
.
assertEqual
(
sent_message
.
getTextContent
(),
mocked_sent_text
)
self
.
assertEqual
(
sent_message
.
getTextContent
(),
mocked_sent_text
)
received_message
=
[
x
for
x
in
event_message_list
\
received_message
=
[
x
for
x
in
event_message_list
\
if
x
.
getTitle
()
==
'Received
SOAP
'
][
0
]
if
x
.
getTitle
()
==
'Received
Data
'
][
0
]
self
.
assertEqual
(
received_message
.
getPredecessor
(),
self
.
assertEqual
(
received_message
.
getPredecessor
(),
sent_message
.
getRelativeUrl
())
sent_message
.
getRelativeUrl
())
self
.
assertEqual
(
received_message
.
getTextContent
(),
mocked_received_text
)
self
.
assertEqual
(
received_message
.
getTextContent
(),
mocked_received_text
)
...
...
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