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
Hardik Juneja
slapos.core
Commits
7d663881
Commit
7d663881
authored
Jul 11, 2017
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Fix Tests to follow up recent changes
parent
72a3ddb3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
228 additions
and
248 deletions
+228
-248
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringHostingSubscriptionState.py
...upportRequest_updateMonitoringHostingSubscriptionState.py
+10
-10
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+218
-238
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringHostingSubscriptionState.py
View file @
7d663881
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
json
from
Products.ERP5Type.DateUtils
import
addToDate
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
document
=
context
.
getAggregateValue
()
document
=
context
.
getAggregateValue
()
...
@@ -10,6 +7,7 @@ if document is None:
...
@@ -10,6 +7,7 @@ if document is None:
return
return
has_error
=
False
has_error
=
False
software_instance
=
None
# Check if at least one software Instance is Allocated
# Check if at least one software Instance is Allocated
for
instance
in
document
.
getSpecialiseRelatedValueList
(
for
instance
in
document
.
getSpecialiseRelatedValueList
(
...
@@ -20,6 +18,7 @@ for instance in document.getSpecialiseRelatedValueList(
...
@@ -20,6 +18,7 @@ for instance in document.getSpecialiseRelatedValueList(
if
instance
.
getAggregateValue
()
is
not
None
:
if
instance
.
getAggregateValue
()
is
not
None
:
if
instance
.
getPortalType
()
==
"Software Instance"
and
\
if
instance
.
getPortalType
()
==
"Software Instance"
and
\
instance
.
SoftwareInstance_hasReportedError
():
instance
.
SoftwareInstance_hasReportedError
():
software_instance
=
instance
has_error
=
True
has_error
=
True
break
break
else
:
else
:
...
@@ -31,10 +30,11 @@ if not has_error:
...
@@ -31,10 +30,11 @@ if not has_error:
if
not
person
:
if
not
person
:
return
return
message
=
instance
.
SoftwareInstance_hasReportedError
(
include_message
=
True
)
if
software_instance
is
not
None
:
message
=
software_instance
.
SoftwareInstance_hasReportedError
(
include_message
=
True
)
if
message
in
[
"Not possible to find the last message"
,
"#access instance available"
]:
if
message
in
[
"Not possible to find the last message"
,
"#access instance available"
]:
# Do not change state in case of transitory states.
# Do not change state in case of transitory states.
return
message
return
if
context
.
getSimulationState
()
==
"validated"
:
if
context
.
getSimulationState
()
==
"validated"
:
context
.
suspend
()
context
.
suspend
()
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
7d663881
...
@@ -58,7 +58,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
...
@@ -58,7 +58,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
validate
()
ticket
.
validate
()
ticket
.
immediateReindexObject
()
ticket
.
immediateReindexObject
()
open_ticket_list
=
module
.
Folder_getOpenTicketList
(
title
=
ticket
.
getTitle
())
open_ticket_list
=
module
.
Folder_getOpenTicketList
(
title
=
ticket
.
getTitle
())
...
@@ -77,7 +76,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
...
@@ -77,7 +76,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
_test_upgrade_decision
(
self
,
ticket
,
expected_amount
):
def
_test_upgrade_decision
(
self
,
ticket
,
expected_amount
):
module
=
ticket
.
getParentValue
()
module
=
ticket
.
getParentValue
()
open_ticket_list
=
module
.
Folder_getOpenTicketList
(
title
=
ticket
.
getTitle
())
open_ticket_list
=
module
.
Folder_getOpenTicketList
(
title
=
ticket
.
getTitle
())
...
@@ -112,7 +110,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
...
@@ -112,7 +110,6 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
len
(
open_ticket_list
),
expected_amount
)
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
self
.
assertEquals
(
open_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_support_request
(
self
):
def
test_support_request
(
self
):
def
newSupportRequest
():
def
newSupportRequest
():
sr
=
self
.
portal
.
support_request_module
.
newContent
(
\
sr
=
self
.
portal
.
support_request_module
.
newContent
(
\
...
@@ -149,12 +146,10 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
...
@@ -149,12 +146,10 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
portal_type
=
'Upgrade Decision'
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
reference
=
"TESTUD-%s"
%
self
.
new_id
reference
=
"TESTUD-%s"
%
self
.
new_id
)
)
ticket
.
immediateReindexObject
()
ticket
.
immediateReindexObject
()
return
ticket
return
ticket
ticket
=
newUpgradeDecision
()
ticket
=
newUpgradeDecision
()
self
.
_test_upgrade_decision
(
ticket
,
1
)
self
.
_test_upgrade_decision
(
ticket
,
1
)
...
@@ -213,7 +208,6 @@ class TestSlapOSTicketEvent(testSlapOSMixin):
...
@@ -213,7 +208,6 @@ class TestSlapOSTicketEvent(testSlapOSMixin):
last_event
=
ticket
.
Ticket_getLatestEvent
()
last_event
=
ticket
.
Ticket_getLatestEvent
()
self
.
assertEquals
(
last_event
,
event
)
self
.
assertEquals
(
last_event
,
event
)
# Now we test unwanted cases (deleted and cancelled)
# Now we test unwanted cases (deleted and cancelled)
another_event
=
newEvent
(
ticket
)
another_event
=
newEvent
(
ticket
)
last_event
=
ticket
.
Ticket_getLatestEvent
()
last_event
=
ticket
.
Ticket_getLatestEvent
()
...
@@ -2119,8 +2113,6 @@ class TestSlapOSRegularisationRequest_deleteHostingSubscriptionList(
...
@@ -2119,8 +2113,6 @@ class TestSlapOSRegularisationRequest_deleteHostingSubscriptionList(
self
.
tic
()
self
.
tic
()
class
TestSlapOSComputer_notifyWrongAllocationScope
(
testSlapOSMixin
):
class
TestSlapOSComputer_notifyWrongAllocationScope
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
...
@@ -2304,7 +2296,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
...
@@ -2304,7 +2296,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
self
.
tic
()
self
.
tic
()
self
.
assertEquals
(
computer
.
getAllocationScope
(),
'open/personal'
)
self
.
assertEquals
(
computer
.
getAllocationScope
(),
'open/personal'
)
def
test_computerAllowedAllocationScope_OpenPublic
(
self
):
def
test_computerAllowedAllocationScope_OpenPublic
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
person
=
computer
.
getSourceAdministrationValue
()
person
=
computer
.
getSourceAdministrationValue
()
...
@@ -2315,7 +2306,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
...
@@ -2315,7 +2306,6 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
self
.
tic
()
self
.
tic
()
self
.
assertEquals
(
computer
.
getAllocationScope
(),
'open/public'
)
self
.
assertEquals
(
computer
.
getAllocationScope
(),
'open/public'
)
def
test_computerAllowedAllocationScope_OpenFriend
(
self
):
def
test_computerAllowedAllocationScope_OpenFriend
(
self
):
computer
=
self
.
_makeComputer
()
computer
=
self
.
_makeComputer
()
person
=
computer
.
getSourceAdministrationValue
()
person
=
computer
.
getSourceAdministrationValue
()
...
@@ -2438,7 +2428,6 @@ class TestSlapOSPerson_isServiceProvider(testSlapOSMixin):
...
@@ -2438,7 +2428,6 @@ class TestSlapOSPerson_isServiceProvider(testSlapOSMixin):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
super
(
TestSlapOSPerson_isServiceProvider
,
self
).
afterSetUp
()
super
(
TestSlapOSPerson_isServiceProvider
,
self
).
afterSetUp
()
def
test_Person_isServiceProvider
(
self
):
def
test_Person_isServiceProvider
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
@@ -2568,7 +2557,6 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
...
@@ -2568,7 +2557,6 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
class
TestSlapOSGenerateSupportRequestForSlapOS
(
testSlapOSMixin
):
class
TestSlapOSGenerateSupportRequestForSlapOS
(
testSlapOSMixin
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
super
(
TestSlapOSGenerateSupportRequestForSlapOS
,
self
).
afterSetUp
()
super
(
TestSlapOSGenerateSupportRequestForSlapOS
,
self
).
afterSetUp
()
self
.
tic
()
self
.
tic
()
...
@@ -2820,7 +2808,6 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
...
@@ -2820,7 +2808,6 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
self
.
assertEqual
(
support_request
.
getRelativeUrl
(),
in_progress
)
self
.
assertEqual
(
support_request
.
getRelativeUrl
(),
in_progress
)
class
TestSlapOSComputer_CheckState
(
testSlapOSMixin
):
class
TestSlapOSComputer_CheckState
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
...
@@ -3097,17 +3084,10 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(testSlapOSMixin):
...
@@ -3097,17 +3084,10 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(testSlapOSMixin):
hosting_subscription
,
"test-slapos-crm-check.notification"
)
hosting_subscription
,
"test-slapos-crm-check.notification"
)
self
.
tic
()
self
.
tic
()
previous_ticket
=
ticket
ticket
=
self
.
_getGeneratedSupportRequest
(
ticket
=
self
.
_getGeneratedSupportRequest
(
hosting_subscription
.
getUid
())
hosting_subscription
.
getUid
())
self
.
assertEqual
(
ticket
,
previous_ticket
)
# Do not reopen the ticket if it is suspended
self
.
assertEqual
(
ticket
.
getSimulationState
(),
"validated"
)
self
.
assertEqual
(
None
,
ticket
)
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s'
%
(
\
ticket_title
.
replace
(
''
,
''
),
'Test NM content
\
n
%s
\
n
'
%
hosting_subscription
.
getReference
(),
person
.
getRelativeUrl
()),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 1'
)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 1'
)
def
testHostingSubscription_createSupportRequestEvent_closed
(
self
):
def
testHostingSubscription_createSupportRequestEvent_closed
(
self
):
...
@@ -3221,7 +3201,7 @@ class TestSlapOSHasError(testSlapOSMixin):
...
@@ -3221,7 +3201,7 @@ class TestSlapOSHasError(testSlapOSMixin):
instance
.
setAggregateValue
(
self
.
computer
.
partition1
)
instance
.
setAggregateValue
(
self
.
computer
.
partition1
)
self
.
assertEquals
(
instance
.
SoftwareInstance_hasReportedError
(),
error_date
)
self
.
assertEquals
(
str
(
instance
.
SoftwareInstance_hasReportedError
()),
'#error '
)
memcached_dict
[
instance
.
getReference
()]
=
json
.
dumps
(
memcached_dict
[
instance
.
getReference
()]
=
json
.
dumps
(
{
"created_at"
:
"%s"
%
error_date
,
"text"
:
"#access "
}
{
"created_at"
:
"%s"
%
error_date
,
"text"
:
"#access "
}
...
...
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