示例#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)
示例#2
0
文件: api_test.py 项目: gnott/h
    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)
示例#3
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)
示例#4
0
文件: api_test.py 项目: gnott/h
    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)
示例#5
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}
示例#6
0
文件: api_test.py 项目: gnott/h
    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}