示例#1
0
    def test_delete(self):
        self.assertEqual(ItemData.query.count(), 0)

        item_data = ItemData(id='test/artist/Tester', item_id=self.item.id)
        db.session.add(item_data)
        db.session.flush()
        self.assertEqual(ItemData.query.count(), 1)

        item_data.delete()
        self.assertEqual(ItemData.query.count(), 0)
示例#2
0
    def test_delete(self):
        resp = Item.query.all()
        assert len(resp) == 0

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

        item_data = ItemData(id='item-data-1', item_id=item.id)
        db.session.add(item_data)
        db.session.flush()

        resp = ItemData.query.all()
        assert len(resp) == 1

        item_data.delete()

        resp = ItemData.query.all()
        assert len(resp) == 0