def test_that_it_refuses_to_allow_someone_other_than_the_events_creator_in(self, mock_render, mock_event_get):
        mock_user = Mock()
        mock_event = Mock()
        mock_event_get.return_value = mock_event
        mock_event.verify_ownership.return_value = False
        request = rf.get('/events/1/edit/')
        request.user = mock_user
        mock_wrapped_view = Mock()
        wrapped_view = views.verified_ownership(mock_wrapped_view)
        response = wrapped_view(request, event_hash = '1')

        assert not mock_render.called
        mock_event.verify_ownership.assert_called_with(mock_user)
        assert response.status_code == 403
    def test_that_it_correctly_fetches_the_event(self, mock_render, mock_event_get):
        mock_user = Mock()
        mock_event = models.Event()
        mock_event_get.return_value = mock_event
        mock_wrapped_view = Mock()
        with patch.object(mock_event, 'verify_ownership') as mock_verify_ownership:
            mock_verify_ownership.return_value = True
            # mock_event.verify_ownership.return_value = True
            request = rf.get('/events/1/edit/')
            request.user = mock_user

            wrapped_view = views.verified_ownership(mock_wrapped_view)
            wrapped_view(request, event_hash = '1')
            mock_event_get.assert_called_with(models.Event, url_hash = '1')
            mock_verify_ownership.assert_called_with(mock_user)
            mock_wrapped_view.assert_called_with(request, mock_event)