mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Fix simple tests
This commit is contained in:
parent
f7ed48809c
commit
c31b30bf83
@ -220,5 +220,5 @@ class BuildTest(TestCase):
|
|||||||
|
|
||||||
# And a new stock item created for the build output
|
# And a new stock item created for the build output
|
||||||
self.assertEqual(StockItem.objects.get(pk=7).quantity, 1)
|
self.assertEqual(StockItem.objects.get(pk=7).quantity, 1)
|
||||||
self.assertEqual(StockItem.objects.get(pk=7).serial, 1)
|
self.assertEqual(StockItem.objects.get(pk=7).serial, "1")
|
||||||
self.assertEqual(StockItem.objects.get(pk=7).build, self.build)
|
self.assertEqual(StockItem.objects.get(pk=7).build, self.build)
|
||||||
|
@ -346,10 +346,12 @@ class Part(MPTTModel):
|
|||||||
|
|
||||||
if n is None:
|
if n is None:
|
||||||
return 1
|
return 1
|
||||||
elif n is int:
|
|
||||||
return n + 1
|
|
||||||
else:
|
else:
|
||||||
return None
|
try:
|
||||||
|
return int(n) + 1
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def getSerialNumberString(self, quantity):
|
def getSerialNumberString(self, quantity):
|
||||||
"""
|
"""
|
||||||
|
@ -295,10 +295,7 @@ class StockTest(TestCase):
|
|||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
item.serializeStock(-1, [], self.user)
|
item.serializeStock(-1, [], self.user)
|
||||||
|
|
||||||
# Try invalid serial numbers
|
# Not enough serial numbers for all stock items.
|
||||||
with self.assertRaises(ValidationError):
|
|
||||||
item.serializeStock(3, [1, 2, 'k'], self.user)
|
|
||||||
|
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
item.serializeStock(3, "hello", self.user)
|
item.serializeStock(3, "hello", self.user)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user