mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixed unit test
This commit is contained in:
parent
a8e3e6c8db
commit
7ac7e8f969
@ -15,6 +15,8 @@ from django.contrib.auth import get_user_model
|
|||||||
from InvenTree.helpers import addUserPermissions
|
from InvenTree.helpers import addUserPermissions
|
||||||
from InvenTree.status_codes import StockStatus
|
from InvenTree.status_codes import StockStatus
|
||||||
|
|
||||||
|
from common.models import InvenTreeSetting
|
||||||
|
|
||||||
from .models import StockItem, StockLocation
|
from .models import StockItem, StockLocation
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +38,9 @@ class StockAPITestCase(APITestCase):
|
|||||||
|
|
||||||
self.user = user.objects.create_user('testuser', 'test@testing.com', 'password')
|
self.user = user.objects.create_user('testuser', 'test@testing.com', 'password')
|
||||||
|
|
||||||
|
self.user.is_staff = True
|
||||||
|
self.user.save()
|
||||||
|
|
||||||
# Add the necessary permissions to the user
|
# Add the necessary permissions to the user
|
||||||
perms = [
|
perms = [
|
||||||
'view_stockitemtestresult',
|
'view_stockitemtestresult',
|
||||||
@ -223,6 +228,13 @@ class StockItemListTest(StockAPITestCase):
|
|||||||
Filter StockItem by expiry status
|
Filter StockItem by expiry status
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# First, we can assume that the 'stock expiry' feature is disabled
|
||||||
|
response = self.get_stock(expired=1)
|
||||||
|
self.assertEqual(len(response), 19)
|
||||||
|
|
||||||
|
# Now, ensure that the expiry date feature is enabled!
|
||||||
|
InvenTreeSetting.set_setting('STOCK_ENABLE_EXPIRY', True, self.user)
|
||||||
|
|
||||||
response = self.get_stock(expired=1)
|
response = self.get_stock(expired=1)
|
||||||
self.assertEqual(len(response), 1)
|
self.assertEqual(len(response), 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user