def test_can_create_view_for_second_page(self): """ We can create a view for the second page """ search_list = posts.Journals.journals_for_search(search_string='TLV', page=2) list_view2 = postviews.JournalListView(search_list) self.assertIn('extkey', list_view2[12], 'extkey missing')
def test_last_page_correct_no(self): """ The last page should have the correct no of records """ search_list = posts.Journals.journals_for_search(search_string='TLV', page=4) list_view3 = postviews.JournalListView(search_list) self.assertEqual(len(list_view3), 10, 'Wrong no of journals on last page')
def test_view_for_page_info(self): """ The view has page info """ list_view4 = postviews.JournalListView(self.search_list) self.assertEqual(list_view4.page, 1, 'Wrong or no page number in view') self.assertEqual(list_view4.pagelength, 25, 'Wrong or no page length in view') self.assertEqual(list_view4.total_pages, 4, 'Wrong or no no of pages in view')
def test_can_show_other_page(self): """ There are differences between different pages """ search_list = posts.Journals.journals_for_search(search_string='BRH', page=1) list_view5 = postviews.JournalListView(search_list) extkeys = [] for journal in list_view5: extkeys.append(journal['extkey']) rv2 = self.app.get('/journallist?search_for=BRH&page=2') for extkey in extkeys: self.assertNotIn(extkey.encode(), rv2.data, 'Duplicaten in 2e pagina')
def test_can_make_view(self): """ We can create a view from a search list """ list_view1 = postviews.JournalListView(self.search_list) self.assertEqual(len(list_view1), 25, 'Wrong number of journals in list view')