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
df3a8f07
Commit
df3a8f07
authored
Jun 08, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testInventoryAPI: silent pyflakes warnings
parent
d5eb5803
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
31 deletions
+26
-31
bt5/tmp_work/TestTemplateItem/portal_components/test.erp5.testInventoryAPI.py
...plateItem/portal_components/test.erp5.testInventoryAPI.py
+26
-31
No files found.
bt5/tmp_work/TestTemplateItem/portal_components/test.erp5.testInventoryAPI.py
View file @
df3a8f07
...
@@ -625,9 +625,9 @@ class TestInventory(InventoryAPITestCase):
...
@@ -625,9 +625,9 @@ class TestInventory(InventoryAPITestCase):
self
.
assertNotEquals
(
len
(
node_list
),
0
)
self
.
assertNotEquals
(
len
(
node_list
),
0
)
# getInventory on node uid for all member of a category ...
# getInventory on node uid for all member of a category ...
total_quantity
=
sum
([
quantity_for_node
[
node
]
for
node
in
node_list
])
total_quantity
=
sum
([
quantity_for_node
[
x
]
for
x
in
node_list
])
self
.
assertInventoryEquals
(
total_quantity
,
self
.
assertInventoryEquals
(
total_quantity
,
node_uid
=
[
node
.
getUid
()
for
node
in
node_list
])
node_uid
=
[
x
.
getUid
()
for
x
in
node_list
])
# ... is equivalent to node_category
# ... is equivalent to node_category
self
.
assertInventoryEquals
(
total_quantity
,
self
.
assertInventoryEquals
(
total_quantity
,
node_category
=
category
.
getRelativeUrl
())
node_category
=
category
.
getRelativeUrl
())
...
@@ -1141,8 +1141,8 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1141,8 +1141,8 @@ class TestInventoryList(InventoryAPITestCase):
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
self
.
section
.
setGroup
(
'level1'
)
self
.
section
.
setGroup
(
'level1'
)
self
.
other_section
.
setGroup
(
'level1'
)
self
.
other_section
.
setGroup
(
'level1'
)
m1
=
self
.
_makeMovement
(
quantity
=
2
)
self
.
_makeMovement
(
quantity
=
2
)
m2
=
self
.
_makeMovement
(
destination_section_value
=
self
.
other_section
,
quantity
=
3
)
self
.
_makeMovement
(
destination_section_value
=
self
.
other_section
,
quantity
=
3
)
inventory_list
=
getInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
inventory_list
=
getInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
section_category
=
'group/level1'
,
section_category
=
'group/level1'
,
...
@@ -1158,8 +1158,8 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1158,8 +1158,8 @@ class TestInventoryList(InventoryAPITestCase):
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
self
.
section
.
setGroup
(
'level1'
)
self
.
section
.
setGroup
(
'level1'
)
self
.
other_section
.
setGroup
(
'level1'
)
self
.
other_section
.
setGroup
(
'level1'
)
m1
=
self
.
_makeMovement
(
quantity
=
2
)
self
.
_makeMovement
(
quantity
=
2
)
m2
=
self
.
_makeMovement
(
destination_section_value
=
self
.
other_section
,
quantity
=
3
)
self
.
_makeMovement
(
destination_section_value
=
self
.
other_section
,
quantity
=
3
)
inventory_list
=
getInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
inventory_list
=
getInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
section_category
=
'group/level1'
,
section_category
=
'group/level1'
,
...
@@ -1819,7 +1819,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -1819,7 +1819,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
start_date
=
DateTime
(
2001
,
1
,
1
)
start_date
=
DateTime
(
2001
,
1
,
1
)
stop_date
=
DateTime
(
2002
,
2
,
2
)
stop_date
=
DateTime
(
2002
,
2
,
2
)
mvt
=
self
.
_makeMovement
(
quantity
=
100
,
self
.
_makeMovement
(
quantity
=
100
,
start_date
=
start_date
,
start_date
=
start_date
,
stop_date
=
stop_date
)
stop_date
=
stop_date
)
# start_date is for source
# start_date is for source
...
@@ -1849,9 +1849,9 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -1849,9 +1849,9 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
testResource
(
self
):
def
testResource
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
mvt
=
self
.
_makeMovement
(
quantity
=
100
)
self
.
_makeMovement
(
quantity
=
100
)
another_resource
=
self
.
_makeResource
()
another_resource
=
self
.
_makeResource
()
another_mvt
=
self
.
_makeMovement
(
quantity
=
3
,
self
.
_makeMovement
(
quantity
=
3
,
resource_value
=
another_resource
)
resource_value
=
another_resource
)
# we can query resource directly by uid
# we can query resource directly by uid
mvt_history_list
=
getMovementHistoryList
(
mvt_history_list
=
getMovementHistoryList
(
...
@@ -1873,7 +1873,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -1873,7 +1873,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
testSectionCategory
(
self
):
def
testSectionCategory
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
self
.
section
.
setGroup
(
'level1/level2'
)
self
.
section
.
setGroup
(
'level1/level2'
)
mvt
=
self
.
_makeMovement
(
quantity
=
100
)
self
.
_makeMovement
(
quantity
=
100
)
# for section category, both exact category or any parent category works
# for section category, both exact category or any parent category works
# section_category can also be a list.
# section_category can also be a list.
...
@@ -1897,7 +1897,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -1897,7 +1897,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
# it is currently invalid to pass the same category twice to inventory API
# it is currently invalid to pass the same category twice to inventory API
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
self
.
section
.
setGroup
(
'level1/level2'
)
self
.
section
.
setGroup
(
'level1/level2'
)
mvt
=
self
.
_makeMovement
(
quantity
=
100
)
self
.
_makeMovement
(
quantity
=
100
)
movement_history_list
=
getMovementHistoryList
(
movement_history_list
=
getMovementHistoryList
(
section_category
=
[
'group/level1'
,
section_category
=
[
'group/level1'
,
'group/level1/level2'
])
'group/level1/level2'
])
...
@@ -1909,7 +1909,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -1909,7 +1909,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
self
.
section
.
setGroup
(
'level1/level2'
)
self
.
section
.
setGroup
(
'level1/level2'
)
self
.
node
.
setGroup
(
'level1'
)
self
.
node
.
setGroup
(
'level1'
)
mvt
=
self
.
_makeMovement
(
quantity
=
100
)
self
.
_makeMovement
(
quantity
=
100
)
valid_category_list
=
[
'group/level1'
,
valid_category_list
=
[
'group/level1'
,
[
'group/level1'
,
'group/anotherlevel'
],
[
'group/level1'
,
'group/anotherlevel'
],
...
@@ -2275,7 +2275,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2275,7 +2275,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
testSameNodeDifferentDates
(
self
):
def
testSameNodeDifferentDates
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
date
=
DateTime
()
date
=
DateTime
()
mvt
=
self
.
_makeMovement
(
quantity
=
2
,
self
.
_makeMovement
(
quantity
=
2
,
start_date
=
date
,
start_date
=
date
,
stop_date
=
date
+
1
,
stop_date
=
date
+
1
,
source_value
=
self
.
node
,
source_value
=
self
.
node
,
...
@@ -2288,7 +2288,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2288,7 +2288,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
testSameNodeSameDates
(
self
):
def
testSameNodeSameDates
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
mvt
=
self
.
_makeMovement
(
quantity
=
2
,
self
.
_makeMovement
(
quantity
=
2
,
start_date
=
DateTime
(),
start_date
=
DateTime
(),
source_value
=
self
.
node
,
source_value
=
self
.
node
,
destination_value
=
self
.
node
)
destination_value
=
self
.
node
)
...
@@ -2299,7 +2299,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2299,7 +2299,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
testSameNodeSameDatesSameSections
(
self
):
def
testSameNodeSameDatesSameSections
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
mvt
=
self
.
_makeMovement
(
quantity
=
2
,
self
.
_makeMovement
(
quantity
=
2
,
start_date
=
DateTime
(),
start_date
=
DateTime
(),
source_value
=
self
.
node
,
source_value
=
self
.
node
,
destination_value
=
self
.
node
,
destination_value
=
self
.
node
,
...
@@ -2378,8 +2378,8 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2378,8 +2378,8 @@ class TestMovementHistoryList(InventoryAPITestCase):
def
test_OmitAssetIncreaseDecrease
(
self
):
def
test_OmitAssetIncreaseDecrease
(
self
):
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
m1
=
self
.
_makeMovement
(
quantity
=
1
,
price
=-
1
)
self
.
_makeMovement
(
quantity
=
1
,
price
=-
1
)
m2
=
self
.
_makeMovement
(
quantity
=-
1
,
price
=-
1
)
self
.
_makeMovement
(
quantity
=-
1
,
price
=-
1
)
mvt_history_list
=
getMovementHistoryList
(
node_uid
=
self
.
node
.
getUid
(),
mvt_history_list
=
getMovementHistoryList
(
node_uid
=
self
.
node
.
getUid
(),
omit_asset_increase
=
1
)
omit_asset_increase
=
1
)
self
.
assertEqual
(
1
,
len
(
mvt_history_list
))
self
.
assertEqual
(
1
,
len
(
mvt_history_list
))
...
@@ -2516,7 +2516,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
...
@@ -2516,7 +2516,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
m2
=
delivery
.
newContent
(
portal_type
=
'Dummy Movement'
,
quantity
=
1
,
m2
=
delivery
.
newContent
(
portal_type
=
'Dummy Movement'
,
quantity
=
1
,
price
=
2
,
resource_value
=
self
.
resource
,
price
=
2
,
resource_value
=
self
.
resource
,
start_date
=
DateTime
(
2010
,
1
,
1
))
start_date
=
DateTime
(
2010
,
1
,
1
))
m3
=
delivery
.
newContent
(
portal_type
=
'Dummy Movement'
,
quantity
=
1
,
delivery
.
newContent
(
portal_type
=
'Dummy Movement'
,
quantity
=
1
,
price
=
7
,
resource_value
=
self
.
other_resource
,
price
=
7
,
resource_value
=
self
.
other_resource
,
start_date
=
DateTime
(
2010
,
1
,
2
))
start_date
=
DateTime
(
2010
,
1
,
2
))
self
.
commit
();
self
.
commit
();
...
@@ -2777,9 +2777,6 @@ class TestTrackingList(InventoryAPITestCase):
...
@@ -2777,9 +2777,6 @@ class TestTrackingList(InventoryAPITestCase):
item_a
=
data_dict
[
'item_a'
]
item_a
=
data_dict
[
'item_a'
]
item_b
=
data_dict
[
'item_b'
]
item_b
=
data_dict
[
'item_b'
]
node_b
=
data_dict
[
'node_b'
]
node_b
=
data_dict
[
'node_b'
]
movement_a
=
data_dict
[
'movement_a'
]
movement_b
=
data_dict
[
'movement_b'
]
movement_c
=
data_dict
[
'movement_c'
]
getTrackingList
=
self
.
portal
.
portal_simulation
.
getTrackingList
getTrackingList
=
self
.
portal
.
portal_simulation
.
getTrackingList
path_list
=
[
i
.
path
for
i
in
getTrackingList
(
path_list
=
[
i
.
path
for
i
in
getTrackingList
(
...
@@ -3308,7 +3305,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3308,7 +3305,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
# Create an old movement
# Create an old movement
INVENTORY_QUANTITY_4
=
100
INVENTORY_QUANTITY_4
=
100
INVENTORY_DATE_4
=
self
.
NOW
-
3
*
self
.
CACHE_LAG
INVENTORY_DATE_4
=
self
.
NOW
-
3
*
self
.
CACHE_LAG
movement
=
self
.
_makeMovement
(
quantity
=
INVENTORY_QUANTITY_4
,
self
.
_makeMovement
(
quantity
=
INVENTORY_QUANTITY_4
,
start_date
=
INVENTORY_DATE_4
,
start_date
=
INVENTORY_DATE_4
,
simulation_state
=
'delivered'
)
simulation_state
=
'delivered'
)
# Get inventory in past so that cache is filled
# Get inventory in past so that cache is filled
...
@@ -3374,7 +3371,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
...
@@ -3374,7 +3371,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
# Create a new movement, indexation should not fail
# Create a new movement, indexation should not fail
INVENTORY_QUANTITY_4
=
5000
INVENTORY_QUANTITY_4
=
5000
INVENTORY_DATE_4
=
self
.
CACHE_DATE
INVENTORY_DATE_4
=
self
.
CACHE_DATE
movement
=
self
.
_makeMovement
(
self
.
_makeMovement
(
quantity
=
INVENTORY_QUANTITY_4
,
quantity
=
INVENTORY_QUANTITY_4
,
start_date
=
INVENTORY_DATE_4
,
start_date
=
INVENTORY_DATE_4
,
simulation_state
=
'delivered'
,
simulation_state
=
'delivered'
,
...
@@ -3945,5 +3942,3 @@ def test_suite():
...
@@ -3945,5 +3942,3 @@ def test_suite():
suite
.
addTest
(
unittest
.
makeSuite
(
TestUnitConversionDefinition
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestUnitConversionDefinition
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestUnitConversionBackwardCompatibility
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestUnitConversionBackwardCompatibility
))
return
suite
return
suite
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