title: How do you unit test formsets in Django?
body: <p>Ok, so i need to unit test a view, more precise form in a view . So i create such a unit test.</p>
  
  <pre><code>class ViewTest(TestCase):
      fixtures = ['fixture.json']
      def setUp(self):
          self.client = Client()
      def test_company_create(self):
          post_data = {
              'form-0-user': '',
              'form-0-share': '',
              'form-TOTAL_FORMS': 1,
              'form-INITIAL_FORMS': 0,
              'form-MAX_NUM_FORMS': 10
          }
      resp = self.client.post('/company/create/', post_data)
      self.assertFormError (resp, 'shareholder_formset', 'share', 'This field is required.')
      self.assertFormError (resp, 'shareholder_formset', 'user', 'This field is required.')
  </code></pre>
  
  <p>Ofcourse i get back an error </p>
  
  <blockquote>
    <p>AttributeError: 'ShareholderFormFormSet' object has no attribute
    'fields'</p>
  </blockquote>
  
  <p>Because formset has forms in it, not fields..... So what is the correct way to test a formset?</p>