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
Eric Zheng
slapos.core
Commits
24e1810d
Commit
24e1810d
authored
Jun 10, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Include tests for HostingSubscription_edit
parent
cc7de675
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
326 additions
and
2 deletions
+326
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/HostingSubscription_edit.py
...l_skins/slapos_hal_json_style/HostingSubscription_edit.py
+1
-2
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+325
-0
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/HostingSubscription_edit.py
View file @
24e1810d
request
=
context
.
REQUEST
request
=
context
.
REQUEST
edit_kw
=
{}
edit_kw
=
{}
if
monitor_scope
is
not
None
and
monitor_scope
!=
context
.
getMonitorScope
():
if
monitor_scope
is
not
None
and
monitor_scope
!=
context
.
getMonitorScope
():
...
@@ -29,4 +28,4 @@ if 'software_type' in request and isSoftwareTypeChanged(request['software_type']
...
@@ -29,4 +28,4 @@ if 'software_type' in request and isSoftwareTypeChanged(request['software_type']
raise
ValueError
(
"Change Software Type is forbidden."
)
raise
ValueError
(
"Change Software Type is forbidden."
)
if
context
.
getTextContent
()
!=
text_content
:
if
context
.
getTextContent
()
!=
text_content
:
context
.
HostingSubscription_requestPerson
(
instance_xml
=
request
[
'text_content'
]
)
context
.
HostingSubscription_requestPerson
(
instance_xml
=
text_content
)
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
24e1810d
...
@@ -835,6 +835,331 @@ class TestBase_getComputerToken(TestSlapOSHalJsonStyleMixin):
...
@@ -835,6 +835,331 @@ class TestBase_getComputerToken(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
"One Time Restricted Access Token"
,
token
.
getPortalType
())
self
.
assertEqual
(
"One Time Restricted Access Token"
,
token
.
getPortalType
())
class
TestHostingSubscription_edit
(
TestSlapOSHalJsonStyleMixin
):
def
afterSetUp
(
self
):
TestSlapOSHalJsonStyleMixin
.
afterSetUp
(
self
)
self
.
changeSkin
(
'Hal'
)
def
test_HostingSubscription_edit
(
self
):
self
.
_makeTree
()
self
.
hosting_subscription
.
edit
(
monitor_scope
=
"enabled"
,
upgrade_scope
=
"auto"
,
short_title
=
"X"
,
description
=
"Y"
)
original_parameter
=
self
.
hosting_subscription
.
getTextContent
()
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
()
)
self
.
assertEqual
(
"enabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"auto"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
"X1"
,
description
=
"Y1"
,
monitor_scope
=
"disabled"
,
upgrade_scope
=
"disabled"
)
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X1"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y1"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
# Check if owner can edit it
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
()
)
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X1"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y1"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
"X2"
,
description
=
"Y2"
,
monitor_scope
=
"enabled"
,
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"enabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"auto"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X2"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y2"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
def
test_HostingSubscription_edit_request
(
self
):
self
.
_makeTree
()
kw
=
dict
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
())
original_parameter
=
self
.
hosting_subscription
.
getTextContent
()
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
new_parameter
=
self
.
generateSafeXml
()
kw
[
'text_content'
]
=
new_parameter
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertNotEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
hosting_subscription
.
getTextContent
())
# Check if owner can edit it
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
original_parameter
=
new_parameter
new_parameter
=
self
.
generateSafeXml
()
kw
[
'text_content'
]
=
new_parameter
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertNotEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
hosting_subscription
.
getTextContent
())
def
test_HostingSubscription_edit_shared_instance
(
self
):
self
.
_makeTree
()
project
=
self
.
_makeProject
()
self
.
hosting_subscription
.
edit
(
monitor_scope
=
"enabled"
,
upgrade_scope
=
"auto"
,
short_title
=
"X"
,
description
=
"Y"
)
self
.
person_user
.
newContent
(
portal_type
=
"Assignment"
,
destination_project_value
=
project
).
open
()
another_person
=
self
.
_makePerson
(
user
=
1
)
another_person
.
newContent
(
portal_type
=
"Assignment"
,
destination_project_value
=
project
).
open
()
# Place instances on the project
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
assertEqual
(
self
.
hosting_subscription
.
HostingSubscription_createMovement
(
destination_project
=
project
.
getRelativeUrl
()),
None
)
self
.
login
()
self
.
tic
()
self
.
assertEqual
(
self
.
hosting_subscription
.
Item_getCurrentProjectValue
(),
project
)
original_parameter
=
self
.
hosting_subscription
.
getTextContent
()
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
()
)
self
.
assertEqual
(
"enabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"auto"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
"X1"
,
description
=
"Y1"
,
monitor_scope
=
"disabled"
,
upgrade_scope
=
"disabled"
)
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X1"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y1"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
# Check if owner can edit it
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
()
)
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X1"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y1"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
"X2"
,
description
=
"Y2"
,
monitor_scope
=
"enabled"
,
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"enabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"auto"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X2"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y2"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
logout
()
self
.
login
(
another_person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
()
)
self
.
assertEqual
(
"enabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"auto"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X2"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y2"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
hosting_subscription
.
HostingSubscription_edit
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
"X3"
,
description
=
"Y3"
,
monitor_scope
=
"disabled"
,
upgrade_scope
=
"disabled"
)
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getMonitorScope
())
self
.
assertEqual
(
"disabled"
,
self
.
hosting_subscription
.
getUpgradeScope
())
self
.
assertEqual
(
"X3"
,
self
.
hosting_subscription
.
getShortTitle
())
self
.
assertEqual
(
"Y3"
,
self
.
hosting_subscription
.
getDescription
())
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
def
test_HostingSubscription_edit_shared_instance_request
(
self
):
self
.
_makeTree
()
project
=
self
.
_makeProject
()
self
.
hosting_subscription
.
edit
(
monitor_scope
=
"enabled"
,
upgrade_scope
=
"auto"
,
short_title
=
"X"
,
description
=
"Y"
)
self
.
person_user
.
newContent
(
portal_type
=
"Assignment"
,
destination_project_value
=
project
).
open
()
another_person
=
self
.
_makePerson
(
user
=
1
)
another_person
.
newContent
(
portal_type
=
"Assignment"
,
destination_project_value
=
project
).
open
()
# Place instances on the project
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
assertEqual
(
self
.
hosting_subscription
.
HostingSubscription_createMovement
(
destination_project
=
project
.
getRelativeUrl
()),
None
)
self
.
login
()
self
.
tic
()
self
.
assertEqual
(
self
.
hosting_subscription
.
Item_getCurrentProjectValue
(),
project
)
kw
=
dict
(
text_content
=
self
.
hosting_subscription
.
getTextContent
(),
short_title
=
self
.
hosting_subscription
.
getShortTitle
(),
description
=
self
.
hosting_subscription
.
getDescription
())
original_parameter
=
self
.
hosting_subscription
.
getTextContent
()
self
.
changeSkin
(
"Hal"
)
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
new_parameter
=
self
.
generateSafeXml
()
kw
[
'text_content'
]
=
new_parameter
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertNotEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
hosting_subscription
.
getTextContent
())
# Check if owner can edit it
self
.
logout
()
self
.
login
(
self
.
person_user
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
original_parameter
=
new_parameter
new_parameter
=
self
.
generateSafeXml
()
kw
[
'text_content'
]
=
new_parameter
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertNotEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
login
(
another_person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
original_parameter
=
new_parameter
new_parameter
=
self
.
generateSafeXml
()
kw
[
'text_content'
]
=
new_parameter
self
.
hosting_subscription
.
HostingSubscription_edit
(
**
kw
)
self
.
assertNotEqual
(
original_parameter
,
self
.
hosting_subscription
.
getTextContent
())
self
.
assertEqual
(
new_parameter
,
self
.
hosting_subscription
.
getTextContent
())
...
...
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