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
1
Merge Requests
1
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
Romain Courteaud
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
Hide 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.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
unittest
import
skip
import
json
from
DateTime
import
DateTime
class
TestSlapOSPayzenUpdateConfirmedPayment
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
abort_transaction
=
1
def
_simulatePaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
...
...
@@ -22,13 +18,13 @@ class TestSlapOSPayzenUpdateConfirmedPayment(testSlapOSMixin):
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_startPayzenPayment') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_alarm_confirmed_draft_payzen
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -126,7 +122,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 1"""
)
transaction
.
commit
()
self
.
commit
()
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
...
...
@@ -137,13 +133,13 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 0"""
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_not_confirmed_payment
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -222,7 +218,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
class
TestSlapOSPayzenUpdateStartedPayment
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
self
.
abort
()
def
test_not_started_payment
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -281,7 +277,7 @@ class Foo:
context.stop()
return Foo()
"""
)
transaction
.
commit
()
self
.
commit
()
def
_simulatePaymentTransaction_createNotPaidPayzenEvent
(
self
):
script_name
=
'PaymentTransaction_createPayzenEvent'
...
...
@@ -299,13 +295,13 @@ class Foo:
pass
return Foo()
"""
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_createPayzenEvent
(
self
):
script_name
=
'PaymentTransaction_createPayzenEvent'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_paid_payment
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -368,13 +364,13 @@ return Foo()
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_updateStatus') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPaymentTransaction_updateStatus
(
self
):
script_name
=
'PaymentTransaction_updateStatus'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_alarm_started_draft_payzen
(
self
):
new_id
=
self
.
generateNewId
()
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
View file @
2035def4
...
...
@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenAlarm
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenAlarm
</string>
</value>
...
...
@@ -33,27 +45,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
...
...
@@ -63,13 +55,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -82,7 +89,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -91,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.py
View file @
2035def4
...
...
@@ -7,14 +7,13 @@
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
import
transaction
class
TestSlapOSPaymentTransactionOrderBuilder
(
testSlapOSMixin
):
def
sumReceivable
(
self
,
transaction
):
def
sumReceivable
(
self
,
payment_
transaction
):
quantity
=
.
0
default_source_uid
=
self
.
portal
.
restrictedTraverse
(
'account_module/receivable'
).
getUid
()
for
line
in
transaction
.
searchFolder
(
for
line
in
payment_
transaction
.
searchFolder
(
portal_type
=
self
.
portal
.
getPortalAccountingMovementTypeList
(),
default_source_uid
=
default_source_uid
):
quantity
+=
line
.
getQuantity
()
...
...
@@ -141,7 +140,7 @@ class TestSlapOSPaymentTransactionOrderBuilder(testSlapOSMixin):
invoice
.
stop
()
self
.
tic
()
payment_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
())
transaction
.
commit
()
self
.
commit
()
# the payment transaction is immediately indexed
self
.
assertEqual
(
1
,
len
(
payment_list
))
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
View file @
2035def4
...
...
@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenBuilder
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenBuilder
</string>
</value>
...
...
@@ -33,9 +45,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 13, 26: Redefining name \'transaction\' from outer scope (line 10) (redefined-outer-name)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -45,13 +55,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -64,7 +89,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -73,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</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.
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
import
transaction
from
unittest
import
expectedFailure
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
difflib
from
functools
import
wraps
HARDCODED_PRICE
=
99.6
...
...
@@ -22,8 +17,7 @@ vads_url_return = 'http://example.org/return'
class
TestSlapOSPayzenInterfaceWorkflow
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
abort_transaction
=
1
def
createPaymentTransaction
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -118,7 +112,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
event
=
self
.
createPayzenEvent
()
payment
=
self
.
createPaymentTransaction
()
event
.
edit
(
destination_value
=
payment
)
transaction_date
,
payzen_id
=
payment
.
PaymentTransaction_generatePayzenId
()
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
ValueError
,
event
.
generateManualPaymentPage
,
vads_url_cancel
=
vads_url_cancel
,
vads_url_error
=
vads_url_error
,
...
...
@@ -275,7 +269,7 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
event
.
edit
(
destination_value
=
payment
,
)
transaction_date
,
payzen_id
=
payment
.
PaymentTransaction_generatePayzenId
()
_
,
_
=
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
AttributeError
,
event
.
updateStatus
)
def
mockSoapGetInfo
(
self
,
method_to_call
,
expected_args
,
result_tuple
):
...
...
@@ -300,13 +294,13 @@ class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin):
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PayzenEvent_processUpdate') """
)
transaction
.
commit
()
self
.
commit
()
def
_dropPayzenEvent_processUpdate
(
self
):
script_name
=
'PayzenEvent_processUpdate'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
self
.
commit
()
def
test_updateStatus_defaultUseCase
(
self
):
event
=
self
.
createPayzenEvent
()
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
View file @
2035def4
...
...
@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzenWorkflow
</string>
</value>
...
...
@@ -33,17 +45,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
...
...
@@ -53,13 +55,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -72,7 +89,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -81,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</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