Exemplo n.º 1
0
    def testHtmlBody_WithEscapedHtml(self):
        """"An html body is sent with html content escaped."""
        body_with_html_content = (
            '<a href="http://www.google.com">test</a> \'something\'')
        email_task = notify_helpers._MakeEmailWorkItem(
            notify_reasons.AddrPerm(False, '*****@*****.**',
                                    self.member, REPLY_NOT_ALLOWED,
                                    user_pb2.UserPrefs()), ['reason'],
            self.issue, 'body link-only', body_with_html_content,
            'unused body mem', self.project, 'example.com',
            self.commenter_view, self.detail_url)

        escaped_body_with_html_content = (
            '&lt;a href=&quot;http://www.google.com&quot;&gt;test&lt;/a&gt; '
            '&#39;something&#39;')
        notify_helpers._MakeNotificationFooter(['reason'], REPLY_NOT_ALLOWED,
                                               'example.com')
        expected_html_body = (
            notify_helpers.HTML_BODY_WITH_GMAIL_ACTION_TEMPLATE % {
                'url':
                self.detail_url,
                'body':
                '%s-- <br/>%s' %
                (escaped_body_with_html_content, self.expected_html_footer)
            })
        self.assertEquals(expected_html_body, email_task['html_body'])
Exemplo n.º 2
0
    def testMakeNotificationFooter_WithReason(self):
        footer = notify_helpers._MakeNotificationFooter(['REASON'],
                                                        REPLY_NOT_ALLOWED,
                                                        'example.com')
        self.assertIn('REASON', footer)
        self.assertIn('https://example.com/hosting/settings', footer)

        footer = notify_helpers._MakeNotificationFooter(['REASON'],
                                                        REPLY_NOT_ALLOWED,
                                                        'example.com')
        self.assertIn('REASON', footer)
        self.assertIn('https://example.com/hosting/settings', footer)
Exemplo n.º 3
0
 def testMakeNotificationFooter_ManyReasons(self):
     footer = notify_helpers._MakeNotificationFooter(
         ['Funny', 'Caring', 'Warmblooded'], REPLY_NOT_ALLOWED,
         'example.com')
     self.assertIn('Funny', footer)
     self.assertIn('Caring', footer)
     self.assertIn('Warmblooded', footer)
Exemplo n.º 4
0
    def testMakeNotificationFooter_WithReplyInstructions(self):
        footer = notify_helpers._MakeNotificationFooter(['REASON'],
                                                        REPLY_NOT_ALLOWED,
                                                        'example.com')
        self.assertNotIn('Reply', footer)
        self.assertIn('https://example.com/hosting/settings', footer)

        footer = notify_helpers._MakeNotificationFooter(['REASON'],
                                                        REPLY_MAY_COMMENT,
                                                        'example.com')
        self.assertIn('add a comment', footer)
        self.assertNotIn('make updates', footer)
        self.assertIn('https://example.com/hosting/settings', footer)

        footer = notify_helpers._MakeNotificationFooter(['REASON'],
                                                        REPLY_MAY_UPDATE,
                                                        'example.com')
        self.assertIn('add a comment', footer)
        self.assertIn('make updates', footer)
        self.assertIn('https://example.com/hosting/settings', footer)
Exemplo n.º 5
0
 def testMakeNotificationFooter_NoReason(self):
     footer = notify_helpers._MakeNotificationFooter([], REPLY_NOT_ALLOWED,
                                                     'example.com')
     self.assertEqual('', footer)