def test_delete_event_with_tasks_and_awards(self):
        """Ensure we cannot delete an event with related tasks and awards.

        Deletion is prevented via Award.event's on_delete=PROTECT."""
        event = Event.objects.get(slug="starts-today-ongoing")
        role = Role.objects.create(name='NonInstructor')
        badge = Badge.objects.create(name='noninstructor',
                                     title='Non-instructor',
                                     criteria='')
        task = Task.objects.create(event=event, person=self.spiderman,
                                   role=role)
        award = Award.objects.create(person=self.spiderman,
                                     badge=badge,
                                     awarded=date.today(),
                                     event=event)

        rv = self.client.get(reverse('event_delete', args=[event.pk, ]))
        assert rv.status_code == 200

        content = rv.content.decode('utf-8')
        assert "Failed to delete" in content
        assert "awards" in content

        # make sure these objects were not deleted
        Event.objects.get(pk=event.pk)
        Badge.objects.get(pk=badge.pk)
        Task.objects.get(pk=task.pk)
        Award.objects.get(pk=award.pk)
dataset/ETHPy150Open swcarpentry/amy/workshops/test/test_event.py/TestEvent.test_delete_event_with_tasks_and_awards/original