Merge remote-tracking branch 'parent/main' into upstream-20240226

This commit is contained in:
KMY 2024-02-26 12:23:46 +09:00
commit 1802e318f9
85 changed files with 814 additions and 212 deletions

View file

@ -325,7 +325,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
end
end
context 'with property values' do
context 'with property values, an avatar, and a profile header' do
let(:payload) do
{
id: 'https://foo.test',
@ -336,14 +336,30 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
{ type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
{ type: 'PropertyValue', name: 'non-string', value: %w(foo bar) },
],
image: {
type: 'Image',
mediaType: 'image/png',
url: 'https://foo.test/image.png',
},
icon: {
type: 'Image',
url: [
{
mediaType: 'image/png',
href: 'https://foo.test/icon.png',
},
],
},
}.with_indifferent_access
end
before do
stub_request(:get, 'https://example.com/.well-known/nodeinfo').to_return(body: '{}')
stub_request(:get, 'https://foo.test/image.png').to_return(request_fixture('avatar.txt'))
stub_request(:get, 'https://foo.test/icon.png').to_return(request_fixture('avatar.txt'))
end
it 'parses out of attachment' do
it 'parses property values, avatar and profile header as expected' do
account = subject.call('alice', 'example.com', payload)
expect(account.fields)
@ -361,6 +377,10 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
name: eq('Occupation'),
value: eq('Unit test')
)
expect(account).to have_attributes(
avatar_remote_url: 'https://foo.test/icon.png',
header_remote_url: 'https://foo.test/image.png'
)
end
end