title: How do I mock a function in Django?
body: <p>I expect the following call to <code>which_user</code> to return <code>self.user</code> no matter what is passed into it but it's behaving as if it is not mocked at all.</p>
  
  <pre><code>def test_user_can_retrieve_favs_using_impersonation(self):
          with mock.patch('impersonate.helpers.which_user', return_value=self.user):
              user = which_user(self.user2)
  </code></pre>
  
  <p>What am I doing wrong here? I imported <code>which_user</code> like so: <code>from impersonate.helpers import which_user</code> if that helps.</p>