Commit b920ddbf authored by Benjamin Neff's avatar Benjamin Neff

Move special and ignored associations to tests

parent f704f305
......@@ -48,15 +48,6 @@ class AccountDeleter
notifications blocks authorizations o_auth_applications pairwise_pseudonymous_identifiers]
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
normal_ar_user_associates_to_delete.each do |asso|
user.send(asso).ids.each_slice(20) do |ids|
......@@ -65,6 +56,10 @@ class AccountDeleter
end
end
def normal_ar_person_associates_to_delete
%i[posts photos mentions participations roles blocks conversation_visibilities]
end
def delete_standard_person_associations
normal_ar_person_associates_to_delete.each do |asso|
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)
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
AccountDeletion.find_by(person: person)&.update_attributes(completed_at: Time.now.utc)
end
......
......@@ -175,14 +175,20 @@ describe AccountDeleter do
end
end
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)
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))
it "has all user association keys accounted for" do
special_ar_user_associations = %i[person profile contacts auto_follow_back_aspect]
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
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)
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))
it "has all person association keys accounted for" do
ignored_or_special_ar_person_associations = %i[comments likes poll_participations contacts notification_actors
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment