def test_it_deletes_then_annotation_from_storage(self, pyramid_request, storage): context = mock.Mock() views.delete(context, pyramid_request) storage.delete_annotation.assert_called_once_with(pyramid_request.db, context.annotation.id)
def test_it_inits_and_fires_an_AnnotationEvent(self, AnnotationEvent, pyramid_request): context = mock.Mock() event = AnnotationEvent.return_value views.delete(context, pyramid_request) AnnotationEvent.assert_called_once_with(pyramid_request, context.annotation.id, 'delete') pyramid_request.notify_after_commit.assert_called_once_with(event)
def test_it_inits_and_fires_an_AnnotationEvent(self, AnnotationEvent, AnnotationJSONPresenter, pyramid_request): context = mock.Mock() event = AnnotationEvent.return_value views.delete(context, pyramid_request) AnnotationEvent.assert_called_once_with(pyramid_request, context.annotation.id, 'delete') pyramid_request.notify_after_commit.assert_called_once_with(event)
def test_it_returns_object(self, pyramid_request): context = mock.Mock() result = views.delete(context, pyramid_request) assert result == {'id': context.annotation.id, 'deleted': True}