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
Xiaowu Zhang
slapos.core
Commits
5245afa5
Commit
5245afa5
authored
Nov 15, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify asserting.
Check simulation only once.
parent
0bf6489d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
49 deletions
+42
-49
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5DefaultScenario.py
...os_erp5/TestTemplateItem/testSlapOSERP5DefaultScenario.py
+41
-48
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5DefaultScenario.py
View file @
5245afa5
...
...
@@ -369,8 +369,7 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
def
assertHostingSubscriptionSimulationCoverage
(
self
,
subscription
,
level
=
1
):
def
assertHostingSubscriptionSimulationCoverage
(
self
,
subscription
):
self
.
login
()
applied_rule_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Applied Rule'
,
causality_uid
=
subscription
.
getUid
())
...
...
@@ -391,32 +390,36 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
simulation_movement
.
getStartDate
().
day
())
self
.
assertEqual
(
subscription
.
getPeriodicityMonthDay
(),
simulation_movement
.
getStopDate
().
day
())
delivery_line
=
simulation_movement
.
getDeliveryValue
()
self
.
assertNotEqual
(
None
,
delivery_line
)
delivery
=
delivery_line
.
getParentValue
()
self
.
assertEqual
(
'Sale Packing List'
,
delivery
.
getPortalType
())
self
.
assertEqual
(
'delivered'
,
delivery
.
getSimulationState
())
causality_state
=
delivery
.
getCausalityState
()
self
.
assertEqual
(
'solved'
,
causality_state
)
applied_rule_list_l2
=
simulation_movement
.
contentValues
(
portal_type
=
'Applied Rule'
)
if
level
==
1
:
self
.
assertEqual
(
0
,
len
(
applied_rule_list_l2
))
else
:
raise
NotImplementedError
def
assertHostingSubscriptionRelatedDeliveryList
(
self
,
subscription
,
causality_state
=
'building'
):
self
.
login
()
applied_rule_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Applied Rule'
,
causality_uid
=
subscription
.
getUid
())
self
.
assertEqual
(
1
,
len
(
applied_rule_list
))
applied_rule
=
applied_rule_list
[
0
]
simulation_movement_list
=
applied_rule
.
contentValues
(
self
.
assertEqual
(
1
,
len
(
applied_rule_list_l2
))
invoice_applied_rule
=
applied_rule_list_l2
[
0
]
invoice_simulation_movement_list
=
invoice_applied_rule
.
contentValues
(
portal_type
=
'Simulation Movement'
)
self
.
assertNotEqual
(
0
,
len
(
simulation_movement_list
))
for
simulation_movement
in
simulation_movement_list
:
self
.
assertNotEqual
(
None
,
simulation_movement
.
getDelivery
())
delivery_line
=
simulation_movement
.
getDeliveryValue
()
self
.
assertEqual
(
1
,
len
(
invoice_simulation_movement_list
))
invoice_simulation_movement
=
invoice_simulation_movement_list
[
0
]
self
.
assertEqual
(
open_sale_order_line_template
.
getResource
(),
invoice_simulation_movement
.
getResource
())
self
.
assertEqual
(
subscription
.
getRelativeUrl
(),
invoice_simulation_movement
.
getAggregate
())
delivery_line
=
invoice_simulation_movement
.
getDeliveryValue
()
self
.
assertNotEqual
(
None
,
delivery_line
)
delivery
=
delivery_line
.
getParentValue
()
self
.
assertEqual
(
'Sale Packing List'
,
delivery
.
getPortalType
())
self
.
assertEqual
(
'Sale Invoice Transaction'
,
delivery
.
getPortalType
())
self
.
assertEqual
(
'delivered'
,
delivery
.
getSimulationState
())
self
.
assertEqual
(
causality_state
,
delivery
.
getCausalityState
())
causality_state
=
delivery
.
getCausalityState
()
self
.
assertEqual
(
'solved'
,
causality_state
)
def
assertOpenSaleOrderCoverage
(
self
,
person_reference
):
self
.
login
()
...
...
@@ -577,39 +580,28 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self
.
assertOpenSaleOrderCoverage
(
friend_reference
)
self
.
assertOpenSaleOrderCoverage
(
public_reference
)
#
check the Subscription Simulation
#
generate simulation for open order
self
.
stepCallUpdateOpenOrderSimulationAlarm
()
self
.
tic
()
for
person_reference
in
(
owner_reference
,
friend_reference
,
public_reference
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
reference
=
person_reference
)
for
subscription
in
self
.
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
default_destination_section_uid
=
person
.
getUid
()):
self
.
assertHostingSubscriptionSimulationCoverage
(
subscription
.
getObject
())
# check the generated Subscription Sale Packing Lists
# build subscription packing list
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
for
person_reference
in
(
owner_reference
,
friend_reference
,
public_reference
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
reference
=
person_reference
)
for
subscription
in
self
.
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
default_destination_section_uid
=
person
.
getUid
()):
self
.
assertHostingSubscriptionRelatedDeliveryList
(
subscription
.
getObject
())
# stabilise build deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# check causality solving and simulation expand
# build invoices
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
# stabilise built invoices and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# check final simulation state
for
person_reference
in
(
owner_reference
,
friend_reference
,
public_reference
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
...
...
@@ -617,5 +609,6 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
for
subscription
in
self
.
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
default_destination_section_uid
=
person
.
getUid
()):
self
.
assertHostingSubscriptionRelatedDeliveryList
(
subscription
.
getObject
(),
causality_state
=
'solved'
)
self
.
assertHostingSubscriptionSimulationCoverage
(
subscription
.
getObject
())
raise
NotImplementedError
(
'Waiting for implementation of payment'
)
master/bt5/slapos_erp5/bt/revision
View file @
5245afa5
93
\ No newline at end of file
94
\ No newline at end of file
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