mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 16:41:36 +01:00
Add response_avatar_link
helper to webfinger request spec (#31999)
This commit is contained in:
parent
447d0a3e88
commit
2b4bda8004
1 changed files with 16 additions and 12 deletions
|
@ -168,10 +168,12 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'returns avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to_not be_nil
|
||||
expect(avatar_link[:type]).to eq alice.avatar.content_type
|
||||
expect(avatar_link[:href]).to eq Addressable::URI.new(host: Rails.configuration.x.local_domain, path: alice.avatar.to_s, scheme: 'https').to_s
|
||||
expect(response_avatar_link)
|
||||
.to be_present
|
||||
.and include(
|
||||
type: eq(alice.avatar.content_type),
|
||||
href: eq(Addressable::URI.new(host: Rails.configuration.x.local_domain, path: alice.avatar.to_s, scheme: 'https').to_s)
|
||||
)
|
||||
end
|
||||
|
||||
context 'with limited federation mode' do
|
||||
|
@ -182,8 +184,8 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'does not return avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
expect(response_avatar_link)
|
||||
.to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -197,8 +199,8 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'does not return avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
expect(response_avatar_link)
|
||||
.to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -212,8 +214,8 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
end
|
||||
|
||||
it 'does not return avatar in response' do
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
expect(response_avatar_link)
|
||||
.to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -247,7 +249,9 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
|
||||
private
|
||||
|
||||
def get_avatar_link(json)
|
||||
json[:links].find { |link| link[:rel] == 'http://webfinger.net/rel/avatar' }
|
||||
def response_avatar_link
|
||||
response
|
||||
.parsed_body[:links]
|
||||
.find { |link| link[:rel] == 'http://webfinger.net/rel/avatar' }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue