1
0
Fork 0
forked from fedi/mastodon

Add tests for avatar/header in backup service (#25037)

This commit is contained in:
Claire 2023-05-19 12:04:18 +02:00 committed by GitHub
parent 27ec8f297d
commit b805b7f021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,27 @@ RSpec.describe BackupService, type: :service do
end end
end end
context 'when the user has an avatar and header' do
before do
user.account.update!(avatar: attachment_fixture('avatar.gif'))
user.account.update!(header: attachment_fixture('emojo.png'))
end
it 'stores them as expected' do
service_call
json = Oj.load(read_zip_file(backup, 'actor.json'))
avatar_path = json.dig('icon', 'url')
header_path = json.dig('image', 'url')
expect(avatar_path).to_not be_nil
expect(header_path).to_not be_nil
expect(read_zip_file(backup, avatar_path)).to be_present
expect(read_zip_file(backup, header_path)).to be_present
end
end
it 'marks the backup as processed' do it 'marks the backup as processed' do
expect { service_call }.to change(backup, :processed).from(false).to(true) expect { service_call }.to change(backup, :processed).from(false).to(true)
end end