Fix unit tests to match new API format

This commit is contained in:
Oliver 2021-08-24 08:18:59 +10:00
parent 6091f2ba33
commit 2aa505b2cb

View File

@ -249,7 +249,7 @@ class PurchaseOrderReceiveTest(OrderTest):
{
"items": [
{
"supplier_part": 12345,
"line_item": 12345,
"location": 12345
}
]
@ -257,9 +257,9 @@ class PurchaseOrderReceiveTest(OrderTest):
expected_code=400
).data
items = data['items']
items = data['items'][0]
self.assertIn('Invalid pk "12345"', str(items['supplier_part']))
self.assertIn('Invalid pk "12345"', str(items['line_item']))
self.assertIn("object does not exist", str(items['location']))
def test_mismatched_items(self):
@ -267,6 +267,23 @@ class PurchaseOrderReceiveTest(OrderTest):
Test for supplier parts which *do* exist but do not match the order supplier
"""
data = self.post(
self.url,
{
'items': [
{
'line_item': 22,
'quantity': 123,
'location': 1,
}
],
'location': None,
},
expected_code=400
).data
self.assertIn('Line item does not match purchase order', str(data))
class SalesOrderTest(OrderTest):
"""