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
4f4ca158
Commit
4f4ca158
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
e71e9e31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
33 deletions
+31
-33
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+28
-9
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
...l_components/test.erp5.testSlapOSSubscriptionScenario.xml
+3
-24
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
4f4ca158
...
...
@@ -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
()
...
...
@@ -1244,12 +1259,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
()
...
...
@@ -1916,6 +1932,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
)
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
View file @
4f4ca158
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSSubscriptionScenario
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
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