title: Mock a function call on a class you mocked
body: <p>How do I mock</p>
  
  <pre><code>    with closing(StringIO()) as screenshot_stringio:
          screenshot.save(screenshot_stringio, format="PNG")
          screenshot_as_bytes = screenshot_stringio.getvalue()
  </code></pre>
  
  <p>assuming 'screenshot' is already Mocked.</p>
  
  <p>I tried different permutations of:</p>
  
  <pre><code>    moduleiamtesting.classiamtesting.StringIO = Mock()
      moduleiamtesting.classiamtesting.StringIO.getvalue = Mock(return_value="test_bytes")
  </code></pre>
  
  <p>but cannot get it to work. the return value in my debugger is another mock</p>