From e2cf8d76da964747a7d87512d9cec43f097e2580 Mon Sep 17 00:00:00 2001 From: Justin Littman Date: Fri, 25 Oct 2024 13:27:07 -0400 Subject: [PATCH] Remove Publish robot. refs https://github.com/sul-dlss/dor-services-app/issues/5197 --- lib/robots/dor_repo/accession/publish.rb | 23 --------- .../robots/dor_repo/accession/publish_spec.rb | 50 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 lib/robots/dor_repo/accession/publish.rb delete mode 100644 spec/robots/dor_repo/accession/publish_spec.rb diff --git a/lib/robots/dor_repo/accession/publish.rb b/lib/robots/dor_repo/accession/publish.rb deleted file mode 100644 index 5296cc55..00000000 --- a/lib/robots/dor_repo/accession/publish.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Robots - module DorRepo - module Accession - # Sends initial metadata to PURL, in robots/release/release_publish we push - # to PURL again with updates to identityMetadata - class Publish < LyberCore::Robot - def initialize - super('accessionWF', 'publish') - end - - def perform_work - return LyberCore::ReturnState.new(status: :skipped, note: 'Admin policy objects are not published') if cocina_object.admin_policy? - - # Calls asynchronous process, which will set the publish workflow step to complete when it is done. - object_client.publish(workflow: 'accessionWF', lane_id:) - LyberCore::ReturnState.new(status: :noop, note: 'Initiated publish API call.') - end - end - end - end -end diff --git a/spec/robots/dor_repo/accession/publish_spec.rb b/spec/robots/dor_repo/accession/publish_spec.rb deleted file mode 100644 index 945cc797..00000000 --- a/spec/robots/dor_repo/accession/publish_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Robots::DorRepo::Accession::Publish do - let(:druid) { 'druid:zz000zz0001' } - let(:robot) { described_class.new } - let(:object_client) do - instance_double(Dor::Services::Client::Object, - publish: 'http://dor-services/background-job/123', - find: object) - end - let(:process) { instance_double(Dor::Workflow::Response::Process, lane_id: 'low') } - - describe '#perform' do - subject(:perform) { test_perform(robot, druid) } - - before do - allow(Dor::Services::Client).to receive(:object).with(druid).and_return(object_client) - allow(robot.workflow_service).to receive(:process).and_return(process) - end - - context 'when called on a Collection' do - let(:object) { build(:collection, id: druid) } - - it 'publishes metadata' do - expect(perform.status).to eq 'noop' - expect(object_client).to have_received(:publish).with(workflow: 'accessionWF', lane_id: 'low') - end - end - - context 'when called on an Item' do - let(:object) { build(:dro, id: druid) } - - it 'publishes metadata' do - expect(perform.status).to eq 'noop' - expect(object_client).to have_received(:publish).with(workflow: 'accessionWF', lane_id: 'low') - end - end - - context 'when called on an AdminPolicy' do - let(:object) { build(:admin_policy, id: druid) } - - it 'does not publish metadata' do - expect(perform.status).to eq 'skipped' - expect(object_client).not_to have_received(:publish) - end - end - end -end