Move special and ignored associations to tests
This commit is contained in:
parent
f704f30572
commit
b920ddbff5
2 changed files with 16 additions and 24 deletions
|
|
@ -48,15 +48,6 @@ class AccountDeleter
|
||||||
notifications blocks authorizations o_auth_applications pairwise_pseudonymous_identifiers]
|
notifications blocks authorizations o_auth_applications pairwise_pseudonymous_identifiers]
|
||||||
end
|
end
|
||||||
|
|
||||||
def special_ar_user_associations
|
|
||||||
%i[person profile contacts auto_follow_back_aspect]
|
|
||||||
end
|
|
||||||
|
|
||||||
def ignored_ar_user_associations
|
|
||||||
%i[followed_tags invited_by invited_users contact_people aspect_memberships
|
|
||||||
ignored_people share_visibilities conversation_visibilities conversations reports]
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete_standard_user_associations
|
def delete_standard_user_associations
|
||||||
normal_ar_user_associates_to_delete.each do |asso|
|
normal_ar_user_associates_to_delete.each do |asso|
|
||||||
user.send(asso).ids.each_slice(20) do |ids|
|
user.send(asso).ids.each_slice(20) do |ids|
|
||||||
|
|
@ -65,6 +56,10 @@ class AccountDeleter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def normal_ar_person_associates_to_delete
|
||||||
|
%i[posts photos mentions participations roles blocks conversation_visibilities]
|
||||||
|
end
|
||||||
|
|
||||||
def delete_standard_person_associations
|
def delete_standard_person_associations
|
||||||
normal_ar_person_associates_to_delete.each do |asso|
|
normal_ar_person_associates_to_delete.each do |asso|
|
||||||
person.send(asso).ids.each_slice(20) do |ids|
|
person.send(asso).ids.each_slice(20) do |ids|
|
||||||
|
|
@ -96,15 +91,6 @@ class AccountDeleter
|
||||||
Contact.all_contacts_of_person(person).find_each(batch_size: 20, &:destroy)
|
Contact.all_contacts_of_person(person).find_each(batch_size: 20, &:destroy)
|
||||||
end
|
end
|
||||||
|
|
||||||
def normal_ar_person_associates_to_delete
|
|
||||||
%i[posts photos mentions participations roles blocks conversation_visibilities]
|
|
||||||
end
|
|
||||||
|
|
||||||
def ignored_or_special_ar_person_associations
|
|
||||||
%i[comments likes poll_participations contacts notification_actors notifications owner profile
|
|
||||||
pod conversations messages]
|
|
||||||
end
|
|
||||||
|
|
||||||
def mark_account_deletion_complete
|
def mark_account_deletion_complete
|
||||||
AccountDeletion.find_by(person: person)&.update_attributes(completed_at: Time.now.utc)
|
AccountDeletion.find_by(person: person)&.update_attributes(completed_at: Time.now.utc)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -175,14 +175,20 @@ describe AccountDeleter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has all user association keys accounted for' do
|
it "has all user association keys accounted for" do
|
||||||
all_keys = (@account_deletion.normal_ar_user_associates_to_delete + @account_deletion.special_ar_user_associations + @account_deletion.ignored_ar_user_associations)
|
special_ar_user_associations = %i[person profile contacts auto_follow_back_aspect]
|
||||||
expect(all_keys.sort{|x, y| x.to_s <=> y.to_s}).to eq(User.reflections.keys.sort{|x, y| x.to_s <=> y.to_s}.map(&:to_sym))
|
ignored_ar_user_associations = %i[followed_tags invited_by invited_users contact_people aspect_memberships
|
||||||
|
ignored_people share_visibilities conversation_visibilities conversations reports]
|
||||||
|
all_keys = @account_deletion.normal_ar_user_associates_to_delete +
|
||||||
|
special_ar_user_associations + ignored_ar_user_associations
|
||||||
|
expect(all_keys.sort_by(&:to_s)).to eq(User.reflections.keys.sort_by(&:to_s).map(&:to_sym))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has all person association keys accounted for' do
|
it "has all person association keys accounted for" do
|
||||||
all_keys = (@account_deletion.normal_ar_person_associates_to_delete + @account_deletion.ignored_or_special_ar_person_associations)
|
ignored_or_special_ar_person_associations = %i[comments likes poll_participations contacts notification_actors
|
||||||
expect(all_keys.sort{|x, y| x.to_s <=> y.to_s}).to eq(Person.reflections.keys.sort{|x, y| x.to_s <=> y.to_s}.map(&:to_sym))
|
notifications owner profile pod conversations messages]
|
||||||
|
all_keys = @account_deletion.normal_ar_person_associates_to_delete + ignored_or_special_ar_person_associations
|
||||||
|
expect(all_keys.sort_by(&:to_s)).to eq(Person.reflections.keys.sort_by(&:to_s).map(&:to_sym))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue