profile_url and atom_url are optional in webfinger
This commit is contained in:
parent
1fca90d68d
commit
e001d14b8f
3 changed files with 19 additions and 4 deletions
|
|
@ -12,8 +12,8 @@ module DiasporaFederation
|
|||
rule :alias_url, URI: %i(host path)
|
||||
rule :hcard_url, [:not_nil, URI: %i(host path)]
|
||||
rule :seed_url, %i(not_nil URI)
|
||||
rule :profile_url, [:not_nil, URI: %i(host path)]
|
||||
rule :atom_url, [:not_nil, URI: %i(host path)]
|
||||
rule :profile_url, URI: %i(host path)
|
||||
rule :atom_url, URI: %i(host path)
|
||||
rule :salmon_url, URI: %i(host path)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ XML
|
|||
expect(wf.public_key).to eq(person.serialized_public_key)
|
||||
end
|
||||
|
||||
it "reads minimal xml" do
|
||||
minimal_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Subject>#{acct}</Subject>
|
||||
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="#{person.hcard_url}"/>
|
||||
<Link rel="http://joindiaspora.com/seed_location" type="text/html" href="#{person.url}"/>
|
||||
</XRD>
|
||||
XML
|
||||
wf = Discovery::WebFinger.from_xml(minimal_xml)
|
||||
expect(wf.acct_uri).to eq(acct)
|
||||
expect(wf.hcard_url).to eq(person.hcard_url)
|
||||
expect(wf.seed_url).to eq(person.url)
|
||||
end
|
||||
|
||||
it "is frozen after parsing" do
|
||||
wf = Discovery::WebFinger.from_xml(xml)
|
||||
expect(wf).to be_frozen
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module DiasporaFederation
|
|||
end
|
||||
end
|
||||
|
||||
%i(hcard_url profile_url atom_url).each do |prop|
|
||||
%i(hcard_url).each do |prop|
|
||||
describe "##{prop}" do
|
||||
it_behaves_like "a url validator without path" do
|
||||
let(:property) { prop }
|
||||
|
|
@ -23,7 +23,7 @@ module DiasporaFederation
|
|||
end
|
||||
|
||||
# optional urls
|
||||
%i(alias_url salmon_url).each do |prop|
|
||||
%i(alias_url salmon_url profile_url atom_url).each do |prop|
|
||||
describe "##{prop}" do
|
||||
it_behaves_like "a property with a value validation/restriction" do
|
||||
let(:property) { prop }
|
||||
|
|
|
|||
Loading…
Reference in a new issue