Skip to content

Commit

Permalink
Valkyrizes spec/requests/riiif_spec.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatson78 authored and jeremyf committed Jan 25, 2024
1 parent 8a73c16 commit e33aae6
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions spec/requests/riiif_spec.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
# frozen_string_literal: true
RSpec.describe 'IIIF image API', type: :request do
let(:wings_disabled) { Hyrax.config.disable_wings }
let(:user) { create(:user) }
let(:work) { create(:work_with_one_file, user: user) }
let(:file_set) { work.ordered_members.to_a.first }
let(:file) { file_set.original_file }
let(:uploaded_file) { create(:uploaded_file, file: File.open('spec/fixtures/world.png')) }
let(:file_metadata) { valkyrie_create(:file_metadata, :original_file, :with_file, file: uploaded_file) }
let(:file_set) do
if wings_disabled
valkyrie_create(:hyrax_file_set,
depositor: user.user_key,
read_users: [user],
files: [file_metadata],
original_file: file_metadata)

# NOTE: It is necessary to switch to an ActiveFedora object below because the test on
# L#35 produces the following image conversion error:
# Riiif::ConversionError:
# Unable to execute command "convert -resize 300 -quality 85 -sampling-factor 4:2:0 -strip
# tmp/network_files/f9c086c8ab9d22475371af0974ccf6c3 jpg:-"
# convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/746.
# convert: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3354.
else
create(:file_set, user: user)
end
end
let(:file) { wings_disabled ? file_set : file_set.original_file }
let(:size) { '300,' }

before do
Hydra::Works::AddFileToFileSet.call(file_set,
File.open(fixture_path + '/world.png'),
:original_file)
if wings_disabled
file_set
else
Hydra::Works::AddFileToFileSet.call(file_set, File.open(fixture_path + '/world.png'), :original_file)
end
end

describe 'GET /images/:id' do
context "when the user is authorized" do
it "returns an image", skip: Hyrax.config.use_valkyrie? && 'this failure is unrelated to embargoes (#5844). waiting for valkyrie spec suite improvements' do
it "returns an image" do
login_as user

get Riiif::Engine.routes.url_helpers.image_path(file.id, size: size, format: 'jpg', channels: nil)
Expand Down

0 comments on commit e33aae6

Please sign in to comment.