noyainrain / listling

Web app to make and edit lists collaboratively.
https://listling.org/
GNU Affero General Public License v3.0
34 stars 8 forks source link

Fix incomplete item deletion #98

Closed noyainrain closed 3 years ago

noyainrain commented 3 years ago

At the moment, assignees and votes are not deleted with the Item.

Unit test to reproduce:

class ItemTest:
    async def test_delete(self) -> None:
        await self.list.edit(features=['assign', 'vote'])
        self.item.assignees.assign(self.user, user=self.user)
        self.item.votes.vote(user=self.user)
        self.item.delete()
        with self.assertRaises(KeyError):
            # pylint: disable=pointless-statement; error raised on access
            self.app.items[self.item.id]
        self.assertFalse(self.item.assignees)
        self.assertFalse(self.item.votes)
        self.assertFalse(self.list.items)