def test_create_identity(self, client): all_before = Identity.all() res = client.post("/identity/new") self.assertEqual(302, res.status_code) all_after = Identity.all() new_identities = [iden for iden in all_after if iden not in all_before] self.assertTrue(len(new_identities) == 1)
def test_get_all(self): self.assertEqual([], Identity.all()) joe = Identity() joe.save() self.assertEqual([joe], Identity.all()) jane = Identity() jane.save() self.assertListEqual([joe, jane], Identity.all())
def list_identities(): all_identities = Identity.all() return ListIdentities(all_identities).render()