Add test for optional old_identity on AccountMigration
This commit is contained in:
parent
78ee282c9c
commit
25b5b8d888
1 changed files with 23 additions and 4 deletions
|
|
@ -6,11 +6,11 @@ module DiasporaFederation
|
||||||
let(:new_diaspora_id) { new_user.diaspora_id }
|
let(:new_diaspora_id) { new_user.diaspora_id }
|
||||||
|
|
||||||
let(:data) {
|
let(:data) {
|
||||||
hash.tap {|hash|
|
hash.dup.tap {|data|
|
||||||
properties = described_class.new(hash).send(:enriched_properties)
|
properties = described_class.new(hash).send(:enriched_properties)
|
||||||
hash[:signature] = properties[:signature]
|
data[:signature] = properties[:signature]
|
||||||
hash[:profile] = Entities::Profile.new(hash[:profile].to_h.tap {|profile| profile[:edited_at] = nil })
|
data[:profile] = Entities::Profile.new(hash[:profile].to_h.tap {|profile| profile[:edited_at] = nil })
|
||||||
hash[:remote_photo_path] = "http://localhost:3000/uploads/images/"
|
data[:remote_photo_path] = "http://localhost:3000/uploads/images/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let(:signature_data) { "AccountMigration:#{old_diaspora_id}:#{new_diaspora_id}" }
|
let(:signature_data) { "AccountMigration:#{old_diaspora_id}:#{new_diaspora_id}" }
|
||||||
|
|
@ -245,6 +245,25 @@ XML
|
||||||
expect(parsed_instance.old_identity).to eq(data[:author])
|
expect(parsed_instance.old_identity).to eq(data[:author])
|
||||||
expect(parsed_instance.remote_photo_path).to be_nil
|
expect(parsed_instance.remote_photo_path).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "adds old_identity when author is the old identity" do
|
||||||
|
expected_xml = <<-XML
|
||||||
|
<account_migration>
|
||||||
|
<author>#{data[:author]}</author>
|
||||||
|
<profile>
|
||||||
|
<author>#{data[:profile].author}</author>
|
||||||
|
<searchable>true</searchable>
|
||||||
|
<public>false</public>
|
||||||
|
<nsfw>false</nsfw>
|
||||||
|
</profile>
|
||||||
|
<signature>#{data[:signature]}</signature>
|
||||||
|
<old_identity>#{data[:author]}</old_identity>
|
||||||
|
</account_migration>
|
||||||
|
XML
|
||||||
|
|
||||||
|
entity = Entities::AccountMigration.new(hash)
|
||||||
|
expect(entity.to_xml.to_s.strip).to eq(expected_xml.strip)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue