From 8c757292cf14e9471292965b9bf6281c361937b1 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 31 May 2016 19:50:26 -0700 Subject: [PATCH] test_bugdown: Add test for nonmatching realm filters. --- zerver/tests/test_bugdown.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index 251955dac7..6eae5d1835 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -343,6 +343,15 @@ class BugdownTest(TestCase): self.assertEqual(converted, '

We should fix #224 and #115, but not issue#124 or #1124z or trac #15 today.

') self.assertEqual(converted_subject, [u'https://trac.zulip.net/ticket/444']) + def test_realm_patterns_negative(self): + realm = get_realm('zulip.com') + RealmFilter(realm=realm, pattern=r"#(?P[0-9]{2,8})", + url_format_string=r"https://trac.zulip.net/ticket/%(id)s").save() + boring_msg = Message(sender=get_user_profile_by_email("othello@zulip.com"), + subject=u"no match here") + converted_boring_subject = bugdown.subject_links(realm.domain.lower(), boring_msg.subject) + self.assertEqual(converted_boring_subject, []) + def test_stream_subscribe_button_simple(self): msg = '!_stream_subscribe_button(simple)' converted = bugdown_convert(msg)