예제 #1
0
def test_delete_calls_delete_annotation(storage):
    context = mock.Mock()
    request = mock.Mock()

    views.delete(context, request)

    storage.delete_annotation.assert_called_once_with(context.id)
예제 #2
0
파일: views_test.py 프로젝트: plainspace/h
def test_delete_event(AnnotationEvent):
    request = mock.Mock()
    annotation = _mock_annotation(id='foo')
    event = AnnotationEvent.return_value
    views.delete(annotation, request)
    AnnotationEvent.assert_called_once_with(request, annotation, 'delete')
    request.registry.notify.assert_called_once_with(event)
예제 #3
0
    def test_it_serializes_the_annotation(self, AnnotationJSONPresenter):
        annotation = mock.Mock()
        request = mock.Mock()

        views.delete(annotation, request)

        AnnotationJSONPresenter.assert_called_once_with(request, annotation)
예제 #4
0
파일: views_test.py 프로젝트: linhua55/h
def test_delete_calls_delete_annotation(logic):
    annotation = mock.MagicMock()
    request = mock.Mock()

    views.delete(annotation, request)

    logic.delete_annotation.assert_called_once_with(annotation.model)
예제 #5
0
def test_delete_calls_delete_annotation(storage):
    annotation = mock.Mock()
    request = mock.Mock()

    views.delete(annotation, request)

    storage.delete_annotation.assert_called_once_with(request, annotation.id)
예제 #6
0
파일: views_test.py 프로젝트: tilgovi/h
def test_delete_does_not_crash_if_annotation_has_no_group():
    annotation = _mock_annotation(id='foo')
    assert 'group' not in annotation

    views.delete(
        annotation,
        mock.Mock(effective_principals=['group:test-group']))
예제 #7
0
파일: views_test.py 프로젝트: tilgovi/h
def test_delete_calls_delete_annotation(logic):
    annotation = mock.MagicMock()
    request = mock.Mock()

    views.delete(annotation, request)

    logic.delete_annotation.assert_called_once_with(annotation.model)
예제 #8
0
파일: views_test.py 프로젝트: ningyifan/h
def test_delete_event(AnnotationEvent):
    request = mock.Mock()
    annotation = _mock_annotation(id='foo')
    event = AnnotationEvent.return_value
    views.delete(annotation, request)
    AnnotationEvent.assert_called_once_with(request, annotation, 'delete')
    request.registry.notify.assert_called_once_with(event)
예제 #9
0
파일: views_test.py 프로젝트: bZichett/h
    def test_it_serializes_the_annotation(self, AnnotationJSONPresenter):
        annotation = mock.Mock()
        request = mock.Mock()

        views.delete(annotation, request)

        AnnotationJSONPresenter.assert_called_once_with(request, annotation)
예제 #10
0
파일: views_test.py 프로젝트: hashin/h
def test_delete_calls_delete_annotation(storage):
    annotation = mock.Mock()
    request = mock.Mock()

    views.delete(annotation, request)

    storage.delete_annotation.assert_called_once_with(request, annotation.id)
예제 #11
0
파일: views_test.py 프로젝트: bZichett/h
    def test_it_deletes_then_annotation_from_storage(self, storage):
        annotation = mock.Mock()
        request = mock.Mock()

        views.delete(annotation, request)

        storage.delete_annotation.assert_called_once_with(request.db,
                                                          annotation.id)
예제 #12
0
    def test_it_deletes_then_annotation_from_storage(self, storage):
        annotation = mock.Mock()
        request = mock.Mock()

        views.delete(annotation, request)

        storage.delete_annotation.assert_called_once_with(
            request.db, annotation.id)
예제 #13
0
    def test_it_calls_notify_with_an_event(self, AnnotationEvent):
        annotation = mock.Mock()
        request = mock.Mock()
        event = AnnotationEvent.return_value

        views.delete(annotation, request)

        AnnotationEvent.assert_called_once_with(request, annotation, 'delete')
        request.registry.notify.assert_called_once_with(event)
예제 #14
0
파일: views_test.py 프로젝트: tilgovi/h
def test_delete_event(AnnotationEvent):
    annotation = _mock_annotation(id='foo', group='test-group')
    request = mock.Mock(effective_principals=['group:test-group'])
    event = AnnotationEvent.return_value

    views.delete(annotation, request)

    AnnotationEvent.assert_called_once_with(request, annotation.model, 'delete')
    request.registry.notify.assert_called_once_with(event)
예제 #15
0
파일: views_test.py 프로젝트: ackermann/h
    def test_it_calls_notify_with_an_event(self, AnnotationEvent):
        annotation = mock.Mock()
        request = mock.Mock()
        event = AnnotationEvent.return_value

        views.delete(annotation, request)

        AnnotationEvent.assert_called_once_with(request, annotation, 'delete')
        request.registry.notify.assert_called_once_with(event)
예제 #16
0
def test_delete_event(AnnotationEvent):
    context = mock.Mock()
    request = mock.Mock()
    event = AnnotationEvent.return_value

    views.delete(context, request)

    AnnotationEvent.assert_called_once_with(request, context.model, 'delete')
    request.registry.notify.assert_called_once_with(event)
예제 #17
0
파일: views_test.py 프로젝트: linhua55/h
def test_delete_event(AnnotationEvent):
    annotation = _mock_annotation(id='foo', group='test-group')
    request = mock.Mock(effective_principals=['group:test-group'])
    event = AnnotationEvent.return_value

    views.delete(annotation, request)

    AnnotationEvent.assert_called_once_with(request, annotation.model,
                                            'delete')
    request.registry.notify.assert_called_once_with(event)
예제 #18
0
파일: views_test.py 프로젝트: fchasen/h
    def test_it_calls_notify_with_an_event(self, AnnotationEvent, AnnotationJSONPresenter):
        annotation = mock.Mock()
        request = mock.Mock()
        event = AnnotationEvent.return_value

        views.delete(annotation, request)

        AnnotationJSONPresenter.assert_called_once_with(request, annotation)
        presented = AnnotationJSONPresenter.return_value.asdict()

        AnnotationEvent.assert_called_once_with(request, presented, 'delete')
        request.notify_after_commit.assert_called_once_with(event)
예제 #19
0
    def test_it_inits_and_fires_an_AnnotationEvent(self, AnnotationEvent,
                                                   AnnotationJSONPresenter):
        annotation = mock.Mock()
        request = mock.Mock()
        event = AnnotationEvent.return_value
        annotation_dict = AnnotationJSONPresenter.return_value.asdict.return_value

        views.delete(annotation, request)

        AnnotationEvent.assert_called_once_with(
            request, annotation.id, 'delete', annotation_dict=annotation_dict)
        request.notify_after_commit.assert_called_once_with(event)
예제 #20
0
파일: views_test.py 프로젝트: bZichett/h
    def test_it_inits_and_fires_an_AnnotationEvent(self,
                                                   AnnotationEvent,
                                                   AnnotationJSONPresenter):
        annotation = mock.Mock()
        request = mock.Mock()
        event = AnnotationEvent.return_value
        annotation_dict = AnnotationJSONPresenter.return_value.asdict.return_value

        views.delete(annotation, request)

        AnnotationEvent.assert_called_once_with(request, annotation.id, 'delete',
                                                annotation_dict=annotation_dict)
        request.notify_after_commit.assert_called_once_with(event)
예제 #21
0
파일: views_test.py 프로젝트: bZichett/h
    def test_it_returns_object(self):
        annotation = mock.Mock()
        request = mock.Mock()

        result = views.delete(annotation, request)

        assert result == {'id': annotation.id, 'deleted': True}
예제 #22
0
파일: views_test.py 프로젝트: tilgovi/h
def test_delete_returns_id():
    annotation = _mock_annotation(id='foo', group='test-group')

    response_data = views.delete(
        annotation, mock.Mock(effective_principals=['group:test-group']))

    assert response_data['id'] == annotation.model['id']
예제 #23
0
파일: views_test.py 프로젝트: linhua55/h
def test_delete_returns_id():
    annotation = _mock_annotation(id='foo', group='test-group')

    response_data = views.delete(
        annotation, mock.Mock(effective_principals=['group:test-group']))

    assert response_data['id'] == annotation.model['id']
예제 #24
0
def test_delete_returns_object():
    context = mock.Mock()
    request = mock.Mock()

    result = views.delete(context, request)

    assert result == {'id': context.id, 'deleted': True}
예제 #25
0
def test_delete_returns_object():
    annotation = mock.Mock()
    request = mock.Mock()

    result = views.delete(annotation, request)

    assert result == {'id': annotation.id, 'deleted': True}
예제 #26
0
파일: views_test.py 프로젝트: ningyifan/h
def test_delete_calls_delete():
    annotation = _mock_annotation(id='foo')

    views.delete(annotation, mock.Mock())

    annotation.delete.assert_called_once_with()
예제 #27
0
파일: views_test.py 프로젝트: ningyifan/h
def test_delete_returns_id():
    annotation = _mock_annotation(id='foo')

    response_data = views.delete(annotation, mock.Mock())

    assert response_data['id'] == annotation['id']
예제 #28
0
파일: views_test.py 프로젝트: tilgovi/h
def test_delete_returns_deleted():
    response_data = views.delete(
        _mock_annotation(id='foo', group='test-group'),
        mock.Mock(effective_principals=['group:test-group']))

    assert response_data['deleted'] is True
예제 #29
0
파일: views_test.py 프로젝트: ningyifan/h
def test_delete_returns_deleted():
    response_data = views.delete(_mock_annotation(id='foo'), mock.Mock())

    assert response_data['deleted'] is True
예제 #30
0
파일: views_test.py 프로젝트: linhua55/h
def test_delete_does_not_crash_if_annotation_has_no_group():
    annotation = _mock_annotation(id='foo')
    assert 'group' not in annotation

    views.delete(annotation,
                 mock.Mock(effective_principals=['group:test-group']))
예제 #31
0
파일: views_test.py 프로젝트: plainspace/h
def test_delete_returns_deleted():
    response_data = views.delete(_mock_annotation(id='foo'), mock.Mock())

    assert response_data['deleted'] is True
예제 #32
0
파일: views_test.py 프로젝트: plainspace/h
def test_delete_returns_id():
    annotation = _mock_annotation(id='foo')

    response_data = views.delete(annotation, mock.Mock())

    assert response_data['id'] == annotation['id']
예제 #33
0
파일: views_test.py 프로젝트: plainspace/h
def test_delete_calls_delete():
    annotation = _mock_annotation(id='foo')

    views.delete(annotation, mock.Mock())

    annotation.delete.assert_called_once_with()
예제 #34
0
파일: views_test.py 프로젝트: linhua55/h
def test_delete_returns_deleted():
    response_data = views.delete(
        _mock_annotation(id='foo', group='test-group'),
        mock.Mock(effective_principals=['group:test-group']))

    assert response_data['deleted'] is True