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
Jérome Perrin
slapos.core
Commits
6db7919b
Commit
6db7919b
authored
Nov 21, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover slapos_sale_packing_list_builder
parent
c524da25
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
1 deletion
+131
-1
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingBuilder.py
...ccounting/TestTemplateItem/testSlapOSAccountingBuilder.py
+129
-0
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
master/bt5/slapos_accounting/bt/template_test_id_list
master/bt5/slapos_accounting/bt/template_test_id_list
+1
-0
No files found.
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingBuilder.py
0 → 100644
View file @
6db7919b
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
from
DateTime
import
DateTime
def
convertCategoryList
(
base
,
l
):
return
[
'%s/%s'
%
(
base
,
q
)
for
q
in
l
]
class
TestSlapOSSalePackingListBuilder
(
testSlapOSMixin
):
def
test
(
self
):
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
applied_rule
=
self
.
portal
.
portal_simulation
.
newContent
(
portal_type
=
'Applied Rule'
,
causality
=
hosting_subscription
.
getRelativeUrl
(),
specialise
=
'portal_rules/slapos_subscription_item_rule'
)
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
simulation_movement_kw
=
dict
(
portal_type
=
'Simulation Movement'
,
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
causality
=
[
'business_process_module/slapos_sale_business_process'
'/deliver'
,
'business_process_module/slapos_sale_business_pr'
'ocess/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
'organisation_module/slapos'
,
source_section
=
'organisation_module/slapos'
,
specialise
=
'sale_trade_condition_module/slapos_trade_condition'
,
trade_phase
=
'slapos/delivery'
,
use
=
'trade/sale'
,
)
simulation_movement_1
=
applied_rule
.
newContent
(
quantity
=
1.2
,
price
=
3.4
,
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
**
simulation_movement_kw
)
simulation_movement_2
=
applied_rule
.
newContent
(
quantity
=
5.6
,
price
=
7.8
,
start_date
=
DateTime
(
'2012/03/01'
),
stop_date
=
DateTime
(
'2012/04/01'
),
**
simulation_movement_kw
)
self
.
tic
()
self
.
portal
.
portal_deliveries
.
slapos_sale_packing_list_builder
.
build
(
path
=
'%s/%%'
%
applied_rule
.
getPath
())
self
.
tic
()
def
checkSimulationMovement
(
simulation_movement
):
self
.
assertEqual
(
1.0
,
simulation_movement
.
getDeliveryRatio
())
self
.
assertEqual
(
0.0
,
simulation_movement
.
getDeliveryError
())
self
.
assertNotEqual
(
None
,
simulation_movement
.
getDeliveryValue
())
checkSimulationMovement
(
simulation_movement_1
)
checkSimulationMovement
(
simulation_movement_2
)
delivery_line_1
=
simulation_movement_1
.
getDeliveryValue
()
delivery_line_2
=
simulation_movement_2
.
getDeliveryValue
()
self
.
assertNotEqual
(
delivery_line_1
.
getRelativeUrl
(),
delivery_line_2
.
getRelativeUrl
())
def
checkDeliveryLine
(
simulation_movement
,
delivery_line
):
self
.
assertEqual
(
'Sale Packing List Line'
,
delivery_line
.
getPortalType
())
self
.
assertSameSet
([
'resource/service_module/slapos_instance_subscription'
,
'use/trade/sale'
,
'quantity_unit/unit/piece'
,
'base_contribution/base_amount/invoicing/discounted'
,
'base_contribution/base_amount/invoicing/taxable'
]
\
+
convertCategoryList
(
'aggregate'
,
simulation_movement
.
getAggregateList
()),
delivery_line
.
getCategoryList
()
)
self
.
assertEqual
(
simulation_movement
.
getQuantity
(),
delivery_line
.
getQuantity
())
self
.
assertEqual
(
simulation_movement
.
getPrice
(),
delivery_line
.
getPrice
())
self
.
assertFalse
(
delivery_line
.
hasStartDate
())
self
.
assertFalse
(
delivery_line
.
hasStopDate
())
checkDeliveryLine
(
simulation_movement_1
,
delivery_line_1
)
checkDeliveryLine
(
simulation_movement_2
,
delivery_line_2
)
delivery_1
=
delivery_line_1
.
getParentValue
()
delivery_2
=
delivery_line_2
.
getParentValue
()
def
checkDelivery
(
simulation_movement
,
delivery
):
self
.
assertEqual
(
'Sale Packing List'
,
delivery
.
getPortalType
())
self
.
assertEqual
(
'delivered'
,
delivery
.
getSimulationState
())
self
.
assertEqual
(
'building'
,
delivery
.
getCausalityState
())
self
.
assertEqual
(
simulation_movement
.
getStartDate
(),
delivery
.
getStartDate
())
self
.
assertEqual
(
simulation_movement
.
getStopDate
(),
delivery
.
getStopDate
())
self
.
assertSameSet
([
'source/organisation_module/slapos'
,
'source_section/organisation_module/slapos'
,
'price_currency/currency_module/EUR'
,
'specialise/sale_trade_condition_module/slapos_trade_condition'
]
\
+
convertCategoryList
(
'destination'
,
simulation_movement
.
getDestinationList
())
\
+
convertCategoryList
(
'destination_section'
,
simulation_movement
.
getDestinationSectionList
())
\
+
convertCategoryList
(
'destination_decision'
,
simulation_movement
.
getDestinationDecisionList
())
\
+
convertCategoryList
(
'causality'
,
simulation_movement
.
getParentValue
().
getCausalityList
()),
delivery
.
getCategoryList
())
checkDelivery
(
simulation_movement_1
,
delivery_1
)
checkDelivery
(
simulation_movement_2
,
delivery_2
)
master/bt5/slapos_accounting/bt/revision
View file @
6db7919b
105
106
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_accounting/bt/template_test_id_list
View file @
6db7919b
testSlapOSAccountingAlarm
testSlapOSAccountingAlarm
testSlapOSAccountingBuilder
testSlapOSAccountingConstraint
testSlapOSAccountingConstraint
testSlapOSAccountingInteractionWorkflow
testSlapOSAccountingInteractionWorkflow
testSlapOSAccountingRule
testSlapOSAccountingRule
\ 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