mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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
|
||||
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)
|
||||
|
@ -346,11 +346,13 @@ class Part(MPTTModel):
|
||||
|
||||
if n is None:
|
||||
return 1
|
||||
elif n is int:
|
||||
return n + 1
|
||||
else:
|
||||
try:
|
||||
return int(n) + 1
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
def getSerialNumberString(self, quantity):
|
||||
"""
|
||||
Return a formatted string representing the next available serial numbers,
|
||||
|
@ -295,10 +295,7 @@ class StockTest(TestCase):
|
||||
with self.assertRaises(ValidationError):
|
||||
item.serializeStock(-1, [], self.user)
|
||||
|
||||
# Try invalid serial numbers
|
||||
with self.assertRaises(ValidationError):
|
||||
item.serializeStock(3, [1, 2, 'k'], self.user)
|
||||
|
||||
# Not enough serial numbers for all stock items.
|
||||
with self.assertRaises(ValidationError):
|
||||
item.serializeStock(3, "hello", self.user)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user