title: Same response for any call to a Mock Object
body: <p>Is it possible to capture any invocation on an object via a Mock and respond to it with controlled behavior?</p>
  <p>For example, let's say I have a <code>class Foo</code> and I want to increment the number of times its calls are made via a Mock.</p>
  <pre><code>Class Foo(): 
     def __init__(self): 
         pass
     def func_one(self): 
         # do work
         pass
     def func_two(self): 
         # do work
         pass
  
  Class EventListener(): 
     def __init__(foo): 
         self.worker = foo
  
     def consume(self, event): 
         if event == someVal: 
            self.worker.func_one()
         elif event == someOtherVal: 
            self.worker.func_two()
         else: 
            # do nothing
            pass
  
  call_counter = 0
  
  def test_EventListener():
     fooMock = mock.Mock(&quot;Foo Mock&quot;)
     # instead of mocking each function in fooMock that corresponds to a 
     # function in class Foo, is it possible to generically mock each function 
     # call and then respond with a uniform return or side_effect?
     # Start Example: 
     global call_counter
     fooMock.anyfunctionCall.returnValue = lambda : call_counter += 1
     # End Example
     eventListener = EventListener(fooMock)
   
     eventListener.consume(evt1)
     eventListener.consume(evt2)
     ...
     eventListner.consumer(evtN)
  
  
  </code></pre>
  <p>In my <code>EventListener</code> how can I increment a counter whenever a Foo &quot;anyCall()&quot; is made? A mock solution is acceptable but I don't know how to make Mocks do this yet.</p>