Esempio n. 1
0
 def test_OneOrder_ValidShipment_OneProviding_MultipleWarehouses(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 1}},
                              {'name': 'dm', 'inventory': {'apple': 3}}
                              ]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     shipment = inventoryAlloc.shipment_validation()
     self.assertEqual(shipment, [{'owd': {'apple': 1}}])
Esempio n. 2
0
 def test_MultipleOrders_ValidShipment_OneProviding_OneWarehouse(self):
     order = {'apple': 1, 'orange': 2}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 1, 'orange': 2}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     shipment = inventoryAlloc.shipment_validation()
     self.assertEqual(shipment, [{'owd': {'apple': 1, 'orange': 2}}])
Esempio n. 3
0
 def test_OneOrder_InvalidShipment__OneProviding_OneWarehouse(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 0}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     shipment = inventoryAlloc.shipment_validation()
     self.assertEqual(shipment, [])
Esempio n. 4
0
 def test_NameInDistributionIsNonString_TypeError(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 1, 'inventory': {'apple': 1}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     with self.assertRaises(TypeError):
         inventoryAlloc.shipment_validation()
Esempio n. 5
0
 def test_InventoryAmountIsString_TypeError(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': '1'}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     with self.assertRaises(TypeError):
         inventoryAlloc.shipment_validation()
Esempio n. 6
0
 def test_surplusInventory(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 10}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     shipment = inventoryAlloc.shipment_validation()
     self.assertEqual(shipment, [{'owd': {'apple': 1}}])
Esempio n. 7
0
 def test_OrderIsNotPresent(self):
     order = {'apple': 1, 'orange': 2}
     inventory_distribution = [{'name': 'owd', 'inventory': {'Banana': 1}}]
     inventoryAlloc = InventoryAllocation(order, inventory_distribution)
     shipment = inventoryAlloc.shipment_validation()
     self.assertEqual(shipment, [])