Skip to content

Commit b39ca90

Browse files
Account for API version in test
1 parent 80f1d1d commit b39ca90

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

test/test_part.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,31 @@ 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)
712706

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

714732
class PartBarcodeTest(InvenTreeTestCase):
715733
"""Tests for Part barcode functionality"""

0 commit comments

Comments
 (0)