mirror of https://github.com/zulip/zulip.git
test_narrow: Improve group_with_with search test.
The previous test structure was weird, in that it didn't cover the case where there was at least one group PM thread.
This commit is contained in:
parent
d032e1ad96
commit
227e5fdcc2
|
@ -219,6 +219,7 @@ class NarrowBuilderTest(ZulipTestCase):
|
|||
self._do_add_term_test(term, 'WHERE id != :param_1')
|
||||
|
||||
def test_add_term_using_group_pm_operator_and_not_the_same_user_as_operand(self) -> None:
|
||||
# Test wtihout any such group PM threads existing
|
||||
term = dict(operator='group-pm-with', operand=self.example_email("othello"))
|
||||
with mock.patch("sqlalchemy.util.warn") as mock_warn:
|
||||
self._do_add_term_test(term, 'WHERE recipient_id != recipient_id')
|
||||
|
@ -226,6 +227,13 @@ class NarrowBuilderTest(ZulipTestCase):
|
|||
# SQLalchemy warns because this query is a tautology.
|
||||
mock_warn.assert_called_once()
|
||||
|
||||
# Test with at least one such group PM thread existing
|
||||
self.send_huddle_message(self.user_profile.email, [self.example_email("othello"),
|
||||
self.example_email("cordelia")])
|
||||
|
||||
term = dict(operator='group-pm-with', operand=self.example_email("othello"))
|
||||
self._do_add_term_test(term, 'WHERE recipient_id IN (:recipient_id_1)')
|
||||
|
||||
def test_add_term_using_group_pm_operator_not_the_same_user_as_operand_and_negated(
|
||||
self) -> None: # NEGATED
|
||||
term = dict(operator='group-pm-with', operand=self.example_email("othello"), negated=True)
|
||||
|
|
Loading…
Reference in New Issue