Beispiel #1
0
    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)
Beispiel #2
0
    def test_it_calls_the_annotation_delete_service(self, pyramid_request,
                                                    annotation_delete_service):
        context = mock.Mock()

        views.delete(context, pyramid_request)

        annotation_delete_service.delete.assert_called_once_with(
            context.annotation)
Beispiel #3
0
    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)
Beispiel #4
0
    def test_it_calls_the_annotation_delete_service(
        self, pyramid_request, annotation_delete_service
    ):
        context = mock.Mock()

        views.delete(context, pyramid_request)

        annotation_delete_service.delete.assert_called_once_with(context.annotation)
Beispiel #5
0
    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)
Beispiel #6
0
    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)
Beispiel #7
0
    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}
Beispiel #8
0
    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}