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)
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}
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, }
def test_delete_annotation_calls_delete(): annotation = mock.MagicMock() logic.delete_annotation(annotation) annotation.delete.assert_called_once_with()