def testD_orderFilled(self): """Test routine D""" # creating a test order testOrder = Order("mushrooms", 10) print repr(testOrder) # perform the test testOrder.fill(self.fooSource) print testOrder.isFilled() # perform the checks self.assertTrue(testOrder.isFilled()) self.assertNotEqual(testOrder._orderFilled, -1) self.fooSource.hasInventory.assert_called_once_with("mushrooms") self.fooSource.getInventory.assert_called_with("mushrooms", 10) testCalls = [call.hasInventory("mushrooms"), call.getInventory("mushrooms", 10)] self.fooSource.assert_has_calls(testCalls)
def testE_orderIncomplete(self): """Test routine E""" # creating a test order testOrder = Order("mushrooms", 10) print repr(testOrder) # perform the test testOrder.fill(self.fooSource) print testOrder.isFilled() # perform the checks self.assertFalse(testOrder.isFilled()) self.assertNotEqual(testOrder._orderFilled, testOrder._orderAmount) self.fooSource.hasInventory.assert_called_once_with("mushrooms") self.fooSource.getInventory.assert_called_with("mushrooms", 10) print self.fooSource.mock_calls testCalls = [call.hasInventory("mushrooms"), call.getInventory("mushrooms", 10)] self.fooSource.assert_has_calls(testCalls)