Skip to content

Commit 47b9a35

Browse files
committed
Add test for creating multiple StockItems at once
1 parent 9d44497 commit 47b9a35

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_stock.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,25 @@ def test_barcode_support(self):
248248

249249
item.unassignBarcode()
250250

251+
def test_serialized(self):
252+
"""Test serializing multiple objects on create"""
253+
254+
# Create items with serial numbers
255+
items = StockItem.create(
256+
self.api,
257+
{
258+
"part": 10004,
259+
"quantity": 3,
260+
"serial_numbers": "1005,1006,1007"
261+
}
262+
)
263+
264+
self.assertEqual(3, len(items))
265+
266+
self.assertEqual('1005', items[0].serial)
267+
self.assertEqual('1006', items[1].serial)
268+
self.assertEqual('1007', items[2].serial)
269+
251270

252271
class StockAdjustTest(InvenTreeTestCase):
253272
"""Unit tests for stock 'adjustment' actions"""

0 commit comments

Comments
 (0)