def test_load404_ok(self): with self.app.test_request_context(): session = database.get_session() session.save(database.PersonRow(hello="world")) session.commit() with self.app.test_request_context(): person = database.get_person_or_404(1) self.assertEqual(person.id, 1) self.assertEqual(person, {"hello": "world"})
def test_list_of_participants(self): self._create_participant(u"10") self._create_participant(u"1") resp = self.client.get("/meeting/1/printouts/verified/short_list") # conditie: Verif and Cat>9 and Cat<98 and Cat["registered"] is Ture with self.app.test_request_context(): person_row = database.get_person_or_404(1) category = schema.category[person_row["personal_category"]] self.assertTrue(category["registered"]) with self.app.test_request_context(): person_row = database.get_person_or_404(2) category = schema.category[person_row["personal_category"]] self.assertFalse(category["registered"]) [representing] = select(resp.data, "table .printout-representing") representing = representing.text_content() self.assertIn(u"Europe", representing) self.assertIn(u"Romania", representing)
def test_load404_error(self): import werkzeug.exceptions with self.app.test_request_context(): with self.assertRaises(werkzeug.exceptions.NotFound) as e: database.get_person_or_404(13)