def test_it_unhides_the_annotation(self, pyramid_request, annotation, annotation_context): annotation.moderation = AnnotationModeration() views.delete(annotation_context, pyramid_request) assert not annotation.is_hidden
def test_it_publishes_update_event(self, pyramid_request, resource, events): views.delete(resource, pyramid_request) events.AnnotationEvent.assert_called_once_with( pyramid_request, resource.annotation.id, 'update') pyramid_request.notify_after_commit.assert_called_once_with( events.AnnotationEvent.return_value)
def test_it_publishes_update_event(self, pyramid_request, annotation_context, events): views.delete(annotation_context, pyramid_request) events.AnnotationEvent.assert_called_once_with( pyramid_request, annotation_context.annotation.id, "update") pyramid_request.notify_after_commit.assert_called_once_with( events.AnnotationEvent.return_value)
def test_it_renders_no_content(self, pyramid_request, annotation_context): response = views.delete(annotation_context, pyramid_request) assert isinstance(response, HTTPNoContent)
def test_it_renders_no_content(self, pyramid_request, resource): response = views.delete(resource, pyramid_request) assert isinstance(response, HTTPNoContent)
def test_it_unhides_the_annotation(self, pyramid_request, resource, moderation_service): views.delete(resource, pyramid_request) moderation_service.unhide.assert_called_once_with(resource.annotation)
def test_it_renders_no_content(self, pyramid_request, resource): response = views.delete(resource, pyramid_request) assert isinstance(response, HTTPNoContent)
def test_it_unhides_the_annotation( self, pyramid_request, resource, moderation_service ): views.delete(resource, pyramid_request) moderation_service.unhide.assert_called_once_with(resource.annotation)
def test_it_responds_with_not_found_when_no_admin_access_in_group(self, pyramid_request, resource): pyramid_request.has_permission.return_value = False with pytest.raises(HTTPNotFound): views.delete(resource, pyramid_request)
def test_it_checks_for_group_admin_permission(self, pyramid_request, resource): views.delete(resource, pyramid_request) pyramid_request.has_permission.assert_called_once_with('admin', resource.group)