From abd30a888978da49ffe01025be9918854bc36c7c Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 20 Mar 2015 22:25:27 -0300 Subject: empty queries test makes more sense as a unit test --- service/test/integration/test_soledad_querier.py | 17 ----------------- service/test/unit/adapter/test_soledad_querier.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'service/test') diff --git a/service/test/integration/test_soledad_querier.py b/service/test/integration/test_soledad_querier.py index f5b2978f..f4c23961 100644 --- a/service/test/integration/test_soledad_querier.py +++ b/service/test/integration/test_soledad_querier.py @@ -81,20 +81,3 @@ class SoledadQuerierTest(SoledadTestBase, WithMsgFields): fetched_mails = self.soledad_querier.mails(chashes) self.assertEquals([m.as_dict() for m in fetched_mails], [m.as_dict() for m in mails]) - - def test_empty_or_bad_queries_are_handled(self): - self.add_multiple_to_mailbox(3, 'INBOX') - - test_parameters = ['', 'undefined', None, 'none'] - - def call_with_bad_parameters(funct): - for param in test_parameters: - self.assertFalse(funct(param)) - - call_with_bad_parameters(self.soledad_querier.get_all_flags_by_mbox) - call_with_bad_parameters(self.soledad_querier.get_content_by_phash) - call_with_bad_parameters(self.soledad_querier.get_flags_by_chash) - call_with_bad_parameters(self.soledad_querier.get_header_by_chash) - call_with_bad_parameters(self.soledad_querier.get_recent_by_mbox) - call_with_bad_parameters(self.soledad_querier.idents_by_mailbox) - call_with_bad_parameters(self.soledad_querier.get_mbox) diff --git a/service/test/unit/adapter/test_soledad_querier.py b/service/test/unit/adapter/test_soledad_querier.py index 2cc23750..e977b5dc 100644 --- a/service/test/unit/adapter/test_soledad_querier.py +++ b/service/test/unit/adapter/test_soledad_querier.py @@ -104,3 +104,22 @@ class SoledadQuerierTest(unittest.TestCase): attachment = querier.attachment(u'0400BEBACAFE', 'quoted-printable') self.assertEquals('esse papo seu ta qualquer coisa', attachment['content']) + + def test_empty_or_null_queries_are_ignored(self): + soledad = mock() + when(soledad).get_from_index(any(), any(), any()).thenReturn(['nonempty', 'list']) + querier = SoledadQuerier(soledad) + + test_parameters = ['', None] + + def call_with_bad_parameters(funct): + for param in test_parameters: + self.assertFalse(funct(param)) + + call_with_bad_parameters(querier.get_all_flags_by_mbox) + call_with_bad_parameters(querier.get_content_by_phash) + call_with_bad_parameters(querier.get_flags_by_chash) + call_with_bad_parameters(querier.get_header_by_chash) + call_with_bad_parameters(querier.get_recent_by_mbox) + call_with_bad_parameters(querier.idents_by_mailbox) + call_with_bad_parameters(querier.get_mbox) -- cgit v1.2.3