From a6c98d79d49d512235259c6fd3271dc9fa74bada Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 11 Mar 2015 19:36:51 -0300 Subject: for #315, test queries with bad or empty parameters. They all should return empty, not an error --- service/test/integration/test_soledad_querier.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/service/test/integration/test_soledad_querier.py b/service/test/integration/test_soledad_querier.py index 9c7f8a81..00967d85 100644 --- a/service/test/integration/test_soledad_querier.py +++ b/service/test/integration/test_soledad_querier.py @@ -83,3 +83,20 @@ 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.client.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) -- cgit v1.2.3