def testGetFurthestWarehouseLeftoverOrder(self):
     orders = {'apple': 5, 'banana': 5, 'orange': 5}
     warehouses = [{
         'name': 'owd',
         'inventory': {
             'apple': 5,
             'orange': 10
         }
     }, {
         'name': 'dm',
         'inventory': {
             'banana': 5,
             'orange': 10
         }
     }]
     inventoryAllocator = InventoryAllocator()
     furthest = inventoryAllocator.getFurthestWarehouse(orders, warehouses)
     self.assertEqual(furthest, 1)
 def testGetFurthestWarehouseChooseClosest(self):
     orders = {'apple': 5}
     warehouses = [{
         'name': 'owd',
         'inventory': {
             'apple': 5,
             'orange': 10
         }
     }, {
         'name': 'dm',
         'inventory': {
             'apple': 5,
             'orange': 10
         }
     }]
     furthest = 0
     inventoryAllocator = InventoryAllocator()
     furthest = inventoryAllocator.getFurthestWarehouse(orders, warehouses)
     self.assertEqual(furthest, 0)
 def testGetFurthestWarehouseNotFound(self):
     orders = {'apple': 1}
     warehouses = [{'name': 'owd', 'inventory': {'apple': 0}}]
     inventoryAllocator = InventoryAllocator()
     furthest = inventoryAllocator.getFurthestWarehouse(orders, warehouses)
     self.assertEqual(furthest, -1)