mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 13:35:40 +00:00
Add a test fixture for orders
This commit is contained in:
@ -1 +1,33 @@
|
||||
# TODO - Implement tests for the order app
|
||||
from django.test import TestCase
|
||||
|
||||
from part.models import Part
|
||||
|
||||
class OrderTest(TestCase):
|
||||
"""
|
||||
Tests to ensure that the order models are functioning correctly.
|
||||
"""
|
||||
|
||||
fixtures = [
|
||||
'company',
|
||||
'supplier_part',
|
||||
'category',
|
||||
'part',
|
||||
'location',
|
||||
'stock',
|
||||
'order'
|
||||
]
|
||||
|
||||
def test_on_order(self):
|
||||
""" There should be 3 separate items on order for the M2x4 LPHS part """
|
||||
|
||||
part = Part.objects.get(name='M2x4 LPHS')
|
||||
|
||||
open_orders = []
|
||||
|
||||
for supplier in part.supplier_parts.all():
|
||||
open_orders += supplier.open_orders()
|
||||
|
||||
self.assertEqual(len(open_orders), 3)
|
||||
|
||||
# Test the total on-order quantity
|
||||
self.assertEqual(part.on_order, 400)
|
||||
|
Reference in New Issue
Block a user