Ejemplo n.º 1
0
    def test_delete(self):
        self.assertEqual(Item.query.count(), 0)

        item = Item()
        db.session.add(item)
        db.session.flush()
        self.assertEqual(Item.query.count(), 1)

        item.delete()
        self.assertEqual(Item.query.count(), 0)
Ejemplo n.º 2
0
    def test_delete(self):
        items = Item.query.all()
        assert len(items) == 0

        item = Item()
        db.session.add(item)
        db.session.flush()

        items = Item.query.all()
        assert len(items) == 1

        item.delete()

        items = Item.query.all()
        assert len(items) == 0