def test_render_index(): le, all_entries = _get_last_entries(DB, 10) update_index(le) with open(os.path.join(CONFIG['output_to'], 'index.html')) as html_index: soup = BeautifulSoup(html_index.read(), 'html.parser') assert len(soup.find_all(class_='clearfix entry')) == 10
def test_get_last_entries(): assert len(DB.posts.all()) == 22 le, all = _get_last_entries(DB, 10) assert [e.id for e in le] == list(range(22, 12, -1))