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
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
erp5
Commits
de5c3155
Commit
de5c3155
authored
May 30, 2013
by
Tatuya Kamada
Committed by
Arnaud Fontaine
Jul 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit Test: Move the test steps to the right place, and Correct the comments.
parent
d56e95bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
74 deletions
+72
-74
product/ERP5/tests/testInventory.py
product/ERP5/tests/testInventory.py
+72
-74
No files found.
product/ERP5/tests/testInventory.py
View file @
de5c3155
...
...
@@ -2614,6 +2614,78 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
node_uid
=
node_value
.
getUid
(),
resource_uid
=
second_resource_value
.
getUid
())
def
stepDubleStockValue
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Make stock table double
"""
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"UPDATE stock SET quantity=quantity*2
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepHalfStockValue
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Make stock table half
"""
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"UPDATE stock SET quantity=quantity/2
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepClearInventoryCache
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Explicitly Clear invenvory cache.
"""
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"DELETE FROM inventory_cache
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepCheckCorruptedCacheHasFixedByReindex
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Make sure that corrupted caches are ignored when inventory document
are reindexing.
"""
resource_value
=
sequence
.
get
(
'resource'
)
node_value
=
sequence
.
get
(
'node'
)
section_value
=
sequence
.
get
(
'section'
)
self
.
_testGetInventory
(
expected
=
100
,
optimise
=
True
,
to_date
=
DateTime
(
self
.
full_inventory_start_date_1
),
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
self
.
_testGetInventory
(
expected
=
100
,
optimise__
=
False
,
to_date
=
DateTime
(
self
.
full_inventory_start_date_1
),
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
def
stepStoreWrongCache
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Cache a corrupted stock data.
"""
node_value
=
sequence
.
get
(
'node'
)
to_date
=
DateTime
(
self
.
two_resource_full_inventory2_start_date
)
self
.
getPortalObject
().
portal_simulation
.
getCurrentInventoryList
(
to_date
=
to_date
,
node
=
node_value
.
getRelativeUrl
(),
group_by_variation
=
1
,
group_by_sub_variation
=
1
,
group_by_resource
=
1
)
def
test_01_getInventory
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Test the getInventory methods
...
...
@@ -3344,80 +3416,6 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
sorted
([(
movement
.
getResourceUid
(),
movement
.
getQuantity
())
for
movement
in
full_inventory_2
.
getMovementList
()]))
def
stepImmediateReindexTheLatestInventory
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
inventory_list
=
sequence
.
get
(
'inventory_list'
)
sorted_list
=
sorted
(
inventory_list
,
key
=
lambda
inventory
:
inventory
.
getStartDate
())
latest_inventory
=
sorted_list
[
-
1
]
latest_inventory
.
immediateReindexObject
()
def
stepDubleStockValue
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Make stock table inconsistent so that we can check that
optimisation is well used
"""
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"UPDATE stock SET quantity=quantity*2
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepHalfStockValue
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Make stock table inconsistent so that we can check that
optimisation is well used
"""
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"UPDATE stock SET quantity=quantity/2
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepClearInventoryCache
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
getPortalObject
().
erp5_sql_transactionless_connection
.
manage_test
(
"BEGIN
\
0
"
"DELETE FROM inventory_cache
\
0
"
"COMMIT"
)
self
.
commit
()
def
stepCheckCorruptedCacheHasFixedByReindex
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
resource_value
=
sequence
.
get
(
'resource'
)
node_value
=
sequence
.
get
(
'node'
)
section_value
=
sequence
.
get
(
'section'
)
self
.
_testGetInventory
(
expected
=
100
,
optimise
=
True
,
to_date
=
DateTime
(
self
.
full_inventory_start_date_1
),
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
self
.
_testGetInventory
(
expected
=
100
,
optimise__
=
False
,
to_date
=
DateTime
(
self
.
full_inventory_start_date_1
),
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
def
stepStoreWrongCache
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Cache a corrupted stock data.
"""
node_value
=
sequence
.
get
(
'node'
)
to_date
=
DateTime
(
self
.
two_resource_full_inventory2_start_date
)
self
.
getPortalObject
().
portal_simulation
.
getCurrentInventoryList
(
to_date
=
to_date
,
node
=
node_value
.
getRelativeUrl
(),
group_by_variation
=
1
,
group_by_sub_variation
=
1
,
group_by_resource
=
1
)
@
expectedFailure
def
test_16_CorruptedInventoryCacheAndFullInventory
(
self
,
quiet
=
0
,
run
=
run_all_test
):
...
...
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