From fe4246556156ca7cd3ed16a22e99c4825e3d5687 Mon Sep 17 00:00:00 2001 From: Benjamin Armintor Date: Tue, 26 Nov 2024 17:13:30 -0500 Subject: [PATCH] add specs for restricted image redirect in probe response (DLC-1171) --- .../iiif/authz/v2/probe_service/response_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/models/iiif/authz/v2/probe_service/response_spec.rb b/spec/models/iiif/authz/v2/probe_service/response_spec.rb index 02ad21f5..4dbec046 100644 --- a/spec/models/iiif/authz/v2/probe_service/response_spec.rb +++ b/spec/models/iiif/authz/v2/probe_service/response_spec.rb @@ -21,6 +21,8 @@ let(:token_authorizer) { instance_double(Iiif::Authz::V2::ProbeService::Response::TokenAuthorizer) } let(:user) { instance_double(User) } let(:probe_response_status) { probe_response.to_h[:status] } + let(:probe_response_location) { probe_response.to_h[:location] } + let(:probe_response_format) { probe_response.to_h[:format] } before do allow(controller).to receive(:current_user).and_return(user) @@ -41,6 +43,15 @@ allow(controller).to receive(:bytestream_content_url) end it { expect(probe_response_status).to eql(302) } + context 'solr document is an image' do + let(:well_known_pid) { 'some:pid' } + let(:solr_hash) { { dc_type_ssm: ['StillImage'], id: well_known_pid, fedora_pid_uri_ssi: "info:fedora/#{well_known_pid}" } } + it 'returns a 302 for the image info doc' do + expect(probe_response_status).to eql(302) + expect(probe_response_location).to end_with("#{well_known_pid}/info.json") + expect(probe_response_format).to eql('application/json+ld') + end + end end context "not authorized" do before do