2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 20:20:58 +00:00

better coverage for part/models

- Increase from 57% to 67%
This commit is contained in:
Oliver Walters
2019-04-25 17:51:02 +10:00
parent f36f02b27f
commit 2ab8276672
2 changed files with 25 additions and 0 deletions

@ -64,3 +64,13 @@ class CategoryTest(TestCase):
self.assertEqual(self.p1.partcount, 3)
self.assertEqual(self.p2.partcount, 3)
self.assertEqual(self.p3.partcount, 1)
def test_delete(self):
self.assertEqual(Part.objects.filter(category=self.p1).count(), 0)
# Delete p2 (it has 2 direct parts and one child category)
self.p2.delete()
self.assertEqual(Part.objects.filter(category=self.p1).count(), 2)
self.assertEqual(PartCategory.objects.get(pk=self.p3.id).parent, self.p1)