mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
test: improve coverage of new get_destination
This commit is contained in:
parent
cd07ea835d
commit
f8e4a5ac2e
@ -52,3 +52,10 @@
|
|||||||
part: 2
|
part: 2
|
||||||
supplier: 2
|
supplier: 2
|
||||||
SKU: 'ZERGM312'
|
SKU: 'ZERGM312'
|
||||||
|
|
||||||
|
- model: company.supplierpart
|
||||||
|
pk: 5
|
||||||
|
fields:
|
||||||
|
part: 4
|
||||||
|
supplier: 2
|
||||||
|
SKU: 'R_4K7_0603'
|
||||||
|
@ -65,7 +65,7 @@ class CompanySimpleTest(TestCase):
|
|||||||
self.assertEqual(acme.supplied_part_count, 4)
|
self.assertEqual(acme.supplied_part_count, 4)
|
||||||
|
|
||||||
self.assertTrue(appel.has_parts)
|
self.assertTrue(appel.has_parts)
|
||||||
self.assertEqual(appel.supplied_part_count, 3)
|
self.assertEqual(appel.supplied_part_count, 4)
|
||||||
|
|
||||||
self.assertTrue(zerg.has_parts)
|
self.assertTrue(zerg.has_parts)
|
||||||
self.assertEqual(zerg.supplied_part_count, 2)
|
self.assertEqual(zerg.supplied_part_count, 2)
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
order: 1
|
order: 1
|
||||||
part: 1
|
part: 1
|
||||||
quantity: 100
|
quantity: 100
|
||||||
|
destination: 5 # Desk/Drawer_1
|
||||||
|
|
||||||
# 250 x ACME0002 (M2x4 LPHS)
|
# 250 x ACME0002 (M2x4 LPHS)
|
||||||
# Partially received (50)
|
# Partially received (50)
|
||||||
@ -95,3 +96,10 @@
|
|||||||
part: 3
|
part: 3
|
||||||
quantity: 100
|
quantity: 100
|
||||||
|
|
||||||
|
# 1 x R_4K7_0603
|
||||||
|
- model: order.purchaseorderlineitem
|
||||||
|
pk: 23
|
||||||
|
fields:
|
||||||
|
order: 1
|
||||||
|
part: 5
|
||||||
|
quantity: 1
|
||||||
|
@ -87,7 +87,7 @@ class OrderTest(TestCase):
|
|||||||
order = PurchaseOrder.objects.get(pk=1)
|
order = PurchaseOrder.objects.get(pk=1)
|
||||||
|
|
||||||
self.assertEqual(order.status, PurchaseOrderStatus.PENDING)
|
self.assertEqual(order.status, PurchaseOrderStatus.PENDING)
|
||||||
self.assertEqual(order.lines.count(), 3)
|
self.assertEqual(order.lines.count(), 4)
|
||||||
|
|
||||||
sku = SupplierPart.objects.get(SKU='ACME-WIDGET')
|
sku = SupplierPart.objects.get(SKU='ACME-WIDGET')
|
||||||
part = sku.part
|
part = sku.part
|
||||||
@ -105,11 +105,11 @@ class OrderTest(TestCase):
|
|||||||
order.add_line_item(sku, 100)
|
order.add_line_item(sku, 100)
|
||||||
|
|
||||||
self.assertEqual(part.on_order, 100)
|
self.assertEqual(part.on_order, 100)
|
||||||
self.assertEqual(order.lines.count(), 4)
|
self.assertEqual(order.lines.count(), 5)
|
||||||
|
|
||||||
# Order the same part again (it should be merged)
|
# Order the same part again (it should be merged)
|
||||||
order.add_line_item(sku, 50)
|
order.add_line_item(sku, 50)
|
||||||
self.assertEqual(order.lines.count(), 4)
|
self.assertEqual(order.lines.count(), 5)
|
||||||
self.assertEqual(part.on_order, 150)
|
self.assertEqual(part.on_order, 150)
|
||||||
|
|
||||||
# Try to order a supplier part from the wrong supplier
|
# Try to order a supplier part from the wrong supplier
|
||||||
@ -163,7 +163,7 @@ class OrderTest(TestCase):
|
|||||||
loc = StockLocation.objects.get(id=1)
|
loc = StockLocation.objects.get(id=1)
|
||||||
|
|
||||||
# There should be two lines against this order
|
# There should be two lines against this order
|
||||||
self.assertEqual(len(order.pending_line_items()), 3)
|
self.assertEqual(len(order.pending_line_items()), 4)
|
||||||
|
|
||||||
# Should fail, as order is 'PENDING' not 'PLACED"
|
# Should fail, as order is 'PENDING' not 'PLACED"
|
||||||
self.assertEqual(order.status, PurchaseOrderStatus.PENDING)
|
self.assertEqual(order.status, PurchaseOrderStatus.PENDING)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user