def test_load_all(self): with self.app.test_request_context(): session = database.get_session() session.save(database.PersonRow(hello="world")) session.save(database.PersonRow(x="y")) session.commit() with self.app.test_request_context(): all_persons = list(database.get_all_persons()) self.assertEqual(len(all_persons), 2) self.assertEqual(all_persons[0], {'hello': "world"}) self.assertEqual(all_persons[0].id, 1) self.assertEqual(all_persons[1], {'x': "y"}) self.assertEqual(all_persons[1].id, 2)
def _get_person_data(self): from cites import database with self.app.test_request_context(): return list(database.get_all_persons())