mirror of https://github.com/zulip/zulip.git
test_bugdown: Add test for nonmatching realm filters.
This commit is contained in:
parent
3a0eb01dda
commit
8c757292cf
|
@ -343,6 +343,15 @@ class BugdownTest(TestCase):
|
||||||
self.assertEqual(converted, '<p>We should fix <a href="https://trac.zulip.net/ticket/224" target="_blank" title="https://trac.zulip.net/ticket/224">#224</a> and <a href="https://trac.zulip.net/ticket/115" target="_blank" title="https://trac.zulip.net/ticket/115">#115</a>, but not issue#124 or #1124z or <a href="https://trac.zulip.net/ticket/16" target="_blank" title="https://trac.zulip.net/ticket/16">trac #15</a> today.</p>')
|
self.assertEqual(converted, '<p>We should fix <a href="https://trac.zulip.net/ticket/224" target="_blank" title="https://trac.zulip.net/ticket/224">#224</a> and <a href="https://trac.zulip.net/ticket/115" target="_blank" title="https://trac.zulip.net/ticket/115">#115</a>, but not issue#124 or #1124z or <a href="https://trac.zulip.net/ticket/16" target="_blank" title="https://trac.zulip.net/ticket/16">trac #15</a> today.</p>')
|
||||||
self.assertEqual(converted_subject, [u'https://trac.zulip.net/ticket/444'])
|
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<id>[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):
|
def test_stream_subscribe_button_simple(self):
|
||||||
msg = '!_stream_subscribe_button(simple)'
|
msg = '!_stream_subscribe_button(simple)'
|
||||||
converted = bugdown_convert(msg)
|
converted = bugdown_convert(msg)
|
||||||
|
|
Loading…
Reference in New Issue