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
Laurent S
erp5
Commits
bc447f2b
Commit
bc447f2b
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
2572999b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+40
-1
No files found.
product/ERP5/tests/testInventoryAPI.py
View file @
bc447f2b
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
"""Unit Tests for Inventory API.
"""Unit Tests for Inventory API.
TODO: test variation
TODO: test variation
test selection_
domain, selection_
report
test selection_report
"""
"""
import
os
import
os
...
@@ -172,6 +172,9 @@ class InventoryAPITestCase(ERP5TypeTestCase):
...
@@ -172,6 +172,9 @@ class InventoryAPITestCase(ERP5TypeTestCase):
'product_line/anotherlevel'
,
'product_line/anotherlevel'
,
'use/use1/use11'
,
'use/use1/use11'
,
'use/use1/use12'
,
'use/use1/use12'
,
'site/site1'
,
'site/site2'
,
'use/use1/use12'
,
'function/function1'
,
'function/function1'
,
'function/function1/function2'
,
'function/function1/function2'
,
'ledger/accounting'
,
'ledger/accounting'
,
...
@@ -1443,6 +1446,24 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1443,6 +1446,24 @@ class TestInventoryList(InventoryAPITestCase):
checkInventory
(
line
=
3
,
type
=
'Future'
,
source
=
1
,
quantity
=-
9
)
checkInventory
(
line
=
3
,
type
=
'Future'
,
source
=
1
,
quantity
=-
9
)
checkInventory
(
line
=
3
,
type
=
'Future'
,
destination
=
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
):
def
test_inventory_asset_price
(
self
):
# examples from http://accountinginfo.com/study/inventory/inventory-120.htm
# examples from http://accountinginfo.com/study/inventory/inventory-120.htm
movement_list
=
[
movement_list
=
[
...
@@ -2471,6 +2492,24 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2471,6 +2492,24 @@ class TestMovementHistoryList(InventoryAPITestCase):
self
.
assertEqual
(
7
,
mvt_history_list
[
1
].
total_price
)
self
.
assertEqual
(
7
,
mvt_history_list
[
1
].
total_price
)
self
.
assertEqual
(
12
,
mvt_history_list
[
1
].
running_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
):
class
TestNextNegativeInventoryDate
(
InventoryAPITestCase
):
"""Tests getInventory methods.
"""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