Commit 378ad678 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Only consider tickets from Monitoring for stop Support Request Generation

The generation should ignore users inputs to consider itself  "closed" or not.

Regards,
Rafael Monnerat
parent f6d9dd92
# HARDCODED LIMIT TO BE MOVED TO GLOBAL PREFERENCES # HARDCODED LIMIT TO BE MOVED TO GLOBAL PREFERENCES
limit = 5 limit = 5
portal = context.getPortalObject()
kw['limit'] = limit kw['limit'] = limit
kw['portal_type'] = 'Support Request' kw['portal_type'] = 'Support Request'
kw['simulation_state'] = ["validated","submitted"] kw['simulation_state'] = ["validated","submitted"]
kw['default_resource_uid'] = portal.service_module.slapos_crm_monitoring.getUid()
if destination_decision: if destination_decision:
kw['default_destination_decision_uid'] = context.restrictedTraverse( kw['default_destination_decision_uid'] = context.restrictedTraverse(
destination_decision).getUid() destination_decision).getUid()
......
...@@ -2059,6 +2059,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin): ...@@ -2059,6 +2059,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
def newSupportRequest(): def newSupportRequest():
sr = self.portal.support_request_module.newContent(\ sr = self.portal.support_request_module.newContent(\
title="Test Support Request POIUY", title="Test Support Request POIUY",
resource="service_module/slapos_crm_monitoring",
destination_decision=url) destination_decision=url)
sr.validate() sr.validate()
sr.immediateReindexObject() sr.immediateReindexObject()
...@@ -2079,7 +2080,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin): ...@@ -2079,7 +2080,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed( self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(
other_person.getRelativeUrl())) other_person.getRelativeUrl()))
def test_ERP5Site_isSupportRequestCreationClosed_submitted_state(self): def test_ERP5Site_isSupportRequestCreationClosed_suspended_state(self):
person = self._makePerson() person = self._makePerson()
url = person.getRelativeUrl() url = person.getRelativeUrl()
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(url)) self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(url))
...@@ -2088,6 +2089,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin): ...@@ -2088,6 +2089,7 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
def newSupportRequest(): def newSupportRequest():
sr = self.portal.support_request_module.newContent(\ sr = self.portal.support_request_module.newContent(\
title="Test Support Request POIUY", title="Test Support Request POIUY",
resource="service_module/slapos_crm_monitoring",
destination_decision=url) destination_decision=url)
sr.validate() sr.validate()
sr.suspend() sr.suspend()
...@@ -2101,6 +2103,32 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin): ...@@ -2101,6 +2103,32 @@ class TestSlapOSisSupportRequestCreationClosed(testSlapOSMixin):
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(url)) self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(url))
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed()) self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed())
def test_ERP5Site_isSupportRequestCreationClosed_nonmonitoring(self):
person = self._makePerson()
url = person.getRelativeUrl()
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed(url))
self.assertFalse(self.portal.ERP5Site_isSupportRequestCreationClosed())
def newSupportRequest():
sr = self.portal.support_request_module.newContent(\
title="Test Support Request POIUY",
destination_decision=url)
sr.validate()
sr.validate()
sr.immediateReindexObject()
# Create five tickets, the limit of ticket creation
newSupportRequest()
newSupportRequest()
newSupportRequest()
newSupportRequest()
newSupportRequest()
self.assertTrue(self.portal.ERP5Site_isSupportRequestCreationClosed(url))
self.assertTrue(self.portal.ERP5Site_isSupportRequestCreationClosed())
class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin): class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment