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
7
Merge Requests
7
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
Jérome Perrin
erp5
Commits
ed422ffb
Commit
ed422ffb
authored
Aug 22, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup testSupply
parent
6905aa33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
26 deletions
+6
-26
product/ERP5/tests/testSupply.py
product/ERP5/tests/testSupply.py
+6
-26
No files found.
product/ERP5/tests/testSupply.py
View file @
ed422ffb
...
@@ -41,9 +41,8 @@ class TestSupplyMixin:
...
@@ -41,9 +41,8 @@ class TestSupplyMixin:
"""
"""
return
(
'erp5_base'
,
'erp5_pdm'
,
'erp5_dummy_movement'
,
'erp5_trade'
)
return
(
'erp5_base'
,
'erp5_pdm'
,
'erp5_dummy_movement'
,
'erp5_trade'
)
def
afterSetUp
(
self
,
quiet
=
1
,
run
=
1
):
def
afterSetUp
(
self
):
self
.
login
()
self
.
login
()
portal
=
self
.
getPortal
()
self
.
category_tool
=
self
.
getCategoryTool
()
self
.
category_tool
=
self
.
getCategoryTool
()
self
.
domain_tool
=
self
.
getDomainTool
()
self
.
domain_tool
=
self
.
getDomainTool
()
self
.
catalog_tool
=
self
.
getCatalogTool
()
self
.
catalog_tool
=
self
.
getCatalogTool
()
...
@@ -63,7 +62,6 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -63,7 +62,6 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
"""
"""
Test Supplies usage
Test Supplies usage
"""
"""
run_all_test
=
1
supply_portal_type
=
'Sale Supply'
supply_portal_type
=
'Sale Supply'
supply_line_portal_type
=
'Sale Supply Line'
supply_line_portal_type
=
'Sale Supply Line'
...
@@ -72,9 +70,6 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -72,9 +70,6 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
generic_supply_cell_portal_type
=
'Supply Cell'
generic_supply_cell_portal_type
=
'Supply Cell'
predicate_portal_type
=
'Predicate'
predicate_portal_type
=
'Predicate'
def
getTitle
(
self
):
return
"Sale Supply"
@
reindex
@
reindex
def
_makeMovement
(
self
,
**
kw
):
def
_makeMovement
(
self
,
**
kw
):
"""Creates a movement.
"""Creates a movement.
...
@@ -109,12 +104,11 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -109,12 +104,11 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
supply_cell
.
edit
(
**
kw
)
supply_cell
.
edit
(
**
kw
)
return
supply_cell
return
supply_cell
def
test_
01_MovementAndSupplyModification
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_
MovementAndSupplyModification
(
self
):
"""
"""
Check that moving timeframe of supply
Check that moving timeframe of supply
and then setting movement into that timeframe works.
and then setting movement into that timeframe works.
"""
"""
if
not
run
:
return
# movement is in middle of timeframe...
# movement is in middle of timeframe...
movement
=
self
.
_makeMovement
(
start_date
=
'2009/01/15'
)
movement
=
self
.
_makeMovement
(
start_date
=
'2009/01/15'
)
...
@@ -164,13 +158,11 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -164,13 +158,11 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
self
.
assertSameSet
(
res_line
,
[
supply_line
])
self
.
assertSameSet
(
res_line
,
[
supply_line
])
self
.
assertSameSet
(
res_cell
,
[
supply_cell
])
self
.
assertSameSet
(
res_cell
,
[
supply_cell
])
def
test_
02_checkLineIsReindexedOnSupplyChange
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_
checkLineIsReindexedOnSupplyChange
(
self
):
"""
"""
Check that Supply Line is properly reindexed (in predicate table)
Check that Supply Line is properly reindexed (in predicate table)
when date is change on Supply.
when date is change
d
on Supply.
"""
"""
if
not
run
:
return
original_date
=
DateTime
().
earliestTime
()
# lower precision of date
original_date
=
DateTime
().
earliestTime
()
# lower precision of date
new_date
=
DateTime
(
original_date
+
10
)
new_date
=
DateTime
(
original_date
+
10
)
...
@@ -194,20 +186,17 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -194,20 +186,17 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
self
.
tic
()
self
.
tic
()
# ...and check supply line
# ...and check supply line
kw
[
'predicate.uid'
]
=
supply_line
.
getUid
()
result
=
self
.
catalog_tool
(
**
kw
)
result
=
self
.
catalog_tool
(
**
kw
)
self
.
assertEquals
(
1
,
len
(
result
)
)
self
.
assertEquals
(
1
,
len
(
result
)
)
result
=
result
[
0
]
result
=
result
[
0
]
self
.
assertEquals
(
result
.
start_date_range_min
,
new_date
.
toZone
(
'UTC'
))
self
.
assertEquals
(
result
.
start_date_range_min
,
new_date
.
toZone
(
'UTC'
))
def
test_
03_SupplyLineApplied
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_
SupplyLineApplied
(
self
):
"""
"""
Test supply line being found.
Test supply line being found.
XXX: This tests fails for second run due to bug #1248.
XXX: This tests fails for second run due to bug #1248.
"""
"""
if
not
run
:
return
portal
=
self
.
portal
portal
=
self
.
portal
original_date
=
DateTime
().
earliestTime
()
original_date
=
DateTime
().
earliestTime
()
...
@@ -283,7 +272,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -283,7 +272,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
self
.
_testSubContentReindexing
(
generic_supply_line
,
[
generic_supply_cell
,
self
.
_testSubContentReindexing
(
generic_supply_line
,
[
generic_supply_cell
,
generic_supply_predicate
])
generic_supply_predicate
])
def
testSupplyCellPropertyAndAccessor
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
testSupplyCellPropertyAndAccessor
(
self
):
"""
"""
Check that getter/setter and get/setProperty methods works the same
Check that getter/setter and get/setProperty methods works the same
on supply cell. This test is added due to a bug introduced by revision
on supply cell. This test is added due to a bug introduced by revision
...
@@ -335,27 +324,18 @@ class TestPurchaseSupply(TestSaleSupply):
...
@@ -335,27 +324,18 @@ class TestPurchaseSupply(TestSaleSupply):
"""
"""
Test Purchase Supplies usage
Test Purchase Supplies usage
"""
"""
run_all_test
=
1
supply_portal_type
=
'Purchase Supply'
supply_portal_type
=
'Purchase Supply'
supply_line_portal_type
=
'Purchase Supply Line'
supply_line_portal_type
=
'Purchase Supply Line'
supply_cell_portal_type
=
'Purchase Supply Cell'
supply_cell_portal_type
=
'Purchase Supply Cell'
def
getTitle
(
self
):
return
"Purchase Supply"
class
TestInternalSupply
(
TestSaleSupply
):
class
TestInternalSupply
(
TestSaleSupply
):
"""
"""
Test Internal Supplies usage
Test Internal Supplies usage
"""
"""
run_all_test
=
1
supply_portal_type
=
'Internal Supply'
supply_portal_type
=
'Internal Supply'
supply_line_portal_type
=
'Internal Supply Line'
supply_line_portal_type
=
'Internal Supply Line'
supply_cell_portal_type
=
'Internal Supply Cell'
supply_cell_portal_type
=
'Internal Supply Cell'
def
getTitle
(
self
):
return
"Internal Supply"
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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