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
Eric Zheng
slapos.core
Commits
c5630292
Commit
c5630292
authored
Dec 26, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Sale Packing List checking.
parent
aa637673
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
48 deletions
+77
-48
master/product/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
...ct/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
+68
-43
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
+9
-5
No files found.
master/product/Vifib/tests/testVifibInstanceHostingRelatedDocument.py
View file @
c5630292
import
unittest
import
unittest
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
Products.ERP5Type.DateUtils
import
getClosestDate
from
DateTime
import
DateTime
from
testVifibOpenOrderSimulation
import
generateTimeFrameList
class
TestVifibInstanceHostingRelatedDocument
(
TestVifibSlapWebServiceMixin
):
class
TestVifibInstanceHostingRelatedDocument
(
TestVifibSlapWebServiceMixin
):
...
@@ -8,37 +11,57 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
...
@@ -8,37 +11,57 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
self
.
portal
.
portal_alarms
.
vifib_trigger_build
.
activeSense
()
self
.
portal
.
portal_alarms
.
vifib_trigger_build
.
activeSense
()
def
stepCheckSubscriptionSalePackingListCoverage
(
self
,
sequence
,
**
kw
):
def
stepCheckSubscriptionSalePackingListCoverage
(
self
,
sequence
,
**
kw
):
raise
NotImplementedError
(
hosting_subscription
=
self
.
portal
.
portal_catalog
.
getResultValue
(
"Shall check that 12 SPLs are build to cover the whole year."
)
uid
=
sequence
[
'hosting_subscription_uid'
])
# check one more sale packing list is generated
delivery_list
=
self
.
portal
.
portal_catalog
(
# and only one sale packing list line is inside
portal_type
=
'Sale Packing List'
,
sale_packing_list
=
sequence
[
'current_sale_packing_list'
]
causality_relative_url
=
hosting_subscription
.
getRelativeUrl
(),
sale_packing_list_line_list
=
\
sort_on
=
((
'delivery.start_date'
,
'desc'
),)
sale_packing_list
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)
)
self
.
assertEquals
(
1
,
len
(
sale_packing_list_line_list
))
# is whole year covered?
sale_packing_list_line
=
sale_packing_list_line_list
[
0
]
self
.
assertEqual
(
12
,
len
(
delivery_list
))
# check sale packing list related property
# 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
)
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
(
hosting_subscription
.
getRelativeUrl
(),
delivery
.
getCausality
())
delivery_line_list
=
\
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)
self
.
assertEquals
(
1
,
len
(
delivery_line_list
))
delivery_line
=
delivery_line_list
[
0
]
self
.
assertEquals
(
"organisation_module/vifib_internet"
,
self
.
assertEquals
(
"organisation_module/vifib_internet"
,
sale_packing_list
.
getSource
())
delivery
.
getSource
())
self
.
assertEquals
(
"organisation_module/vifib_internet"
,
self
.
assertEquals
(
"organisation_module/vifib_internet"
,
sale_packing_list
.
getSourceSection
())
delivery
.
getSourceSection
())
self
.
assertEquals
(
"person_module/test_vifib_customer"
,
self
.
assertEquals
(
"person_module/test_vifib_customer"
,
sale_packing_list
.
getDestination
())
delivery
.
getDestination
())
self
.
assertEquals
(
"person_module/test_vifib_customer"
,
self
.
assertEquals
(
"person_module/test_vifib_customer"
,
sale_packing_list
.
getDestinationSection
())
delivery
.
getDestinationSection
())
self
.
assertEquals
(
"currency_module/EUR"
,
self
.
assertEquals
(
"currency_module/EUR"
,
sale_packing_list
.
getPriceCurrency
())
delivery
.
getPriceCurrency
())
# check sale packing list line related property
# check sale packing list line related property
self
.
assertEquals
(
"service_module/vifib_instance_subscription"
,
self
.
assertEquals
(
"service_module/vifib_instance_subscription"
,
sale_packing_list
_line
.
getResource
())
delivery
_line
.
getResource
())
self
.
assertEquals
(
1
,
self
.
assertEquals
(
1
,
sale_packing_list
_line
.
getQuantity
())
delivery
_line
.
getQuantity
())
self
.
assertEquals
(
"unit/piece"
,
self
.
assertEquals
(
"unit/piece"
,
sale_packing_list
_line
.
getQuantityUnit
())
delivery
_line
.
getQuantityUnit
())
self
.
assertEquals
(
1
,
self
.
assertEquals
(
1
,
sale_packing_list
_line
.
getPrice
())
delivery
_line
.
getPrice
())
# fetch open order, open order line and subscription
# fetch open order, open order line and subscription
person
=
self
.
portal
.
person_module
[
'test_vifib_customer'
]
person
=
self
.
portal
.
person_module
[
'test_vifib_customer'
]
...
@@ -49,8 +72,9 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
...
@@ -49,8 +72,9 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
# check related property
# check related property
self
.
assertEquals
(
open_order_line
.
getSpecialise
(),
self
.
assertEquals
(
open_order_line
.
getSpecialise
(),
sale_packing_list
.
getSpecialise
())
delivery
.
getSpecialise
())
idx
+=
1
def
stepCheckOneMoreDocumentList
(
self
,
sequence
,
**
kw
):
def
stepCheckOneMoreDocumentList
(
self
,
sequence
,
**
kw
):
hosting_subscription
=
self
.
portal
.
portal_catalog
\
hosting_subscription
=
self
.
portal
.
portal_catalog
\
...
@@ -117,6 +141,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
...
@@ -117,6 +141,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
"""
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
raise
NotImplementedError
(
'Cover various cases of triggering build'
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
master/product/Vifib/tests/testVifibOpenOrderSimulation.py
View file @
c5630292
...
@@ -5,6 +5,14 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin
...
@@ -5,6 +5,14 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from
DateTime.DateTime
import
DateTime
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
):
class
TestVifibOpenOrderSimulation
(
TestVifibSlapWebServiceMixin
):
def
stepCheckSimulationMovement
(
self
,
sequence
,
**
kw
):
def
stepCheckSimulationMovement
(
self
,
sequence
,
**
kw
):
...
@@ -76,11 +84,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
...
@@ -76,11 +84,7 @@ 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_list
=
[
start_date
]
expected_time_frame_list
=
generateTimeFrameList
(
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
))
# test the test: have we generated 12th next months coverage?
# test the test: have we generated 12th next months coverage?
self
.
assertEqual
(
13
,
len
(
expected_time_frame_list
))
self
.
assertEqual
(
13
,
len
(
expected_time_frame_list
))
...
...
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