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
ee7be573
Commit
ee7be573
authored
Sep 08, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add some inventory API test for domain_selection
Currently, the domain selection is implictly on node_category
parent
545ba6b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+39
-1
No files found.
product/ERP5/tests/testInventoryAPI.py
View file @
ee7be573
...
...
@@ -29,7 +29,7 @@
"""Unit Tests for Inventory API.
TODO: test variation
test selection_
domain, selection_
report
test selection_report
"""
import
os
...
...
@@ -172,6 +172,8 @@ class InventoryAPITestCase(ERP5TypeTestCase):
'product_line/anotherlevel'
,
'use/use1/use11'
,
'use/use1/use12'
,
'site/site1'
,
'site/site2'
,
'function/function1'
,
'function/function1/function2'
,
'ledger/accounting'
,
...
...
@@ -1443,6 +1445,24 @@ class TestInventoryList(InventoryAPITestCase):
checkInventory
(
line
=
3
,
type
=
'Future'
,
source
=
1
,
quantity
=-
9
)
checkInventory
(
line
=
3
,
type
=
'Future'
,
destination
=
1
,
quantity
=
9
)
def
test_node_selection_domain
(
self
):
self
.
node
.
setSite
(
'site1'
)
self
.
other_node
.
setSite
(
'site2'
)
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
self
.
_makeMovement
(
quantity
=
2
,
destination_value
=
self
.
node
)
self
.
_makeMovement
(
quantity
=
3
,
destination_value
=
self
.
other_node
)
site1_mvt_history_list
=
getInventoryList
(
selection_domain
=
{
'site'
:
(
'portal_categories'
,
'site/site1'
)})
self
.
assertEqual
(
1
,
len
(
site1_mvt_history_list
))
self
.
assertEqual
(
2
,
site1_mvt_history_list
[
0
].
total_quantity
)
site2_mvt_history_list
=
getInventoryList
(
selection_domain
=
{
'site'
:
(
'portal_categories'
,
'site/site2'
)})
self
.
assertEqual
(
1
,
len
(
site2_mvt_history_list
))
self
.
assertEqual
(
3
,
site2_mvt_history_list
[
0
].
total_quantity
)
def
test_inventory_asset_price
(
self
):
# examples from http://accountinginfo.com/study/inventory/inventory-120.htm
movement_list
=
[
...
...
@@ -2471,6 +2491,24 @@ class TestMovementHistoryList(InventoryAPITestCase):
self
.
assertEqual
(
7
,
mvt_history_list
[
1
].
total_price
)
self
.
assertEqual
(
12
,
mvt_history_list
[
1
].
running_total_price
)
def
test_node_selection_domain
(
self
):
self
.
node
.
setSite
(
'site1'
)
self
.
other_node
.
setSite
(
'site2'
)
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
self
.
_makeMovement
(
quantity
=
2
,
destination_value
=
self
.
node
)
self
.
_makeMovement
(
quantity
=
3
,
destination_value
=
self
.
other_node
)
site1_mvt_history_list
=
getMovementHistoryList
(
selection_domain
=
{
'site'
:
(
'portal_categories'
,
'site/site1'
)})
self
.
assertEqual
(
1
,
len
(
site1_mvt_history_list
))
self
.
assertEqual
(
2
,
site1_mvt_history_list
[
0
].
total_quantity
)
site2_mvt_history_list
=
getMovementHistoryList
(
selection_domain
=
{
'site'
:
(
'portal_categories'
,
'site/site2'
)})
self
.
assertEqual
(
1
,
len
(
site2_mvt_history_list
))
self
.
assertEqual
(
3
,
site2_mvt_history_list
[
0
].
total_quantity
)
class
TestNextNegativeInventoryDate
(
InventoryAPITestCase
):
"""Tests getInventory methods.
...
...
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