'ModelForm test of unique_together constraint'

def test_unique_together(self):

    form = PriceForm({u'price': u'6.00', u'quantity': u'1'})
    self.assertTrue(form.is_valid())
    form.save()
    form = PriceForm({u'price': u'6.00', u'quantity': u'1'})
    self.assertFalse(form.is_valid())
    self.assertEqual(len(form.errors), 1)
    self.assertEqual(form.errors[u'__all__'], [u'Price    with    this    Price    and    Quantity    already    exists.'])
