Skip to content
Snippets Groups Projects
Commit e92391db authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

extract organization URL from metadata

parent 7f2be3ea
No related branches found
No related tags found
No related merge requests found
......@@ -186,6 +186,15 @@ sub parse {
}
push @{ $data->{contacts} }, $details;
}
} elsif ($child->localname() eq 'Organization') {
my @urls = $child->getElementsByLocalName('OrganizationURL');
my %urls =
map { $_->getAttribute('xml:lang') => $_->textContent() }
@urls;
$data->{organization} =
$urls{en} ? $urls{en} :
@urls ? $urls[0]->textContent() :
undef;
}
## Getting X.509 certificates
......
......@@ -10,7 +10,7 @@ use Test::Exception;
use AccountManager::Metadata;
plan tests => 21;
plan tests => 22;
my $metadata;
......@@ -91,6 +91,7 @@ ok(defined $sp, 'filtered metadata extraction: defined result');
ok(ref $sp eq 'ARRAY', 'filtered metadata extraction: result type');
ok(scalar @$sp == 1, 'filtered metadata extraction: result count');
is($sp->[0]->{entityid}, 'https://filesender.ipm.ir/', 'filtered entity has expected ID');
is($sp->[0]->{organization}, 'http://www.ipm.ir/', 'filtered entity has expected organization URL');
my $none = $metadata->parse(id => 'https://no.such.sp/');
ok(defined $none, 'filtered metadata extraction: defined result');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment