'Ensure that non field errors are displayed for each of the
forms in the changelist\'s formset. Refs #13126.'

def test_non_field_errors(self):

    fd1 = FoodDelivery.objects.create(reference=u'123', driver=u'bill', restaurant=u'thai')
    fd2 = FoodDelivery.objects.create(reference=u'456', driver=u'bill', restaurant=u'india')
    fd3 = FoodDelivery.objects.create(reference=u'789', driver=u'bill', restaurant=u'pizza')
    data = {u'form-TOTAL_FORMS': u'3', u'form-INITIAL_FORMS': u'3', u'form-MAX_NUM_FORMS': u'0', u'form-0-id': str(fd1.id), u'form-0-reference': u'123', u'form-0-driver': u'bill', u'form-0-restaurant': u'thai', u'form-1-id': str(fd2.id), u'form-1-reference': u'456', u'form-1-driver': u'bill', u'form-1-restaurant': u'thai', u'form-2-id': str(fd3.id), u'form-2-reference': u'789', u'form-2-driver': u'bill', u'form-2-restaurant': u'pizza', u'_save': u'Save'}
    response = self.client.post(u'/test_admin/admin/admin_views/fooddelivery/', data)
    self.assertContains(response, u'<tr><td    colspan="4"><ul    class="errorlist"><li>Food    delivery    with    this    Driver    and    Restaurant    already    exists.</li></ul></td></tr>', 1, html=True)
    data = {u'form-TOTAL_FORMS': u'3', u'form-INITIAL_FORMS': u'3', u'form-MAX_NUM_FORMS': u'0', u'form-0-id': str(fd1.id), u'form-0-reference': u'123', u'form-0-driver': u'bill', u'form-0-restaurant': u'thai', u'form-1-id': str(fd2.id), u'form-1-reference': u'456', u'form-1-driver': u'bill', u'form-1-restaurant': u'thai', u'form-2-id': str(fd3.id), u'form-2-reference': u'789', u'form-2-driver': u'bill', u'form-2-restaurant': u'thai', u'_save': u'Save'}
    response = self.client.post(u'/test_admin/admin/admin_views/fooddelivery/', data)
    self.assertContains(response, u'<tr><td    colspan="4"><ul    class="errorlist"><li>Food    delivery    with    this    Driver    and    Restaurant    already    exists.</li></ul></td></tr>', 2, html=True)
