2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-23 09:35:30 +00:00

Fixes for Stocktransfer API endpoint

This commit is contained in:
Oliver Walters
2020-04-10 01:01:39 +10:00
parent 5b2665edb1
commit bc91975f2c
2 changed files with 45 additions and 53 deletions
+25
View File
@@ -154,3 +154,28 @@ class StocktakeTest(APITestCase):
response = self.doPost(url, data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_transfer(self):
"""
Test stock transfers
"""
data = {
'item': {
'pk': 1234,
'quantity': 10,
},
'location': 1,
'notes': "Moving to a new location"
}
url = reverse('api-stock-transfer')
response = self.doPost(url, data)
self.assertContains(response, "Moved 1 parts to", status_code=status.HTTP_200_OK)
# Now try one which will fail due to a bad location
data['location'] = 'not a location'
response = self.doPost(url, data)
self.assertContains(response, 'Valid location must be specified', status_code=status.HTTP_400_BAD_REQUEST)