Add test for removing endorsed accounts on account deletion/suspension (#14241)

This commit is contained in:
ThibG 2020-07-07 02:01:13 +02:00 committed by GitHub
parent a783bdf4ad
commit e96e9cae62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ RSpec.describe SuspendAccountService, type: :service do
let!(:passive_relationship) { Fabricate(:follow, target_account: account) } let!(:passive_relationship) { Fabricate(:follow, target_account: account) }
let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', protocol: :activitypub) } let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', protocol: :activitypub) }
let!(:remote_bob) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub) } let!(:remote_bob) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
let!(:endorsment) { Fabricate(:account_pin, account: passive_relationship.account, target_account: account) }
it 'deletes associated records' do it 'deletes associated records' do
is_expected.to change { is_expected.to change {
@ -30,8 +31,9 @@ RSpec.describe SuspendAccountService, type: :service do
account.favourites, account.favourites,
account.active_relationships, account.active_relationships,
account.passive_relationships, account.passive_relationships,
AccountPin.where(target_account: account),
].map(&:count) ].map(&:count)
}.from([1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0]) }.from([1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0])
end end
it 'sends a delete actor activity to all known inboxes' do it 'sends a delete actor activity to all known inboxes' do