Unit test fixes

This commit is contained in:
Oliver Walters 2021-09-07 22:27:39 +10:00
parent 5ab4be7025
commit ecc7bd2d5b
2 changed files with 9 additions and 3 deletions

View File

@ -8,8 +8,9 @@ from django.db.utils import IntegrityError
from InvenTree import status_codes as status
from build.models import Build, BuildItem, get_next_build_number
from stock.models import StockItem
from part.models import Part, BomItem
from stock.models import StockItem
from stock.tasks import delete_old_stock_items
class BuildTest(TestCase):
@ -352,6 +353,11 @@ class BuildTest(TestCase):
# the original BuildItem objects should have been deleted!
self.assertEqual(BuildItem.objects.count(), 0)
self.assertEqual(StockItem.objects.count(), 8)
# Clean up old stock items
delete_old_stock_items()
# New stock items should have been created!
self.assertEqual(StockItem.objects.count(), 7)

View File

@ -332,7 +332,7 @@ class StockTest(TestCase):
w1 = StockItem.objects.get(pk=100)
w2 = StockItem.objects.get(pk=101)
self.assertFalse(w2.scheduled_for_depletion)
self.assertFalse(w2.scheduled_for_deletion)
# Take 25 units from w1 (there are only 10 in stock)
w1.take_stock(30, None, notes='Took 30')
@ -346,7 +346,7 @@ class StockTest(TestCase):
# w2 should now be marked for future deletion
w2 = StockItem.objects.get(pk=101)
self.assertTrue(w2.scheduled_for_depletion)
self.assertTrue(w2.scheduled_for_deletion)
from stock.tasks import delete_old_stock_items