mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +00:00
search: Add tests for multiple unicode search operands.
This commit is contained in:
committed by
Tim Abbott
parent
04a79800b9
commit
d6df408a0e
@@ -983,6 +983,21 @@ class GetOldMessagesTest(ZulipTestCase):
|
|||||||
english_message['match_content'],
|
english_message['match_content'],
|
||||||
u'<p>I want to go to <span class="highlight">日本</span>!</p>')
|
u'<p>I want to go to <span class="highlight">日本</span>!</p>')
|
||||||
|
|
||||||
|
# Multiple search operands with unicode
|
||||||
|
multi_search_narrow = [
|
||||||
|
dict(operator='search', operand='ちは'),
|
||||||
|
dict(operator='search', operand='今日は'),
|
||||||
|
]
|
||||||
|
multi_search_result = self.get_and_check_messages(dict(
|
||||||
|
narrow=ujson.dumps(multi_search_narrow),
|
||||||
|
anchor=next_message_id,
|
||||||
|
num_after=10,
|
||||||
|
num_before=0,
|
||||||
|
))
|
||||||
|
self.assertEqual(len(multi_search_result['messages']), 1)
|
||||||
|
self.assertEqual(multi_search_result['messages'][0]['match_content'],
|
||||||
|
'<p>こんに <span class="highlight">ちは</span> 。 <span class="highlight">今日は</span> いい 天気ですね。</p>')
|
||||||
|
|
||||||
@override_settings(USING_PGROONGA=False)
|
@override_settings(USING_PGROONGA=False)
|
||||||
def test_get_messages_with_search_not_subscribed(self):
|
def test_get_messages_with_search_not_subscribed(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
@@ -1095,6 +1110,21 @@ class GetOldMessagesTest(ZulipTestCase):
|
|||||||
self.assertEqual(multi_search_result['messages'][0]['match_content'],
|
self.assertEqual(multi_search_result['messages'][0]['match_content'],
|
||||||
'<p><span class="highlight">Can</span> you <span class="highlight">speak</span> <a href="https://en.wikipedia.org/wiki/Japanese" target="_blank" title="https://en.wikipedia.org/wiki/Japanese">https://en.<span class="highlight">wiki</span>pedia.org/<span class="highlight">wiki</span>/Japanese</a>?</p>')
|
'<p><span class="highlight">Can</span> you <span class="highlight">speak</span> <a href="https://en.wikipedia.org/wiki/Japanese" target="_blank" title="https://en.wikipedia.org/wiki/Japanese">https://en.<span class="highlight">wiki</span>pedia.org/<span class="highlight">wiki</span>/Japanese</a>?</p>')
|
||||||
|
|
||||||
|
# Multiple search operands with unicode
|
||||||
|
multi_search_narrow = [
|
||||||
|
dict(operator='search', operand='朝は'),
|
||||||
|
dict(operator='search', operand='べました'),
|
||||||
|
]
|
||||||
|
multi_search_result = self.get_and_check_messages(dict(
|
||||||
|
narrow=ujson.dumps(multi_search_narrow),
|
||||||
|
anchor=next_message_id,
|
||||||
|
num_after=10,
|
||||||
|
num_before=0,
|
||||||
|
))
|
||||||
|
self.assertEqual(len(multi_search_result['messages']), 1)
|
||||||
|
self.assertEqual(multi_search_result['messages'][0]['match_content'],
|
||||||
|
'<p>今<span class="highlight">朝は</span>ごはんを食<span class="highlight">べました</span>。</p>')
|
||||||
|
|
||||||
narrow = [dict(operator='search', operand='https://google.com')]
|
narrow = [dict(operator='search', operand='https://google.com')]
|
||||||
link_search_result = self.get_and_check_messages(dict(
|
link_search_result = self.get_and_check_messages(dict(
|
||||||
narrow=ujson.dumps(narrow),
|
narrow=ujson.dumps(narrow),
|
||||||
|
|||||||
Reference in New Issue
Block a user