From 2aa505b2cbc23ed68084817a4e91e15b753b006e Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 24 Aug 2021 08:18:59 +1000 Subject: [PATCH] Fix unit tests to match new API format --- InvenTree/order/test_api.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/InvenTree/order/test_api.py b/InvenTree/order/test_api.py index 5ab5230d8e..6db4cbc47e 100644 --- a/InvenTree/order/test_api.py +++ b/InvenTree/order/test_api.py @@ -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): """