Skip to content

Commit

Permalink
Test 4th receive test with debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
30350n committed Oct 1, 2023
1 parent b241b50 commit 50082ae
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions InvenTree/plugin/builtin/suppliers/test_supplier_barcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from company.models import Company, ManufacturerPart, SupplierPart
from InvenTree.unit_test import InvenTreeAPITestCase
from order.models import PurchaseOrder # , PurchaseOrderLineItem
from order.models import PurchaseOrder, PurchaseOrderLineItem
from part.models import Part
from stock.models import StockItem, StockLocation

Expand Down Expand Up @@ -190,24 +190,28 @@ def test_receive_one_stock_location(self):
stock_item = StockItem.objects.get(pk=result2.data["stockitem"]["pk"])
assert stock_item.location == stock_location

# def test_receive_default_line_item_location(self):
# """Test receiving an item into the default line_item location"""
#
# StockLocation.objects.create(name="Test Location 1")
# stock_location2 = StockLocation.objects.create(name="Test Location 2")
#
# line_item = PurchaseOrderLineItem.objects.filter(part__SKU="42")[0]
# line_item.destination = stock_location2
# line_item.save()
#
# url = reverse("api-barcode-po-receive")
# result1 = self.post(url, data={"barcode": MOUSER_BARCODE})
# assert "success" in result1.data
#
# result2 = self.post(reverse("api-barcode-scan"), data={"barcode": MOUSER_BARCODE})
# stock_item = StockItem.objects.get(pk=result2.data["stockitem"]["pk"])
# assert stock_item.location == stock_location2
#
def test_receive_default_line_item_location(self):
"""Test receiving an item into the default line_item location"""

StockLocation.objects.create(name="Test Location 1")
stock_location2 = StockLocation.objects.create(name="Test Location 2")
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", stock_location2)

line_item = PurchaseOrderLineItem.objects.filter(part__SKU="42")[0]
print("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", line_item)
line_item.destination = stock_location2
line_item.save()

url = reverse("api-barcode-po-receive")
result1 = self.post(url, data={"barcode": MOUSER_BARCODE})
print("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", result1, result1.data)
assert "success" in result1.data

result2 = self.post(reverse("api-barcode-scan"), data={"barcode": MOUSER_BARCODE})
print("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", result2, result2.data)
stock_item = StockItem.objects.get(pk=result2.data["stockitem"]["pk"])
assert stock_item.location == stock_location2

# def test_receive_default_part_location(self):
# """Test receiving an item into the default part location"""
#
Expand Down

0 comments on commit 50082ae

Please sign in to comment.