mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Unit test fixes
This commit is contained in:
parent
5ab4be7025
commit
ecc7bd2d5b
@ -8,8 +8,9 @@ from django.db.utils import IntegrityError
|
|||||||
from InvenTree import status_codes as status
|
from InvenTree import status_codes as status
|
||||||
|
|
||||||
from build.models import Build, BuildItem, get_next_build_number
|
from build.models import Build, BuildItem, get_next_build_number
|
||||||
from stock.models import StockItem
|
|
||||||
from part.models import Part, BomItem
|
from part.models import Part, BomItem
|
||||||
|
from stock.models import StockItem
|
||||||
|
from stock.tasks import delete_old_stock_items
|
||||||
|
|
||||||
|
|
||||||
class BuildTest(TestCase):
|
class BuildTest(TestCase):
|
||||||
@ -352,6 +353,11 @@ class BuildTest(TestCase):
|
|||||||
# the original BuildItem objects should have been deleted!
|
# the original BuildItem objects should have been deleted!
|
||||||
self.assertEqual(BuildItem.objects.count(), 0)
|
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!
|
# New stock items should have been created!
|
||||||
self.assertEqual(StockItem.objects.count(), 7)
|
self.assertEqual(StockItem.objects.count(), 7)
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ class StockTest(TestCase):
|
|||||||
w1 = StockItem.objects.get(pk=100)
|
w1 = StockItem.objects.get(pk=100)
|
||||||
w2 = StockItem.objects.get(pk=101)
|
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)
|
# Take 25 units from w1 (there are only 10 in stock)
|
||||||
w1.take_stock(30, None, notes='Took 30')
|
w1.take_stock(30, None, notes='Took 30')
|
||||||
@ -346,7 +346,7 @@ class StockTest(TestCase):
|
|||||||
|
|
||||||
# w2 should now be marked for future deletion
|
# w2 should now be marked for future deletion
|
||||||
w2 = StockItem.objects.get(pk=101)
|
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
|
from stock.tasks import delete_old_stock_items
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user