mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Unit test fixes
This commit is contained in:
parent
77cfadad42
commit
30fd3c8841
@ -7,8 +7,8 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from rest_framework import status
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from rest_framework import status
|
||||||
|
|
||||||
from InvenTree.status_codes import StockStatus
|
from InvenTree.status_codes import StockStatus
|
||||||
from InvenTree.api_tester import InvenTreeAPITestCase
|
from InvenTree.api_tester import InvenTreeAPITestCase
|
||||||
@ -456,30 +456,32 @@ class StocktakeTest(StockAPITestCase):
|
|||||||
|
|
||||||
# POST without a PK
|
# POST without a PK
|
||||||
response = self.post(url, data)
|
response = self.post(url, data)
|
||||||
self.assertContains(response, 'must contain a valid pk', status_code=status.HTTP_400_BAD_REQUEST)
|
self.assertContains(response, 'must contain a valid integer primary-key', status_code=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# POST with a PK but no quantity
|
# POST with an invalid PK
|
||||||
data['items'] = [{
|
data['items'] = [{
|
||||||
'pk': 10
|
'pk': 10
|
||||||
}]
|
}]
|
||||||
|
|
||||||
response = self.post(url, data)
|
response = self.post(url, data)
|
||||||
self.assertContains(response, 'must contain a valid pk', status_code=status.HTTP_400_BAD_REQUEST)
|
self.assertContains(response, 'does not match valid stock item', status_code=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
# POST with missing quantity value
|
||||||
data['items'] = [{
|
data['items'] = [{
|
||||||
'pk': 1234
|
'pk': 1234
|
||||||
}]
|
}]
|
||||||
|
|
||||||
response = self.post(url, data)
|
response = self.post(url, data)
|
||||||
self.assertContains(response, 'must contain a valid quantity', status_code=status.HTTP_400_BAD_REQUEST)
|
self.assertContains(response, 'Invalid quantity value', status_code=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
# POST with an invalid quantity value
|
||||||
data['items'] = [{
|
data['items'] = [{
|
||||||
'pk': 1234,
|
'pk': 1234,
|
||||||
'quantity': '10x0d'
|
'quantity': '10x0d'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
response = self.post(url, data)
|
response = self.post(url, data)
|
||||||
self.assertContains(response, 'must contain a valid quantity', status_code=status.HTTP_400_BAD_REQUEST)
|
self.assertContains(response, 'Invalid quantity value', status_code=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
data['items'] = [{
|
data['items'] = [{
|
||||||
'pk': 1234,
|
'pk': 1234,
|
||||||
|
Loading…
Reference in New Issue
Block a user