add missing properties from xml_order to xml
This commit is contained in:
parent
36a787dd87
commit
ba129aafa3
2 changed files with 10 additions and 1 deletions
|
|
@ -153,7 +153,7 @@ module DiasporaFederation
|
||||||
# @return [Hash] sorted xml elements with updated signatures
|
# @return [Hash] sorted xml elements with updated signatures
|
||||||
def xml_elements
|
def xml_elements
|
||||||
xml_data = super.merge(additional_xml_elements)
|
xml_data = super.merge(additional_xml_elements)
|
||||||
signature_order.map {|element| [element, xml_data[element]] }.to_h.tap do |xml_elements|
|
signature_order.map {|element| [element, xml_data[element] || ""] }.to_h.tap do |xml_elements|
|
||||||
xml_elements[:author_signature] = author_signature || sign_with_author
|
xml_elements[:author_signature] = author_signature || sign_with_author
|
||||||
xml_elements[:parent_author_signature] = parent_author_signature || sign_with_parent_author_if_available.to_s
|
xml_elements[:parent_author_signature] = parent_author_signature || sign_with_parent_author_if_available.to_s
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,15 @@ XML
|
||||||
expect(xml.to_s.strip).to eq(expected_xml.strip)
|
expect(xml.to_s.strip).to eq(expected_xml.strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "adds missing properties from xml_order to xml" do
|
||||||
|
hash.merge!(author_signature: "aa", parent_author_signature: "bb")
|
||||||
|
xml_order = [:author, :guid, :parent_guid, :property, "new_property"]
|
||||||
|
|
||||||
|
xml = SomeRelayable.new(hash, xml_order).to_xml
|
||||||
|
|
||||||
|
expect(xml.at_xpath("new_property").text).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
it "computes correct signatures for the entity" do
|
it "computes correct signatures for the entity" do
|
||||||
expect_callback(:fetch_private_key, author).and_return(author_pkey)
|
expect_callback(:fetch_private_key, author).and_return(author_pkey)
|
||||||
expect_callback(:fetch_private_key, local_parent.author).and_return(parent_pkey)
|
expect_callback(:fetch_private_key, local_parent.author).and_return(parent_pkey)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue