Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
76762b21
Commit
76762b21
authored
Nov 26, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use appropriate user to invoke workflow transitions.
parent
2f888e0b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
56 additions
and
30 deletions
+56
-30
product/ERP5/tests/testAdvancedInvoicing.py
product/ERP5/tests/testAdvancedInvoicing.py
+1
-1
product/ERP5/tests/testApparelTransformation.py
product/ERP5/tests/testApparelTransformation.py
+5
-0
product/ERP5/tests/testDivergenceTester.py
product/ERP5/tests/testDivergenceTester.py
+3
-0
product/ERP5/tests/testERP5Simulation.py
product/ERP5/tests/testERP5Simulation.py
+1
-0
product/ERP5/tests/testInventoryModule.py
product/ERP5/tests/testInventoryModule.py
+5
-0
product/ERP5/tests/testInvoice.py
product/ERP5/tests/testInvoice.py
+8
-14
product/ERP5/tests/testItem.py
product/ERP5/tests/testItem.py
+4
-7
product/ERP5/tests/testNotificationMessageModule.py
product/ERP5/tests/testNotificationMessageModule.py
+1
-0
product/ERP5/tests/testNotificationTool.py
product/ERP5/tests/testNotificationTool.py
+2
-1
product/ERP5/tests/testOrder.py
product/ERP5/tests/testOrder.py
+12
-7
product/ERP5/tests/testPackingList.py
product/ERP5/tests/testPackingList.py
+7
-0
product/ERP5/tests/testProductionOrder.py
product/ERP5/tests/testProductionOrder.py
+2
-0
product/ERP5/tests/testTask.py
product/ERP5/tests/testTask.py
+1
-0
product/ERP5/tests/testTaskReportDivergence.py
product/ERP5/tests/testTaskReportDivergence.py
+2
-0
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+2
-0
No files found.
product/ERP5/tests/testAdvancedInvoicing.py
View file @
76762b21
...
...
@@ -480,7 +480,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
collect_order_group
=
'delivery'
,
int_index
=
len
(
delivery_movement_group_list
)
+
1
)
user
=
uf
.
getUserById
(
'test_
invoice_
user'
).
__of__
(
uf
)
user
=
uf
.
getUserById
(
'test_user'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
test_01_TwoInvoicesFromTwoPackingList
(
self
,
quiet
=
quiet
,
run
=
RUN_ALL_TESTS
):
...
...
product/ERP5/tests/testApparelTransformation.py
View file @
76762b21
...
...
@@ -30,6 +30,7 @@
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
zLOG
import
LOG
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
testOrder
import
TestOrderMixin
class
TestApparelTransformation
(
TestOrderMixin
,
ERP5TypeTestCase
):
...
...
@@ -48,6 +49,10 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
transformed_resource_portal_type
=
'Transformation Transformed Resource'
operation_portal_type
=
'Transformation Operation'
def
afterSetUp
(
self
,
quiet
=
1
,
run
=
1
):
super
(
TestApparelTransformation
,
self
).
afterSetUp
()
self
.
login
()
def
getTitle
(
self
):
return
"Transformation"
...
...
product/ERP5/tests/testDivergenceTester.py
View file @
76762b21
...
...
@@ -30,6 +30,7 @@ import unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
Sequence
from
Products.ERP5.tests.testPackingList
import
TestPackingListMixin
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
class
TestDivergenceTester
(
TestPackingListMixin
,
ERP5TypeTestCase
):
"""
...
...
@@ -62,6 +63,7 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
portal_rules
.
deleteContent
(
rule_id_list
)
self
.
tic
()
@
UnrestrictedMethod
def
stepResetDeliveringRule
(
self
,
sequence
):
original_rule
=
rule
=
self
.
getDeliveringRule
()
self
.
assertEqual
(
rule
.
getId
(),
'new_delivery_simulation_rule'
)
...
...
@@ -125,6 +127,7 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
self
.
assertNotEqual
(
prevision
,
decision
)
movement
.
setQuantity
(
decision
)
@
UnrestrictedMethod
def
_addDivergenceTester
(
self
,
sequence
,
tester_type
,
tester_name
,
**
kw
):
"""
Add a divergence tester to the rule
...
...
product/ERP5/tests/testERP5Simulation.py
View file @
76762b21
...
...
@@ -41,6 +41,7 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase):
def
afterSetUp
(
self
):
super
(
TestERP5Simulation
,
self
).
afterSetUp
()
self
.
login
(
'manager'
)
self
.
portal
.
portal_rules
.
new_delivery_simulation_rule
.
quantity_tester
.
edit
(
quantity_range_max
=
2
,
quantity_range_min
=-
1
)
...
...
product/ERP5/tests/testInventoryModule.py
View file @
76762b21
...
...
@@ -31,6 +31,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5.tests.testOrder
import
TestOrderMixin
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
class
TestInventoryModule
(
TestOrderMixin
,
ERP5TypeTestCase
):
"""
...
...
@@ -125,6 +126,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
sequence
.
edit
(
inventory_list
=
inventory_list
)
return
inventory
@
UnrestrictedMethod
def
createNotVariatedInventoryLine
(
self
,
quantity
=
None
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -161,6 +163,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
quantity
=
quantity
)
@
UnrestrictedMethod
def
stepModifySecondNotVariatedInventory
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
...
...
@@ -232,6 +235,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
sequence_list
.
play
(
self
)
@
UnrestrictedMethod
def
createVariatedInventoryLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
start_date
=
None
,
quantity
=
None
,
item_list
=
None
,
**
kw
):
...
...
@@ -287,6 +291,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
self
.
createVariatedInventoryLine
(
start_date
=
date
,
sequence
=
sequence
,
quantity
=
quantity
)
@
UnrestrictedMethod
def
createVariatedInventory
(
self
,
start_date
=
None
,
quantity
=
None
,
sequence
=
None
,
**
kw
):
"""
...
...
product/ERP5/tests/testInvoice.py
View file @
76762b21
...
...
@@ -124,15 +124,20 @@ class TestInvoiceMixin(TestPackingListMixin):
'use/trade/tax'
,
)
def
afterSetUp
(
self
):
self
.
createUser
(
'test_user'
,
[
'Assignee'
,
'Assignor'
,
'Member'
,
'Associate'
,
'Auditor'
,
'Author'
])
self
.
createUser
(
'manager'
,
[
'Manager'
])
self
.
login
(
'manager'
)
self
.
createCategories
()
self
.
validateRules
()
self
.
createBusinessProcess
()
self
.
login
()
self
.
login
(
'test_user'
)
def
beforeTearDown
(
self
):
self
.
abort
()
self
.
login
(
'manager'
)
super
(
TestInvoiceMixin
,
self
).
beforeTearDown
()
for
folder
in
(
self
.
portal
.
accounting_module
,
self
.
portal
.
organisation_module
,
...
...
@@ -144,14 +149,6 @@ class TestInvoiceMixin(TestPackingListMixin):
folder
.
manage_delObjects
([
x
for
x
in
folder
.
objectIds
()
if
x
not
in
(
'organisation_1'
,
'organisation_2'
,
'ppl_1'
,
'ppl_2'
)])
self
.
tic
()
def
login
(
self
):
"""login, without manager role"""
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'test_invoice_user'
,
''
,
[
'Assignee'
,
'Assignor'
,
'Member'
,
'Associate'
,
'Auditor'
,
'Author'
],
[])
user
=
uf
.
getUserById
(
'test_invoice_user'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
stepCreateSaleInvoiceTransactionRule
(
self
,
sequence
,
**
kw
)
:
pass
# see createBusinessProcess
...
...
@@ -183,7 +180,7 @@ class TestInvoiceMixin(TestPackingListMixin):
if
not
account_module
.
has_key
(
account_id
):
account
=
account_module
.
newContent
(
account_id
,
gap
=
account_gap
,
account_type
=
account_type
)
portal
.
portal_workflow
.
doActionFor
(
account
,
'validate_action'
)
account
.
validate
(
)
for
line_id
,
line_source_id
,
line_destination_id
,
line_ratio
in
\
self
.
transaction_line_definition_list
:
trade_model_path
=
business_process
.
newContent
(
...
...
@@ -2546,9 +2543,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
"""
quiet
=
0
# fix inheritance
login
=
TestInvoiceMixin
.
login
@
UnrestrictedMethod
def
createCategories
(
self
):
TestPackingListMixin
.
createCategories
(
self
)
...
...
product/ERP5/tests/testItem.py
View file @
76762b21
...
...
@@ -35,7 +35,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5.tests.testInvoice
import
TestSaleInvoiceMixin
from
Products.ERP5.tests.utils
import
newSimulationExpectedFailure
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
class
TestItemMixin
(
TestSaleInvoiceMixin
):
item_portal_type
=
'Item'
...
...
@@ -52,12 +52,6 @@ class TestItemMixin(TestSaleInvoiceMixin):
return
TestSaleInvoiceMixin
.
getBusinessTemplateList
(
self
)
+
\
(
'erp5_item'
,)
+
(
'erp5_trade_proxy_field_legacy'
,)
def
login
(
self
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'rc'
,
''
,
[
'Manager'
,
'Member'
,
'Assignee'
],
[])
user
=
uf
.
getUserById
(
'rc'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
createOrganisation
(
self
,
title
=
None
):
organisation_portal_type
=
'Organisation'
organisation_module
=
self
.
portal
.
getDefaultModule
(
...
...
@@ -222,6 +216,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
self
.
assertEqual
(
packing_list
.
getStartDate
(),
self
.
datetime
+
15
)
@
UnrestrictedMethod
def
stepModifyOrderLinesQuantity
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
modify order line quantities
...
...
@@ -231,6 +226,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
for
order_line
in
order_line_list
:
order_line
.
edit
(
quantity
=
self
.
default_quantity
-
1
)
@
UnrestrictedMethod
def
stepModifyOneOrderLineStartDate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
modify order line start date
...
...
@@ -242,6 +238,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
order_line_list
[
-
1
].
edit
(
start_date
=
self
.
datetime
+
15
)
@
UnrestrictedMethod
def
stepModifyOrderLinesDate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
modify order line date
...
...
product/ERP5/tests/testNotificationMessageModule.py
View file @
76762b21
...
...
@@ -73,6 +73,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
def
test_01_get_document
(
self
):
module
=
self
.
getNotificationMessageModule
()
tool
=
self
.
getPortal
().
portal_notifications
self
.
login
(
'manager'
)
#Test Document A in english
n_m_en
=
module
.
newContent
(
portal_type
=
'Notification Message'
,
reference
=
'A'
,
...
...
product/ERP5/tests/testNotificationTool.py
View file @
76762b21
...
...
@@ -119,7 +119,7 @@ class TestNotificationTool(ERP5TypeTestCase):
newSecurityManager
(
None
,
self
.
old_user
)
def
afterSetUp
(
self
):
self
.
createUser
(
'erp5user'
,
[
'Auditor'
,
'Author'
])
self
.
createUser
(
'erp5user'
,
[
'A
ssociate'
,
'A
uditor'
,
'Author'
])
self
.
createUser
(
'manager'
,
[
'Manager'
])
portal
=
self
.
getPortal
()
if
'MailHost'
in
portal
.
objectIds
():
...
...
@@ -134,6 +134,7 @@ class TestNotificationTool(ERP5TypeTestCase):
def
beforeTearDown
(
self
):
self
.
abort
()
# clear modules if necessary
self
.
login
(
'manager'
)
self
.
portal
.
person_module
.
manage_delObjects
(
list
(
self
.
portal
.
person_module
.
objectIds
()))
self
.
tic
()
...
...
product/ERP5/tests/testOrder.py
View file @
76762b21
...
...
@@ -38,6 +38,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from
DateTime
import
DateTime
from
zLOG
import
LOG
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.CMFCore.utils
import
getToolByName
class
TestOrderMixin
(
SubcontentReindexingWrapper
):
...
...
@@ -69,12 +70,6 @@ class TestOrderMixin(SubcontentReindexingWrapper):
'erp5_configurator_standard_trade_template'
,
'erp5_simulation_test'
,
'erp5_administration'
)
def
login
(
self
,
quiet
=
0
,
run
=
1
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'rc'
,
''
,
[
'Manager'
,
'Member'
,
'Assignee'
],
[])
user
=
uf
.
getUserById
(
'rc'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
setUpPreferences
(
self
):
#create apparel variation preferences
portal_preferences
=
self
.
getPreferenceTool
()
...
...
@@ -95,13 +90,21 @@ class TestOrderMixin(SubcontentReindexingWrapper):
preference
.
enable
()
self
.
tic
()
def
createUser
(
self
,
name
,
role_list
):
user_folder
=
self
.
getPortal
().
acl_users
user_folder
.
_doAddUser
(
name
,
'password'
,
role_list
,
[])
def
afterSetUp
(
self
):
# XXX-Leo: cannot call super here, because other classes call
# SuperClass.afterSetUp(self) directly... this needs to be cleaned
# up, including consolidating all conflicting definitions of
# .createCategories()
#super(TestOrderMixin, self).afterSetUp()
self
.
login
()
self
.
createUser
(
'test_user'
,
[
'Assignee'
,
'Assignor'
,
'Member'
,
'Associate'
,
'Auditor'
,
'Author'
])
self
.
createUser
(
'manager'
,
[
'Manager'
])
self
.
login
(
'manager'
)
self
.
category_tool
=
self
.
getCategoryTool
()
portal_catalog
=
self
.
getCatalogTool
()
#portal_catalog.manage_catalogClear()
...
...
@@ -113,6 +116,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
# 1. All calculations are done relative to the same time
# 2. We don't get random failures when tests run close to midnight
self
.
pinDateTime
(
self
.
datetime
)
self
.
login
(
'test_user'
)
def
beforeTearDown
(
self
):
self
.
unpinDateTime
()
...
...
@@ -231,6 +235,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
resource_list
.
append
(
resource
)
sequence
.
edit
(
resource_list
=
resource_list
)
@
UnrestrictedMethod
def
stepCreateVariatedMultipleQuantityUnitResource
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Create a resource with variation and multiple quantity units
...
...
product/ERP5/tests/testPackingList.py
View file @
76762b21
...
...
@@ -240,6 +240,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list
=
sequence
.
get
(
'packing_list'
)
self
.
assertFalse
(
packing_list
.
isDivergent
())
@
UnrestrictedMethod
def
stepChangeOrderLineResource
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
...
...
@@ -262,6 +263,7 @@ class TestPackingListMixin(TestOrderMixin):
portal_type
=
self
.
packing_list_line_portal_type
):
packing_list_line
.
edit
(
resource_value
=
resource
)
@
UnrestrictedMethod
def
stepDecreaseOrderLineQuantity
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
...
...
@@ -704,6 +706,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list
=
sequence
.
get
(
'packing_list'
)
self
.
_solveDivergence
(
packing_list
,
'quantity'
,
'Adopt Solver'
)
@
UnrestrictedMethod
def
_solveDivergence
(
self
,
document
,
property
,
solver
,
**
kw
):
"""Solve divergence by using solver tool"""
solver_process_tool
=
self
.
portal
.
portal_solver_processes
...
...
@@ -1851,6 +1854,7 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
solver_process_type_info
.
getTypeAllowedContentTypeList
()
self
.
added_target_solver_list
=
[]
@
UnrestrictedMethod
def
beforeTearDown
(
self
,
quiet
=
1
,
run
=
1
):
super
(
TestSolvingPackingList
,
self
).
beforeTearDown
()
self
.
portal
.
portal_rules
.
new_delivery_simulation_rule
.
quantity_tester
.
edit
(
...
...
@@ -1886,18 +1890,21 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
added_target_solver_list
.
append
(
solver_id
)
@
UnrestrictedMethod
def
stepSetUpAutomaticQuantityAcceptSolver
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_setUpTargetSolver
(
'Automatic Quantity Accept Solver'
,
'AcceptSolver'
,
(
'quantity'
,))
self
.
portal
.
portal_rules
.
new_delivery_simulation_rule
.
quantity_tester
.
edit
(
solver
=
(
'portal_solvers/Automatic Quantity Accept Solver'
,))
@
UnrestrictedMethod
def
stepSetUpAutomaticQuantityAdoptSolver
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_setUpTargetSolver
(
'Automatic Quantity Adopt Solver'
,
'AdoptSolver'
,
(
'quantity'
,))
self
.
portal
.
portal_rules
.
new_delivery_simulation_rule
.
quantity_tester
.
edit
(
solver
=
(
'portal_solvers/Automatic Quantity Adopt Solver'
,))
@
UnrestrictedMethod
def
stepSetUpMovementSplitSolver
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_setUpTargetSolver
(
'Movement Split Solver'
,
'MovementSplitSolver'
,
())
...
...
product/ERP5/tests/testProductionOrder.py
View file @
76762b21
...
...
@@ -83,7 +83,9 @@ class TestProductionOrderMixin(TestOrderMixin):
def
afterSetUp
(
self
):
TestOrderMixin
.
afterSetUp
(
self
)
self
.
login
(
'manager'
)
self
.
setUpPreferences
()
self
.
login
(
'test_user'
)
def
createCategories
(
self
):
"""
...
...
product/ERP5/tests/testTask.py
View file @
76762b21
...
...
@@ -547,6 +547,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
run_all_test
=
1
def
afterSetUp
(
self
):
self
.
stepLogin
()
self
.
validateRules
()
self
.
tic
()
...
...
product/ERP5/tests/testTaskReportDivergence.py
View file @
76762b21
...
...
@@ -158,7 +158,9 @@ class TestTaskReportDivergence(TestTaskReportDivergenceMixin, ERP5TypeTestCase)
quiet
=
0
def
afterSetUp
(
self
):
self
.
stepLogin
()
self
.
validateRules
()
self
.
tic
()
def
enableLightInstall
(
self
):
"""
...
...
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
76762b21
...
...
@@ -1876,8 +1876,10 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# by searchFolder.
# This will work as long as Bank Account are associated to a workflow that
# allow deletion.
self
.
login
()
obj2
.
delete
()
self
.
tic
()
self
.
login
(
'bob'
)
self
.
assertEqual
([],
[
x
.
getObject
()
for
x
in
obj
.
searchFolder
(
portal_type
=
'Bank Account'
)])
...
...
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