Skip to content

Commit

Permalink
Extending the test suite for the PlumEventProcessor for cases where M…
Browse files Browse the repository at this point in the history
…VWs are updated
  • Loading branch information
jrgriffiniii committed Feb 23, 2018
1 parent 8abf320 commit 03cd699
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/services/plum_event_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,42 @@
resource = Blacklight.default_index.connection.get("select", params: { q: "*:*" })["response"]["docs"].first
expect(resource["exhibit_first_public_bsi"]).to eq false
end

context 'when it is a multi-volume work', mvw: true do
let(:url) { 'https://figgy-staging.princeton.edu/concern/scanned_resources/3ad1d6ad-c0dd-4fd4-8185-c78d62cc7643/manifest' }
let(:event) do
{
"id" => '3ad1d6ad-c0dd-4fd4-8185-c78d62cc7643',
"event" => type,
"manifest_url" => url,
"collection_slugs" => collection_slugs
}
end
let(:response) do
'{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Collection","@id":"https://figgy-staging.princeton.edu/concern/scanned_resources/9b7087d0-16ca-4e2a-bf67-fa066f5c6eea/manifest","label":["Earth rites : fertility rites in pre-industrial Britain"],"description":"Includes index.","viewingHint":"multi-part","metadata":[{"label":"Created At","value":["02/19/18 04:13:55 PM UTC"]},{"label":"Updated At","value":["02/19/18 04:15:02 PM UTC"]},{"label":"Author","value":["Bord, Janet, 1945-"]},{"label":"Depositor","value":["kc16"]},{"label":"Created","value":["01/01/1982"]},{"label":"Extent","value":["xiv, 273 p. : ill. ; 24 cm."]},{"label":"Title","value":[{"@value":"Earth rites : fertility rites in pre-industrial Britain","@language":"eng"}]},{"label":"Contributor","value":["Bord, Colin"]},{"label":"Creator","value":["Bord, Janet, 1945-"]},{"label":"Date","value":["1982"]},{"label":"Description","value":["Includes index."]},{"label":"Language","value":["English"]},{"label":"Publisher","value":["New York: Granada, 1982"]},{"label":"Subject","value":["Fertility cults—Great Britain—History"]},{"label":"Portion Note","value":["Table of content"]},{"label":"Source Metadata Identifier","value":["1234567"]},{"label":"Call Number","value":["BL980.G7 B66 1982"]},{"label":"PDF Type","value":["gray"]},{"label":"Member Of Collections","value":[{"internal_resource":"Collection","created_at":"02/08/18 07:02:24 PM UTC","updated_at":"02/08/18 07:02:24 PM UTC","new_record":false,"read_groups":[],"read_users":[],"edit_users":[],"edit_groups":[],"id":{"id":"81f1d664-9a15-4e1f-b6fc-56cb47a16647"},"title":"Engineering Library Test","slug":"Test","description":["Test Collection for Engineering Library"],"visibility":[],"local_identifier":[]}]}],"manifests":[{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Manifest","@id":"https://figgy-staging.princeton.edu/concern/scanned_resources/3ad1d6ad-c0dd-4fd4-8185-c78d62cc7643/manifest","label":["vol. 2"]}],"seeAlso":{"@id":"https://figgy-staging.princeton.edu/catalog/9b7087d0-16ca-4e2a-bf67-fa066f5c6eea.jsonld","format":"application/ld+json"},"license":"http://rightsstatements.org/vocab/InC/1.0/"}'
end
let(:collection_url) { 'https://figgy-staging.princeton.edu/catalog/9b7087d0-16ca-4e2a-bf67-fa066f5c6eea.jsonld' }
let(:collection_response) do
'{"@context":"https://bibdata.princeton.edu/context.json","@id":"https://figgy-staging.princeton.edu/catalog/9b7087d0-16ca-4e2a-bf67-fa066f5c6eea","title":[{"@value":"Earth rites : fertility rites in pre-industrial Britain","@language":"eng"}],"language":"eng","creator":"Bord, Janet, 1945-","call_number":"BL980.G7 B66 1982","extent":"xiv, 273 p. : ill. ; 24 cm.","format":"Book","description":"Includes index.","publisher":["New York: Granada, 1982"],"subject":"Fertility cults—Great Britain—History","title_sort":"Earth rites : fertility rites in pre-industrial Britain / Janet and Colin Bord.","spatial":"Great Britain","contributor":["Bord, Colin"],"author":"Bord, Janet, 1945-","created":"1982-01-01T00:00:00Z","date":"1982","scopeNote":["Table of content"],"edm_rights":{"@id":"http://rightsstatements.org/vocab/InC/1.0/","@type":"dcterms:RightsStatement","pref_label":"In Copyright"},"memberOf":[{"@id":"https://figgy-staging.princeton.edu/catalog/81f1d664-9a15-4e1f-b6fc-56cb47a16647","@type":"pcdm:Collection","title":"Engineering Library Test"}]}'
end

before do
stub_request(:get, collection_url).to_return status: 200, headers: { 'Content-Type' => 'application/json; charset=utf-8' }, body: collection_response
end

it "marks it as non-public" do
exhibit = FactoryBot.create(:exhibit, slug: "first")
IIIFResource.new(url: url, exhibit: exhibit).save_and_index

stub_request(:head, url).to_return status: 401, headers: { 'Content-Type' => 'application/json; charset=utf-8' }
stub_request(:get, url).to_return status: 401, headers: { 'Content-Type' => 'application/json; charset=utf-8' }, body: '{}'

expect(processor.process).to eq true
Blacklight.default_index.connection.commit
resource = Blacklight.default_index.connection.get("select", params: { q: "*:*" })["response"]["docs"].first
expect(resource["exhibit_first_public_bsi"]).to eq false
end
end
end

context "when it's private and then is made accessible" do
Expand Down

0 comments on commit 03cd699

Please sign in to comment.