Fixes for unit tests

This commit is contained in:
Oliver Walters 2021-01-29 12:47:46 +11:00
parent 4ef6a6dc62
commit 8fda2cf745
3 changed files with 11 additions and 6 deletions

View File

@ -1005,11 +1005,15 @@ class StockItem(MPTTModel):
new_stock.addTransactionNote( new_stock.addTransactionNote(
_("Split from existing stock"), _("Split from existing stock"),
user, user,
_("Split") + f" {helpers.normalize(quantity)} " + _("items") f"{_('Split')} {helpers.normalize(quantity)} {_('items')}"
) )
# Remove the specified quantity from THIS stock item # Remove the specified quantity from THIS stock item
self.take_stock(quantity, user, 'Split {n} items into new stock item'.format(n=quantity)) self.take_stock(
quantity,
user,
f"{_('Split')} {quantity} {_('items into new stock item')}"
)
# Return a copy of the "new" stock item # Return a copy of the "new" stock item
return new_stock return new_stock

View File

@ -284,7 +284,8 @@ class StockTest(TestCase):
# Check that a tracking item was added # Check that a tracking item was added
track = StockItemTracking.objects.filter(item=it).latest('id') track = StockItemTracking.objects.filter(item=it).latest('id')
self.assertIn('Stocktake', track.title) self.assertIn('Counted', track.title)
self.assertIn('items', track.title)
self.assertIn('Counted items', track.notes) self.assertIn('Counted items', track.notes)
n = it.tracking_info.count() n = it.tracking_info.count()

View File

@ -1114,7 +1114,7 @@ class StockAdjust(AjaxView, FormMixin):
return self.do_delete() return self.do_delete()
else: else:
return 'No action performed' return _('No action performed')
def do_add(self): def do_add(self):
@ -1129,7 +1129,7 @@ class StockAdjust(AjaxView, FormMixin):
count += 1 count += 1
return _("Added stock to {n} items".format(n=count)) return f"{_('Added stock to ')} {count} {_('items')}"
def do_take(self): def do_take(self):
@ -1144,7 +1144,7 @@ class StockAdjust(AjaxView, FormMixin):
count += 1 count += 1
return _("Removed stock from {n} items".format(n=count)) return f"{_('Removed stock from ')} {count} {_('items')}"
def do_count(self): def do_count(self):