Commit 9d147ce2 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: Tolerate Events with non visible SR in RSS

parent 43c3206b
......@@ -16,7 +16,11 @@ def getSupportRequestInfo(event):
try:
return getSupportRequest_memo[follow_up]
except KeyError:
support_request = portal.restrictedTraverse(follow_up)
support_request = portal.restrictedTraverse(follow_up, None)
if support_request is None:
# For corner cases where user has an event for which he cannot access the ticket,
# we don't raise error so that others events are visible.
return event.getTitle(), '', ''
getSupportRequest_memo[follow_up] = (
support_request.getTitle(),
support_request.getResourceTranslatedTitle() or '',
......
......@@ -525,6 +525,29 @@ class TestSupportRequestRSSSMultipleEvents(SupportRequestRSSTestCase, DefaultTes
self.assertFalse(rss.bozo)
class TestSupportRequestRSSSNonVisibleSupportRequest(SupportRequestRSSTestCase, DefaultTestRSSMixin):
"""Edge case test for support request RSS for an event (visible by user) on a support request not visible by user.
"""
def afterSetUp(self):
super(TestSupportRequestRSSSNonVisibleSupportRequest, self).afterSetUp()
support_request = self.support_request.Base_createCloneDocument(batch_mode=True)
support_request.manage_permission('View', ['Manager'], 0)
self.event.setFollowUpValue(support_request)
self.tic()
def _checkRSS(self, response):
self.assertEqual(httplib.OK, response.getStatus())
rss = feedparser.parse(response.getBody())
item, = rss.entries
self.assertEqual(item['author'], self.user.getTitle())
# there's no link to support request, as user cannot see it.
self.assertNotIn(self.support_request.getRelativeUrl(), item['link'])
self.assertEqual(item['published'], DateTime(2001, 1, 1).rfc822())
self.assertEqual(item['summary'], '<p>This is <b>Content</b></p>')
# https://pythonhosted.org/feedparser/bozo.html#advanced-bozo
self.assertFalse(rss.bozo)
class TestIngestPostAsWebMessage(SupportRequestTestCase):
"""Tests ingesting HTML Post into web messages.
"""
......
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