diff options
author | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-16 11:53:56 +0200 |
---|---|---|
committer | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-16 11:53:56 +0200 |
commit | eacd5fd5f7f47791ddc2e5568b8e4622420d8562 (patch) | |
tree | f303e7593c8eec8cc626b0df489b7e81128ca6dd /service/test/integration | |
parent | 693957054255b1807ae9c09478a06e191114b7fb (diff) |
#96 Mail searches are now paginated, the pages number start at 1 now
Diffstat (limited to 'service/test/integration')
-rw-r--r-- | service/test/integration/search_test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/service/test/integration/search_test.py b/service/test/integration/search_test.py index 7323866d..81d1fad2 100644 --- a/service/test/integration/search_test.py +++ b/service/test/integration/search_test.py @@ -58,3 +58,33 @@ class SearchTest(unittest.TestCase, SoledadTestBase): all_tag_names = [t['name'] for t in all_tags] self.assertEqual(1, len(all_tag_names)) self.assertTrue('sometag' in all_tag_names) + + def test_search_mails_different_window(self): + input_mail = MailBuilder().build_input_mail() + input_mail2 = MailBuilder().build_input_mail() + self.add_mail_to_inbox(input_mail) + self.add_mail_to_inbox(input_mail2) + + first_page = self.get_mails_by_tag('inbox', page=1, window=1) + + self.assertEqual(len(first_page), 1) + + def test_search_mails_with_multiple_pages(self): + input_mail = MailBuilder().build_input_mail() + input_mail2 = MailBuilder().build_input_mail() + self.add_mail_to_inbox(input_mail) + self.add_mail_to_inbox(input_mail2) + + first_page = self.get_mails_by_tag('inbox', page=1, window=1) + second_page = self.get_mails_by_tag('inbox', page=2, window=1) + + idents = [input_mail.ident, input_mail2.ident] + + self.assertIn(first_page[0].ident, idents) + self.assertIn(second_page[0].ident, idents) + + def test_page_zero_fetches_first_page(self): + input_mail = MailBuilder().build_input_mail() + self.add_mail_to_inbox(input_mail) + page = self.get_mails_by_tag('inbox', page=0, window=1) + self.assertEqual(page[0].ident, input_mail.ident) |