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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
erp5
Commits
ff54401c
Commit
ff54401c
authored
Jun 08, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testInventoryAPI: stock cache is not flushed when a Inventory is indexed/desindexed
Mark the test as expected failure for now.
parent
20d2e959
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
0 deletions
+91
-0
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+91
-0
No files found.
product/ERP5/tests/testInventoryAPI.py
View file @
ff54401c
...
@@ -246,6 +246,28 @@ class InventoryAPITestCase(ERP5TypeTestCase):
...
@@ -246,6 +246,28 @@ class InventoryAPITestCase(ERP5TypeTestCase):
mvt
.
edit
(
**
kw
)
mvt
.
edit
(
**
kw
)
return
mvt
return
mvt
@
reindex
def
_makeInventory
(
self
,
**
kw
):
"""
Create inventory
"""
portal
=
self
.
getPortal
()
inventory_module
=
portal
.
getDefaultModule
(
portal_type
=
"Inventory Module"
)
inventory
=
inventory_module
.
newContent
(
portal_type
=
"Inventory"
)
kw
.
setdefault
(
'destination_section_value'
,
self
.
section
)
kw
.
setdefault
(
'source_section_value'
,
self
.
mirror_section
)
kw
.
setdefault
(
'destination_value'
,
self
.
node
)
kw
.
setdefault
(
'source_value'
,
self
.
mirror_node
)
kw
.
setdefault
(
'resource_value'
,
self
.
resource
)
inventory
.
edit
(
**
kw
)
inventory_line
=
inventory
.
newContent
(
portal_type
=
"Inventory Line"
)
inventory_line
.
edit
(
**
kw
)
inventory
.
deliver
()
return
inventory
@
reindex
@
reindex
def
_makeSimulationMovement
(
self
,
**
kw
):
def
_makeSimulationMovement
(
self
,
**
kw
):
"""Creates a simulation movement.
"""Creates a simulation movement.
...
@@ -3007,6 +3029,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3007,6 +3029,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
self
.
getInventory
(
optimisation__
=
False
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
))
**
inventory_kw
))
@
expectedFailure
def
test_12_CheckCacheFlush
(
self
):
def
test_12_CheckCacheFlush
(
self
):
"""
"""
Test the cache is flushed when indexing a movement into stock
Test the cache is flushed when indexing a movement into stock
...
@@ -3042,6 +3065,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3042,6 +3065,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
value
+
INVENTORY_QUANTITY_4
+
self
.
INVENTORY_QUANTITY_1
,
value
+
INVENTORY_QUANTITY_4
+
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
self
.
getInventory
(
**
inventory_kw
),
)
)
self
.
assertEqual
(
value
+
INVENTORY_QUANTITY_4
+
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
doubleStockValue
()
self
.
doubleStockValue
()
# Cache hit again
# Cache hit again
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -3060,6 +3087,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3060,6 +3087,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
value
+
INVENTORY_QUANTITY_4
+
3
*
self
.
INVENTORY_QUANTITY_1
,
value
+
INVENTORY_QUANTITY_4
+
3
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
self
.
getInventory
(
**
inventory_kw
),
)
)
self
.
assertEqual
(
value
+
INVENTORY_QUANTITY_4
+
3
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
doubleStockValue
()
self
.
doubleStockValue
()
# Cache hit again
# Cache hit again
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -3078,6 +3109,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3078,6 +3109,10 @@ class TestInventoryCacheTable(InventoryAPITestCase):
value
+
INVENTORY_QUANTITY_4
+
7
*
self
.
INVENTORY_QUANTITY_1
,
value
+
INVENTORY_QUANTITY_4
+
7
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
self
.
getInventory
(
**
inventory_kw
),
)
)
self
.
assertEqual
(
value
+
INVENTORY_QUANTITY_4
+
7
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
doubleStockValue
()
self
.
doubleStockValue
()
# Cache hit again
# Cache hit again
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -3096,12 +3131,68 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3096,12 +3131,68 @@ class TestInventoryCacheTable(InventoryAPITestCase):
value
+
15
*
self
.
INVENTORY_QUANTITY_1
,
value
+
15
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
self
.
getInventory
(
**
inventory_kw
),
)
)
self
.
assertEqual
(
value
+
15
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
doubleStockValue
()
self
.
doubleStockValue
()
# Cache hit again
# Cache hit again
self
.
assertEqual
(
self
.
assertEqual
(
value
+
15
*
self
.
INVENTORY_QUANTITY_1
,
value
+
15
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
self
.
getInventory
(
**
inventory_kw
),
)
)
self
.
assertEqual
(
value
+
31
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
# Create an inventory
INVENTORY_QUANTITY_5
=
0
inventory
=
self
.
_makeInventory
(
quantity
=
INVENTORY_QUANTITY_5
,
start_date
=
self
.
NOW
-
1
)
self
.
tic
()
self
.
assertEqual
(
INVENTORY_QUANTITY_5
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
assertEqual
(
INVENTORY_QUANTITY_5
,
self
.
getInventory
(
**
inventory_kw
),
)
self
.
doubleStockValue
()
# Cache hit again
self
.
assertEqual
(
value
+
63
*
self
.
INVENTORY_QUANTITY_1
-
value
-
31
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
assertEqual
(
INVENTORY_QUANTITY_5
,
self
.
getInventory
(
**
inventory_kw
),
)
# Delete inventory, so it gets unindexed and cache entry is flushed
self
.
portal
.
inventory_module
.
manage_delObjects
(
ids
=
[
inventory
.
getId
(),
])
self
.
tic
()
self
.
assertEqual
(
value
+
63
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
assertEqual
(
value
+
63
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
)
self
.
doubleStockValue
()
self
.
assertEqual
(
value
+
127
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
optimisation__
=
False
,
**
inventory_kw
),
)
self
.
assertEqual
(
value
+
63
*
self
.
INVENTORY_QUANTITY_1
,
self
.
getInventory
(
**
inventory_kw
),
)
def
test_13_CacheCreatedFromCache
(
self
):
def
test_13_CacheCreatedFromCache
(
self
):
"""
"""
...
...
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