Skip to content

Commit 9d44497

Browse files
Merge pull request #273 from inventree/unit-test-tweak
Tweak unit tests
2 parents 71d8445 + e0ecff9 commit 9d44497

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

test/test_part.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -703,14 +703,32 @@ def test_get_requirements(self):
703703

704704
# Check for expected content
705705
self.assertIsInstance(req, dict)
706-
self.assertIn('available_stock', req)
707-
self.assertIn('on_order', req)
708-
self.assertIn('required_build_order_quantity', req)
709-
self.assertIn('allocated_build_order_quantity', req)
710-
self.assertIn('required_sales_order_quantity', req)
711-
self.assertIn('allocated_sales_order_quantity', req)
712-
self.assertIn('allocated', req)
713-
self.assertIn('required', req)
706+
707+
# Ref: https://github.com/inventree/InvenTree/pull/9798
708+
if self.api.api_version < 350:
709+
fields = [
710+
'on_order',
711+
'allocated_build_order_quantity',
712+
'allocated_sales_order_quantity',
713+
'required_build_order_quantity',
714+
'required_sales_order_quantity',
715+
]
716+
else:
717+
fields = [
718+
'total_stock',
719+
'unallocated_stock',
720+
'can_build',
721+
'ordering',
722+
'building',
723+
'scheduled_to_build',
724+
'required_for_build_orders',
725+
'allocated_to_build_orders',
726+
'required_for_sales_orders',
727+
'allocated_to_sales_orders',
728+
]
729+
730+
for f in fields:
731+
self.assertIn(f, req)
714732

715733

716734
class PartBarcodeTest(InvenTreeTestCase):

0 commit comments

Comments
 (0)