Check that supplier and manufacturer parts are created

This commit is contained in:
Oliver 2021-08-14 10:43:45 +10:00
parent 6fa4e33062
commit 2b13512145
2 changed files with 27 additions and 21 deletions

View File

@ -704,9 +704,6 @@ class PartList(generics.ListCreateAPIView):
'initial_stock_quantity': [_('Must be a valid quantity')],
})
# If an initial stock quantity is specified...
if initial_stock_quantity > 0:
initial_stock_location = request.data.get('initial_stock_location', None)
try:

View File

@ -580,6 +580,15 @@ class PartAPITest(InvenTreeAPITestCase):
self.assertEqual(Part.objects.count(), n + 1)
pk = response.data['pk']
new_part = Part.objects.get(pk=pk)
# Check that there is a new manufacturer part *and* a new supplier part
self.assertEqual(new_part.supplier_parts.count(), 1)
self.assertEqual(new_part.manufacturer_parts.count(), 1)
class PartDetailTests(InvenTreeAPITestCase):
"""
Test that we can create / edit / delete Part objects via the API