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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
a6030b16
Commit
a6030b16
authored
Jun 09, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: subscription scenario needs project now
parent
9bae8434
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+28
-9
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
a6030b16
...
...
@@ -75,8 +75,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
slapos_pre_payment_template
.
\
updateLocalRolesOnSecurityGroups
()
self
.
subscription_project
=
self
.
createProject
()
# One user to create compute_nodes to deploy the subscription
self
.
createAdminUser
()
self
.
createAdminUser
(
self
.
subscription_project
)
self
.
cleanUpNotificationMessage
()
self
.
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Active Process'
,
...
...
@@ -161,6 +163,14 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
if
str
(
notification_message
.
getVersion
(
""
))
==
"999"
:
notification_message
.
invalidate
()
def
createProject
(
self
):
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'project-%s'
%
self
.
generateNewId
()
)
project
.
validate
()
return
project
def
createNotificationMessage
(
self
,
reference
,
content_type
=
'text/html'
,
language
=
"en"
,
text_content
=
'${name} ${login_name} ${login_password}'
):
...
...
@@ -177,7 +187,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
notification_message
.
validate
()
return
notification_message
def
createAdminUser
(
self
):
def
createAdminUser
(
self
,
project
):
""" Create a Admin user, to manage compute_nodes and instances eventually """
admin_user_login
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
...
...
@@ -193,15 +203,18 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
portal_type
=
"ERP5 Login"
,
reference
=
"admin_user"
).
validate
()
admin_user
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
project
,
function
=
'computer/manager'
).
open
()
admin_user
.
edit
(
first_name
=
"Admin User"
,
reference
=
"Admin_user"
,
default_email_text
=
"do_not_reply_to_admin@example.org"
,
)
for
assignment
in
admin_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
admin_user
.
validate
()
self
.
admin_user
=
admin_user
else
:
...
...
@@ -290,7 +303,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
source_payment
=
self
.
expected_source_section
+
"/bank_account"
,
price_currency
=
"currency_module/EUR"
,
payment_mode
=
'payzen'
,
specialise
=
"sale_trade_condition_module/slapos_subscription_trade_condition"
specialise
=
"sale_trade_condition_module/slapos_subscription_trade_condition"
,
#follow_up_value=self.subscription_project
)
# XXX TODO clarify the with / without tax
sale_trade_condition
.
newContent
(
...
...
@@ -318,7 +332,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
sla_xml
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
,
text_content
=
'<?xml version="1.0" encoding="utf-8"?>
\
n
<instance>
\
n
</instance>'
,
user_input
=
{},
specialise_value
=
sale_trade_condition
specialise_value
=
sale_trade_condition
,
follow_up_value
=
self
.
subscription_project
)
self
.
subscription_condition
.
validate
()
self
.
tic
()
...
...
@@ -1235,12 +1250,13 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Create a Public Server for admin user, and allow
subscription_server_title
=
'Trial Public Server for Admin User %s'
%
self
.
new_id
subscription_server_id
=
self
.
requestComputeNode
(
subscription_server_title
)
subscription_server_id
=
self
.
requestComputeNode
(
subscription_server_title
,
self
.
subscription_project
.
getReference
())
subscription_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
subscription_server_id
)
self
.
setAccessToMemcached
(
subscription_server
)
self
.
assertNotEqual
(
None
,
subscription_server
)
self
.
setServerOpenSubscription
(
subscription_server
)
self
.
assertEqual
(
'open'
,
subscription_server
.
getCapacityScope
()
)
# and install some software on them
subscription_server_software
=
self
.
subscription_condition
.
getUrlString
()
...
...
@@ -1893,6 +1909,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
class
TestSlapOSSubscriptionScenario
(
TestSlapOSSubscriptionScenarioMixin
):
def
test_new_subscription_scenario_with_single_vm
(
self
):
self
.
_test_subscription_scenario
(
amount
=
1
)
def
test_subscription_scenario_with_single_vm
(
self
):
self
.
_test_subscription_scenario
(
amount
=
1
)
...
...
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