mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add some more unit tests for BOM API endpoints
This commit is contained in:
parent
7af9e9123e
commit
b7937a4750
@ -1382,6 +1382,21 @@ class BomItemTest(InvenTreeAPITestCase):
|
|||||||
response = self.get(url, expected_code=200)
|
response = self.get(url, expected_code=200)
|
||||||
self.assertEqual(len(response.data), 5)
|
self.assertEqual(len(response.data), 5)
|
||||||
|
|
||||||
|
# The BomItem detail endpoint should now also reflect the substitute data
|
||||||
|
data = self.get(
|
||||||
|
reverse('api-bom-item-detail', kwargs={'pk': bom_item.pk}),
|
||||||
|
expected_code=200
|
||||||
|
).data
|
||||||
|
|
||||||
|
# 5 substitute parts
|
||||||
|
self.assertEqual(len(data['substitutes']), 5)
|
||||||
|
|
||||||
|
# 5 x 1,000 stock quantity
|
||||||
|
self.assertEqual(data['available_substitute_stock'], 5000)
|
||||||
|
|
||||||
|
# 9,000 stock directly available
|
||||||
|
self.assertEqual(data['available_stock'], 9000)
|
||||||
|
|
||||||
def test_bom_item_uses(self):
|
def test_bom_item_uses(self):
|
||||||
"""
|
"""
|
||||||
Tests for the 'uses' field
|
Tests for the 'uses' field
|
||||||
|
Loading…
Reference in New Issue
Block a user