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
Lisa Casino
slapos.core
Commits
45d912c5
Commit
45d912c5
authored
Mar 12, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update start and stop date assertions.
Also drop not needed methods.
parent
935ebff4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
22 deletions
+17
-22
master/product/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
...ct/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
+17
-14
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
+0
-8
No files found.
master/product/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
View file @
45d912c5
import
unittest
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
Products.ERP5Type.DateUtils
import
getClosestDate
from
Products.ERP5Type.DateUtils
import
getClosestDate
,
getNumberOfDayInMonth
from
DateTime
import
DateTime
from
testVifibOpenOrderSimulation
import
generateTimeFrameList
class
TestVifibInstanceHostingRelatedDocument
(
TestVifibSlapWebServiceMixin
):
...
...
@@ -18,20 +17,24 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
# is next month covered?
self
.
assertEqual
(
1
,
len
(
delivery_list
))
# generate the expected time frames
now
=
DateTime
()
start_date
=
\
getClosestDate
(
target_date
=
now
,
precision
=
'day'
,
before
=
1
)
# Calculate the list of time frames
expected_time_frame_list
=
generateTimeFrameList
(
start_date
)
instance_setup_delivery
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Packing List Line'
,
default_aggregate_uid
=
sequence
[
'software_instance_uid'
],
resource
=
self
.
portal
.
portal_preferences
\
.
getPreferredInstanceSetupResource
()).
getParentValue
()
self
.
assertEqual
(
'stopped'
,
instance_setup_delivery
.
getSimulationState
())
start_date
=
None
for
item
in
self
.
portal
.
portal_workflow
.
getInfoFor
(
ob
=
instance_setup_delivery
,
name
=
'history'
,
wf_id
=
'packing_list_workflow'
):
if
item
.
get
(
'simulation_state'
)
==
'stopped'
:
start_date
=
item
.
get
(
'time'
)
break
stop_date
=
start_date
+
getNumberOfDayInMonth
(
start_date
)
idx
=
0
for
delivery
in
delivery_list
:
expected_start_date
=
expected_time_frame_list
[
idx
]
expected_stop_date
=
expected_time_frame_list
[
idx
+
1
]
self
.
assertEqual
(
expected_start_date
,
delivery
.
getStartDate
())
self
.
assertEqual
(
expected_stop_date
,
delivery
.
getStopDate
())
self
.
assertEqual
(
start_date
,
delivery
.
getStartDate
())
self
.
assertEqual
(
stop_date
,
delivery
.
getStopDate
())
self
.
assertEqual
(
hosting_subscription
.
getRelativeUrl
(),
delivery
.
getCausality
())
...
...
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
View file @
45d912c5
...
...
@@ -5,14 +5,6 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from
DateTime.DateTime
import
DateTime
def
generateTimeFrameList
(
start_date
):
expected_time_frame_list
=
[
start_date
]
current
=
\
getClosestDate
(
target_date
=
start_date
,
precision
=
'month'
,
before
=
0
)
for
m
in
range
(
0
,
12
):
expected_time_frame_list
.
append
(
addToDate
(
current
,
month
=
m
))
return
expected_time_frame_list
class
TestVifibOpenOrderSimulation
(
TestVifibSlapWebServiceMixin
):
def
stepCheckSimulationMovement
(
self
,
sequence
,
**
kw
):
...
...
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