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
Léo-Paul Géneau
slapos.core
Commits
5ea9b36b
Commit
5ea9b36b
authored
Jul 08, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Add and Fix tests
See merge request
nexedi/slapos.core!398
parents
9ece0e53
a5d42aa3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
265 additions
and
6 deletions
+265
-6
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getAttentionPointList.py
...skins/slapos_hal_json_style/Base_getAttentionPointList.py
+0
-1
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+244
-2
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
..._tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
+11
-2
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
...tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
+10
-1
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getAttentionPointList.py
View file @
5ea9b36b
from
json
import
dumps
attention_point_list
=
[]
portal
=
context
.
getPortalObject
()
portal_type
=
context
.
getPortalType
()
...
...
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
5ea9b36b
...
...
@@ -1245,6 +1245,248 @@ class TestSoftwareInstance_getConnectionParameterList(TestSlapOSHalJsonStyleMixi
{
"connection_key"
:
"p1"
,
"connection_value"
:
"DEF"
}]
)
class
TestBase_getAttentionPointList
(
TestSlapOSHalJsonStyleMixin
):
def
afterSetUp
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
preference
.
setPreferredCloudContractEnabled
(
True
)
self
.
tic
()
TestSlapOSHalJsonStyleMixin
.
afterSetUp
(
self
)
def
test_Base_getAttentionPointList_no_cloud_contract
(
self
):
self
.
login
()
expected_list
=
[{
"text"
:
"Your Contract is Deactivated"
,
'page'
:
"slap_request_contract_activation"
}]
self
.
assertEqual
(
expected_list
,
json
.
loads
(
self
.
portal
.
instance_tree_module
.
Base_getAttentionPointList
()))
person
=
self
.
_makePerson
(
user
=
1
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
expected_list
=
[{
"text"
:
"Your Contract is Deactivated"
,
'page'
:
"slap_request_contract_activation"
}]
self
.
assertEqual
(
expected_list
,
json
.
loads
(
person
.
Base_getAttentionPointList
()))
self
.
login
()
instance_tree
=
self
.
_makeInstanceTree
()
self
.
tic
()
expected_list
=
[{
"text"
:
"Your Contract is Deactivated"
,
'page'
:
"slap_request_contract_activation"
}]
self
.
assertEqual
(
expected_list
,
json
.
loads
(
instance_tree
.
Base_getAttentionPointList
()))
def
test_Base_getAttentionPointList_support_request_related_to_compute_node
(
self
):
document
=
self
.
_makeComputeNode
()
self
.
login
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
document
)
ticket
.
submit
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
ticket
.
validate
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
ticket
.
suspend
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
self
.
assertIn
({
"text"
:
"Ticket waiting your response"
,
"link"
:
ticket
.
getRelativeUrl
()},
attention_point_list
)
ticket
.
invalidate
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
\ No newline at end of file
def
test_Base_getAttentionPointList_support_request_related_to_instance_tree
(
self
):
self
.
login
()
document
=
self
.
_makeInstanceTree
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
document
)
ticket
.
submit
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
# 1 is due cloud contract
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
ticket
.
validate
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
ticket
.
suspend
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
2
)
self
.
assertIn
({
"text"
:
"Ticket waiting your response"
,
"link"
:
ticket
.
getRelativeUrl
()},
attention_point_list
)
ticket
.
invalidate
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
document
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
def
test_Base_getAttentionPointList_regularisation_request
(
self
):
support_request_module
=
self
.
portal
.
support_request_module
self
.
login
()
ticket
=
self
.
portal
.
regularisation_request_module
.
newContent
(
\
title
=
"Test Regularisation Request %s"
%
self
.
new_id
)
person
=
self
.
_makePerson
(
user
=
1
)
ticket
.
setDestinationDecision
(
person
.
getRelativeUrl
())
ticket
.
submit
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
login
()
ticket
.
validate
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
login
()
ticket
.
suspend
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
self
.
assertEqual
(
attention_point_list
[
0
][
"text"
],
"Regularisation waiting your response"
)
self
.
assertEqual
(
attention_point_list
[
0
][
"link"
],
ticket
.
getRelativeUrl
())
self
.
login
()
ticket
.
invalidate
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
def
test_Base_getAttentionPointList_support_request
(
self
):
support_request_module
=
self
.
portal
.
support_request_module
self
.
login
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
person
=
self
.
_makePerson
(
user
=
1
)
ticket
.
setDestinationDecision
(
person
.
getRelativeUrl
())
ticket
.
submit
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
login
()
ticket
.
validate
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
login
()
ticket
.
suspend
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
self
.
assertEqual
(
attention_point_list
[
0
][
"text"
],
"Ticket waiting your response"
)
self
.
assertEqual
(
attention_point_list
[
0
][
"link"
],
ticket
.
getRelativeUrl
())
self
.
login
()
ticket
.
invalidate
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
def
test_Base_getAttentionPointList_upgrade_decision
(
self
):
support_request_module
=
self
.
portal
.
support_request_module
self
.
login
()
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
\
title
=
"Test Upgrade Decision %s"
%
self
.
new_id
)
person
=
self
.
_makePerson
(
user
=
1
)
ticket
.
setDestinationDecision
(
person
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
self
.
login
()
ticket
.
confirm
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
len
(
attention_point_list
),
1
)
self
.
assertEqual
(
attention_point_list
[
0
][
"text"
],
"Please Upgrade this service"
)
self
.
assertEqual
(
attention_point_list
[
0
][
"link"
],
ticket
.
getRelativeUrl
())
self
.
login
()
ticket
.
start
()
self
.
login
(
person
.
getUserId
())
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
attention_point_list
=
json
.
loads
(
support_request_module
.
Base_getAttentionPointList
())
self
.
assertEqual
(
attention_point_list
,
[])
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
View file @
5ea9b36b
...
...
@@ -222,8 +222,17 @@
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/click_proceed"
/>
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/wait_for_content_loaded"
/>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_event_discussion_entry.html')]//div[@class="slapos-event-discussion-message-header"]
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_event_discussion_entry.html')]//div[@class="slapos-event-discussion-message-header"]
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page"
/>
<tal:block
define=
"menu_item python: 'Servers'; header menu_item"
>
...
...
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
View file @
5ea9b36b
...
...
@@ -343,7 +343,16 @@
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/click_proceed"
/>
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/wait_for_content_loaded"
/>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_event_discussion_entry.html')]//div[@class="slapos-event-discussion-message-header"]
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_event_discussion_entry.html')]//div[@class="slapos-event-discussion-message-header"]
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page"
/>
...
...
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