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
d56e95bf
Commit
d56e95bf
authored
May 30, 2013
by
Tatuya Kamada
Committed by
Arnaud Fontaine
Jul 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revive a test which is wrongly removed at ec80f06e1b6f40cbc99b249e21a77b3138d10980.
parent
ba0bf09c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
0 deletions
+124
-0
product/ERP5/tests/testInventory.py
product/ERP5/tests/testInventory.py
+124
-0
No files found.
product/ERP5/tests/testInventory.py
View file @
d56e95bf
...
...
@@ -2530,6 +2530,89 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
def
stepCreateTwoResourceFullInventory
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" Create a full Inventory which includes two inventory lines """
inventory
=
self
.
createInventory
(
sequence
=
sequence
)
inventory_list
=
sequence
.
get
(
'inventory_list'
,[])
inventory
.
edit
(
full_inventory
=
True
)
inventory_line
=
inventory
.
newContent
(
portal_type
=
self
.
inventory_line_portal_type
,
resource_value
=
sequence
.
get
(
"first_resource"
),
inventory
=
10
)
inventory_line
=
inventory
.
newContent
(
portal_type
=
self
.
inventory_line_portal_type
,
resource_value
=
sequence
.
get
(
"second_resource"
),
inventory
=
100
)
inventory
.
deliver
()
inventory_list
.
append
(
inventory
)
sequence
.
edit
(
inventory_list
=
inventory_list
)
def
stepCreateTwoResourceFullInventoryAtTheDate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" Create Full Inventory at the date' """
inventory_list
=
sequence
.
get
(
'inventory_list'
,[])
if
kw
.
get
(
'start_date'
,
None
)
is
not
None
:
start_date
=
kw
[
'start_date'
]
else
:
start_date
=
'2013/03/12 00:00:00 GMT+9'
if
kw
.
get
(
'inventory1'
,
None
)
is
not
None
:
inventory1
=
kw
[
'inventory1'
]
else
:
inventory_1
=
10
if
kw
.
get
(
'inventory2'
,
None
)
is
not
None
:
inventory2
=
kw
[
'inventory2'
]
else
:
inventory2
=
100
inventory
=
self
.
createInventory
(
sequence
=
sequence
)
inventory_list
=
sequence
.
get
(
'inventory_list'
,[])
inventory
.
edit
(
full_inventory
=
True
,
start_date
=
start_date
)
inventory_line
=
inventory
.
newContent
(
portal_type
=
self
.
inventory_line_portal_type
,
resource_value
=
sequence
.
get
(
"resource"
),
inventory
=
inventory1
)
inventory_line
=
inventory
.
newContent
(
portal_type
=
self
.
inventory_line_portal_type
,
resource_value
=
sequence
.
get
(
"second_resource"
),
inventory
=
inventory2
)
inventory
.
deliver
()
inventory_list
.
append
(
inventory
)
sequence
.
edit
(
inventory_list
=
inventory_list
)
def
stepCreateTwoResourceFullInventoryAtTheDate1
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
params
=
dict
(
start_date
=
self
.
two_resource_full_inventory1_start_date
,
inventory1
=
self
.
two_resource_full_inventory1_inventory_1
,
inventory2
=
self
.
two_resource_full_inventory1_inventory_2
)
self
.
stepCreateTwoResourceFullInventoryAtTheDate
(
sequence
,
sequence_list
,
**
params
)
def
stepCreateTwoResourceFullInventoryAtTheDate2
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
params
=
dict
(
start_date
=
self
.
two_resource_full_inventory2_start_date
,
inventory1
=
self
.
two_resource_full_inventory2_inventory_1
,
inventory2
=
self
.
two_resource_full_inventory2_inventory_2
)
self
.
stepCreateTwoResourceFullInventoryAtTheDate
(
sequence
,
sequence_list
,
**
params
)
def
stepCheckFullInventoryUpdateWithValidDateOrder
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
resource_value
=
sequence
.
get
(
'resource'
)
second_resource_value
=
sequence
.
get
(
'second_resource'
)
node_value
=
sequence
.
get
(
'node'
)
section_value
=
sequence
.
get
(
'section'
)
self
.
_testGetInventory
(
expected
=
100
,
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
resource_value
.
getUid
())
self
.
_testGetInventory
(
expected
=
0
,
section_uid
=
section_value
.
getUid
(),
node_uid
=
node_value
.
getUid
(),
resource_uid
=
second_resource_value
.
getUid
())
def
test_01_getInventory
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
...
...
@@ -3399,6 +3482,47 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_17_FullInventoryUpdateWithValidDateOrder
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Confirm Full inventory update with a valid start_date order
The case is:
1) full inventory: 2013/02/01,section=A, node=B, resource=X, quantity=15
resource=Y, quantity=20
2) full inventory: 2013/02/02,section=A, node=B, resource=X, quantity=20
resource=Y, quantity=50
3) full inventory: 2013/02/10,section=A, node=B, resource=X, quantity=100
-> X:100
Y:0 # creates a dummy movement with quantity=-50
[test]
getInventory(resource=X, to_date=2013/02/15) should return 100
getInventory(resource=Y, to_date=2013/02/15) should return 0
"""
if
not
run
:
return
self
.
two_resource_full_inventory1_start_date
=
'2013/02/01 00:00:00 GMT+9'
self
.
two_resource_full_inventory1_inventory_1
=
15
self
.
two_resource_full_inventory1_inventory_2
=
20
self
.
two_resource_full_inventory2_start_date
=
'2013/02/02 00:00:00 GMT+9'
self
.
two_resource_full_inventory2_inventory_1
=
20
self
.
two_resource_full_inventory2_inventory_2
=
50
self
.
full_inventory_start_date_1
=
'2013/02/10 00:00:00 GMT+9'
sequence_list
=
SequenceList
()
sequence_string
=
'CreateOrganisationsForModule
\
CreateNotVariatedResource
\
CreateNotVariatedSecondResource
\
CreateTwoResourceFullInventoryAtTheDate1
\
Tic
\
CreateTwoResourceFullInventoryAtTheDate2
\
Tic
\
CreateFullInventoryAtTheDate1
\
Tic
\
CheckFullInventoryUpdateWithValidDateOrder
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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