Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Cédric Le Ninivin
slapos.core
Commits
38c1eacc
Commit
38c1eacc
authored
Dec 26, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop date is exclusive.
parent
71f99fb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
+11
-15
No files found.
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
View file @
38c1eacc
import
unittest
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.DateUtils
import
getClosestDate
,
addToDate
,
\
atTheEndOfPeriod
from
Products.ERP5Type.DateUtils
import
getClosestDate
,
addToDate
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
DateTime.DateTime
import
DateTime
...
...
@@ -77,32 +76,29 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
0.0
,
open_order_line
.
getStopDate
().
second
())
# Calculate the list of time frames
expected_time_frame_tuple_list
=
[(
start_date
,
(
atTheEndOfPeriod
(
start_date
,
'month'
)
-
1
).
latestTime
())]
# now 11 months in form: 2022/02/01 00:00, 2022/02/28 23:59
expected_time_frame_list
=
[
start_date
]
current
=
\
getClosestDate
(
target_date
=
start_date
,
precision
=
'month'
,
before
=
1
)
for
m
in
range
(
1
,
12
):
expected_time_frame_tuple_list
.
append
((
current
,
(
addToDate
(
current
,
month
=
1
)
-
1
).
latestTime
()))
current
=
addToDate
(
current
,
month
=
1
)
getClosestDate
(
target_date
=
start_date
,
precision
=
'month'
,
before
=
0
)
for
m
in
range
(
0
,
12
):
expected_time_frame_list
.
append
(
addToDate
(
current
,
month
=
m
))
# test the test: have we generated 12th months coverage?
self
.
assertEqual
(
1
2
,
len
(
expected_time_frame_tupl
e_list
))
# test the test: have we generated 12th
next
months coverage?
self
.
assertEqual
(
1
3
,
len
(
expected_time_fram
e_list
))
simulation_movement_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Simulation Movement'
,
parent_uid
=
applied_rule
.
getUid
(),
sort_on
=
((
'movement.start_date'
,
'desc'
),)
)
# Check that simulation is created by the periodicity
self
.
assertEquals
(
len
(
expected_time_frame_tuple_list
)
,
# Check that simulation is created by the periodicity
for one year
self
.
assertEquals
(
12
,
len
(
simulation_movement_list
))
# Check the list of expected simulation
idx
=
0
for
simulation_movement
in
simulation_movement_list
:
excepted_start_date
=
expected_time_frame_tuple_list
[
idx
][
0
]
excepted_stop_date
=
expected_time_frame_tuple_list
[
idx
][
1
]
idx
+=
1
excepted_start_date
=
expected_time_frame_list
[
idx
]
excepted_stop_date
=
expected_time_frame_list
[
idx
+
1
]
# Check simulation movement property
self
.
assertEquals
(
1.0
,
simulation_movement
.
getQuantity
())
...
...
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