title: Python Mock: Mocking a function inside the function I'm testing
body: <p>I'm trying to use <code>Mock</code> to test the result returned from a function that retrieves a setting:</p>
  
  <pre><code>def apply_delta_to_date(original_date):
      delta = MySettings.get_delta()
      result_date = original_date + timedelta(delta)
      return result_date
  </code></pre>
  
  <p>When testing the <code>apply_delta_to_date</code> function, I'm trying to mock the call to <code>MySettings.get_delta</code> to simulate that its returning a specific result:</p>
  
  <pre><code>class TestAppyDelta():
      def setUp(self):
          self.MySettings = Mock()
          self.MySettings.get_delta = Mock(return_value=10)
  
      def test_apply_delta(self):
          result = apply_delta_to_date(today)
  </code></pre>
  
  <p>The problem is that I can't manage to "mock" the function call to <code>MySettings.get_delta()</code> which is inside the function that I really want to test.</p>
  
  <p>How could I mock the result returned by an inner function inside the function I'm testing?</p>