def test_it_publishes_update_event(self, pyramid_request, resource, events): views.create(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_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.create(resource, pyramid_request)
def test_it_checks_for_group_admin_permission(self, pyramid_request, resource): views.create(resource, pyramid_request) pyramid_request.has_permission.assert_called_once_with( 'admin', resource.group)
def test_it_renders_no_content(self, pyramid_request, resource): response = views.create(resource, pyramid_request) assert isinstance(response, HTTPNoContent)
def test_it_hides_the_annotation(self, pyramid_request, resource, moderation_service): views.create(resource, pyramid_request) moderation_service.hide.assert_called_once_with(resource.annotation)