Commit 695a5d7c authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: fixup RegularisationRequest_checkToTriggerNextEscalationStep tests

parent a3e33f96
...@@ -237,18 +237,16 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -237,18 +237,16 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
0, ticket.getRelativeUrl(), '', '', '', '' 0, ticket.getRelativeUrl(), '', '', '', ''
) )
@simulate('NotificationTool_getDocumentValue',
'reference=None, language="en"',
'assert reference == "slapos-crm.acknowledgment.escalation", reference\n' \
'return')
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'service_relative_url, title, text_content, comment, REQUEST=None', 'service_relative_url, title, text_content, comment, ' \
'notification_message=None, substitution_method_parameter_dict=None, ' \
'REQUEST=None',
'context.portal_workflow.doActionFor(' \ 'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \ 'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToSendUniqEvent ' \ 'comment="Visited by RegularisationRequest_checkToSendUniqEvent ' \
'%s %s %s %s" % (service_relative_url, title, text_content, comment))\n' \ '%s %s %s %s %s %s" % (service_relative_url, title, text_content, comment, notification_message, substitution_method_parameter_dict))\n' \
'return "fooevent"') 'return "fooevent"')
def test_checkToTriggerNextEscalationStep_matching_event(self): def test_checkToTriggerNextEscalationStep_matchingEvent(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -265,19 +263,21 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -265,19 +263,21 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
event2 = ticket.RegularisationRequest_checkToTriggerNextEscalationStep( event2 = ticket.RegularisationRequest_checkToTriggerNextEscalationStep(
7, 'service_module/slapos_crm_acknowledgement', 7, 'service_module/slapos_crm_acknowledgement',
'service_module/slapos_crm_spam', 'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment') 'foo2 title', 'foo2 content', 'foo2 comment',
notification_message='slapos-crm.acknowledgment.escalation',
substitution_method_parameter_dict={'foo': 'bar'})
self.assertEqual(event2, event.getRelativeUrl()) self.assertEqual(event2, event.getRelativeUrl())
self.assertEqual( self.assertEqual(
'Visited by RegularisationRequest_checkToSendUniqEvent %s %s %s %s' % \ 'Visited by RegularisationRequest_checkToSendUniqEvent %s %s %s %s %s %s' % \
('service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', ('service_module/slapos_crm_spam', 'foo2 title', 'foo2 content',
'foo2 comment'), 'foo2 comment', 'slapos-crm.acknowledgment.escalation', {'foo': 'bar'}),
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_recent_event(self): def test_checkToTriggerNextEscalationStep_recentEvent(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -301,7 +301,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -301,7 +301,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_other_ticket_event(self): def test_checkToTriggerNextEscalationStep_other_ticketEvent(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -324,7 +324,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -324,7 +324,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_other_resource_event(self): def test_checkToTriggerNextEscalationStep_otherResourceEvent(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -348,7 +348,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -348,7 +348,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_no_current_event(self): def test_checkToTriggerNextEscalationStep_noCurrentEvent(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -365,7 +365,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -365,7 +365,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_no_ticket_resource(self): def test_checkToTriggerNextEscalationStep_noTicketResource(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.validate() ticket.validate()
ticket.suspend() ticket.suspend()
...@@ -388,7 +388,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -388,7 +388,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
@simulate('RegularisationRequest_checkToSendUniqEvent', @simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs', '*args, **kwargs',
'raise NotImplementedError, "Should not have been called"') 'raise NotImplementedError, "Should not have been called"')
def test_checkToTriggerNextEscalationStep_not_suspended(self): def test_checkToTriggerNextEscalationStep_notSuspended(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_acknowledgement') ticket.edit(resource='service_module/slapos_crm_acknowledgement')
ticket.validate() ticket.validate()
...@@ -408,7 +408,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep( ...@@ -408,7 +408,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
self.assertEqual(event2, None) self.assertEqual(event2, None)
def test_checkToTriggerNextEscalationStep_REQUEST_disallowed(self): def test_checkToTriggerNextEscalationStep_REQUESTdisallowed(self):
ticket = self.createRegularisationRequest() ticket = self.createRegularisationRequest()
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
......
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