'Transaction is rollbacked by our transaction atomic block.'

def test_api_exception_rollback_transaction(self):

    request = factory.post(u'/')
    num_queries = (4 if getattr(connection.features, u'can_release_savepoints', False) else 3)
    with self.assertNumQueries(num_queries):
        with transaction.atomic():
            response = self.view(request)
            assert transaction.get_rollback()
    assert (response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR)
    assert (BasicModel.objects.count() == 0)
