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
Labels
Merge Requests
17
Merge Requests
17
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
nexedi
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
import
unittest
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.DateUtils
import
getClosestDate
,
addToDate
,
\
from
Products.ERP5Type.DateUtils
import
getClosestDate
,
addToDate
atTheEndOfPeriod
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
DateTime.DateTime
import
DateTime
from
DateTime.DateTime
import
DateTime
...
@@ -77,32 +76,29 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
...
@@ -77,32 +76,29 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
0.0
,
open_order_line
.
getStopDate
().
second
())
0.0
,
open_order_line
.
getStopDate
().
second
())
# Calculate the list of time frames
# Calculate the list of time frames
expected_time_frame_tuple_list
=
[(
start_date
,
(
atTheEndOfPeriod
(
start_date
,
'month'
)
-
1
).
latestTime
())]
expected_time_frame_list
=
[
start_date
]
# now 11 months in form: 2022/02/01 00:00, 2022/02/28 23:59
current
=
\
current
=
\
getClosestDate
(
target_date
=
start_date
,
precision
=
'month'
,
before
=
1
)
getClosestDate
(
target_date
=
start_date
,
precision
=
'month'
,
before
=
0
)
for
m
in
range
(
1
,
12
):
for
m
in
range
(
0
,
12
):
expected_time_frame_tuple_list
.
append
((
current
,
(
addToDate
(
current
,
month
=
1
)
-
1
).
latestTime
()))
expected_time_frame_list
.
append
(
addToDate
(
current
,
month
=
m
))
current
=
addToDate
(
current
,
month
=
1
)
# test the test: have we generated 12th months coverage?
# test the test: have we generated 12th
next
months coverage?
self
.
assertEqual
(
1
2
,
len
(
expected_time_frame_tupl
e_list
))
self
.
assertEqual
(
1
3
,
len
(
expected_time_fram
e_list
))
simulation_movement_list
=
self
.
portal
.
portal_catalog
(
simulation_movement_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Simulation Movement'
,
portal_type
=
'Simulation Movement'
,
parent_uid
=
applied_rule
.
getUid
(),
parent_uid
=
applied_rule
.
getUid
(),
sort_on
=
((
'movement.start_date'
,
'desc'
),)
sort_on
=
((
'movement.start_date'
,
'desc'
),)
)
)
# Check that simulation is created by the periodicity
# Check that simulation is created by the periodicity
for one year
self
.
assertEquals
(
len
(
expected_time_frame_tuple_list
)
,
self
.
assertEquals
(
12
,
len
(
simulation_movement_list
))
len
(
simulation_movement_list
))
# Check the list of expected simulation
# Check the list of expected simulation
idx
=
0
idx
=
0
for
simulation_movement
in
simulation_movement_list
:
for
simulation_movement
in
simulation_movement_list
:
excepted_start_date
=
expected_time_frame_tuple_list
[
idx
][
0
]
excepted_start_date
=
expected_time_frame_list
[
idx
]
excepted_stop_date
=
expected_time_frame_tuple_list
[
idx
][
1
]
excepted_stop_date
=
expected_time_frame_list
[
idx
+
1
]
idx
+=
1
# Check simulation movement property
# Check simulation movement property
self
.
assertEquals
(
1.0
,
self
.
assertEquals
(
1.0
,
simulation_movement
.
getQuantity
())
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