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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
6d36e12b
Commit
6d36e12b
authored
Aug 03, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: lint and fix testSlapOSCRMSkins
parent
d51f5744
Pipeline
#10800
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
85 deletions
+44
-85
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+24
-69
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
...teItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
+20
-16
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
6d36e12b
...
...
@@ -147,7 +147,7 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
monitor_url_temp_document_list
=
module
.
SupportRequestModule_getMonitoringUrlList
()
self
.
assertEqual
(
len
(
monitor_url_temp_document_list
),
1
)
self
.
assertEqual
(
monitor_url_temp_document_list
[
0
].
getTitle
()
,
self
.
assertEqual
(
monitor_url_temp_document_list
[
0
].
title
,
hosting_subscription
.
getTitle
())
self
.
assertEqual
(
monitor_url_temp_document_list
[
0
].
monitor_url
,
"http://monitor.url/#/ABC"
)
...
...
@@ -622,15 +622,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
TestCRMSkinsMixin
.
afterSetUp
(
self
)
self
.
_cancelTestSupportRequestList
(
title
=
"%%TESTCOMPT-%"
)
def
_makeComputer
(
self
):
TestCRMSkinsMixin
.
_makeComputer
(
self
)
# Clone computer document
self
.
computer
.
edit
(
source_administration_value
=
self
.
makePerson
()
)
return
self
.
computer
def
_getGeneratedSupportRequest
(
self
,
computer
):
request_title
=
'%%We have changed allocation scope for %s'
%
\
computer
.
getReference
()
...
...
@@ -667,7 +658,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
'%s %s %s" % (message_title, message, destination_relative_url))
\
n
'
\
'return 1'
)
def
test_computerNotAllowedAllocationScope_OpenPublic
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_computerNotAllowedAllocationScope_OpenPublic'
]
=
\
...
...
@@ -703,7 +694,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
'%s %s %s" % (message_title, message, destination_relative_url))
\
n
'
\
'return 1'
)
def
test_computerNotAllowedAllocationScope_OpenFriend
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_computerNotAllowedAllocationScope_OpenFriend'
]
=
\
...
...
@@ -738,7 +729,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
'%s %s %s" % (message_title, message, destination_relative_url))
\
n
'
\
'return 1'
)
def
test_computerToCloseAllocationScope_OpenPersonal
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
target_allocation_scope
=
'close/outdated'
...
...
@@ -759,7 +750,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
support_request
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_computerNormalAllocationScope_OpenPersonal
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
...
...
@@ -769,7 +760,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/personal'
)
def
test_computerAllowedAllocationScope_OpenPublic
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
...
...
@@ -779,7 +770,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/public'
)
def
test_computerAllowedAllocationScope_OpenFriend
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
friend_person
=
self
.
makePerson
()
person
=
computer
.
getSourceAdministrationValue
()
self
.
_updatePersonAssignment
(
person
,
'role/service_provider'
)
...
...
@@ -793,10 +784,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
class
TestComputer_hasContactedRecently
(
SlapOSTestCaseMixinWithAbort
):
def
_makeComputer
(
self
):
SlapOSTestCaseMixinWithAbort
.
_makeComputer
(
self
)
return
self
.
computer
def
createSPL
(
self
,
computer
):
delivery_template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredInstanceDeliveryTemplate
())
...
...
@@ -820,14 +807,14 @@ class TestComputer_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
return
delivery
def
test_Computer_hasContactedRecently_newly_created
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
[
0
]
self
.
tic
()
has_contacted
=
computer
.
Computer_hasContactedRecently
()
self
.
assertTrue
(
has_contacted
)
@
simulate
(
'Computer_getCreationDate'
,
'*args, **kwargs'
,
'return DateTime() - 32'
)
def
test_Computer_hasContactedRecently_no_data
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
[
0
]
self
.
tic
()
computer
.
getCreationDate
=
self
.
portal
.
Computer_getCreationDate
...
...
@@ -836,7 +823,7 @@ class TestComputer_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'Computer_getCreationDate'
,
'*args, **kwargs'
,
'return DateTime() - 32'
)
def
test_Computer_hasContactedRecently_memcached
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
[
0
]
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
...
...
@@ -853,7 +840,7 @@ class TestComputer_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'Computer_getCreationDate'
,
'*args, **kwargs'
,
'return DateTime() - 32'
)
def
test_Computer_hasContactedRecently_memcached_oudated_no_spl
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
[
0
]
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
...
...
@@ -870,7 +857,7 @@ class TestComputer_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'Computer_getCreationDate'
,
'*args, **kwargs'
,
'return DateTime() - 32'
)
def
test_Computer_hasContactedRecently_memcached_oudated_with_spl
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
[
0
]
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
...
...
@@ -1009,14 +996,6 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self
.
tic
()
self
.
_cancelTestSupportRequestList
()
def
_makeComputer
(
self
):
SlapOSTestCaseMixin
.
_makeComputer
(
self
)
# Clone computer document
self
.
computer
.
edit
(
source_administration_value
=
self
.
makePerson
(
user
=
0
)
)
return
self
.
computer
def
test_computer_Base_generateSupportRequestForSlapOS
(
self
):
self
.
_makeComputer
()
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
...
...
@@ -1115,7 +1094,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
def
test_Base_generateSupportRequestForSlapOS_do_not_recreate_if_open
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
support_request
=
self
.
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
,
self
.
computer
.
getRelativeUrl
()
...
...
@@ -1131,7 +1110,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
def
test_Base_generateSupportRequestForSlapOS_do_not_recreate_if_suspended
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
support_request
=
self
.
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
,
self
.
computer
.
getRelativeUrl
()
...
...
@@ -1148,7 +1127,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self
.
assertEqual
(
support_request
,
same_support_request
)
def
test_Base_generateSupportRequestForSlapOS_recreate_if_closed
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
support_request
=
self
.
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
,
self
.
computer
.
getRelativeUrl
())
...
...
@@ -1167,7 +1146,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self
.
assertNotEqual
(
support_request
,
None
)
def
test_Base_generateSupportRequestForSlapOS_recreate
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
title
=
"Test Support Request %s"
%
self
.
computer
.
getRelativeUrl
()
support_request
=
self
.
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
,
self
.
computer
.
getRelativeUrl
())
...
...
@@ -1179,7 +1158,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self
.
assertEqual
(
support_request
,
same_support_request
)
def
test_Base_generateSupportRequestForSlapOS_inprogress
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
title
=
"Test Support Request %s"
%
self
.
computer
.
getRelativeUrl
()
support_request
=
self
.
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
,
self
.
computer
.
getRelativeUrl
())
...
...
@@ -1229,15 +1208,6 @@ class TestSlapOSComputer_CheckState(TestCRMSkinsMixin):
)
return
support_request
def
_makeComputer
(
self
):
TestCRMSkinsMixin
.
_makeComputer
(
self
)
# Clone computer document
self
.
computer
.
edit
(
source_administration_value
=
self
.
makePerson
(
user
=
0
)
)
return
self
.
computer
def
_simulateBase_generateSupportRequestForSlapOS
(
self
):
script_name
=
'Base_generateSupportRequestForSlapOS'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
...
@@ -1258,7 +1228,7 @@ class TestSlapOSComputer_CheckState(TestCRMSkinsMixin):
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
def
test_Computer_checkState_call_support_request
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
...
...
@@ -1283,7 +1253,7 @@ class TestSlapOSComputer_CheckState(TestCRMSkinsMixin):
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
def
test_Computer_checkState_empty_cache
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
self
.
_simulateBase_generateSupportRequestForSlapOS
()
support_request
=
self
.
_makeSupportRequest
()
...
...
@@ -1311,7 +1281,7 @@ class TestSlapOSComputer_CheckState(TestCRMSkinsMixin):
'comment="Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s" % (message_title, message, destination_relative_url))'
)
def
test_Computer_checkState_notify
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
...
...
@@ -1353,7 +1323,7 @@ class TestSlapOSComputer_CheckState(TestCRMSkinsMixin):
'comment="Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s" % (message_title, message, destination_relative_url))'
)
def
test_Computer_checkState_empty_cache_notify
(
self
):
computer
=
self
.
_makeComputer
(
)
computer
=
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
]
person
=
computer
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_Computer_checkState_empty_cache_notify'
]
=
\
...
...
@@ -1811,16 +1781,8 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
class
TestSupportRequestTrySendNotificationMessage
(
SlapOSTestCaseMixin
):
def
_makeComputer
(
self
):
SlapOSTestCaseMixin
.
_makeComputer
(
self
)
# Clone computer document
self
.
computer
.
edit
(
source_administration_value
=
self
.
makePerson
(
user
=
0
)
)
return
self
.
computer
def
test_SupportRequest_trySendNotificationMessage
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
)
)
person
=
self
.
computer
.
getSourceAdministrationValue
()
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
text_content
=
'Test NM content<br/>%s<br/>'
%
self
.
computer
.
getReference
()
...
...
@@ -1908,14 +1870,6 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
class
TestSupportRequestUpdateMonitoringState
(
SlapOSTestCaseMixin
):
def
_makeComputer
(
self
):
SlapOSTestCaseMixin
.
_makeComputer
(
self
)
# Clone computer document
self
.
computer
.
edit
(
source_administration_value
=
self
.
makePerson
(
user
=
0
)
)
return
self
.
computer
def
_makeHostingSubscription
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
...
@@ -1979,7 +1933,8 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
self
.
assertEqual
(
None
,
support_request
.
SupportRequest_updateMonitoringDestroyRequestedState
())
support_request
.
setAggregateValue
(
self
.
_makeComputer
())
support_request
.
setAggregateValue
(
self
.
_makeComputer
(
owner
=
self
.
makePerson
(
user
=
0
))[
0
])
self
.
assertEqual
(
None
,
support_request
.
SupportRequest_updateMonitoringDestroyRequestedState
())
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
View file @
6d36e12b
...
...
@@ -100,11 +100,13 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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