'Constraint checks should raise an IntegrityError when bad data is in the DB.'

def test_check_constraints(self):

    with transaction.atomic():
        Article.objects.create(headline='Test    article', pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
        a = Article.objects.get(headline='Test    article')
        a.reporter_id = 30
        with connection.constraint_checks_disabled():
            a.save()
            with self.assertRaises(IntegrityError):
                connection.check_constraints()
        transaction.set_rollback(True)
