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
Titouan Soulard
slapos.core
Commits
4d5af958
Commit
4d5af958
authored
Apr 11, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: test: create project by doing a subscription request
parent
a2017340
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
51 deletions
+21
-51
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+21
-51
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
4d5af958
...
...
@@ -147,6 +147,18 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
"""Overwrite this function on project context to tweak production focus tests"""
pass
def
addAccountingManagerAssignment
(
self
,
person
):
person
.
newContent
(
portal_type
=
'Assignment'
,
function
=
'accounting/manager'
).
open
()
def
addSaleManagerAssignment
(
self
,
person
):
person
.
newContent
(
portal_type
=
'Assignment'
,
function
=
'sale/manager'
).
open
()
def
addProjectProductionManagerAssignment
(
self
,
person
,
project
):
person
.
newContent
(
portal_type
=
'Assignment'
,
...
...
@@ -161,59 +173,17 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
function
=
'customer'
).
open
()
def
addProject
(
self
,
is_accountable
=
False
):
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'project-%s'
%
self
.
generateNewId
()
)
if
is_accountable
:
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
"Currency"
,
reference
=
"test-currency-%s"
%
self
.
generateNewId
(),
short_title
=
"tc%s"
%
self
.
generateNewId
(),
base_unit_quantity
=
0.01
)
currency
.
validate
()
def
addProject
(
self
,
organisation
=
None
,
currency
=
None
,
person
=
None
,
is_accountable
=
False
):
# Action to submit project subscription
service
=
self
.
portal
.
restrictedTraverse
(
'service_module/slapos_virtual_master_subscription'
)
subscription_request
=
service
.
Resource_createSubscriptionRequest
(
person
,
None
)
self
.
tic
()
seller_organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
"Organisation"
,
title
=
"test-seller-%s"
%
self
.
generateNewId
()
)
seller_bank_account
=
seller_organisation
.
newContent
(
portal_type
=
"Bank Account"
,
title
=
"test_bank_account_%s"
%
self
.
generateNewId
()
)
seller_organisation
.
validate
()
self
.
portal
.
portal_alarms
.
slapos_subscription_request_validate_submitted
.
activeSense
()
self
.
tic
()
self
.
logout
()
sale_trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'seller_organisation_%s'
%
seller_organisation
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
destination_project_value
=
project
,
source_value
=
seller_organisation
,
source_section_value
=
seller_organisation
,
source_payment_value
=
seller_bank_account
,
price_currency_value
=
currency
)
sale_trade_condition
.
newContent
(
portal_type
=
"Trade Model Line"
,
reference
=
"VAT"
,
resource
=
"service_module/slapos_tax"
,
base_application
=
"base_amount/invoicing/taxable"
,
trade_phase
=
"slapos/tax"
,
price
=
0.2
,
quantity
=
1.0
,
membership_criterion_base_category
=
(
'price_currency'
,),
membership_criterion_category
=
(
'price_currency/%s'
%
currency
.
getRelativeUrl
(),)
)
sale_trade_condition
.
validate
()
# XXX Is it a good idea to have a cross relation?
project
.
edit
(
specialise_value
=
sale_trade_condition
)
project
.
validate
()
return
project
return
subscription_request
.
getAggregate
()
def
_addERP5Login
(
self
,
document
,
**
kw
):
if
document
.
getPortalType
()
==
"Person"
:
...
...
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