add date__on to query and some other improvments

This commit is contained in:
Ivan Pereira
2017-11-30 21:26:09 +00:00
parent 6c11c759c0
commit fe965e7d19
3 changed files with 21 additions and 15 deletions

View File

@@ -28,19 +28,23 @@ class TestQuery(unittest.TestCase):
def test_sent_from(self):
res = build_search_query(sent_from='test@example.com')
self.assertEqual(res, "(FROM \"test@example.com\")")
self.assertEqual(res, '(FROM "test@example.com")')
def test_sent_to(self):
res = build_search_query(sent_to='test@example.com')
self.assertEqual(res, "(TO \"test@example.com\")")
self.assertEqual(res, '(TO "test@example.com")')
def test_date__gt(self):
res = build_search_query(date__gt=date(2014, 12, 31))
self.assertEqual(res, "(SINCE \"31-Dec-2014\")")
self.assertEqual(res, '(SINCE "31-Dec-2014")')
def test_date__lt(self):
res = build_search_query(date__lt=date(2014, 1, 1))
self.assertEqual(res, "(BEFORE \"1-Jan-2014\")")
self.assertEqual(res, '(BEFORE "01-Jan-2014")')
def test_date__on(self):
res = build_search_query(date__on=date(2014, 1, 1))
self.assertEqual(res, '(ON "01-Jan-2014")')