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
Carlos Ramos Carreño
slapos.core
Commits
2035def4
Commit
2035def4
authored
Jan 18, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_payzen: Clean up tests (Make lint happy)
parent
b5dc01cc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
76 deletions
+114
-76
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
...Item/portal_components/test.erp5.testSlapOSPayzenAlarm.py
+12
-16
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
...tem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
+31
-24
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.py
...em/portal_components/test.erp5.testSlapOSPayzenBuilder.py
+3
-4
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
...m/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
+31
-6
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
...m/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
+6
-12
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
.../portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
+31
-14
No files found.
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
View file @
2035def4
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
testSlapOSMixin
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
unittest
import
skip
import
json
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestSlapOSPayzenUpdateConfirmedPayment
(
testSlapOSMixin
):
class
TestSlapOSPayzenUpdateConfirmedPayment
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
abort_transaction
=
1
transaction
.
abort
()
def
_simulatePaymentTransaction_startPayzenPayment
(
self
):
def
_simulatePaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
script_name
=
'PaymentTransaction_startPayzenPayment'
...
@@ -22,13 +18,13 @@ class TestSlapOSPayzenUpdateConfirmedPayment(testSlapOSMixin):
...
@@ -22,13 +18,13 @@ class TestSlapOSPayzenUpdateConfirmedPayment(testSlapOSMixin):
'# 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_startPayzenPayment') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_startPayzenPayment') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_startPayzenPayment
(
self
):
def
_dropPaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
script_name
=
'PaymentTransaction_startPayzenPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_alarm_confirmed_draft_payzen
(
self
):
def
test_alarm_confirmed_draft_payzen
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -126,7 +122,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -126,7 +122,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'*args, **kwargs'
,
'*args, **kwargs'
,
'# Script body
\
n
'
'# Script body
\
n
'
"""return 1"""
)
"""return 1"""
)
transaction
.
commit
()
self
.
commit
()
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
script_name
=
'PaymentTransaction_getTotalPayablePrice'
...
@@ -137,13 +133,13 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -137,13 +133,13 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'*args, **kwargs'
,
'*args, **kwargs'
,
'# Script body
\
n
'
'# Script body
\
n
'
"""return 0"""
)
"""return 0"""
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_not_confirmed_payment
(
self
):
def
test_not_confirmed_payment
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -222,7 +218,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
...
@@ -222,7 +218,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
class
TestSlapOSPayzenUpdateStartedPayment
(
testSlapOSMixin
):
class
TestSlapOSPayzenUpdateStartedPayment
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
self
.
abort
()
def
test_not_started_payment
(
self
):
def
test_not_started_payment
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -281,7 +277,7 @@ class Foo:
...
@@ -281,7 +277,7 @@ class Foo:
context.stop()
context.stop()
return Foo()
return Foo()
"""
)
"""
)
transaction
.
commit
()
self
.
commit
()
def
_simulatePaymentTransaction_createNotPaidPayzenEvent
(
self
):
def
_simulatePaymentTransaction_createNotPaidPayzenEvent
(
self
):
script_name
=
'PaymentTransaction_createPayzenEvent'
script_name
=
'PaymentTransaction_createPayzenEvent'
...
@@ -299,13 +295,13 @@ class Foo:
...
@@ -299,13 +295,13 @@ class Foo:
pass
pass
return Foo()
return Foo()
"""
)
"""
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_createPayzenEvent
(
self
):
def
_dropPaymentTransaction_createPayzenEvent
(
self
):
script_name
=
'PaymentTransaction_createPayzenEvent'
script_name
=
'PaymentTransaction_createPayzenEvent'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_paid_payment
(
self
):
def
test_paid_payment
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -368,13 +364,13 @@ return Foo()
...
@@ -368,13 +364,13 @@ return Foo()
'# 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') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_updateStatus
(
self
):
def
_dropPaymentTransaction_updateStatus
(
self
):
script_name
=
'PaymentTransaction_updateStatus'
script_name
=
'PaymentTransaction_updateStatus'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_alarm_started_draft_payzen
(
self
):
def
test_alarm_started_draft_payzen
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
View file @
2035def4
...
@@ -6,10 +6,22 @@
...
@@ -6,10 +6,22 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenAlarm
</string>
</value>
<value>
<string>
testSlapOSPayzenAlarm
</string>
</value>
</item>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenAlarm
</string>
</value>
<value>
<string>
test.erp5.testSlapOSPayzenAlarm
</string>
</value>
...
@@ -33,27 +45,7 @@
...
@@ -33,27 +45,7 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple/>
<string>
W: 35, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W: 57, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W: 78, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:101, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:150, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:168, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:186, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:206, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:229, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:243, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:257, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:312, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:339, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:381, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:403, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:424, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W:447, 4: Redefining name \'transaction\' from outer scope (line 2) (redefined-outer-name)
</string>
<string>
W: 6, 0: Unused import skip (unused-import)
</string>
<string>
W: 7, 0: Unused import json (unused-import)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
@@ -63,13 +55,28 @@
...
@@ -63,13 +55,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<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>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -82,7 +89,7 @@
...
@@ -82,7 +89,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -91,7 +98,7 @@
...
@@ -91,7 +98,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.py
View file @
2035def4
...
@@ -7,14 +7,13 @@
...
@@ -7,14 +7,13 @@
from
Products.SlapOS.tests.testSlapOSMixin
import
\
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
testSlapOSMixin
import
transaction
class
TestSlapOSPaymentTransactionOrderBuilder
(
testSlapOSMixin
):
class
TestSlapOSPaymentTransactionOrderBuilder
(
testSlapOSMixin
):
def
sumReceivable
(
self
,
transaction
):
def
sumReceivable
(
self
,
payment_
transaction
):
quantity
=
.
0
quantity
=
.
0
default_source_uid
=
self
.
portal
.
restrictedTraverse
(
default_source_uid
=
self
.
portal
.
restrictedTraverse
(
'account_module/receivable'
).
getUid
()
'account_module/receivable'
).
getUid
()
for
line
in
transaction
.
searchFolder
(
for
line
in
payment_
transaction
.
searchFolder
(
portal_type
=
self
.
portal
.
getPortalAccountingMovementTypeList
(),
portal_type
=
self
.
portal
.
getPortalAccountingMovementTypeList
(),
default_source_uid
=
default_source_uid
):
default_source_uid
=
default_source_uid
):
quantity
+=
line
.
getQuantity
()
quantity
+=
line
.
getQuantity
()
...
@@ -141,7 +140,7 @@ class TestSlapOSPaymentTransactionOrderBuilder(testSlapOSMixin):
...
@@ -141,7 +140,7 @@ class TestSlapOSPaymentTransactionOrderBuilder(testSlapOSMixin):
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
())
payment_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
())
transaction
.
commit
()
self
.
commit
()
# the payment transaction is immediately indexed
# the payment transaction is immediately indexed
self
.
assertEqual
(
1
,
len
(
payment_list
))
self
.
assertEqual
(
1
,
len
(
payment_list
))
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
View file @
2035def4
...
@@ -6,10 +6,22 @@
...
@@ -6,10 +6,22 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenBuilder
</string>
</value>
<value>
<string>
testSlapOSPayzenBuilder
</string>
</value>
</item>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenBuilder
</string>
</value>
<value>
<string>
test.erp5.testSlapOSPayzenBuilder
</string>
</value>
...
@@ -33,9 +45,7 @@
...
@@ -33,9 +45,7 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple/>
<string>
W: 13, 26: Redefining name \'transaction\' from outer scope (line 10) (redefined-outer-name)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
@@ -45,13 +55,28 @@
...
@@ -45,13 +55,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<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>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -64,7 +89,7 @@
...
@@ -64,7 +89,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -73,7 +98,7 @@
...
@@ -73,7 +98,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.py
View file @
2035def4
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from
Products.SlapOS.tests.testSlapOSMixin
import
\
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
testSlapOSMixin
import
transaction
from
unittest
import
expectedFailure
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
difflib
import
difflib
from
functools
import
wraps
HARDCODED_PRICE
=
99.6
HARDCODED_PRICE
=
99.6
...
@@ -22,8 +17,7 @@ vads_url_return = 'http://example.org/return'
...
@@ -22,8 +17,7 @@ vads_url_return = 'http://example.org/return'
class
TestSlapOSPayzenInterfaceWorkflow
(
testSlapOSMixin
):
class
TestSlapOSPayzenInterfaceWorkflow
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
abort_transaction
=
1
transaction
.
abort
()
def
createPaymentTransaction
(
self
):
def
createPaymentTransaction
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
...
@@ -118,7 +112,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
...
@@ -118,7 +112,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
event
=
self
.
createPayzenEvent
()
event
=
self
.
createPayzenEvent
()
payment
=
self
.
createPaymentTransaction
()
payment
=
self
.
createPaymentTransaction
()
event
.
edit
(
destination_value
=
payment
)
event
.
edit
(
destination_value
=
payment
)
transaction_date
,
payzen_id
=
payment
.
PaymentTransaction_generatePayzenId
()
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
ValueError
,
event
.
generateManualPaymentPage
,
self
.
assertRaises
(
ValueError
,
event
.
generateManualPaymentPage
,
vads_url_cancel
=
vads_url_cancel
,
vads_url_cancel
=
vads_url_cancel
,
vads_url_error
=
vads_url_error
,
vads_url_error
=
vads_url_error
,
...
@@ -275,7 +269,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
...
@@ -275,7 +269,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
event
.
edit
(
event
.
edit
(
destination_value
=
payment
,
destination_value
=
payment
,
)
)
transaction_date
,
payzen_id
=
payment
.
PaymentTransaction_generatePayzenId
()
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
AttributeError
,
event
.
updateStatus
)
self
.
assertRaises
(
AttributeError
,
event
.
updateStatus
)
def
mockSoapGetInfo
(
self
,
method_to_call
,
expected_args
,
result_tuple
):
def
mockSoapGetInfo
(
self
,
method_to_call
,
expected_args
,
result_tuple
):
...
@@ -300,13 +294,13 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
...
@@ -300,13 +294,13 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
'# 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 PayzenEvent_processUpdate') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PayzenEvent_processUpdate') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPayzenEvent_processUpdate
(
self
):
def
_dropPayzenEvent_processUpdate
(
self
):
script_name
=
'PayzenEvent_processUpdate'
script_name
=
'PayzenEvent_processUpdate'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_updateStatus_defaultUseCase
(
self
):
def
test_updateStatus_defaultUseCase
(
self
):
event
=
self
.
createPayzenEvent
()
event
=
self
.
createPayzenEvent
()
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
View file @
2035def4
...
@@ -6,10 +6,22 @@
...
@@ -6,10 +6,22 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenWorkflow
</string>
</value>
<value>
<string>
testSlapOSPayzenWorkflow
</string>
</value>
</item>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenWorkflow
</string>
</value>
<value>
<string>
test.erp5.testSlapOSPayzenWorkflow
</string>
</value>
...
@@ -33,17 +45,7 @@
...
@@ -33,17 +45,7 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple/>
<string>
W:121, 4: Unused variable \'transaction_date\' (unused-variable)
</string>
<string>
W:121, 22: Unused variable \'payzen_id\' (unused-variable)
</string>
<string>
W:278, 4: Unused variable \'transaction_date\' (unused-variable)
</string>
<string>
W:278, 22: Unused variable \'payzen_id\' (unused-variable)
</string>
<string>
W: 5, 0: Unused import expectedFailure (unused-import)
</string>
<string>
W: 7, 0: Unused import setSecurityManager (unused-import)
</string>
<string>
W: 12, 0: Unused import wraps (unused-import)
</string>
<string>
W: 7, 0: Unused import getSecurityManager (unused-import)
</string>
<string>
W: 6, 0: Unused import UnsupportedWorkflowMethod (unused-import)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
@@ -53,13 +55,28 @@
...
@@ -53,13 +55,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<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>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -72,7 +89,7 @@
...
@@ -72,7 +89,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -81,7 +98,7 @@
...
@@ -81,7 +98,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
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