

def test_view_executed_once(self):
    self.assertEqual(User.objects.count(), 0)
    response = self.client.get('/new_user/')
    self.assertContains(response, 'Profiling')
    self.assertEqual(User.objects.count(), 1)
    with self.assertRaises(IntegrityError):
        with transaction.atomic():
            response = self.client.get('/new_user/')
    self.assertEqual(User.objects.count(), 1)

dataset/ETHPy150Open django-debug-toolbar/django-debug-toolbar/tests/panels/test_profiling.py ProfilingPanelIntegrationTestCase.test_view_executed_once/original