Skip to content

Commit

Permalink
Merge pull request #1186 from sul-dlss/tested-url
Browse files Browse the repository at this point in the history
Fix tested url
  • Loading branch information
justinlittman authored Jun 28, 2024
2 parents 47e9596 + 3ede3d3 commit 4922bdd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions spec/requests/iiif_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

describe 'metadata requests' do
it 'handles JSON requests' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json', headers: { HTTP_ACCEPT: 'application/json' }
get '/image/iiif/nr349ct7889%2Fimage/info.json', headers: { HTTP_ACCEPT: 'application/json' }

expect(response.media_type).to eq 'application/json'
json = response.parsed_body
Expand All @@ -74,7 +74,7 @@
end

it 'handles JSON-LD requests' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json', headers: { HTTP_ACCEPT: 'application/ld+json' }
get '/image/iiif/nr349ct7889%2Fimage/info.json', headers: { HTTP_ACCEPT: 'application/ld+json' }

expect(response.media_type).to eq 'application/ld+json'
json = JSON.parse(response.body) # rubocop:disable Rails/ResponseParsedBody
Expand Down Expand Up @@ -107,7 +107,7 @@

context 'outside of the location' do
it 'uses the unauthorized status code for the response' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json'
get '/image/iiif/nr349ct7889%2Fimage/info.json'
expect(response).to have_http_status :unauthorized
end

Expand Down Expand Up @@ -151,7 +151,7 @@
allow_any_instance_of(IiifController).to receive(:current_user).and_return(user)
end
it 'uses the ok status code for the response' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json'
get '/image/iiif/nr349ct7889%2Fimage/info.json'
expect(response).to have_http_status :ok
end
end
Expand Down Expand Up @@ -221,12 +221,12 @@
end

it 'serves up regular info.json (no degraded)' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json'
get '/image/iiif/nr349ct7889%2Fimage/info.json'
expect(response).to have_http_status :ok
end

it 'replaces the sizes element to reflect the only downloadable (thumbnail) size' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/info.json'
get '/image/iiif/nr349ct7889%2Fimage/info.json'
json = response.parsed_body

expect(json['sizes']).to eq [{ 'width' => 266, 'height' => 400 }]
Expand Down Expand Up @@ -290,7 +290,7 @@
end

it 'is ignored when instantiating StacksImage' do
get "/image/iiif/nr349ct7889%2Fimage.jp2/0,640,2552,2552/100,100/0/default.jpg?ignored=ignored&host=host"
get "/image/iiif/nr349ct7889%2Fimage/0,640,2552,2552/100,100/0/default.jpg?ignored=ignored&host=host"

expect(response).to have_http_status :ok
end
Expand All @@ -303,7 +303,7 @@
end

it 'returns 404 Not Found' do
get "/image/iiif/nr349ct7889%2Fimage.jp2/0,640,2552,2552/100,100/0/default.jpg?ignored=ignored&host=host"
get "/image/iiif/nr349ct7889%2Fimage/0,640,2552,2552/100,100/0/default.jpg?ignored=ignored&host=host"
expect(response).to have_http_status :not_found
end
end
Expand All @@ -314,9 +314,9 @@
end

it 'returns 404 Not Found' do
stub_request(:get, "http://imageserver-prod.stanford.edu/iiif/2/nr%2F349%2Fct%2F7889%2Fimage.jp2/0,640,2552,2552/100,100/0/default.jpg")
stub_request(:get, "http://imageserver-prod.stanford.edu/iiif/2/nr%2F349%2Fct%2F7889%2Fimage/0,640,2552,2552/100,100/0/default.jpg")
.to_return(status: 200, body: "", headers: {})
get "/image/iiif/nr349ct7889%2Fimage.jp2/0,640,2552,2552/100,100/0/default.jpg"
get "/image/iiif/nr349ct7889%2Fimage/0,640,2552,2552/100,100/0/default.jpg"
expect(response).to have_http_status :not_found
end
end
Expand All @@ -342,7 +342,7 @@
end

it 'loads the image' do
get '/image/iiif/nr349ct7889%2Fimage.jp2/pct:3,3,77,77/full/0/default.jpg'
get '/image/iiif/nr349ct7889%2Fimage/pct:3,3,77,77/full/0/default.jpg'

expect(response.media_type).to eq 'image/jpeg'
expect(response).to have_http_status :ok
Expand Down

0 comments on commit 4922bdd

Please sign in to comment.