title: Django: mock function that is called by other function
body: <p>Imagine that there is a <code>models.py</code> file which have <code>update</code> and <code>bulk_update</code> methods</p>
  
  <pre><code>...
  @staticmethod
  def bulk_update(self, ids):
    for id in ids:
      Foo.objects.get(id=id).update()
  
  def update(self):
    pass
  ...
  </code></pre>
  
  <p>Not imagine that we have <code>tests.py</code> file, where we want to <code>mock</code> the <code>update</code> method. The problem is that whatever I do, <code>mock_update</code> always calls original <code>update</code> instead of a mocked one.</p>
  
  <p>TRY #1:</p>
  
  <pre><code># NOT WORKING
  @mock.patch('models.Foo.update')
  class FooTestCase(TestCase):
    def test_foo(self):
      Foo.bulk_update([1,2,3])
  </code></pre>