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
e0110082
Commit
e0110082
authored
Sep 25, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: ComputeNode_checkAndUpdateAllocationScope was dropped
parent
fb5ed64f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
161 deletions
+1
-161
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+1
-161
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
e0110082
...
...
@@ -23,7 +23,7 @@
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
simulate
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
from
DateTime
import
DateTime
from
App.Common
import
rfc1123_date
...
...
@@ -455,166 +455,6 @@ class TestSlapOSComputeNode_getTicketRelatedList(TestCRMSkinsMixin):
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
class
TestSlapOSComputeNode_notifyWrongAllocationScope
(
TestCRMSkinsMixin
):
def
afterSetUp
(
self
):
TestCRMSkinsMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
self
.
_cancelTestSupportRequestList
(
title
=
"%%TESTCOMPT-%"
)
def
_getGeneratedSupportRequest
(
self
,
compute_node
):
request_title
=
'%%We have changed allocation scope for %s'
%
\
compute_node
.
getReference
()
support_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Support Request'
,
title
=
request_title
,
simulation_state
=
'suspended'
,
default_aggregate_uid
=
compute_node
.
getUid
()
)
return
support_request
def
_makeNotificationMessage
(
self
,
reference
):
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'We have changed allocation scope for %s'
%
reference
,
text_content
=
'Test NM content<br/>%s<br/>'
%
reference
,
content_type
=
'text/html'
,
)
return
notification_message
.
getRelativeUrl
()
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm-compute_node_allocation_scope.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNodeNotAllowedAllocationScope_OpenPublic"])'
)
def
test_ComputeNodeNotAllowedAllocationScope_OpenPublic
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
person
=
compute_node
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_ComputeNodeNotAllowedAllocationScope_OpenPublic'
]
=
\
self
.
_makeNotificationMessage
(
compute_node
.
getReference
())
compute_node
.
edit
(
allocation_scope
=
'open/public'
)
ticket
=
compute_node
.
ComputeNode_checkAndUpdateAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
'open/personal'
)
#ticket = self._getGeneratedSupportRequest(compute_node)
self
.
assertNotEqual
(
None
,
ticket
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
event_list
=
ticket
.
getFollowUpRelatedValueList
()
self
.
assertEqual
(
len
(
event_list
),
1
)
event
=
event_list
[
0
]
self
.
assertEqual
(
event
.
getTitle
(),
'Allocation scope of %s changed to %s'
%
(
compute_node
.
getReference
(),
'open/personal'
))
self
.
assertIn
(
compute_node
.
getReference
(),
event
.
getTextContent
())
self
.
assertEqual
(
event
.
getSource
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
ticket
.
getSourceSection
())
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm-compute_node_allocation_scope.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNodeNotAllowedAllocationScope_OpenFriend"])'
)
def
test_ComputeNodeNotAllowedAllocationScope_OpenFriend
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
person
=
compute_node
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_ComputeNodeNotAllowedAllocationScope_OpenFriend'
]
=
\
self
.
_makeNotificationMessage
(
compute_node
.
getReference
())
friend_person
=
self
.
makePerson
(
self
.
project
)
compute_node
.
edit
(
allocation_scope
=
'open/friend'
,
destination_section
=
friend_person
.
getRelativeUrl
())
ticket
=
compute_node
.
ComputeNode_checkAndUpdateAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
'open/personal'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
event_list
=
ticket
.
getFollowUpRelatedValueList
()
self
.
assertEqual
(
len
(
event_list
),
1
)
event
=
event_list
[
0
]
self
.
assertEqual
(
event
.
getTitle
(),
'Allocation scope of %s changed to %s'
%
(
compute_node
.
getReference
(),
'open/personal'
))
self
.
assertIn
(
compute_node
.
getReference
(),
event
.
getTextContent
())
self
.
assertEqual
(
event
.
getSource
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
ticket
.
getSourceSection
())
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
@
simulate
(
'ComputeNode_hasContactedRecently'
,
'*args, **kwargs'
,
'return False'
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm-compute-node-allocation-scope-closed.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNodeToCloseAllocationScope_OpenPersonal"])'
)
def
test_ComputeNodeToCloseAllocationScope_OpenPersonal
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
person
=
compute_node
.
getSourceAdministrationValue
()
target_allocation_scope
=
'close/outdated'
self
.
portal
.
REQUEST
[
'test_ComputeNodeToCloseAllocationScope_OpenPersonal'
]
=
\
self
.
_makeNotificationMessage
(
compute_node
.
getReference
())
compute_node
.
edit
(
allocation_scope
=
'open/personal'
)
support_request
=
compute_node
.
ComputeNode_checkAndUpdatePersonalAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
'suspended'
,
support_request
.
getSimulationState
())
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
target_allocation_scope
)
event_list
=
support_request
.
getFollowUpRelatedValueList
()
self
.
assertEqual
(
len
(
event_list
),
1
)
event
=
event_list
[
0
]
self
.
assertEqual
(
event
.
getTitle
(),
'Allocation scope of %s changed to %s'
%
\
(
compute_node
.
getReference
(),
target_allocation_scope
))
self
.
assertIn
(
compute_node
.
getReference
(),
event
.
getTextContent
())
self
.
assertEqual
(
event
.
getSource
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
support_request
.
getSourceSection
())
def
test_ComputeNodeNormalAllocationScope_OpenPersonal
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
person
=
compute_node
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
compute_node
.
edit
(
allocation_scope
=
'open/personal'
)
compute_node
.
ComputeNode_checkAndUpdateAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
'open/personal'
)
def
test_ComputeNodeAllowedAllocationScope_OpenPublic
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
person
=
compute_node
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
compute_node
.
edit
(
allocation_scope
=
'open/public'
)
compute_node
.
ComputeNode_checkAndUpdateAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
'open/public'
)
def
test_ComputeNodeAllowedAllocationScope_OpenFriend
(
self
):
compute_node
=
self
.
_makeComputeNode
(
self
.
project
)[
0
]
#, owner=self.makePerson(self.project, user=0))[0]
friend_person
=
self
.
makePerson
(
self
.
project
)
person
=
compute_node
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
compute_node
.
edit
(
allocation_scope
=
'open/friend'
,
destination_section
=
friend_person
.
getRelativeUrl
())
compute_node
.
ComputeNode_checkAndUpdateAllocationScope
()
self
.
tic
()
self
.
assertEqual
(
compute_node
.
getAllocationScope
(),
'open/friend'
)
class
TestComputeNode_hasContactedRecently
(
SlapOSTestCaseMixinWithAbort
):
def
test_ComputeNode_hasContactedRecently_newly_created
(
self
):
...
...
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