2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 19:50:59 +00:00

Fixes for stock api unit tests

- Remove old unit tests
- Require quantity when creating a new stock item
This commit is contained in:
Oliver
2021-11-05 00:27:26 +11:00
parent f27acde934
commit 78ac40083a
4 changed files with 27 additions and 90 deletions

View File

@ -364,24 +364,22 @@ class StockItemTest(StockAPITestCase):
'part': 1,
'location': 1,
},
expected_code=201,
expected_code=400
)
# Item should have been created with default quantity
self.assertEqual(response.data['quantity'], 1)
self.assertIn('Quantity is required', str(response.data))
# POST with quantity and part and location
response = self.client.post(
response = self.post(
self.list_url,
data={
'part': 1,
'location': 1,
'quantity': 10,
}
},
expected_code=201
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_default_expiry(self):
"""
Test that the "default_expiry" functionality works via the API.