Example #1
0
def test_delete_does_not_crash_if_annotation_has_no_group():
    annotation = mock.MagicMock()
    annotation_data = {}  # No 'group' key.
    annotation.get.side_effect = annotation_data.get
    annotation.__getitem__.side_effect = annotation_data.__getitem__

    logic.delete_annotation(annotation)
Example #2
0
def test_delete_does_not_crash_if_annotation_has_no_group():
    annotation = mock.MagicMock()
    annotation_data = {}  # No 'group' key.
    annotation.get.side_effect = annotation_data.get
    annotation.__getitem__.side_effect = annotation_data.__getitem__

    logic.delete_annotation(annotation)
Example #3
0
File: views.py Project: chrber/h
def delete(context, request):
    """Delete the annotation permanently."""
    annotation = context.model

    logic.delete_annotation(annotation)

    # Notify any subscribers
    _publish_annotation_event(request, annotation, "delete")

    # Return a confirmation
    return {"id": annotation["id"], "deleted": True}
Example #4
0
def delete(context, request):
    """Delete the annotation permanently."""
    annotation = context.model

    logic.delete_annotation(annotation)

    # Notify any subscribers
    _publish_annotation_event(request, annotation, 'delete')

    # Return a confirmation
    return {
        'id': annotation['id'],
        'deleted': True,
    }
Example #5
0
File: views.py Project: linhua55/h
def delete(context, request):
    """Delete the annotation permanently."""
    annotation = context.model

    logic.delete_annotation(annotation)

    # Notify any subscribers
    _publish_annotation_event(request, annotation, 'delete')

    # Return a confirmation
    return {
        'id': annotation['id'],
        'deleted': True,
    }
Example #6
0
def test_delete_annotation_calls_delete():
    annotation = mock.MagicMock()

    logic.delete_annotation(annotation)

    annotation.delete.assert_called_once_with()
Example #7
0
def test_delete_annotation_calls_delete():
    annotation = mock.MagicMock()

    logic.delete_annotation(annotation)

    annotation.delete.assert_called_once_with()