2
0
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:
Oliver Walters
2019-06-17 19:47:16 +10:00
parent 78bfc0b6a8
commit 0857ec61fd
4 changed files with 82 additions and 1 deletions

View File

@ -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)