Skip to content

Commit

Permalink
Unit test for bulk deletion of stock items
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Jul 30, 2022
1 parent 700d78f commit 7793089
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,28 @@ def test_get_stock_item(self):
self.assertEqual(location.pk, 3)
self.assertEqual(location.name, "Dining Room")

def test_bulk_delete(self):
"""Test bulk deletion of stock items"""

# Add some items to location 3
for i in range(10):
StockItem.create(self.api, {
'location': 3,
'part': 1,
'quantity': i + 50,
})

self.assertTrue(len(StockItem.list(self.api, location=3)) >= 10)

# Delete *all* items from location 3
StockItem.bulkDelete(self.api, filters={
'location': 3
})

loc = StockLocation(self.api, pk=3)
items = loc.getStockItems()
self.assertEqual(len(items), 0)


class StockAdjustTest(InvenTreeTestCase):
"""Unit tests for stock 'adjustment' actions"""
Expand Down

0 comments on commit 7793089

Please sign in to comment.