title: Patching(mocking) forms form in django tests
body: <p>I tried to mock form with mock.patch and can`t. I have this code</p>
  
  <p>forms.py</p>
  
  <pre><code>class CreatePostForm(object):
      pass
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from forms import CreatePostForm
  
  def doit():
      print CreatePostForm()
  </code></pre>
  
  <p>and I want to to test this view in isolation. I tried to patch form with mock.patch and i wrote something like that:</p>
  
  <p>tests.py:</p>
  
  <pre><code>from mock import patch
  
  import views
  
  with patch('forms.CreatePostForm') as Form:
      views.doit()
  </code></pre>
  
  <p>I tried to google for solution and find nothing</p>
  
  <p><strong>Answered:</strong> thanks @dstanek for good answer and good sample of code</p>